From ef6495ebb2d06c6b15e3bff550d5376f0ddf6e73 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Wed, 10 Apr 2024 14:58:31 +0900 Subject: [PATCH] network/ndisc: redirect routes do not have lifetime Hence, ndisc_router_update_redirect() does nothing. Let's remove it. Also, ndisc_request_route() does not set lifetime for the route, it is not necessary to set the third argument. --- src/network/networkd-ndisc.c | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c index 3486621808..859217b14b 100644 --- a/src/network/networkd-ndisc.c +++ b/src/network/networkd-ndisc.c @@ -591,23 +591,6 @@ static int ndisc_redirect_handler(Link *link, sd_ndisc_redirect *rd) { return ndisc_request_redirect_route(link, rd); } -static int ndisc_router_update_redirect(Link *link) { - int r, ret = 0; - - assert(link); - - /* Reconfigure redirect routes to update their lifetime. */ - - sd_ndisc_redirect *rd; - SET_FOREACH(rd, link->ndisc_redirects) { - r = ndisc_request_redirect_route(link, rd); - if (r < 0) - RET_GATHER(ret, log_link_warning_errno(link, r, "Failed to update lifetime of the Redirect route: %m")); - } - - return ret; -} - static int ndisc_drop_redirect(Link *link, const struct in6_addr *router, bool remove) { int r; @@ -2129,7 +2112,6 @@ static int ndisc_start_dhcp6_client(Link *link, sd_ndisc_router *rt) { static int ndisc_router_handler(Link *link, sd_ndisc_router *rt) { struct in6_addr router; usec_t timestamp_usec; - bool is_default; int r; assert(link); @@ -2170,7 +2152,6 @@ static int ndisc_router_handler(Link *link, sd_ndisc_router *rt) { r = ndisc_remember_default_router(link, rt); if (r < 0) return r; - is_default = r; r = ndisc_start_dhcp6_client(link, rt); if (r < 0) @@ -2204,12 +2185,7 @@ static int ndisc_router_handler(Link *link, sd_ndisc_router *rt) { if (r < 0) return r; - if (is_default) { - r = ndisc_router_update_redirect(link); - if (r < 0) - return r; - - } else if (sd_ndisc_router_get_lifetime(rt, NULL) <= 0) { + if (sd_ndisc_router_get_lifetime(rt, NULL) <= 0) { r = ndisc_drop_redirect(link, &router, /* remove = */ true); if (r < 0) return r; -- 2.25.1