From owner-freebsd-net@freebsd.org Mon Jul 29 05:58:48 2019 Return-Path: Delivered-To: freebsd-net@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 944C9BE1EA for ; Mon, 29 Jul 2019 05:58:48 +0000 (UTC) (envelope-from hrs@allbsd.org) Received: from mail.allbsd.org (mx.allbsd.org [IPv6:2001:2f0:104:e001::41]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail.allbsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E8D8B8FA6C for ; Mon, 29 Jul 2019 05:58:47 +0000 (UTC) (envelope-from hrs@allbsd.org) Received: from mail-d.allbsd.org ([IPv6:2409:11:a740:4700:58:65ff:fe00:b0b]) (authenticated bits=56) by mail.allbsd.org (8.15.2/8.15.2) with ESMTPSA id x6T5wJUt058815 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=OK) (Client CN "/CN=mail-d.allbsd.org", Issuer "/C=US/O=Let's+20Encrypt/CN=Let's+20Encrypt+20Authority+20X3"); Mon, 29 Jul 2019 14:58:30 +0900 (JST) (envelope-from hrs@allbsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=allbsd.org; s=20190220; t=1564379923; bh=YVwujWuM1qd0LMJw+C+Yqcv+/voMPn2DccKgezt2+fQ=; h=Date:To:Cc:Subject:From:In-Reply-To:References; b=q68k9fRT8QCzPrr82sg8GhKQ88OMGTPwal+pg6HujwP4iE3pcHfsowJ2NY1Iv68Yt QSiIZi6hRpJyOCExPx3wnTCyxSsLbY0kaWQy173P+CqXy6Ufv0BlYhFf6KWz6JXBL/ OjufjzQ9B6P3QmUBycMVnDEgbx77PgcqROoBJr64= Received: from alph.d.allbsd.org ([IPv6:2409:11:a740:4700:16:ceff:fe34:2700]) by mail-d.allbsd.org (8.15.2/8.15.2) with ESMTPS id x6T5wDKN080793 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 29 Jul 2019 14:58:14 +0900 (JST) (envelope-from hrs@allbsd.org) Received: from localhost (localhost [[UNIX: localhost]]) (authenticated bits=0) by alph.d.allbsd.org (8.15.2/8.15.2) with ESMTPA id x6T5wBj0080790; Mon, 29 Jul 2019 14:58:13 +0900 (JST) (envelope-from hrs@allbsd.org) Date: Mon, 29 Jul 2019 14:56:54 +0900 (JST) Message-Id: <20190729.145654.1521764302694128109.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)? From: Hiroki Sato In-Reply-To: References: X-PGPkey-fingerprint: BDB3 443F A5DD B3D0 A530 FFD7 4F2C D3D8 2793 CF2D X-Mailer: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Multipart/Signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="--Security_Multipart(Mon_Jul_29_14_56_54_2019_268)--" Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.2 (mail.allbsd.org [IPv6:2001:2f0:104:e001:0:0:0:41]); Mon, 29 Jul 2019 14:58:37 +0900 (JST) X-Spam-Status: No, score=4.7 required=13.0 tests=CONTENT_TYPE_PRESENT, QENCPTR1, RCVD_IN_AHBL,RCVD_IN_AHBL_PROXY,RCVD_IN_AHBL_SPAM,RDNS_NONE, UNPARSEABLE_RELAY,URIBL_SC2_SURBL,URIBL_XS_SURBL autolearn=no autolearn_force=no version=3.4.2 X-Spam-Level: **** X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mx.allbsd.org X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jul 2019 05:58:48 -0000 ----Security_Multipart(Mon_Jul_29_14_56_54_2019_268)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Yuri wrote in : 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)----