summaryrefslogtreecommitdiff
path: root/src/libsystemd-network
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-05-23 16:27:59 +0200
committerLennart Poettering <lennart@poettering.net>2016-05-26 15:34:42 +0200
commitc1c9b211e3337e3491acc5f2550e8d48542986aa (patch)
tree41db61ac8afe9a15b4d7344819f88b753999e69e /src/libsystemd-network
parenta114066685b6a996c3f0ae914ee32587e8f59f2f (diff)
sd-ndisc: make the _stop() call idempotent
It's a good idea to make stopcalls idempotent, so that they become nops if the object is already stopped.
Diffstat (limited to 'src/libsystemd-network')
-rw-r--r--src/libsystemd-network/sd-ndisc.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/libsystemd-network/sd-ndisc.c b/src/libsystemd-network/sd-ndisc.c
index 06afafd2c7..c03e104e3b 100644
--- a/src/libsystemd-network/sd-ndisc.c
+++ b/src/libsystemd-network/sd-ndisc.c
@@ -651,12 +651,13 @@ static int ndisc_router_solicitation_timeout(sd_event_source *s, uint64_t usec,
int sd_ndisc_stop(sd_ndisc *nd) {
assert_return(nd, -EINVAL);
- assert_return(nd->event, -EINVAL);
- log_ndisc(client, "Stop NDisc");
+ if (nd->state == NDISC_STATE_IDLE)
+ return 0;
+
+ log_ndisc(client, "Stopping IPv6 Router Solicitation client");
ndisc_reset(nd);
-
nd->state = NDISC_STATE_IDLE;
if (nd->callback)