When configuring a new address on an interface, an upstream router
authorphessler <phessler@openbsd.org>
Tue, 25 Apr 2023 15:41:17 +0000 (15:41 +0000)
committerphessler <phessler@openbsd.org>
Tue, 25 Apr 2023 15:41:17 +0000 (15:41 +0000)
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@

sys/netinet6/nd6_nbr.c

index 31bbc8f..f78e232 100644 (file)
@@ -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);
                }
        }