network: dhcp6pd: drop unreachable routes when lease lost

This commit is contained in:
Yu Watanabe
2021-12-06 21:30:57 +09:00
parent 95eb38c8d0
commit da10d2d584
@@ -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);
}