Is there an way for a program to know when the list of network interfaces has changed (without rescanning them)?

Hiroki Sato hrs at allbsd.org
Mon Jul 29 05:58:48 UTC 2019


Yuri <yuri at rawbw.com> wrote
  in <de8fe1fc-81a1-80f3-82e5-1ec41f639b63 at rawbw.com>:

yu> I am asking because wireshark doesn't sense the interface list
yu> changes, and it just always shows the list from the time it was
yu> launched .

 You can open a routing socket and watch it to see if RTM_IFANNOUNCE
 message is coming.  The following command lines (on two different
 terminals on the same machine) show how this works when a new interface
 arrives:

  termA% route monitor
  (this waits for routing messages)

  termB# ifconfig tap0 create

 An example code to handle routing messages can be found in
 src/sbin/route/route.c.

-- Hiroki
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 163 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-net/attachments/20190729/02b470d9/attachment.sig>


More information about the freebsd-net mailing list