]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
BSD: Strip scope from link-local addresses for KAME stacks
authorRoy Marples <roy@marples.name>
Tue, 14 Nov 2017 12:16:26 +0000 (12:16 +0000)
committerRoy Marples <roy@marples.name>
Tue, 14 Nov 2017 12:16:26 +0000 (12:16 +0000)
This fixes DHCPv6 and IPv6ND trying to send messages from
DETACHED or TENTATIVE addresses when carrier comes back.

src/if-bsd.c

index 5dcdc71be97bc02c4f87b158bd6ce9dfa1176097..b5bb667d99f5a038d48a71c42eab0a069b67707b 100644 (file)
@@ -1164,6 +1164,12 @@ if_ifa(struct dhcpcd_ctx *ctx, const struct ifa_msghdr *ifam)
                }
 #endif
 
+#ifdef __KAME__
+               if (IN6_IS_ADDR_LINKLOCAL(&addr6))
+                       /* Remove the scope from the address */
+                       addr6.s6_addr[2] = addr6.s6_addr[3] = '\0';
+#endif
+
                ipv6_handleifa(ctx, ifam->ifam_type, NULL,
                    ifp->name, &addr6, ipv6_prefixlen(&mask6), addrflags);
                break;