From owner-freebsd-net@freebsd.org Sat Jun 30 18:33:26 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 BEF66FD3B23 for ; Sat, 30 Jun 2018 18:33:26 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from CAN01-TO1-obe.outbound.protection.outlook.com (mail-eopbgr670068.outbound.protection.outlook.com [40.107.67.68]) (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 56EF487405; Sat, 30 Jun 2018 18:33:26 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from YTOPR0101MB0953.CANPRD01.PROD.OUTLOOK.COM (52.132.44.24) by YTOPR0101MB2042.CANPRD01.PROD.OUTLOOK.COM (52.132.49.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.906.26; Sat, 30 Jun 2018 18:33:24 +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; Sat, 30 Jun 2018 18:33:24 +0000 From: Rick Macklem To: "Andrey V. Elsukov" , Rick Macklem , FreeBSD Net Subject: 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: AQHUEEv8cr4RnInROESx3zvZznTUdKR42400 Date: Sat, 30 Jun 2018 18:33:24 +0000 Message-ID: References: <201806292207.w5TM7QX9052770@repo.freebsd.org>, <0c85d229-3b8f-3b4c-ba3c-34ec06728455@yandex.ru> In-Reply-To: <0c85d229-3b8f-3b4c-ba3c-34ec06728455@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; YTOPR0101MB2042; 7:2XzXwOVBVlO2Fgjvv+dZBIWyLUqFuhC70/JgvuAoMIrLrtjaCHYbvafuoB5xJ9m2T+wFs500An6y89PLw6V8K3sv8psb9Vb65KKgH7rwPNjSKmPGSaAsWCef0YPS0ya/xgkd3oWKeIjyOBKmzZ8yjPrYcA5a0XNgRHiX9X6j1P/4tn/oP40kiYViwZQBEW5CS/92Gd2yh3AiML+JLM35BLPS/M3yrUDJYXcrzbkLMfYufqjf8druEqU95oMnkhQ/ x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: 84b76d9e-9ecc-47e3-36cd-08d5deb7f6df x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:YTOPR0101MB2042; x-ms-traffictypediagnostic: YTOPR0101MB2042: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(56005881305849)(158342451672863)(5213294742642)(21532816269658); 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:YTOPR0101MB2042; BCL:0; PCL:0; RULEID:; SRVR:YTOPR0101MB2042; x-forefront-prvs: 0719EC6A9A x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(136003)(39860400002)(376002)(366004)(396003)(199004)(189003)(14454004)(2906002)(8676002)(25786009)(6436002)(26005)(11346002)(446003)(966005)(106356001)(33656002)(316002)(786003)(186003)(478600001)(81156014)(81166006)(86362001)(8936002)(105586002)(110136005)(68736007)(102836004)(74316002)(305945005)(99286004)(53936002)(74482002)(6506007)(256004)(7696005)(55016002)(14444005)(2900100001)(6306002)(76176011)(5250100002)(476003)(9686003)(5660300001)(486006)(97736004); DIR:OUT; SFP:1101; SCL:1; SRVR:YTOPR0101MB2042; 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: oz0KUrrOZTGtH++zRWyl8wYVB4Y4QTungU8UZ2yxIo/tfhquBiPStw/gvStQBOnk1YONYI5P/FEpwFjgGeToFEsNIkkX2RO8HrYZOaZL+IytSH38PciTEF5T1kqIL77dUkel7ShCI5LctxL0+mEbTYTXQ2eWz/JveZ5J5WKN+ZaansGznkcJq3XMGAccn080zni67d98uUsr143ZgBJPVbIEkyakoDakLE5Ynh1zBs8THRYg0dlXdlaP4vqoeJQHc+6n3Y52dUEcIic+16PdiiHSt9gD0O2NX86Ikco6cJuVuACw0TyFA0U+T+HphKZuf96Ous2k3DAPTPG0bpf+SBMOBY1cPfD8i0Izdt4kXsA= 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: 84b76d9e-9ecc-47e3-36cd-08d5deb7f6df X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Jun 2018 18:33:24.4207 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: be62a12b-2cad-49a1-a5fa-85f4f3156a7d X-MS-Exchange-Transport-CrossTenantHeadersStamped: YTOPR0101MB2042 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: Sat, 30 Jun 2018 18:33:27 -0000 Andrey V. Elsukov wrote: >On 30.06.2018 01:07, Rick Macklem wrote: >> Author: rmacklem >> Date: Fri Jun 29 22:07:25 2018 >> New Revision: 335806 >> URL: https://svnweb.freebsd.org/changeset/base/335806 >> >> Log: >> Add support for IPv6 addresses to the "-p" option for the pNFS server = DS >> specifications. >> >> + char *mdspath, *mdsp, ip6[INET6_ADDRSTRLEN]; >> + const char *ad; >> int ecode; >> + hints.ai_flags =3D AI_CANONNAME | AI_ADDRCONFIG; >> + hints.ai_family =3D PF_UNSPEC; >> hints.ai_socktype =3D SOCK_STREAM; >> hints.ai_protocol =3D IPPROTO_TCP; >> ecode =3D getaddrinfo(cp, NULL, &hints, &ai_tcp); >> if (ecode !=3D 0) >> err(1, "getaddrinfo pnfs: %s %s", cp, >> gai_strerror(ecode)); >> + memcpy(&sin6, res->ai_addr, sizeof(sin6)); >> + ad =3D inet_ntop(AF_INET6, &sin6.sin6_addr= , ip6, >> + sizeof(ip6)); > >Hi, > >I'm unaware of applicability of IPv6 addresses with restricted scope in >this area, but when you use inet_ntop() to get IPv6 address text >representation, you can lost IPv6 scope zone id. getaddrinfo() can >return sockaddr structure with properly filled sin6_scope_id field. It >is better to use getnameinfo() with NI_NUMERICHOST flag. Also the size >of ip6 buffer should be enough to keep scope specifier. Thanks for mentioning this. First off, you could write what I know about IP= v6 addresses on a very small postage stamp... Are you referring to the 4bits in the second octet of the address or the st= uff that can end up as a suffix starting with"%"? In this case, the address string is put "on the wire" for the client to use= to connect to a data server (DS). I'm not sure if the "%..." stuff is useful in this c= ase and, when it gets to the client, it will be translated to an address via the ker= nel version of inet_pton(), which does not parse "%..." as far as I can see. So maybe others can clarify if it would be better to use getnameinfo() for = this use case? Thanks, rick ps: I changed the mailing list to freebsd-nat@ so hopefully the net folks w= ill notice.