lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20071113183209.5087.28230.stgit@manray.1015granger.net>
Date:	Tue, 13 Nov 2007 13:32:09 -0500
From:	Chuck Lever <chuck.lever@...cle.com>
To:	nfs@...ts.sourceforge.net
Cc:	netdev@...r.kernel.org
Subject: [PATCH 13/25] NFS: Distinguish IPv6 addresses in __nfs_find_client

Add support for the AF_INET6 family of IP addresses in __nfs_find_client.

Signed-off-by: Chuck Lever <chuck.lever@...cle.com>
Cc: Aurelien Charbon <aurelien.charbon@....bull.net>
---

 fs/nfs/client.c |   34 +++++++++++++++++++++++++++-------
 1 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 8eff0b2..67a5a53 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -34,6 +34,8 @@
 #include <linux/nfs_idmap.h>
 #include <linux/vfs.h>
 #include <linux/inet.h>
+#include <linux/in6.h>
+#include <net/ipv6.h>
 #include <linux/nfs_xdr.h>
 
 #include <asm/system.h>
@@ -213,11 +215,10 @@ static struct nfs_client *__nfs_find_client(const struct sockaddr *addr,
 					    unsigned int nfsversion,
 					    int match_port)
 {
-	struct sockaddr_in *ap = (struct sockaddr_in *)addr;
 	struct nfs_client *clp;
 
 	list_for_each_entry(clp, &nfs_client_list, cl_share_link) {
-		struct sockaddr_in *clap = (struct sockaddr_in *)&clp->cl_addr;
+		struct sockaddr *clap = (struct sockaddr *)&clp->cl_addr;
 
 		/* Don't match clients that failed to initialise properly */
 		if (clp->cl_cons_state < 0)
@@ -227,14 +228,33 @@ static struct nfs_client *__nfs_find_client(const struct sockaddr *addr,
 		if (clp->rpc_ops->version != nfsversion)
 			continue;
 
-		if (((struct sockaddr *)clap)->sa_family != addr->sa_family)
+		if (clap->sa_family != addr->sa_family)
 			continue;
 
-		if (clap->sin_addr.s_addr != ap->sin_addr.s_addr)
+		switch (addr->sa_family) {
+		case AF_INET: {
+			struct sockaddr_in *sap = (struct sockaddr_in *)clap;
+			struct sockaddr_in *ap = (struct sockaddr_in *)addr;
+			if (sap->sin_addr.s_addr != ap->sin_addr.s_addr)
+				continue;
+			if (!match_port || sap->sin_port == ap->sin_port)
+				goto found;
 			continue;
-
-		if (!match_port || clap->sin_port == ap->sin_port)
-			goto found;
+			}
+		case AF_INET6: {
+			struct sockaddr_in6 *sap = (struct sockaddr_in6 *)clap;
+			struct sockaddr_in6 *ap = (struct sockaddr_in6 *)addr;
+			if (!ipv6_addr_equal(&sap->sin6_addr, &ap->sin6_addr))
+				continue;
+			if (!match_port || sap->sin6_port == ap->sin6_port)
+				goto found;
+			continue;
+			}
+		default:
+			printk(KERN_ERR "%s: address family not supported\n",
+				__FUNCTION__);
+			return NULL;
+		}
 	}
 
 	return NULL;

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ