From patchwork Thu Jun 9 23:02:50 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Greear X-Patchwork-Id: 867492 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p59N4MmM003461 for ; Thu, 9 Jun 2011 23:04:52 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757146Ab1FIXEv (ORCPT ); Thu, 9 Jun 2011 19:04:51 -0400 Received: from mail.candelatech.com ([208.74.158.172]:34537 "EHLO ns3.lanforge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756650Ab1FIXEv (ORCPT ); Thu, 9 Jun 2011 19:04:51 -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 p59N33Sl008979 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 9 Jun 2011 16:03:12 -0700 From: greearb@candelatech.com To: linux-nfs@vger.kernel.org Cc: Ben Greear Subject: [RFC 06/11] nfs: Use srcaddr in nfs_match_client. Date: Thu, 9 Jun 2011 16:02:50 -0700 Message-Id: <1307660575-6994-7-git-send-email-greearb@candelatech.com> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <1307660575-6994-1-git-send-email-greearb@candelatech.com> References: <1307660575-6994-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 (demeter2.kernel.org [140.211.167.43]); Thu, 09 Jun 2011 23:04:52 +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; }