]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: dhcp6pd: drop unreachable routes when lease lost 21638/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 4 Dec 2021 20:03:09 +0000 (05:03 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 6 Dec 2021 12:30:57 +0000 (21:30 +0900)
src/network/networkd-dhcp-prefix-delegation.c

index 2b2f78779508d11b55a2890cb798601ab4cf0bbd..24bafb8b4ab4954f00434685b0a493ce579a8a11 100644 (file)
@@ -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);
 }