]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: make route_update() accept NULL 8961/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 11 May 2018 06:43:04 +0000 (15:43 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 11 May 2018 06:43:04 +0000 (15:43 +0900)
This also fixes a wrong argument for route_configure().

Fixes #8960.

src/network/networkd-dhcp6.c
src/network/networkd-route.c

index a2ccc6e494304a53f781a52dc151143fe062f703..e9db977036da331954bcb64e20cb1a67d3bfab16 100644 (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;
index fd4bd65a0ed9860e1570498d30232b93b897f988..63a6b9c2e0b5954bec39beba92aebf8d8941be75 100644 (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;