[PATCH] mount.cifs: add support for sending IPv6 scope ID to kernel

Jeff Layton <[email protected]>
Newsgroups gmane.linux.file-systems.cifs
Message-ID <[email protected]>
When getaddrinfo returns an IPv6 address with a non-zero scope_id, send
that to the kernel in the new ip6scope mount option. This allows people
to mount servers via their link-local IPv6 addresses (assuming the kernel
supports this option, of course).

Signed-off-by: Jeff Layton <[email protected]>
---
 client/mount.cifs.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/client/mount.cifs.c b/client/mount.cifs.c
index 97144a0..840e4ae 100644
--- a/client/mount.cifs.c
+++ b/client/mount.cifs.c
@@ -1562,6 +1562,14 @@ mount_retry:
 		}
 	}
 
+	if (addr->ai_addr->sa_family == AF_INET6 && addr6->sin6_scope_id) {
+		strlcat(options, ",v6scope=", options_size);
+		current_len = strnlen(options, options_size);
+		optionstail = options + current_len;
+		snprintf(optionstail, options_size - current_len, "%u",
+			 addr6->sin6_scope_id);
+	}
+
 	if (!fakemnt && mount(dev_name, mountpoint, "cifs", flags, options)) {
 		switch (errno) {
 		case ECONNREFUSED:
-- 
1.6.0.6
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.