Radv proto sending adverts on wrong interface

Ondrej Zajicek santiago at crfreenet.org
Sun Mar 12 13:29:23 CET 2023


On Sat, Mar 11, 2023 at 06:28:58AM +0100, Daniel Gröber wrote:
> Hi,
> 
> I'm using bird as a replacement for radvd since the latter has a
> longstanding issue with sending adverts on unconfigured interfaces under
> complex conditions.
> 
> Turns out bird has a similar issue :)
> 
> Looking at the code, when opening the socket for an interface in
> radv_sk_open we set sk->iface as you'd expect, which should cause packets
> to be sent directly via this interface.
> 
> However radv sends packets to the all-nodes multicasts address for periodic
> adverts, see radv_send_ra. This then calls sk_send_to which (eventually)
> calls sockaddr_fill6. Here rther we find this code:
> 
>     if (ifa && ipa_is_link_local(a))
>       sa->sin6_scope_id = ifa->index;
> 
> This would seem to be the problem to me, since a=ff02::1 doesn't pass this
> check so the sendmsg call goes out without the interface-index being
> communicated to the kernel.

Hi

I do not really get this. For multicast, outgoing interface is defined by
setsockopt(IPV6_MULTICAST_IF) in sk_setup_multicast6().

The field sin6_scope_id should be used only for link-local addresses (to
define their scope), not as a way to route multicasts.

(Hmm, ff02::/16 is defined as link-local multicast address, so perhaps
setting sin6_scope_id makes sense.)

If sending (IPv6) multicasts does not work properly, that should be also
noticed in OSPFv3/RIPng, but i am not aware of such issue.

-- 
Elen sila lumenn' omentielvo

Ondrej 'Santiago' Zajicek (email: santiago at crfreenet.org)
OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net)
"To err is human -- to blame it on a computer is even more so."



More information about the Bird-users mailing list