Is there an way for a program to know when the list of network interfaces has changed (without rescanning them)?
Eugene Grosbein
eugen at grosbein.net
Mon Jul 29 06:04:42 UTC 2019
29.07.2019 12:35, Yuri wrote:
> I am asking because wireshark doesn't sense the interface list changes, and it just always shows the list from the time it was launched .
There is a way as we have devd(8) reading kernel-generated events and running commands in response.
Look at default /etc/devd.conf rules for example:
notify 0 {
match "system" "IFNET";
match "subsystem" "!(usbus|wlan)[0-9]+";
match "type" "ATTACH";
action "/etc/pccard_ether $subsystem start";
};
Quoting devd(8) manual page:
> Since devctl(4) allows only one active reader, devd multiplexes it,
> forwarding all events to any number of connected clients. Clients
> connect by opening the SOCK_SEQPACKET UNIX domain socket at
> /var/run/devd.seqpacket.pipe.
We have bsnmpd(1) in base system and its module usr.sbin/bsnmpd/modules/snmp_hostres
acting as client of devd, for example.
More information about the freebsd-net
mailing list