[PATCH] Fix sk sending link-local scope multicast on wrong interface

Daniel Gröber dxld at darkboxed.org
Sat Mar 11 07:08:04 CET 2023


When radv sends to the ipv6 all-nodes multicast address (ff02::1) we don't
set sin6_scope_id because ipa_is_link_local isn't satisfied. This will
cause packets to be sent via the wrong interface.

To fix this we use ip6_classify, which returns SCOPE_LINK for unicast
fe80::/64 as well as multicast ff02::/8 destinations.
---
Tested with bird 2.0.10 on Debian 11.

 sysdep/unix/io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c
index e131ca41..f77b4a51 100644
--- a/sysdep/unix/io.c
+++ b/sysdep/unix/io.c
@@ -229,7 +229,7 @@ sockaddr_fill6(struct sockaddr_in6 *sa, ip_addr a, struct iface *ifa, uint port)
   sa->sin6_flowinfo = 0;
   sa->sin6_addr = ipa_to_in6(a);
 
-  if (ifa && ipa_is_link_local(a))
+  if (ifa && ip6_classify(&a) & SCOPE_LINK)
     sa->sin6_scope_id = ifa->index;
 }
 
-- 
2.30.2



More information about the Bird-users mailing list