]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
networkd: Set unreachable routes for unassigned DHCPv6 prefixes
authorPatrik Flykt <patrik.flykt@linux.intel.com>
Thu, 4 Jan 2018 13:12:01 +0000 (15:12 +0200)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Thu, 4 Jan 2018 13:22:44 +0000 (15:22 +0200)
Set unreachable routes for prefixes delegated via DHCPv6 that were
not assigned to links.

src/network/networkd-dhcp6.c

index 4bb42919dfcefd20239662dd1055164a4733e530..d54fb05d402727cf9bc00bed5191f26b04fd4d37 100644 (file)
@@ -194,6 +194,30 @@ static int dhcp6_pd_prefix_distribute(Link *dhcp6_link, Iterator *i,
                         return r;
         }
 
+        if (n_used < n_prefixes) {
+                Route *route;
+                int n = n_used;
+
+                r = route_new(&route);
+                if (r < 0)
+                        return r;
+
+                while (n < n_prefixes) {
+                        route_update(route, &prefix, pd_prefix_len, NULL, NULL,
+                                     0, 0, RTN_UNREACHABLE);
+
+                        r = route_configure(route, link, NULL);
+                        if (r < 0) {
+                                route_free(route);
+                                return r;
+                        }
+
+                        r = in_addr_prefix_next(AF_INET6, &prefix, pd_prefix_len);
+                        if (r < 0)
+                                return r;
+                }
+        }
+
         return n_used;
 }