Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 6 Oct 2019 12:17:30 -0400
From:      Allan Jude <allanjude@freebsd.org>
To:        Kyle Evans <kevans@freebsd.org>
Cc:        src-committers <src-committers@freebsd.org>, svn-src-all <svn-src-all@freebsd.org>, svn-src-head <svn-src-head@freebsd.org>
Subject:   Re: svn commit: r353057 - head/sys/net
Message-ID:  <b8d52a61-820e-17cb-fe5f-770c6e3d6ba3@freebsd.org>
In-Reply-To: <CACNAnaGziLmr79Z=OwO2FTO8Dv9BDZ4TUehEEPQHtFmsb-xXQw@mail.gmail.com>
References:  <201910031754.x93Hs0HD065043@repo.freebsd.org> <CACNAnaGziLmr79Z=OwO2FTO8Dv9BDZ4TUehEEPQHtFmsb-xXQw@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)
--XTVpOt3eZDSOPub1EOlCC4uaXs0dmBSUo
Content-Type: multipart/mixed; boundary="nzeTaqgE5i1KQGzS8KtwOPLBv4L5ULSud";
 protected-headers="v1"
From: Allan Jude <allanjude@freebsd.org>
To: Kyle Evans <kevans@freebsd.org>
Cc: src-committers <src-committers@freebsd.org>,
 svn-src-all <svn-src-all@freebsd.org>,
 svn-src-head <svn-src-head@freebsd.org>
Message-ID: <b8d52a61-820e-17cb-fe5f-770c6e3d6ba3@freebsd.org>
Subject: Re: svn commit: r353057 - head/sys/net
References: <201910031754.x93Hs0HD065043@repo.freebsd.org>
 <CACNAnaGziLmr79Z=OwO2FTO8Dv9BDZ4TUehEEPQHtFmsb-xXQw@mail.gmail.com>
In-Reply-To: <CACNAnaGziLmr79Z=OwO2FTO8Dv9BDZ4TUehEEPQHtFmsb-xXQw@mail.gmail.com>

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

On 2019-10-04 08:57, Kyle Evans wrote:
> On Thu, Oct 3, 2019 at 12:54 PM Kyle Evans <kevans@freebsd.org> wrote:
>>
>> Author: kevans
>> Date: Thu Oct  3 17:54:00 2019
>> New Revision: 353057
>> URL: https://svnweb.freebsd.org/changeset/base/353057
>>
>> Log:
>>   if_tuntap: create /dev aliases when a tuntap device gets renamed
>>
>>   Currently, if you do:
>>
>>   $ ifconfig tun0 create
>>   $ ifconfig tun0 name wg0
>>   $ ls -l /dev | egrep 'wg|tun'
>>
>>   You will see tun0, but no wg0. In fact, it's slightly more annoying =
to make
>>   the association between the new name and the old name in order to op=
en the
>>   device (if it hadn't been opened during the rename).
>>
>>   Register an eventhandler for ifnet_arrival_events and catch interfac=
e
>>   renames. We can determine if the ifnet is a tun easily enough from t=
he
>>   if_dname, which matches the cevsw.d_name from the associated tuntap_=
driver.
>>
>>   Some locking dance is required because renames don't require the dev=
ice to
>>   be opened, so it could go away in the middle of handling the ioctl, =
but as
>>   soon as we've verified this isn't the case we can attempt to busy th=
e tun
>>   and either bail out if the tun device is dying, or we can proceed wi=
th the
>>   rename.
>>
>>   We only create these aliases on a best-effort basis. Renaming a tun =
device
>>   to "usbctl", which doesn't exist as an ifnet but does as a /dev, is =
clearly
>>   not that disastrous, but we can't and won't create a /dev for that.
>>
>=20
> It's been brought to my attention that I actually had a PR that I took
> six months ago that this should've belonged to.
>=20
> PR: 219746
>=20

Thanks for this, I was having similar problems with this trying to use
wireguard inside a VNET jail, so it was even harder to find and destroy
the correct interface.

--=20
Allan Jude


--nzeTaqgE5i1KQGzS8KtwOPLBv4L5ULSud--

--XTVpOt3eZDSOPub1EOlCC4uaXs0dmBSUo
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (MingW32)

iQIcBAEBAgAGBQJdmhObAAoJEBmVNT4SmAt+vc0QAIpqq49y3A/7SWQemvwzJPdO
4mpmkhkE5om5jxm4pI8uUCv+bL8ntGNW/KHaX6MYAeGtipFl1TaYbgP1sQX6R43c
cdozTI2VFkLYMM3Xzz/nCPgu63norFgEbcYdMHlBJlS8iv2vgCC3WdEZ//yigxHV
Lg14jrgDtg39gF7aEBcaflbklWdWtYl318Gsix/ytwbkJ28bOv1tP6KQYtgjTCyM
TPQjuypz4bU5+h0bOiWzdIoewznGQSf7ZFB6PZUEy/onIpFGhuhW7Y6uVihZdyPH
Aer1XewNHdH/99iodWjA7H2iFY5kIrOsFUclWqTzeoi5WmMT8p82j6QOHlXZMXwI
vnk11Fkt8CTILn5YZ3gcG5y70tZMbfIvJ8qQ54Dy8StFpq06HW6fZm+mGeyF9nbL
zxl9ruOz/yAeNQBEQVMpRTvIgNBKX/HYEq1vzmwNysl90AUnhXG8/5Q6GMl/9Bz9
fYNeDMjIBxnu2OhCNEQHX03Yq9yGwK1tKnkAr8IRkw/3ENOHfLNdOYS6CR7gdIUj
qstfx4DgveScq0Ytbvg8vA7Mf0ZO601rJZNM7Sl1J06IwiNMj1BzBOts5+NPkYR0
fthwJcrjqOpjS7pa0SpgR8BkQrGBrGBGeE/i6ZO8g7Int0bXZSTypSdEaqoCeekY
pSGLpzBytm2m3Ei7Odsx
=B2EK
-----END PGP SIGNATURE-----

--XTVpOt3eZDSOPub1EOlCC4uaXs0dmBSUo--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?b8d52a61-820e-17cb-fe5f-770c6e3d6ba3>