diff options
author | Patrik Flykt <patrik.flykt@linux.intel.com> | 2017-05-19 16:22:46 +0300 |
---|---|---|
committer | Patrik Flykt <patrik.flykt@linux.intel.com> | 2017-05-30 10:34:15 +0300 |
commit | e82a19cb1833c64604c11f307a84cf998f4aeffe (patch) | |
tree | 378ecaa165e1234aaa35e6f0dc13726f079aa2c4 /src/libsystemd-network | |
parent | 1bd6f8953dab8db9c05ea3e54a890486b1e1a56f (diff) | |
download | systemd-e82a19cb1833c64604c11f307a84cf998f4aeffe.tar.gz |
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.
Diffstat (limited to 'src/libsystemd-network')
-rw-r--r-- | src/libsystemd-network/sd-ndisc.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libsystemd-network/sd-ndisc.c b/src/libsystemd-network/sd-ndisc.c index 5dfe6ea36f..4bf558b12b 100644 --- a/src/libsystemd-network/sd-ndisc.c +++ b/src/libsystemd-network/sd-ndisc.c @@ -281,12 +281,6 @@ static int ndisc_timeout(sd_event_source *s, uint64_t usec, void *userdata) { assert(nd); assert(nd->event); - r = icmp6_send_router_solicitation(nd->fd, &nd->mac_addr); - if (r < 0) { - log_ndisc_errno(r, "Error sending Router Solicitation: %m"); - goto fail; - } - assert_se(sd_event_now(nd->event, clock_boottime_or_monotonic(), &time_now) >= 0); 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) { goto fail; } + r = icmp6_send_router_solicitation(nd->fd, &nd->mac_addr); + if (r < 0) { + log_ndisc_errno(r, "Error sending Router Solicitation: %m"); + goto fail; + } + log_ndisc("Sent Router Solicitation, next solicitation in %s", format_timespan(time_string, FORMAT_TIMESPAN_MAX, nd->retransmit_time, USEC_PER_SEC)); |