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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 18 May 2008 17:20:26 -0400
From:	Chuck Lever <chuck.lever@...cle.com>
To:	netdev@...r.kernel.org
Subject: [PATCH 4/4] NFS: handle interface identifiers in incoming IPv6
	addresses

Add support in the kernel NFS client's address parser for interface
identifiers.

IPv6 link-local addresses require an additional "interface identifier",
which is an integer that indexes the array of local network interfaces.
They are suffixed to the address with a '%'.  For example:

	fe80::215:c5ff:fe3b:e1b2%2

indicates an index of 2.  Without the interface ID, link-local addresses
are not usable for NFS.

Note these can also be expressed:

	fe80::215:c5ff:fe3b:e1b2%eth0

The mount.nfs command maps the device name to an interface index before
passing in "addr=".

Signed-off-by: Chuck Lever <chuck.lever@...cle.com>
---

 fs/nfs/super.c |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)


diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 970f976..eb4a001 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -734,6 +734,7 @@ static void nfs_parse_ipv6_address(char *string, size_t str_len,
 {
 	struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sap;
 	u8 *addr = (u8 *)&sin6->sin6_addr.in6_u;
+	const char *delim;
 
 	dfprintk(MOUNT, "NFS: parsing IPv6 address %*s\n",
 			str_len, string);
@@ -741,8 +742,22 @@ static void nfs_parse_ipv6_address(char *string, size_t str_len,
 	if (str_len < INET6_ADDRSTRLEN) {
 		sin6->sin6_family = AF_INET6;
 		*addr_len = sizeof(*sin6);
-		if (in6_pton(string, str_len, addr, '\0', NULL))
+		if (in6_pton(string, str_len, addr, '%', &delim)) {
+			if (*delim == '%') {
+				size_t len = (string + str_len) - delim - 1;
+				char *p = kstrndup(delim + 1, len, GFP_KERNEL);
+				if (p) {
+					unsigned long id = 0;
+					/* id is set to zero on error */
+					strict_strtoul(p, 10, &id);
+					kfree(p);
+					sin6->sin6_scope_id = id;
+					dfprintk(MOUNT, "NFS: IPv6 scope "
+							"ID = %lu\n", id);
+				}
+			}
 			return;
+		}
 	}
 
 	sap->sa_family = AF_UNSPEC;

--
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