Date: Sun, 8 Apr 2018 12:31:05 +0400 From: Roman Bogorodskiy <novel@FreeBSD.org> To: Poul-Henning Kamp <phk@phk.freebsd.dk> Cc: freebsd-hackers@freebsd.org Subject: Re: Getting /dev entry by interface name Message-ID: <20180408083104.GA1780@kloomba> In-Reply-To: <37078.1523089049@critter.freebsd.dk> References: <20180407025807.GA18883@kloomba> <37078.1523089049@critter.freebsd.dk>
next in thread | previous in thread | raw e-mail | index | archive | help
--tThc/1wpZn/ma/RB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Poul-Henning Kamp wrote: > -------- > In message <20180407025807.GA18883@kloomba>, Roman Bogorodskiy writes: >=20 > >1. Create tap(4) like that: > > > ># ifconfig tap create > >tap2 > ># > > > >2. Rename it > > > ># ifconfig tap2 name testif > >testif > > > >Now I can do 'ifconfig testif' and there'll be no signs that it was > >named 'tap2' previously, however, in /dev it's still /dev/tap2. >=20 > I would argue that is an error. >=20 > The /dev entry should also be renamed, or maybe better, a symlink > with the new name should be created, pointing to the /dev/tap%d > entry. >=20 > However, I dont know if that is actually possible, is the device > driver even even told about the new interface name ? >=20 > There is also a name-space validation issue to think about: >=20 > ifconfig tap2 name ../etc I'm not sure if that's possible (or a reasonable thing to do) either. Not only stuff like '../etc' needs to be validated as you mentioned, but also we need to make sure not to clash with other devices. For example, now it's possible to rename tap device to 'null' which will not be possible if we create a symlink. Back to the original question, julian@ suggested to take a look at sysctl, and there's indeed one that reports this information. There's even some sample code in tools/ available: https://svnweb.freebsd.org/base/head/tools/tools/ifinfo/ifinfo.c?view=3Dmar= kup#l123 This sysctl is not easy to find unless you know what you're looking for. Roman Bogorodskiy --tThc/1wpZn/ma/RB Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJaydNIAAoJEMltX/4IwiJqtF4H/1m5XUPWap+Ua3og6ofN2Mv2 aoUOBYvJT35KxGmjJ/E5tPtNJ4SIJstyRkZII+xQsrptOswhuFjZmTpRsgDWhhz0 eRw8BDOQGtXtc+XGbcdcS/KScnIJdxb7TN7GE3lX9RXwfpVepqQyEzuSpNBsrIpi uds9nhO6+6QtUSRS10xvH+zpJmE+tZspWHYFH4oMmXG3yi+1UGW6sGtUC5znASu2 OqjfC2JcM4DxZy2N5gKTfTSJw+uh9K2GD1gmsUdN1lfU3UMFot5L8iYcoY5pij+x bvQCmbEECJAT8XvwPi9sLvR79rIslTJZbWoZGUJW2FcEFEsKDXTAmfqQrHLUvq4= =X2y9 -----END PGP SIGNATURE----- --tThc/1wpZn/ma/RB--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20180408083104.GA1780>