Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Jul 2019 13:04:05 +0700
From:      Eugene Grosbein <eugen@grosbein.net>
To:        Yuri <yuri@rawbw.com>, "freebsd-net@freebsd.org" <freebsd-net@freebsd.org>
Subject:   Re: Is there an way for a program to know when the list of network interfaces has changed (without rescanning them)?
Message-ID:  <4c60eb9c-2947-1d2b-3c65-8b87201a0487@grosbein.net>
In-Reply-To: <de8fe1fc-81a1-80f3-82e5-1ec41f639b63@rawbw.com>
References:  <de8fe1fc-81a1-80f3-82e5-1ec41f639b63@rawbw.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4c60eb9c-2947-1d2b-3c65-8b87201a0487>