From dan@kulesh.obluda.cz  Thu Sep 27 22:55:34 2007
Return-Path: <dan@kulesh.obluda.cz>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7C09716A50F
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 27 Sep 2007 22:55:34 +0000 (UTC)
	(envelope-from dan@kulesh.obluda.cz)
Received: from smtp1.kolej.mff.cuni.cz (smtp1.kolej.mff.cuni.cz [78.128.192.4])
	by mx1.freebsd.org (Postfix) with ESMTP id F032E13C4A3
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 27 Sep 2007 22:55:33 +0000 (UTC)
	(envelope-from dan@kulesh.obluda.cz)
Received: from kulesh.obluda.cz (openvpn.ms.mff.cuni.cz [195.113.20.87])
	by smtp1.kolej.mff.cuni.cz (8.13.8/8.13.8) with ESMTP id l8RMtHuK089590
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 28 Sep 2007 00:55:18 +0200 (CEST)
	(envelope-from dan@kulesh.obluda.cz)
Received: from kulesh.obluda.cz (localhost. [127.0.0.1])
	by kulesh.obluda.cz (8.14.1/8.14.1) with ESMTP id l8RMtHSW001441
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 28 Sep 2007 00:55:17 +0200 (CEST)
	(envelope-from dan@kulesh.obluda.cz)
Received: (from root@localhost)
	by kulesh.obluda.cz (8.14.1/8.13.8/Submit) id l8RMtGU2001440;
	Fri, 28 Sep 2007 00:55:16 +0200 (CEST)
	(envelope-from dan)
Message-Id: <200709272255.l8RMtGU2001440@kulesh.obluda.cz>
Date: Fri, 28 Sep 2007 00:55:16 +0200 (CEST)
From: Dan Lukes <dan@obluda.cz>
Reply-To: Dan Lukes <dan@obluda.cz>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [ PATCH ] ifconfig's name argument has no effect on /dev/net/
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         116697
>Category:       kern
>Synopsis:       [net] [patch] ifconfig's name argument has no effect on /dev/net/
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kmacy
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Sep 27 23:00:04 GMT 2007
>Closed-Date:    Fri Mar 12 06:43:42 UTC 2010
>Last-Modified:  Fri Mar 12 06:43:42 UTC 2010
>Originator:     Dan Lukes
>Release:        FreeBSD 6.2-STABLE i386
>Organization:
Obludarium
>Environment:
FreeBSD 6.2-STABLE
src/sys/net/if.c,v 1.234.2.21 2007/07/13 01:26:44

>Description:
	All network interfaces has special device node under /dev/net/ directory

	ifconfig's name argument allow renaming of interface, but it has no
effect on /dev/net content. It create incostistence between ifconfig's view
of interface list and /dev/net/ content

	Althought detected and analysed on RELENG-6, it does apply to CURRENT as well.

>How-To-Repeat:

	ifconfig vlan0 create ZEROVLAN
	ls /dev/net/

>Fix:

	Recreate device nodes on interface name change.

--- sys/net/if.c.ORIG	2007-09-27 10:05:10.000000000 +0200
+++ sys/net/if.c	2007-09-27 10:05:10.000000000 +0200
@@ -1393,6 +1393,14 @@
 			sdl->sdl_data[--namelen] = 0xff;
 		IFA_UNLOCK(ifa);
 
+		destroy_dev(ifdev_byindex(ifp->if_index));
+		ifdev_byindex(ifp->if_index) = make_dev(&net_cdevsw,
+		    unit2minor(ifp->if_index),
+		    UID_ROOT, GID_WHEEL, 0600, "%s/%s",
+		    net_cdevsw.d_name, ifp->if_xname);
+		make_dev_alias(ifdev_byindex(ifp->if_index), "%s%d",
+		    net_cdevsw.d_name, ifp->if_index);
+
 		EVENTHANDLER_INVOKE(ifnet_arrival_event, ifp);
 		/* Announce the return of the interface. */
 		rt_ifannouncemsg(ifp, IFAN_ARRIVAL);
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->kmacy 
Responsible-Changed-By: kmacy 
Responsible-Changed-When: Fri Nov 16 07:58:00 UTC 2007 
Responsible-Changed-Why:  

Looks straightforward. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=116697 
State-Changed-From-To: open->analyzed 
State-Changed-By: vwe 
State-Changed-When: Sat Jan 31 08:30:12 UTC 2009 
State-Changed-Why:  
Will (wca) has checked this issue and created a slightly different 
patch for this problem. You can find it at: 
http://firepipe.net/if.c.116697-diff 

http://www.freebsd.org/cgi/query-pr.cgi?pr=116697 

From: Will Andrews <will@firepipe.net>
To: bug-followup@freebsd.org
Cc:  
Subject: Re: kern/116697: [net] [patch] ifconfig's name argument has no efect 
	on /dev/net/
Date: Sat, 31 Jan 2009 02:06:27 -0700

 --001636c5b496f188d60461c3a2b3
 Content-Type: multipart/alternative; boundary=001636c5b496f188cf0461c3a2b1
 
 --001636c5b496f188cf0461c3a2b1
 Content-Type: text/plain; charset=ISO-8859-1
 Content-Transfer-Encoding: 7bit
 
 Here is a cleaner patch.
 --Will.
 
 --001636c5b496f188cf0461c3a2b1
 Content-Type: text/html; charset=ISO-8859-1
 Content-Transfer-Encoding: 7bit
 
 Here is a cleaner patch.<div><br></div><div>--Will.</div>
 
 --001636c5b496f188cf0461c3a2b1--
 --001636c5b496f188d60461c3a2b3
 Content-Type: text/plain; charset=US-ASCII; name="if.c.116697-diff.txt"
 Content-Disposition: attachment; filename="if.c.116697-diff.txt"
 Content-Transfer-Encoding: base64
 X-Attachment-Id: f_fqm27c4h0
 
 SW5kZXg6IGlmLmMKPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
 PT09PT09PT09PT09PT09PT09PT09PQotLS0gaWYuYwkocmV2aXNpb24gMTg3OTMzKQorKysgaWYu
 Ywkod29ya2luZyBjb3B5KQpAQCAtMTY2OCw2ICsxNjY4LDcgQEAKIAljaGFyIG5ld19uYW1lW0lG
 TkFNU0laXTsKIAlzdHJ1Y3QgaWZhZGRyICppZmE7CiAJc3RydWN0IHNvY2thZGRyX2RsICpzZGw7
 CisJc3RydWN0IGNkZXYgKm5hbWVfY2RldjsKIAogCWlmciA9IChzdHJ1Y3QgaWZyZXEgKilkYXRh
 OwogCXN3aXRjaCAoY21kKSB7CkBAIC0xODEwLDYgKzE4MTEsMTQgQEAKIAkJCXNkbC0+c2RsX2Rh
 dGFbLS1uYW1lbGVuXSA9IDB4ZmY7CiAJCUlGQV9VTkxPQ0soaWZhKTsKIAorCQlkZXN0cm95X2Rl
 dihpZmRldl9ieWluZGV4KGlmcC0+aWZfaW5kZXgpKTsKKwkJbmFtZV9jZGV2ID0gbWFrZV9kZXYo
 Jm5ldF9jZGV2c3csIGlmcC0+aWZfaW5kZXgsCisJCSAgICBVSURfUk9PVCwgR0lEX1dIRUVMLCAw
 NjAwLCAiJXMvJXMiLAorCQkgICAgbmV0X2NkZXZzdy5kX25hbWUsIGlmcC0+aWZfeG5hbWUpOwor
 CQlpZmRldl9zZXRieWluZGV4KGlmcC0+aWZfaW5kZXgsIG5hbWVfY2Rldik7CisJCW1ha2VfZGV2
 X2FsaWFzKGlmZGV2X2J5aW5kZXgoaWZwLT5pZl9pbmRleCksCisJCSAgICAiJXMlZCIsIG5ldF9j
 ZGV2c3cuZF9uYW1lLCBpZnAtPmlmX2luZGV4KTsKKwogCQlFVkVOVEhBTkRMRVJfSU5WT0tFKGlm
 bmV0X2Fycml2YWxfZXZlbnQsIGlmcCk7CiAJCS8qIEFubm91bmNlIHRoZSByZXR1cm4gb2YgdGhl
 IGludGVyZmFjZS4gKi8KIAkJcnRfaWZhbm5vdW5jZW1zZyhpZnAsIElGQU5fQVJSSVZBTCk7Cg==
 --001636c5b496f188d60461c3a2b3--

From: Dan Lukes <dan@obluda.cz>
To: vwe@FreeBSD.org, wca@FreeBSD.org
Cc: kmacy@FreeBSD.org, bug-followup@FreeBSD.org
Subject: Re: kern/116697: [net] [patch] ifconfig's name argument has no efect
 on /dev/net/
Date: Sat, 31 Jan 2009 13:50:09 +0100

 vwe@FreeBSD.org napsal/wrote, On 01/31/09 09:31:
 > Synopsis: [net] [patch] ifconfig's name argument has no efect on /dev/net/
 
 > Will (wca) has checked this issue and created a slightly different
 > patch for this problem. You can find it at:
 > http://firepipe.net/if.c.116697-diff
 
 Yes, it works.
 
 Both my and your patch has problem - the "ifconfig name" is "rename" 
 operation only. It doesn't delete the interface and doesn't create the 
 new one. The network operations are not disrupted.
 
 We should rename the /dev/net entry as well. The rename will not disrupt 
 operations (if someone works on the device) and preserve the ownership 
 and mode of the device also.
 
 Unfortunately, I don't know how to rename device entry.
 
 						Dan
State-Changed-From-To: analyzed->closed 
State-Changed-By: brooks 
State-Changed-When: Fri Mar 12 06:39:06 UTC 2010 
State-Changed-Why:  
We've removed the /dev/net tree in 8.0.  I principle we could commit 
a fix to 7.x and merge to 6.x, but I can't really see doing that 
at this late date for an interface people need to stop using. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=116697 
>Unformatted:
