Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Oct 2019 07:57:06 -0500
From:      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:  <CACNAnaGziLmr79Z=OwO2FTO8Dv9BDZ4TUehEEPQHtFmsb-xXQw@mail.gmail.com>
In-Reply-To: <201910031754.x93Hs0HD065043@repo.freebsd.org>
References:  <201910031754.x93Hs0HD065043@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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 open the
>   device (if it hadn't been opened during the rename).
>
>   Register an eventhandler for ifnet_arrival_events and catch interface
>   renames. We can determine if the ifnet is a tun easily enough from the
>   if_dname, which matches the cevsw.d_name from the associated tuntap_driver.
>
>   Some locking dance is required because renames don't require the device 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 the tun
>   and either bail out if the tun device is dying, or we can proceed with 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.
>

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.

PR: 219746



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACNAnaGziLmr79Z=OwO2FTO8Dv9BDZ4TUehEEPQHtFmsb-xXQw>