kern/116697: [ PATCH ] ifconfig's name argument has no efect on /dev/net/

Dan Lukes dan at obluda.cz
Thu Sep 27 16:00:05 PDT 2007


>Number:         116697
>Category:       kern
>Synopsis:       [ PATCH ] ifconfig's name argument has no efect on /dev/net/
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Sep 27 23:00:04 GMT 2007
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:


More information about the freebsd-bugs mailing list