From: phessler Date: Tue, 25 Apr 2023 15:41:17 +0000 (+0000) Subject: When configuring a new address on an interface, an upstream router X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=4c2ba03ddf5775d45441504327f61d707cd8fe33;p=openbsd When configuring a new address on an interface, an upstream router doesn't know where to send traffic. This will send an unsolicited neighbor advertisement, as described in RFC9131, to the all-routers multicast address so all routers on the same link will learn the path back to the address. This is intended to speed up the first return packet on an IPv6 interface. OK florian@ --- diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c index 31bbc8f2e2e..f78e2324d85 100644 --- a/sys/netinet6/nd6_nbr.c +++ b/sys/netinet6/nd6_nbr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6_nbr.c,v 1.144 2023/04/05 19:35:23 bluhm Exp $ */ +/* $OpenBSD: nd6_nbr.c,v 1.145 2023/04/25 15:41:17 phessler Exp $ */ /* $KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $ */ /* @@ -1132,6 +1132,9 @@ nd6_dad_timer(void *xifa) { struct ifaddr *ifa = xifa; struct in6_ifaddr *ia6 = ifatoia6(ifa); + struct in6_addr taddr6 = ia6->ia_addr.sin6_addr; + struct in6_addr daddr6; + struct ifnet *ifp = ifa->ifa_ifp; struct dadq *dp; char addr[INET6_ADDRSTRLEN]; @@ -1199,6 +1202,11 @@ nd6_dad_timer(void *xifa) inet_ntop(AF_INET6, &ia6->ia_addr.sin6_addr, addr, sizeof(addr)))); + daddr6 = in6addr_linklocal_allrouters; + daddr6.s6_addr16[1] = htons(ifp->if_index); + /* RFC9131 - inform routers about our new address */ + nd6_na_output(ifp, &daddr6, &taddr6, 0, 1, NULL); + nd6_dad_destroy(dp); } }