Date: Mon, 29 Jul 2019 14:56:54 +0900 (JST) From: Hiroki Sato <hrs@allbsd.org> To: yuri@rawbw.com Cc: 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: <20190729.145654.1521764302694128109.hrs@allbsd.org> 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
----Security_Multipart(Mon_Jul_29_14_56_54_2019_268)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Yuri <yuri@rawbw.com> wrote in <de8fe1fc-81a1-80f3-82e5-1ec41f639b63@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 ----Security_Multipart(Mon_Jul_29_14_56_54_2019_268)-- Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iEYEABECAAYFAl0+iqYACgkQTyzT2CeTzy1ctACff7pORjAKQnbAzG8s3Iubfhe4 fzIAoNzC6pAIDNpFBEdFVaUcHs2EX3QY =q6Vo -----END PGP SIGNATURE----- ----Security_Multipart(Mon_Jul_29_14_56_54_2019_268)----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20190729.145654.1521764302694128109.hrs>