From owner-freebsd-net@freebsd.org Sun Jul 1 17:25:43 2018 Return-Path: Delivered-To: freebsd-net@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 07549FD06D7 for ; Sun, 1 Jul 2018 17:25:43 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from CAN01-QB1-obe.outbound.protection.outlook.com (mail-eopbgr660088.outbound.protection.outlook.com [40.107.66.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "Microsoft IT TLS CA 4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 795EE76869; Sun, 1 Jul 2018 17:25:42 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from YTOPR0101MB0953.CANPRD01.PROD.OUTLOOK.COM (52.132.44.24) by YTOPR0101MB1084.CANPRD01.PROD.OUTLOOK.COM (52.132.50.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.906.26; Sun, 1 Jul 2018 17:25:40 +0000 Received: from YTOPR0101MB0953.CANPRD01.PROD.OUTLOOK.COM ([fe80::d0eb:3783:7c99:2802]) by YTOPR0101MB0953.CANPRD01.PROD.OUTLOOK.COM ([fe80::d0eb:3783:7c99:2802%4]) with mapi id 15.20.0906.026; Sun, 1 Jul 2018 17:25:40 +0000 From: Rick Macklem To: "Andrey V. Elsukov" , Rick Macklem , FreeBSD Net Subject: Re: IPv6 scope handling, was Re: svn commit: r335806 - projects/pnfs-planb-server/usr.sbin/nfsd Thread-Topic: IPv6 scope handling, was Re: svn commit: r335806 - projects/pnfs-planb-server/usr.sbin/nfsd Thread-Index: AQHUEEv8cr4RnInROESx3zvZznTUdKR42400gABuSICAADe3z4AAsTqAgABrXEw= Date: Sun, 1 Jul 2018 17:25:40 +0000 Message-ID: References: <201806292207.w5TM7QX9052770@repo.freebsd.org> <0c85d229-3b8f-3b4c-ba3c-34ec06728455@yandex.ru> <048d1b79-f263-506c-210e-21d9e4437c3e@yandex.ru> , <1e62847a-fe06-9190-ac98-ce120e96f325@yandex.ru> In-Reply-To: <1e62847a-fe06-9190-ac98-ce120e96f325@yandex.ru> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=rmacklem@uoguelph.ca; x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; YTOPR0101MB1084; 7:/Mgg3p+W4g5cxQY1y+chqQk+4qD11cHTHArMTZwrNkW+fspdMBYmuw4qzmSoMft1cEk1jmWrf85jUerbin6R4SURxWt3AN9c9Tx3gCoXQoBIMMy+3kjeOUgCabYzkvU+/iSfiEnzYYsLdTr++vbN9UpTccDpkPxdHJqvSkb7LktnxjnFc2KNneRTInsMf+aDLDszpUwwU7XieF447h9eomBPR2yLaPy53Q2zoFr0d6KSwZc5zvTcKskKTzKEJBHT x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: 356deac7-95bd-46de-c540-08d5df77aaef x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:YTOPR0101MB1084; x-ms-traffictypediagnostic: YTOPR0101MB1084: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(5213294742642); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93001095)(3231254)(944501410)(52105095)(149027)(150027)(6041310)(20161123560045)(201703131423095)(201702281529075)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:YTOPR0101MB1084; BCL:0; PCL:0; RULEID:; SRVR:YTOPR0101MB1084; x-forefront-prvs: 07200C0526 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(39860400002)(366004)(136003)(346002)(376002)(51914003)(199004)(189003)(786003)(68736007)(53936002)(2906002)(5660300001)(305945005)(316002)(229853002)(14454004)(86362001)(2900100001)(99286004)(106356001)(105586002)(74316002)(25786009)(33656002)(102836004)(74482002)(446003)(7696005)(93886005)(476003)(11346002)(256004)(81166006)(26005)(8936002)(8676002)(186003)(110136005)(81156014)(6436002)(478600001)(6506007)(97736004)(76176011)(6246003)(486006)(5250100002)(55016002)(9686003)(21314002); DIR:OUT; SFP:1101; SCL:1; SRVR:YTOPR0101MB1084; H:YTOPR0101MB0953.CANPRD01.PROD.OUTLOOK.COM; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: uoguelph.ca does not designate permitted sender hosts) x-microsoft-antispam-message-info: flt29b6aG8CttB8Jfd8l3SLnmfjShnUTIv9Z8+jdL2KYz6IjH+vO0H02iJDSB8EuZ7hXp+8xGSpELiqcNcxGCcbECXlcEVAWCziRyIAL7NtP1t+qnmMNQVpnrkK3kS39tUTIiaHvKj6sle9g/k+YvCGxaWIdn56Hbs6zzXdiP+mk4327MI/hHEp48QwjmQdCacdtv/sGRoX0dixEtUYbQsiLlmbYIb/47TwL6rEYocd8G6N97+/DSyaSX0ffIXicchI7m2JXR0SoXK0F5iC3EHbm6Qs/Z3iLHLC6w/iJKiElzg9Epq6e086Jp1hVGRQ+O5uA2seKsn6ikovetMzptAlpOZLEYyYXZa2Di2Tpe/8= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: uoguelph.ca X-MS-Exchange-CrossTenant-Network-Message-Id: 356deac7-95bd-46de-c540-08d5df77aaef X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Jul 2018 17:25:40.3655 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: be62a12b-2cad-49a1-a5fa-85f4f3156a7d X-MS-Exchange-Transport-CrossTenantHeadersStamped: YTOPR0101MB1084 X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Jul 2018 17:25:43 -0000 Andrey V. Elsukov wrote: [stuff snipped] >> >> I think what you are saying above is that a Link-local address won't wor= k >> and that the address must be a global one? >> Should the code check for "fe8" at the start and skip over those ones? > >It is possible that all hosts are in the same scope zone, e.g. they are >connected in the one broadcast domain through the switch. >In this case it is possible to use link-local addresses and they all >will be reachable. > >> The "on-the-wire" address sent to HostC is specified in standard string = form >> (can't remember the RFC#, but it is referenced by RFC5661), so I can't s= end >> any more than that to HostC. > >So if I understand correctly, after formatting you are sending this >address string to the some foreign host? Yes, that is what happens. >The scope zone id specifier is only does matter for the host where it is >used. I.e. there is no sense to send "%ifname" to the foreign host, >because it can have different ifname for the link and that address >specification won't work. That is what I thought. >I think for now we can leave the code as is (put some XXX with comment >here), and then in the future, if it will be needed, add better handling >for that :) How about this patch? (Basically use the link local address if it is the on= ly one returned by getaddrinfo().) --- nfsd.c 2018-06-30 08:16:51.771742000 -0400 +++ /tmp/nfsd.c 2018-07-01 13:01:30.243285000 -0400 @@ -1309,7 +1309,17 @@ parse_dsserver(const char *optionarg, st memcpy(&sin6, res->ai_addr, sizeof(sin6)); ad =3D 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 !=3D NULL && + !IN6_IS_ADDR_LINKLOCAL(&sin6.sin6_addr)) + break; } } if (ad =3D=3D NULL) [more stuff snipped] Thanks for the comments, rick