Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 03 May 2020 09:42:07 +0100
From:      Alexander V. Chernikov <melifaro@freebsd.org>
To:        Steffen Christgau <mail@s14u.de>, "freebsd-net@freebsd.org" <freebsd-net@freebsd.org>
Subject:   Re: Notification about tentative IPv6 address from route socket
Message-ID:  <718441588495188@mail.yandex.ru>
In-Reply-To: <4f3a314a-f938-476b-f75e-e495756a5488@s14u.de>
References:  <4f3a314a-f938-476b-f75e-e495756a5488@s14u.de>

next in thread | previous in thread | raw e-mail | index | archive | help
30.04.2020, 17:40, "Steffen Christgau" <mail@s14u.de>:
> Hi everybody,
Hi Steffen,
>
> I'm quiet new in developing applications with support for FreeBSD, so
> please excuse if that question has an obvious answer which I can't see
> at the moment.
>
> I'm developing a small daemon which should detect and handle changes of
> IP addresses in order to open new sockets and close them when addresses
> come and go. I implemented this so far by using PF_ROUTE sockets on
> FreeBSD 12.1. This works quiet well and I'm able to see additions and
> deletions of addresses.
>
> For IPv6, however, I get notified about an address which is tentative (I
> use ifconfig to add an link-local address manually) and I -
> understandably - cannot bind a socket to that address. While I assume
> that I can check for the address being tentative with ioctl(fd,
> SIOCGIFAFLAG_IN6, ...), I'd like to ask the following:
>
> 1) Is there a way to get notified about the address being available for
> usage (i.e. not tentative anymore, not duplicated) without _polling_ via
Not that I'm aware of :-(
> ioctl? My application is currently almost completely event driven and
> integrating such a repeated timeout based detection of
> tentative/duplicated addresses appears a little awkward. In addition
> blocking until the address state changes is not really an option.
>
> 2) I know FreeBSD is not Linux, but on Linux with netlink sockets I get
> notified about a) the address appearing (including flags) and b) some
> time later the address being not tentative anymore (detectable via
> flags). I wonder why the route socket on FreeBSD reports an address that
> is currently hardly to use. On the other hand, I understand that
> RTM_NEWADDR does exactly what is documented, i.e. to notify about an
> "address being added to iface". Nevertheless, wouldn't it make sense to
> tell an application that a change for an address takes place? I couldn't
> observe such a behavior for IPv6 on FreeBSD. If there is currently no
> really such notification, the kernel could emit a new message like
> RTM_ADDRCHANGE or it may repeats the emission of RTM_NEWADDR (which
It makes total sense. I have plans to update some rtsock internals and will take a look at this one.
Thank you for your suggestion!
> might confuse existing applications). Also the addition of an address
> flags field to ifa_msghdr message might be beneficial. It would also
> avoid additional ioctl calls and the boilerplate required around that.
> Just thinking aloud... However, if there is already a notification-based
> mechanism to get informed about a ready-to-use IPv6 address, could you
> please provide me a pointer to that?
>
> Looking forward for your responses.
>
> Regards, Steffen
> _______________________________________________
> freebsd-net@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-net
> To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?718441588495188>