From owner-freebsd-hackers@freebsd.org Fri Aug 11 10:02:06 2017 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 989F5DC246F for ; Fri, 11 Aug 2017 10:02:06 +0000 (UTC) (envelope-from bu7cher@yandex.ru) Received: from forward106j.mail.yandex.net (forward106j.mail.yandex.net [IPv6:2a02:6b8:0:801:2::109]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "forwards.mail.yandex.net", Issuer "Yandex CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3C2096A817 for ; Fri, 11 Aug 2017 10:02:06 +0000 (UTC) (envelope-from bu7cher@yandex.ru) Received: from mxback10o.mail.yandex.net (mxback10o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::24]) by forward106j.mail.yandex.net (Yandex) with ESMTP id 8B5461804BBC; Fri, 11 Aug 2017 13:01:44 +0300 (MSK) Received: from smtp4p.mail.yandex.net (smtp4p.mail.yandex.net [2a02:6b8:0:1402::15:6]) by mxback10o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id St8HBqhWuB-1ipeP0Vj; Fri, 11 Aug 2017 13:01:44 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1502445704; bh=XnO1gHdRqkHU9DW9NeXdwolK95iOt1vRCHI9zaSTadw=; h=Subject:To:Cc:References:From:Message-ID:Date:In-Reply-To; b=o1AnwcK9Ife21PXteFH/tU+ugaqxI95Qj16fwRMqUYIRcm8qdojIhYLypqzn8AcVK gbFczORnJuVtLVvoSlnm89NoNC1lmnJDL7WLD91DrhXTgk+mh0x15yCPnU1w9oAp6J LVl2Six+1UO/Yevk/9zKnlxGeMW5TSExM6m8GHgc= Received: by smtp4p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 3dyM8vK2hw-1h8Cnv4M; Fri, 11 Aug 2017 13:01:44 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1502445704; bh=XnO1gHdRqkHU9DW9NeXdwolK95iOt1vRCHI9zaSTadw=; h=Subject:To:Cc:References:From:Message-ID:Date:In-Reply-To; b=o1AnwcK9Ife21PXteFH/tU+ugaqxI95Qj16fwRMqUYIRcm8qdojIhYLypqzn8AcVK gbFczORnJuVtLVvoSlnm89NoNC1lmnJDL7WLD91DrhXTgk+mh0x15yCPnU1w9oAp6J LVl2Six+1UO/Yevk/9zKnlxGeMW5TSExM6m8GHgc= Authentication-Results: smtp4p.mail.yandex.net; dkim=pass header.i=@yandex.ru Subject: Re: `ifconfig` patch to resolve IPv6 scope names To: raichoo Cc: freebsd-hackers@freebsd.org References: <8ebce8ed-5b3f-2b59-5b37-f6af7f3d4c2b@yandex.ru> From: "Andrey V. Elsukov" Openpgp: id=E6591E1B41DA1516F0C9BC0001C5EA0410C8A17A Message-ID: <92290fd6-fa7f-5d62-732a-1353af612297@yandex.ru> Date: Fri, 11 Aug 2017 12:58:25 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="6MqdLMl0xTfo6GaFUBr5lvRV2cGiHfxLq" X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Aug 2017 10:02:06 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --6MqdLMl0xTfo6GaFUBr5lvRV2cGiHfxLq Content-Type: multipart/mixed; boundary="UQbhUc9cppqNQJ8sRWmfUlEqK9hhbAJ51"; protected-headers="v1" From: "Andrey V. Elsukov" To: raichoo Cc: freebsd-hackers@freebsd.org Message-ID: <92290fd6-fa7f-5d62-732a-1353af612297@yandex.ru> Subject: Re: `ifconfig` patch to resolve IPv6 scope names References: <8ebce8ed-5b3f-2b59-5b37-f6af7f3d4c2b@yandex.ru> In-Reply-To: --UQbhUc9cppqNQJ8sRWmfUlEqK9hhbAJ51 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 10.08.2017 23:02, raichoo via freebsd-hackers wrote: > Oh boy, should have read more code before posting that ^^. >=20 > Thanks a lot for your feedback :) >=20 > I've modified that patch to make it use the macros defined in in6.h. I'= m > also quite > aware that this patch might be rejected since it might break script > depending on `ifconfig` > output. But it's a useful little learning experience anyway :) >=20 > Kind regards, > raichoo >=20 > Here's the new iteration: >=20 > diff --git a/sbin/ifconfig/af_inet6.c b/sbin/ifconfig/af_inet6.c > index e93d94355e..e1d44395c9 100644 > --- a/sbin/ifconfig/af_inet6.c > +++ b/sbin/ifconfig/af_inet6.c > @@ -167,6 +167,35 @@ setip6eui64(const char *cmd, int dummy __unused, i= nt s, > } >=20 > static void > +in6_addr_scope(const struct in6_addr *addr) > +{ > + if (IN6_IS_ADDR_LINKLOCAL(addr)) > + printf("link-local "); > + else if (IN6_IS_ADDR_SITELOCAL(addr)) > + printf("site-local "); > + else if (IN6_IS_ADDR_MULTICAST(addr)) { > + printf("multicast "); > + switch (__IPV6_ADDR_MC_SCOPE(addr)) { > + case __IPV6_ADDR_SCOPE_NODELOCAL: > + printf("node-local "); > + break; > + case __IPV6_ADDR_SCOPE_LINKLOCAL: > + printf("link-local "); > + break; > + case __IPV6_ADDR_SCOPE_SITELOCAL: > + printf("site-local "); > + break; > + case __IPV6_ADDR_SCOPE_ORGLOCAL: > + printf("organization-local "); > + break; > + case __IPV6_ADDR_SCOPE_GLOBAL: > + printf("global "); > + break; > + } > + } > +} Hi, I'm not sure how it is useful configuring multicast addresses on the interface. I think there are only four possible useful cases: 1. loopback address should be marked as link-local 2. link-local addresses should be marked as link-local 3. site-local addresses should be marked as site-local 4. all other non multicast addresses should be marked as global Also, AFAIR, the site-local scope was deprecated a long time ago. --=20 WBR, Andrey V. Elsukov --UQbhUc9cppqNQJ8sRWmfUlEqK9hhbAJ51-- --6MqdLMl0xTfo6GaFUBr5lvRV2cGiHfxLq Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEzBAEBCAAdFiEE5lkeG0HaFRbwybwAAcXqBBDIoXoFAlmNf8EACgkQAcXqBBDI oXp6MAf+P3hJviN6fDQ9okEFyyqkgEBU7N4q8zCSUlXxpWXUyFIW7iXZAlv9Kjrd WRAsCiPZ0nlotQaE29JuFcBgzmfsilfXQnQLg1nfpkyO4OEWERANaS6zeEGhgLfP Hf4EQ2w0bPfU4prrjTc5mvnDl/tGIEpn0wUUzVl4GV1+yFO0EiiWYOPOCEA3uG1p RE8dADqwwn5+5wM/MEzs+cZBXCegXfjEdPh5tz5rs5fuiuJ2oCXBgPGdYk5yRhJz x2//5qZ75uMl2BjBwnhz9z6TKOFoWD8RoJR+8r0VCxaBaw/mIO47Abm1DGhuqf1x tUM/HPE12RtZ0Ebqwzk9GwPNF4VXsQ== =2xwf -----END PGP SIGNATURE----- --6MqdLMl0xTfo6GaFUBr5lvRV2cGiHfxLq--