From owner-svn-src-all@freebsd.org Fri Oct 4 12:57:19 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 444A712DF78 for ; Fri, 4 Oct 2019 12:57:19 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46l8zM15nJz4LlF for ; Fri, 4 Oct 2019 12:57:19 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qk1-f178.google.com (mail-qk1-f178.google.com [209.85.222.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id EF9C71FB76 for ; Fri, 4 Oct 2019 12:57:18 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qk1-f178.google.com with SMTP id u186so5673106qkc.5 for ; Fri, 04 Oct 2019 05:57:18 -0700 (PDT) X-Gm-Message-State: APjAAAV8fL9fgMVl+z37IvDEregszKamAhB/OnW9UcxHfXk4vK6mHH2K A54/4kFVmkBnAznMFTH/JO9+EmmtyEFpdSweIX8= X-Received: by 2002:ae9:dd81:: with SMTP id r123mt8650360qkf.103.1570193838295; Fri, 04 Oct 2019 05:57:18 -0700 (PDT) MIME-Version: 1.0 References: <201910031754.x93Hs0HD065043@repo.freebsd.org> In-Reply-To: <201910031754.x93Hs0HD065043@repo.freebsd.org> From: Kyle Evans Date: Fri, 4 Oct 2019 07:57:06 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r353057 - head/sys/net Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Oct 2019 12:57:19 -0000 On Thu, Oct 3, 2019 at 12:54 PM Kyle Evans 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