Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 May 2006 09:00:07 +1200
From:      Andrew Thompson <thompsa@freebsd.org>
To:        freebsd-net@freebsd.org
Subject:   interface notifications
Message-ID:  <20060524210007.GB68191@heff.fud.org.nz>

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


I want to bring up the idea again of announcing all interfaces on
creation/insert rather than just physical ones as it is right now. The
difference will be that pseudo interfaces will be reported to devd and
this lets actions be taken in userland.

Anyone care to test.


Andrew


Index: etc/devd.conf
===================================================================
RCS file: /home/ncvs/src/etc/devd.conf,v
retrieving revision 1.32
diff -u -p -r1.32 devd.conf
--- etc/devd.conf	16 Mar 2006 17:42:27 -0000	1.32
+++ etc/devd.conf	3 Apr 2006 00:21:00 -0000
@@ -28,17 +28,19 @@ options {
 # override these general rules.
 
 #
-# For ethernet like devices start configuring the interface.  Due to
-# a historical accident, this script is called pccard_ether.
+# Configure the interface on attach.  Due to a historical accident, this
+# script is called pccard_ether.
 #
-attach 0 {
-	media-type "ethernet";
-	action "/etc/pccard_ether $device-name start";
+notify 0 {
+	match "system"		"IFNET";
+	match "type"		"ATTACH";
+	action "/etc/pccard_ether $subsystem start";
 };
 
-detach 0 {
-	media-type "ethernet";
-	action "/etc/pccard_ether $device-name stop";
+notify 0 {
+	match "system"		"IFNET";
+	match "type"		"DETACH";
+	action "/etc/pccard_ether $subsystem stop";
 };
 
 #
Index: sys/net/if.c
===================================================================
RCS file: /home/ncvs/src/sys/net/if.c,v
retrieving revision 1.255
diff -u -p -r1.255 if.c
--- sys/net/if.c	21 Mar 2006 14:31:18 -0000	1.255
+++ sys/net/if.c	3 Apr 2006 00:22:22 -0000
@@ -505,6 +505,7 @@ if_attach(struct ifnet *ifp)
 		if_attachdomain1(ifp);
 
 	EVENTHANDLER_INVOKE(ifnet_arrival_event, ifp);
+	devctl_notify("IFNET", ifp->if_xname, "ATTACH", NULL);
 
 	/* Announce the interface. */
 	rt_ifannouncemsg(ifp, IFAN_ARRIVAL);
@@ -682,6 +683,7 @@ if_detach(struct ifnet *ifp)
 	/* Announce that the interface is gone. */
 	rt_ifannouncemsg(ifp, IFAN_DEPARTURE);
 	EVENTHANDLER_INVOKE(ifnet_departure_event, ifp);
+	devctl_notify("IFNET", ifp->if_xname, "DETACH", NULL);
 
 	IF_AFDATA_LOCK(ifp);
 	for (dp = domains; dp; dp = dp->dom_next) {




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