summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2018-05-11 08:43:04 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2018-05-11 08:43:04 +0200
commit26db55f39e436d8c2dae46b85e1bc068bfe1fd1d (patch)
tree286a0404a3d0cfe1f6e013875882c179b22ab8ab /src/network
parentnetwork: fix indentation (diff)
downloadsystemd-26db55f39e436d8c2dae46b85e1bc068bfe1fd1d.tar.xz
systemd-26db55f39e436d8c2dae46b85e1bc068bfe1fd1d.zip
network: make route_update() accept NULL
This also fixes a wrong argument for route_configure(). Fixes #8960.
Diffstat (limited to 'src/network')
-rw-r--r--src/network/networkd-dhcp6.c4
-rw-r--r--src/network/networkd-route.c10
2 files changed, 7 insertions, 7 deletions
diff --git a/src/network/networkd-dhcp6.c b/src/network/networkd-dhcp6.c
index a2ccc6e494..e9db977036 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 fd4bd65a0e..63a6b9c2e0 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;