From: Yu Watanabe Date: Sat, 4 Dec 2021 20:03:09 +0000 (+0900) Subject: network: dhcp6pd: drop unreachable routes when lease lost X-Git-Tag: v250-rc1~60^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F21638%2Fhead;p=thirdparty%2Fsystemd.git network: dhcp6pd: drop unreachable routes when lease lost --- diff --git a/src/network/networkd-dhcp-prefix-delegation.c b/src/network/networkd-dhcp-prefix-delegation.c index 2b2f7877950..24bafb8b4ab 100644 --- a/src/network/networkd-dhcp-prefix-delegation.c +++ b/src/network/networkd-dhcp-prefix-delegation.c @@ -655,6 +655,7 @@ static int dhcp6_pd_finalize(Link *link) { } void dhcp6_pd_prefix_lost(Link *dhcp6_link) { + Route *route; Link *link; int r; @@ -670,6 +671,25 @@ void dhcp6_pd_prefix_lost(Link *dhcp6_link) { link_enter_failed(link); } + SET_FOREACH(route, dhcp6_link->manager->routes) { + if (route->source != NETWORK_CONFIG_SOURCE_DHCP6) + continue; + if (route->family != AF_INET6) + continue; + if (route->type != RTN_UNREACHABLE) + continue; + if (!set_contains(dhcp6_link->dhcp6_pd_prefixes, + &(struct in_addr_prefix) { + .family = AF_INET6, + .prefixlen = route->dst_prefixlen, + .address = route->dst })) + continue; + + (void) route_remove(route); + + route_cancel_request(route, dhcp6_link); + } + set_clear(dhcp6_link->dhcp6_pd_prefixes); }