diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2007-12-10 14:59:35 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2008-01-30 02:05:57 -0500 |
commit | 3c7c7e4812e40e50a9ce9d687432ab5515cb3f2f (patch) | |
tree | f6c5a8d7c2e18525ca50cd08b356b7cd1ec4b764 /fs | |
parent | 4c5680177012a2b5c0f3fdf58f4375dd84a1da67 (diff) |
NFS: Pull covers off IPv6 address parsing
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>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfs/super.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index 7efc6a34b56b..3cbe32f3e88b 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c | |||
@@ -652,12 +652,23 @@ static void nfs_parse_server_address(char *value, | |||
652 | struct sockaddr *sap, | 652 | struct sockaddr *sap, |
653 | size_t *len) | 653 | size_t *len) |
654 | { | 654 | { |
655 | struct sockaddr_in *ap = (void *)sap; | 655 | if (strchr(value, ':')) { |
656 | struct sockaddr_in6 *ap = (struct sockaddr_in6 *)sap; | ||
657 | u8 *addr = (u8 *)&ap->sin6_addr.in6_u; | ||
656 | 658 | ||
657 | ap->sin_family = AF_INET; | 659 | ap->sin6_family = AF_INET6; |
658 | *len = sizeof(*ap); | 660 | *len = sizeof(*ap); |
659 | if (in4_pton(value, -1, (u8 *)&ap->sin_addr.s_addr, '\0', NULL)) | 661 | if (in6_pton(value, -1, addr, '\0', NULL)) |
660 | return; | 662 | return; |
663 | } else { | ||
664 | struct sockaddr_in *ap = (struct sockaddr_in *)sap; | ||
665 | u8 *addr = (u8 *)&ap->sin_addr.s_addr; | ||
666 | |||
667 | ap->sin_family = AF_INET; | ||
668 | *len = sizeof(*ap); | ||
669 | if (in4_pton(value, -1, addr, '\0', NULL)) | ||
670 | return; | ||
671 | } | ||
661 | 672 | ||
662 | sap->sa_family = AF_UNSPEC; | 673 | sap->sa_family = AF_UNSPEC; |
663 | *len = 0; | 674 | *len = 0; |