Commit 2ca20a6bba for frr
commit 2ca20a6bbad288c0a963bf6a0d9f895ac75b5b28
Author: Vincent Jardin <vjardin@free.fr>
Date: Wed Nov 11 10:48:35 2026 +0100
ospf6d: give link-local packet sources their scope on macOS
ospf6d sends its packets with IPV6_PKTINFO and the link-local address
of the interface as source. XNU uses that address as is, and its
output path wants a link-local address with the zone embedded the old
KAME way: with a plain fe80:: address sendmsg() fails with
EHOSTUNREACH, so no Hello ever leaves and no adjacency comes up:
sendmsg failed: source: fe80::21c:42ff:fe5a:101 Dest: ff02::5 ifindex: 7: No route to host (65)
Embed the interface index in a link-local source address on macOS.
Signed-off-by: Vincent Jardin <vjardin@free.fr>
diff --git a/ospf6d/ospf6_network.c b/ospf6d/ospf6_network.c
index e9ab7087de..feb97229fb 100644
--- a/ospf6d/ospf6_network.c
+++ b/ospf6d/ospf6_network.c
@@ -180,6 +180,13 @@ int ospf6_sendmsg(struct in6_addr *src, struct in6_addr *dst,
else
memset(&pktinfo->ipi6_addr, 0, sizeof(struct in6_addr));
+#ifdef __APPLE__
+ if (IN6_IS_ADDR_LINKLOCAL(&pktinfo->ipi6_addr)) {
+ pktinfo->ipi6_addr.s6_addr[2] = (ifindex >> 8) & 0xff;
+ pktinfo->ipi6_addr.s6_addr[3] = ifindex & 0xff;
+ }
+#endif
+
/* destination address */
dst_sin6.sin6_family = AF_INET6;
#ifdef SIN6_LEN