From patchwork Thu Jun 11 16:48:52 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 29607 Received: from lists.samba.org (mail.samba.org [66.70.73.150]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n5BGnMtB005244 for ; Thu, 11 Jun 2009 16:49:22 GMT Received: from dp.samba.org (localhost [127.0.0.1]) by lists.samba.org (Postfix) with ESMTP id A2C80163C58 for ; Thu, 11 Jun 2009 16:48:49 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.1.7 (2006-10-05) on dp.samba.org X-Spam-Level: X-Spam-Status: No, score=-2.1 required=3.8 tests=AWL,BAYES_00, FORGED_RCVD_HELO,NO_MORE_FUNN,SPF_PASS autolearn=no version=3.1.7 X-Original-To: linux-cifs-client@lists.samba.org Delivered-To: linux-cifs-client@lists.samba.org Received: from cdptpa-omtalb.mail.rr.com (cdptpa-omtalb.mail.rr.com [75.180.132.123]) by lists.samba.org (Postfix) with ESMTP id 91302163DF6 for ; Thu, 11 Jun 2009 16:48:20 +0000 (GMT) Received: from mail.poochiereds.net ([71.70.153.3]) by cdptpa-omta03.mail.rr.com with ESMTP id <20090611164852638.HAIC19023@cdptpa-omta03.mail.rr.com>; Thu, 11 Jun 2009 16:48:52 +0000 Received: by mail.poochiereds.net (Postfix, from userid 4447) id 2C29A58107; Thu, 11 Jun 2009 12:48:52 -0400 (EDT) From: Jeff Layton To: linux-cifs-client@lists.samba.org Date: Thu, 11 Jun 2009 12:48:52 -0400 Message-Id: <1244738932-2325-1-git-send-email-jlayton@redhat.com> X-Mailer: git-send-email 1.6.0.6 Cc: smfrench@gmail.com, david@erion.co.uk Subject: [linux-cifs-client] [PATCH] mount.cifs: add support for sending IPv6 scope ID to kernel X-BeenThere: linux-cifs-client@lists.samba.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: The Linux CIFS VFS client List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-cifs-client-bounces+patchwork-cifs-client=patchwork.kernel.org@lists.samba.org Errors-To: linux-cifs-client-bounces+patchwork-cifs-client=patchwork.kernel.org@lists.samba.org When getaddrinfo returns an IPv6 address with a non-zero scope_id, send that to the kernel appended to the address with a '%' delimiter. This allows people to mount servers via their link-local IPv6 addresses (given a kernel that understands this address format, of course). Signed-off-by: Jeff Layton --- 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..db05665 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, "%", 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: