2007-11-29 19:44:36

by Chuck Lever

[permalink] [raw]
Subject: [NFS] [PATCH 28/29] 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 <[email protected]>
---

fs/nfs/super.c | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 7c10189..10bdf3c 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -627,11 +627,21 @@ static int nfs_verify_server_address(struct sockaddr_storage *ssp)
static void nfs_parse_server_address(char *value,
struct sockaddr_storage *ssp)
{
- struct sockaddr_in *ap = (void *)ssp;
+ if (strchr(value, ':')) {
+ struct sockaddr_in6 *ap = (struct sockaddr_in6 *)ssp;
+ u8 *addr = (u8 *)&ap->sin6_addr.in6_u;

- ap->sin_family = AF_INET;
- if (in4_pton(value, -1, (u8 *)&ap->sin_addr.s_addr, '\0', NULL))
- return;
+ ap->sin6_family = AF_INET6;
+ if (in6_pton(value, -1, addr, '\0', NULL))
+ return;
+ } else {
+ struct sockaddr_in *ap = (struct sockaddr_in *)ssp;
+ u8 *addr = (u8 *)&ap->sin_addr.s_addr;
+
+ ap->sin_family = AF_INET;
+ if (in4_pton(value, -1, addr, '\0', NULL))
+ return;
+ }

ssp->ss_family = AF_UNSPEC;
}


-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going
mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
_______________________________________________
Please note that [email protected] is being discontinued.
Please subscribe to [email protected] instead.
http://vger.kernel.org/vger-lists.html#linux-nfs