Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Aug 2017 11:19:19 +0300
From:      "Andrey V. Elsukov" <bu7cher@yandex.ru>
To:        raichoo <raichoo@googlemail.com>, freebsd-hackers@freebsd.org
Subject:   Re: `ifconfig` patch to resolve IPv6 scope names
Message-ID:  <8ebce8ed-5b3f-2b59-5b37-f6af7f3d4c2b@yandex.ru>
In-Reply-To: <CAJaUxeyRQoQkVdb3jNim_BVbdtBp0hM1pn3AiaR_DPJZAyQapg@mail.gmail.com>
References:  <CAJaUxeyRQoQkVdb3jNim_BVbdtBp0hM1pn3AiaR_DPJZAyQapg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--dlhXvmALTLSlcj8h0Ho4SVQd1IMOASOiO
Content-Type: multipart/mixed; boundary="7s8lKON7xeJw9LRXGHvk0R9ah0rlBdigS";
 protected-headers="v1"
From: "Andrey V. Elsukov" <bu7cher@yandex.ru>
To: raichoo <raichoo@googlemail.com>, freebsd-hackers@freebsd.org
Message-ID: <8ebce8ed-5b3f-2b59-5b37-f6af7f3d4c2b@yandex.ru>
Subject: Re: `ifconfig` patch to resolve IPv6 scope names
References: <CAJaUxeyRQoQkVdb3jNim_BVbdtBp0hM1pn3AiaR_DPJZAyQapg@mail.gmail.com>
In-Reply-To: <CAJaUxeyRQoQkVdb3jNim_BVbdtBp0hM1pn3AiaR_DPJZAyQapg@mail.gmail.com>

--7s8lKON7xeJw9LRXGHvk0R9ah0rlBdigS
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: quoted-printable

On 09.08.2017 23:18, raichoo via freebsd-hackers wrote:
> Hi,
>=20
> I've made a trivial patch that resolves IPv6 scope names (according to
> rfc4291).
> I thought this might be handy, so one does not have to memorize what id=

> refers
> to which scope. And it's a nice opportunity to get my feet wet I guess =
:)
>=20
> This is my first patch and I have no idea what's the best way to contri=
bute
> to the
> project (probably I didn't look hard enough or in the wrong places).
>=20
> Feedback and pointers appreciated.
>=20
> Kind regards,
> raichoo
>=20
> diff --git a/sbin/ifconfig/af_inet6.c b/sbin/ifconfig/af_inet6.c
> index e93d94355e..165b2cc90a 100644
> --- a/sbin/ifconfig/af_inet6.c
> +++ b/sbin/ifconfig/af_inet6.c
> @@ -268,10 +268,32 @@ in6_status(int s __unused, const struct ifaddrs *=
ifa)
>         if ((flags6 & IN6_IFF_PREFER_SOURCE) !=3D 0)
>                 printf("prefer_source ");
>=20
> -       if (((struct sockaddr_in6 *)(ifa->ifa_addr))->sin6_scope_id)
> +       if (((struct sockaddr_in6 *)(ifa->ifa_addr))->sin6_scope_id) {
>                 printf("scopeid 0x%x ",
>                     ((struct sockaddr_in6
> *)(ifa->ifa_addr))->sin6_scope_id);
>=20
> +               switch (((struct sockaddr_in6
> *)(ifa->ifa_addr))->sin6_scope_id) {
> +               case 0x1:
> +                       printf("interface-local ");
> +                       break;
> +               case 0x2:
> +                       printf("link-local ");
> +                       break;

Hi,

the patch is wrong. sin6_scope_id does not describe the scope, it is
scope zone id. To determine the scope, you should use an address.

--=20
WBR, Andrey V. Elsukov


--7s8lKON7xeJw9LRXGHvk0R9ah0rlBdigS--

--dlhXvmALTLSlcj8h0Ho4SVQd1IMOASOiO
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/

iQEzBAEBCAAdFiEE5lkeG0HaFRbwybwAAcXqBBDIoXoFAlmMFwcACgkQAcXqBBDI
oXp+YQf/doemcn3dkEcg5lgvEz/vn4lQBkTzRzFDv5E5+vPNtThMmMrQWC5EyBbQ
lbrBto1J7zOQ8s3v1LBcY3Xj8iu6XoMttUL9NEXN4c158H5NU0oRBdlmEJK0zZed
fEDLscT9hEcFrF6HRJQGVOsq9HrTC8aQUS/tx9Nl0bUzuTKYbyaJ9sx8cS98MCJZ
Wq0hTNwdVx1ExErZ1Dwd4C36znxVOs8l3vb3GAlr2cF3jukDp8eIeOvMibOgfo/E
dMZz72lH135JwtT206c9znj4LmG2uDk1dBJ9j33eW914SJAAfl2HajAADcRvCuvr
a5O8idsX3SReQUX7Ncl8zXD/uD0Cbg==
=xMRa
-----END PGP SIGNATURE-----

--dlhXvmALTLSlcj8h0Ho4SVQd1IMOASOiO--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8ebce8ed-5b3f-2b59-5b37-f6af7f3d4c2b>