From patchwork Fri Jul 15 17:56:02 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Greear X-Patchwork-Id: 980062 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p6FHwAUR017978 for ; Fri, 15 Jul 2011 17:58:10 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755802Ab1GOR5i (ORCPT ); Fri, 15 Jul 2011 13:57:38 -0400 Received: from mail.candelatech.com ([208.74.158.172]:58955 "EHLO ns3.lanforge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755644Ab1GOR5g (ORCPT ); Fri, 15 Jul 2011 13:57:36 -0400 Received: from fs3.candelatech.com (firewall.candelatech.com [70.89.124.249]) by ns3.lanforge.com (8.14.2/8.14.2) with ESMTP id p6FHuIUe019371 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 15 Jul 2011 10:56:20 -0700 From: greearb@candelatech.com To: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ben Greear Subject: [PATCH (RESEND) 06/12] nfs: Use srcaddr in nfs_match_client. Date: Fri, 15 Jul 2011 10:56:02 -0700 Message-Id: <1310752568-21280-7-git-send-email-greearb@candelatech.com> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <1310752568-21280-1-git-send-email-greearb@candelatech.com> References: <1310752568-21280-1-git-send-email-greearb@candelatech.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 15 Jul 2011 17:58:10 +0000 (UTC) From: Ben Greear For bound clients, we have to make sure we do not re-use a client that is bound differently. Signed-off-by: Ben Greear --- :100644 100644 c571a97... 5d8998a... M fs/nfs/client.c fs/nfs/client.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/fs/nfs/client.c b/fs/nfs/client.c index c571a97..5d8998a 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -131,7 +131,9 @@ struct rpc_program nfsacl_program = { struct nfs_client_initdata { const char *hostname; const struct sockaddr *addr; + const struct sockaddr *srcaddr; size_t addrlen; + size_t srcaddrlen; const struct nfs_rpc_ops *rpc_ops; int proto; u32 minorversion; @@ -463,6 +465,9 @@ static struct nfs_client *nfs_match_client(const struct nfs_client_initdata *dat list_for_each_entry(clp, &nfs_client_list, cl_share_link) { const struct sockaddr *clap = (struct sockaddr *)&clp->cl_addr; + const struct sockaddr *sa; + sa = (const struct sockaddr *)&clp->srcaddr; + /* Don't match clients that failed to initialise properly */ if (clp->cl_cons_state < 0) continue; @@ -480,6 +485,13 @@ static struct nfs_client *nfs_match_client(const struct nfs_client_initdata *dat if (!nfs_sockaddr_cmp(sap, clap)) continue; + /* Check to make sure local-IP bindings match, + * but just the IP-addr. + */ + if (data->srcaddr && + !nfs_sockaddr_match_ipaddr(data->srcaddr, sa)) + continue; + atomic_inc(&clp->cl_count); return clp; }