Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Sep 2007 00:55:16 +0200 (CEST)
From:      Dan Lukes <dan@obluda.cz>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   kern/116697: [ PATCH ] ifconfig's name argument has no efect on /dev/net/
Message-ID:  <200709272255.l8RMtGU2001440@kulesh.obluda.cz>
Resent-Message-ID: <200709272300.l8RN05kd048232@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200709272255.l8RMtGU2001440>