Announce all interfaces to devd on attach/detach. This adds a new devctl

notification so all interfaces including pseudo are reported. When netif
creates the clones at startup devctl_disable has not been turned off yet so the
interfaces will not be initialised twice, enforce this by adding an explicit
order between rc.d/netif and rc.d/devd.

This change allows actions to taken in userland when an interface is cloned
and the pseudo interface will be automatically configured if a ifconfig_<int>=""
line exists in rc.conf.

Reviewed by:		brooks
No objections on:	net
This commit is contained in:
Andrew Thompson 2006-06-01 00:41:07 +00:00
parent cd6816b327
commit f3b90d48bb
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=159126
3 changed files with 14 additions and 10 deletions

View File

@ -28,17 +28,19 @@ options {
# override these general rules. # override these general rules.
# #
# For ethernet like devices start configuring the interface. Due to # Configure the interface on attach. Due to a historical accident, this
# a historical accident, this script is called pccard_ether. # script is called pccard_ether.
# #
attach 0 { notify 0 {
media-type "ethernet"; match "system" "IFNET";
action "/etc/pccard_ether $device-name start"; match "type" "ATTACH";
action "/etc/pccard_ether $subsystem start";
}; };
detach 0 { notify 0 {
media-type "ethernet"; match "system" "IFNET";
action "/etc/pccard_ether $device-name stop"; match "type" "DETACH";
action "/etc/pccard_ether $subsystem stop";
}; };
# #

View File

@ -4,8 +4,8 @@
# #
# PROVIDE: devd # PROVIDE: devd
# REQUIRE: NETWORKING # REQUIRE: netif
# BEFORE: mountcritremote # BEFORE: NETWORKING mountcritremote
# KEYWORD: nojail # KEYWORD: nojail
. /etc/rc.subr . /etc/rc.subr

View File

@ -505,6 +505,7 @@ if_attach(struct ifnet *ifp)
if_attachdomain1(ifp); if_attachdomain1(ifp);
EVENTHANDLER_INVOKE(ifnet_arrival_event, ifp); EVENTHANDLER_INVOKE(ifnet_arrival_event, ifp);
devctl_notify("IFNET", ifp->if_xname, "ATTACH", NULL);
/* Announce the interface. */ /* Announce the interface. */
rt_ifannouncemsg(ifp, IFAN_ARRIVAL); rt_ifannouncemsg(ifp, IFAN_ARRIVAL);
@ -682,6 +683,7 @@ if_detach(struct ifnet *ifp)
/* Announce that the interface is gone. */ /* Announce that the interface is gone. */
rt_ifannouncemsg(ifp, IFAN_DEPARTURE); rt_ifannouncemsg(ifp, IFAN_DEPARTURE);
EVENTHANDLER_INVOKE(ifnet_departure_event, ifp); EVENTHANDLER_INVOKE(ifnet_departure_event, ifp);
devctl_notify("IFNET", ifp->if_xname, "DETACH", NULL);
IF_AFDATA_LOCK(ifp); IF_AFDATA_LOCK(ifp);
for (dp = domains; dp; dp = dp->dom_next) { for (dp = domains; dp; dp = dp->dom_next) {