* [PATCH] ndp: Don't send unsolicited router advertisement if we can't, yet
@ 2024-11-15 14:17 Stefano Brivio
0 siblings, 0 replies; only message in thread
From: Stefano Brivio @ 2024-11-15 14:17 UTC (permalink / raw)
To: passt-dev; +Cc: David Gibson
ndp_timer() is called right away on the first epoll_wait() cycle,
when the communication channel to the guest isn't ready yet:
1.0038: NDP: sending unsolicited RA, next in 264s
1.0038: tap: failed to send 1 frames of 1
check that it's up before sending it. This effectively delays the
first gratuitous router advertisement, which is probably a good idea
given that we expect the guest to send a router solicitation right
away.
Fixes: 6e1e44293ef9 ("ndp: Send unsolicited Router Advertisements")
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
---
ndp.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/ndp.c b/ndp.c
index 7ee44b2..b458785 100644
--- a/ndp.c
+++ b/ndp.c
@@ -420,9 +420,12 @@ void ndp_timer(const struct ctx *c, const struct timespec *now)
interval = min_rtr_adv_interval +
random() % (max_rtr_adv_interval - min_rtr_adv_interval);
- info("NDP: sending unsolicited RA, next in %llds", (long long)interval);
+ if (next_ra) {
+ info("NDP: sending unsolicited RA, next in %llds",
+ (long long)interval);
- ndp_ra(c, &in6addr_ll_all_nodes);
+ ndp_ra(c, &in6addr_ll_all_nodes);
+ }
next_ra = now->tv_sec + interval;
}
--
@@ -420,9 +420,12 @@ void ndp_timer(const struct ctx *c, const struct timespec *now)
interval = min_rtr_adv_interval +
random() % (max_rtr_adv_interval - min_rtr_adv_interval);
- info("NDP: sending unsolicited RA, next in %llds", (long long)interval);
+ if (next_ra) {
+ info("NDP: sending unsolicited RA, next in %llds",
+ (long long)interval);
- ndp_ra(c, &in6addr_ll_all_nodes);
+ ndp_ra(c, &in6addr_ll_all_nodes);
+ }
next_ra = now->tv_sec + interval;
}
--
2.43.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2024-11-15 14:17 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-15 14:17 [PATCH] ndp: Don't send unsolicited router advertisement if we can't, yet Stefano Brivio
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).