Skip to content

Commit e82a19c

Browse files
committed
sd-ndisc.c: Move Router Solicitation sending after timer computaion
Move ICMPv6 Router Solicitation sending after timer computation so that timers are already set up when the packet is being sent. This makes it possible to create a test that inspects Router Solicitation timer values when the Router Solicitation is sent out on the network.
1 parent 1bd6f89 commit e82a19c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/libsystemd-network/sd-ndisc.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -281,12 +281,6 @@ static int ndisc_timeout(sd_event_source *s, uint64_t usec, void *userdata) {
281281
assert(nd);
282282
assert(nd->event);
283283

284-
r = icmp6_send_router_solicitation(nd->fd, &nd->mac_addr);
285-
if (r < 0) {
286-
log_ndisc_errno(r, "Error sending Router Solicitation: %m");
287-
goto fail;
288-
}
289-
290284
assert_se(sd_event_now(nd->event, clock_boottime_or_monotonic(), &time_now) >= 0);
291285

292286
nd->timeout_event_source = sd_event_source_unref(nd->timeout_event_source);
@@ -319,6 +313,12 @@ static int ndisc_timeout(sd_event_source *s, uint64_t usec, void *userdata) {
319313
goto fail;
320314
}
321315

316+
r = icmp6_send_router_solicitation(nd->fd, &nd->mac_addr);
317+
if (r < 0) {
318+
log_ndisc_errno(r, "Error sending Router Solicitation: %m");
319+
goto fail;
320+
}
321+
322322
log_ndisc("Sent Router Solicitation, next solicitation in %s",
323323
format_timespan(time_string, FORMAT_TIMESPAN_MAX,
324324
nd->retransmit_time, USEC_PER_SEC));

0 commit comments

Comments
 (0)