Date: Wed, 04 Dec 2013 08:34:08 -0700 From: Ian Lepore <ian@FreeBSD.org> To: Matthias Andree <matthias.andree@gmx.de> Cc: freebsd-hackers@FreeBSD.org Subject: Re: Asynchronous user-space notification of interface address changes? Message-ID: <1386171248.58852.78.camel@revolution.hippie.lan> In-Reply-To: <529EF36A.2020906@gmx.de> References: <529EF36A.2020906@gmx.de>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 2013-12-04 at 10:18 +0100, Matthias Andree wrote: > Greetings, > > is there any sensible way to have a user-space application notified of > interface address changes (in the light of - but not limited to - IPv6 > automatic configuration, with accept_rtadv or similar), preferably > without the application polling getifaddrs every five-ish seconds? > > It does not appear kevent/kqueue, or devctl, are up to the task. > > I am not asking for turnkey solutions (although I'll gladly take them), > a rough sketch or pointers will suffice. > > Thanks. > > Best regards > Matthias Open a routing socket, select/poll for readability, handle incoming RTM_NEWADDR/RTM_DELADDR messages. Example code in dhclient and faithd and I think ntpd among others. Some info available in man 4 route. I've never done this, just remember seeing the code for it in dhclient. -- Ian
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1386171248.58852.78.camel>