network: make route_update() accept NULL

This also fixes a wrong argument for route_configure().

Fixes #8960.
This commit is contained in:
Yu Watanabe
2018-05-11 15:43:04 +09:00
parent 27efb52bc6
commit 26db55f39e
2 changed files with 7 additions and 7 deletions
+3 -1
View File
@@ -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;
+4 -6
View File
@@ -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;