From d999897b2562b8a46051ceb5d71c143976da65f6 Mon Sep 17 00:00:00 2001 From: thompsa Date: Mon, 24 Jul 2006 20:42:36 +0000 Subject: [PATCH] MFC Announce all interfaces to devd on attach/detach. This adds a new devctl notification so all interfaces including pseudo are reported. r1.33 src/etc/devd.conf r1.9 src/etc/rc.d/devd r1.256 src/sys/net/if.c --- etc/devd.conf | 18 ++++++++++-------- etc/rc.d/devd | 4 ++-- sys/net/if.c | 2 ++ 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/etc/devd.conf b/etc/devd.conf index 005e57cdaf2d..af330376a03f 100644 --- a/etc/devd.conf +++ b/etc/devd.conf @@ -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"; }; # diff --git a/etc/rc.d/devd b/etc/rc.d/devd index 50c8a17d59dc..f025f9a58d16 100644 --- a/etc/rc.d/devd +++ b/etc/rc.d/devd @@ -4,8 +4,8 @@ # # PROVIDE: devd -# REQUIRE: NETWORKING -# BEFORE: mountcritremote +# REQUIRE: netif +# BEFORE: NETWORKING mountcritremote # KEYWORD: nojail . /etc/rc.subr diff --git a/sys/net/if.c b/sys/net/if.c index b0f8c681cccb..749df8cdeca8 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -506,6 +506,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); @@ -689,6 +690,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) {