From: Patrik Flykt Date: Thu, 4 Jan 2018 13:12:01 +0000 (+0200) Subject: networkd: Set unreachable routes for unassigned DHCPv6 prefixes X-Git-Tag: v237~103^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=739229033e2b7a400189b88a410225a1e1001529;p=thirdparty%2Fsystemd.git networkd: Set unreachable routes for unassigned DHCPv6 prefixes Set unreachable routes for prefixes delegated via DHCPv6 that were not assigned to links. --- diff --git a/src/network/networkd-dhcp6.c b/src/network/networkd-dhcp6.c index 4bb42919dfc..d54fb05d402 100644 --- a/src/network/networkd-dhcp6.c +++ b/src/network/networkd-dhcp6.c @@ -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; }