lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20071113183307.5087.96750.stgit@manray.1015granger.net>
Date:	Tue, 13 Nov 2007 13:33:07 -0500
From:	Chuck Lever <chuck.lever@...cle.com>
To:	nfs@...ts.sourceforge.net
Cc:	netdev@...r.kernel.org
Subject: [PATCH 24/25] NFS: Parse IPv6 addresses in nfs_parse_server_address

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

Signed-off-by: Chuck Lever <chuck.lever@...cle.com>
Cc: Aurelien Charbon <aurelien.charbon@....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);
+		}
+	}
 }
 
 /*

-
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ