diff options
author | Peter Hessler <phessler@cvs.openbsd.org> | 2023-04-25 15:41:18 +0000 |
---|---|---|
committer | Peter Hessler <phessler@cvs.openbsd.org> | 2023-04-25 15:41:18 +0000 |
commit | 36615bfb87119a10e68d91c1c4f5bb5063a60ea6 (patch) | |
tree | 025abd785307f4d969d9e24126e21b16747efb1c /sys/netinet6 | |
parent | 99b62dfd185ca0564bdc12ef140415e01d005cd3 (diff) |
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@
Diffstat (limited to 'sys/netinet6')
-rw-r--r-- | sys/netinet6/nd6_nbr.c | 10 |
1 files changed, 9 insertions, 1 deletions
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); } } |