From: Yu Watanabe Date: Thu, 22 Feb 2024 04:59:57 +0000 (+0900) Subject: sd-ndisc: disable timer event source only when a valid RA received X-Git-Tag: v256-rc1~770^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e7cb80474d4e580f7cc7c8645e1412e4a59f7588;p=thirdparty%2Fsystemd.git sd-ndisc: disable timer event source only when a valid RA received Fixes #31439. --- diff --git a/src/libsystemd-network/sd-ndisc.c b/src/libsystemd-network/sd-ndisc.c index 0b5626670b9..9b2635ae1cd 100644 --- a/src/libsystemd-network/sd-ndisc.c +++ b/src/libsystemd-network/sd-ndisc.c @@ -196,6 +196,8 @@ static int ndisc_handle_datagram(sd_ndisc *nd, sd_ndisc_router *rt) { if (r < 0) return r; + (void) event_source_disable(nd->timeout_event_source); + log_ndisc(nd, "Received Router Advertisement: flags %s preference %s lifetime %s", rt->flags & ND_RA_FLAG_MANAGED ? "MANAGED" : rt->flags & ND_RA_FLAG_OTHER ? "OTHER" : "none", rt->preference == SD_NDISC_PREFERENCE_HIGH ? "high" : rt->preference == SD_NDISC_PREFERENCE_LOW ? "low" : "medium", @@ -253,7 +255,6 @@ static int ndisc_recv(sd_event_source *s, int fd, uint32_t revents, void *userda if (in6_addr_is_null(&rt->address)) log_ndisc(nd, "Received RA from null address. Ignoring."); - (void) event_source_disable(nd->timeout_event_source); (void) ndisc_handle_datagram(nd, rt); return 0; }