[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20071113183312.5087.80253.stgit@manray.1015granger.net>
Date: Tue, 13 Nov 2007 13:33:12 -0500
From: Chuck Lever <chuck.lever@...cle.com>
To: nfs@...ts.sourceforge.net
Cc: netdev@...r.kernel.org
Subject: [PATCH 25/25] NFS: Verify IPv6 addresses properly
Add support to nfs_verify_server_address for recognizing AF_INET6 addresses.
Signed-off-by: Chuck Lever <chuck.lever@...cle.com>
Cc: Aurelien Charbon <aurelien.charbon@....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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists