From owner-svn-src-projects@freebsd.org Fri Jul 27 23:34:12 2018 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EC955105A634 for ; Fri, 27 Jul 2018 23:34:11 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A2A748F179; Fri, 27 Jul 2018 23:34:11 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 83D5D1E947; Fri, 27 Jul 2018 23:34:11 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6RNYBk1075769; Fri, 27 Jul 2018 23:34:11 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6RNYB6j075767; Fri, 27 Jul 2018 23:34:11 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201807272334.w6RNYB6j075767@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Fri, 27 Jul 2018 23:34:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r336797 - projects/pnfs-planb-server/usr.sbin/nfsd X-SVN-Group: projects X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: projects/pnfs-planb-server/usr.sbin/nfsd X-SVN-Commit-Revision: 336797 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Jul 2018 23:34:12 -0000 Author: rmacklem Date: Fri Jul 27 23:34:10 2018 New Revision: 336797 URL: https://svnweb.freebsd.org/changeset/base/336797 Log: When parsing the "-p" option for nfsd, only use an IPv6 link local address if it is the only address. Link local addresses that are passed from the MDS to a pNFS client for a DS will only work if they are in the same scope zone and the address is unambiguous for the client. Modified: projects/pnfs-planb-server/usr.sbin/nfsd/nfsd.8 projects/pnfs-planb-server/usr.sbin/nfsd/nfsd.c Modified: projects/pnfs-planb-server/usr.sbin/nfsd/nfsd.8 ============================================================================== --- projects/pnfs-planb-server/usr.sbin/nfsd/nfsd.8 Fri Jul 27 23:28:35 2018 (r336796) +++ projects/pnfs-planb-server/usr.sbin/nfsd/nfsd.8 Fri Jul 27 23:34:10 2018 (r336797) @@ -28,7 +28,7 @@ .\" @(#)nfsd.8 8.4 (Berkeley) 3/29/95 .\" $FreeBSD$ .\" -.Dd June 30, 2018 +.Dd July 27, 2018 .Dt NFSD 8 .Os .Sh NAME @@ -156,6 +156,18 @@ data files for and nfsv4-data1 will be used to store data files for .Dq /export2 . .El +.sp +When using IPv6 addresses for DSs +be wary of using link local addresses. +The IPv6 address for the DS is sent to the client and there is no scope +zone in it. +As such, a link local address may not work for a pNFS client to DS +TCP connection. +When parsed, +.Nm +will only use a link local address if it is the only address returned by +.Xr getaddrinfo 3 +for the DS hostname. .It Fl m Ar mirror_level This option is only meaningful when used with the .Fl p Modified: projects/pnfs-planb-server/usr.sbin/nfsd/nfsd.c ============================================================================== --- projects/pnfs-planb-server/usr.sbin/nfsd/nfsd.c Fri Jul 27 23:28:35 2018 (r336796) +++ projects/pnfs-planb-server/usr.sbin/nfsd/nfsd.c Fri Jul 27 23:34:10 2018 (r336797) @@ -1309,7 +1309,17 @@ parse_dsserver(const char *optionarg, struct nfsd_nfsd memcpy(&sin6, res->ai_addr, sizeof(sin6)); ad = inet_ntop(AF_INET6, &sin6.sin6_addr, ip6, sizeof(ip6)); - break; + + /* + * XXX + * Since a link local address will only + * work if the client and DS are in the + * same scope zone, only use it if it is + * the only address. + */ + if (ad != NULL && + !IN6_IS_ADDR_LINKLOCAL(&sin6.sin6_addr)) + break; } } if (ad == NULL)