Netdev List
 help / color / mirror / Atom feed
* [PATCH 24/25] NFS: Parse IPv6 addresses in nfs_parse_server_address
@ 2007-11-13 18:33 Chuck Lever
  0 siblings, 0 replies; only message in thread
From: Chuck Lever @ 2007-11-13 18:33 UTC (permalink / raw)
  To: nfs; +Cc: netdev

Add the ability to parse IPv6 addresses passed in via the 'addr=' and
'mountaddr=' mount options.

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

 fs/nfs/super.c |   24 +++++++++++++++++++-----
 1 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 2abef88..c066016 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -622,11 +622,25 @@ static void nfs_parse_server_address(char *value,
 				     struct sockaddr_storage *ssp,
 				     size_t *len)
 {
-	struct sockaddr_in *ap = (struct sockaddr_in *)ssp;
-
-	ap->sin_family = AF_INET;
-	ap->sin_addr.s_addr = in_aton(value);
-	*len = sizeof(*ap);
+	if (strchr(value, ':') == NULL) {
+		struct sockaddr_in *ap = (struct sockaddr_in *)ssp;
+		u8 buf[4];
+
+		if (in4_pton(value, -1, buf, '\0', NULL)) {
+			ap->sin_family = AF_INET;
+			memcpy(&ap->sin_addr.s_addr, buf, sizeof(buf));
+			*len = sizeof(*ap);
+		}
+	} else {
+		struct sockaddr_in6 *ap = (struct sockaddr_in6 *)ssp;
+		u8 buf[16];
+
+		if (in6_pton(value, -1, buf, '\0', NULL)) {
+			ap->sin6_family = AF_INET6;
+			memcpy(&ap->sin6_addr.in6_u, buf, sizeof(buf));
+			*len = sizeof(*ap);
+		}
+	}
 }
 
 /*


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2007-11-13 18:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-13 18:33 [PATCH 24/25] NFS: Parse IPv6 addresses in nfs_parse_server_address Chuck Lever

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox