[PATCH 25/25] NFS: Verify IPv6 addresses properly

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <nfs@...>
Cc: <netdev@...>
Date: Tuesday, November 13, 2007 - 2:33 pm

Add support to nfs_verify_server_address for recognizing AF_INET6 addresses.

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

 fs/nfs/super.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index c066016..f0af79b 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -46,6 +46,7 @@
 #include <linux/vfs.h>
 #include <linux/inet.h>
 #include <linux/in6.h>
+#include <net/ipv6.h>
 #include <linux/nfs_xdr.h>
 #include <linux/magic.h>
 #include <linux/parser.h>
@@ -601,14 +602,14 @@ static int nfs_set_address_port(struct sockaddr *sap, unsigned short port)
  */
 static int nfs_verify_server_address(struct sockaddr_storage *ssp)
 {
-	struct sockaddr *addr = (struct sockaddr *)ssp;
-
-	switch (addr->sa_family) {
+	switch (ssp->ss_family) {
 	case AF_INET: {
-		struct sockaddr_in *sa = (struct sockaddr_in *) addr;
-		if (sa->sin_addr.s_addr != INADDR_ANY)
-			return 1;
-		break;
+		struct sockaddr_in *sa = (struct sockaddr_in *)ssp;
+		return sa->sin_addr.s_addr != INADDR_ANY;
+	}
+	case AF_INET6: {
+		struct in6_addr *sa = &((struct sockaddr_in6 *)ssp)->sin6_addr;
+		return !ipv6_addr_any(sa);
 	}
 	}
 

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 25/25] NFS: Verify IPv6 addresses properly, Chuck Lever, (Tue Nov 13, 2:33 pm)