]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
NFS: Pull covers off IPv6 address parsing
authorChuck Lever <chuck.lever@oracle.com>
Mon, 10 Dec 2007 19:59:35 +0000 (14:59 -0500)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Wed, 30 Jan 2008 07:05:57 +0000 (02:05 -0500)
Now that the needed IPv6 infrastructure is in place, allow the NFS client's
IP address parser to generate AF_INET6 addresses.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
fs/nfs/super.c

index 7efc6a34b56bebc4ce4de99fe55a8bd568337a23..3cbe32f3e88bcd795562245515fa469afecea86b 100644 (file)
@@ -652,12 +652,23 @@ static void nfs_parse_server_address(char *value,
                                     struct sockaddr *sap,
                                     size_t *len)
 {
-       struct sockaddr_in *ap = (void *)sap;
+       if (strchr(value, ':')) {
+               struct sockaddr_in6 *ap = (struct sockaddr_in6 *)sap;
+               u8 *addr = (u8 *)&ap->sin6_addr.in6_u;
 
-       ap->sin_family = AF_INET;
-       *len = sizeof(*ap);
-       if (in4_pton(value, -1, (u8 *)&ap->sin_addr.s_addr, '\0', NULL))
-               return;
+               ap->sin6_family = AF_INET6;
+               *len = sizeof(*ap);
+               if (in6_pton(value, -1, addr, '\0', NULL))
+                       return;
+       } else {
+               struct sockaddr_in *ap = (struct sockaddr_in *)sap;
+               u8 *addr = (u8 *)&ap->sin_addr.s_addr;
+
+               ap->sin_family = AF_INET;
+               *len = sizeof(*ap);
+               if (in4_pton(value, -1, addr, '\0', NULL))
+                       return;
+       }
 
        sap->sa_family = AF_UNSPEC;
        *len = 0;