From: Yu Watanabe Date: Thu, 28 Mar 2024 04:22:06 +0000 (+0900) Subject: network/ndisc: remove routes if lifetime is zero X-Git-Tag: v256-rc1~261^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b3ea82afbe66312ecba2c6ac76e335b24b71d4e4;p=thirdparty%2Fsystemd.git network/ndisc: remove routes if lifetime is zero Fixes #31979. --- diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c index 264ecff34d4..249103b7035 100644 --- a/src/network/networkd-ndisc.c +++ b/src/network/networkd-ndisc.c @@ -920,9 +920,15 @@ static int ndisc_router_process_route(Link *link, sd_ndisc_router *rt) { route->dst_prefixlen = prefixlen; route->lifetime_usec = lifetime_usec; - r = ndisc_request_route(route, link, rt); - if (r < 0) - return log_link_warning_errno(link, r, "Could not request additional route: %m"); + if (lifetime_usec != 0) { + r = ndisc_request_route(route, link, rt); + if (r < 0) + return log_link_warning_errno(link, r, "Could not request additional route: %m"); + } else { + r = ndisc_remove_route(route, link); + if (r < 0) + return log_link_warning_errno(link, r, "Could not remove additional route with zero lifetime: %m"); + } return 0; }