From 7ffa777c1ef7f1ba2cf7f789e8565d3ae52a618b Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Mon, 24 Jun 2024 12:04:03 +0100 Subject: [PATCH] IPv6: Delay for LL address before delay for start This syncs with DHCPv6 when waiting for LL. --- src/ipv6nd.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/ipv6nd.c b/src/ipv6nd.c index 9264dce7..06d19cff 100644 --- a/src/ipv6nd.c +++ b/src/ipv6nd.c @@ -2163,7 +2163,7 @@ ipv6nd_handledata(void *arg, unsigned short events) } static void -ipv6nd_startrs1(void *arg) +ipv6nd_startrs2(void *arg) { struct interface *ifp = arg; struct rs_state *state; @@ -2195,22 +2195,34 @@ ipv6nd_startrs1(void *arg) ipv6nd_sendrsprobe(ifp); } -void -ipv6nd_startrs(struct interface *ifp) +static void +ipv6nd_startrs1(void *arg) { + struct interface *ifp = arg; unsigned int delay; - eloop_timeout_delete(ifp->ctx->eloop, NULL, ifp); if (!(ifp->options->options & DHCPCD_INITIAL_DELAY)) { - ipv6nd_startrs1(ifp); + ipv6nd_startrs2(ifp); return; } delay = arc4random_uniform(MAX_RTR_SOLICITATION_DELAY * MSEC_PER_SEC); logdebugx("%s: delaying IPv6 router solicitation for %0.1f seconds", ifp->name, (float)delay / MSEC_PER_SEC); - eloop_timeout_add_msec(ifp->ctx->eloop, delay, ipv6nd_startrs1, ifp); - return; + eloop_timeout_add_msec(ifp->ctx->eloop, delay, ipv6nd_startrs2, ifp); +} + +void +ipv6nd_startrs(struct interface *ifp) +{ + + if (ipv6_linklocal(ifp) == NULL) { + logdebugx("%s: " + "delaying IPv6 Router Solicitation for LL address", + ifp->name); + ipv6_addlinklocalcallback(ifp, ipv6nd_startrs1, ifp); + } else + ipv6nd_startrs1(ifp); } static struct routeinfo *routeinfo_findalloc(struct ra *rap, const struct in6_addr *prefix, uint8_t prefix_len) -- 2.47.2