From: Yu Watanabe Date: Fri, 11 May 2018 06:43:04 +0000 (+0900) Subject: network: make route_update() accept NULL X-Git-Tag: v239~273^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F8961%2Fhead;p=thirdparty%2Fsystemd.git network: make route_update() accept NULL This also fixes a wrong argument for route_configure(). Fixes #8960. --- diff --git a/src/network/networkd-dhcp6.c b/src/network/networkd-dhcp6.c index a2ccc6e4943..e9db977036d 100644 --- a/src/network/networkd-dhcp6.c +++ b/src/network/networkd-dhcp6.c @@ -189,11 +189,13 @@ static int dhcp6_pd_prefix_distribute(Link *dhcp6_link, Iterator *i, if (r < 0) return r; + route->family = AF_INET6; + while (n < n_prefixes) { route_update(route, &prefix, pd_prefix_len, NULL, NULL, 0, 0, RTN_UNREACHABLE); - r = route_configure(route, link, NULL); + r = route_configure(route, dhcp6_link, NULL); if (r < 0) { route_free(route); return r; diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c index fd4bd65a0ed..63a6b9c2e0b 100644 --- a/src/network/networkd-route.c +++ b/src/network/networkd-route.c @@ -361,14 +361,12 @@ void route_update(Route *route, unsigned char type) { assert(route); - assert(src); - assert(gw); - assert(prefsrc); + assert(src || src_prefixlen == 0); - route->src = *src; + route->src = src ? *src : (union in_addr_union) {}; route->src_prefixlen = src_prefixlen; - route->gw = *gw; - route->prefsrc = *prefsrc; + route->gw = gw ? *gw : (union in_addr_union) {}; + route->prefsrc = prefsrc ? *prefsrc : (union in_addr_union) {}; route->scope = scope; route->protocol = protocol; route->type = type;