network: do not add prefix to RA if radv is not configured

Fixes #17017.
This commit is contained in:
Yu Watanabe 2020-09-11 18:39:16 +09:00 committed by Zbigniew Jędrzejewski-Szmek
parent 882f5f429e
commit 85b6a8110d
2 changed files with 7 additions and 3 deletions

View File

@ -158,7 +158,8 @@ static int dhcp6_pd_remove_old(Link *link, bool force) {
if (k < 0)
r = k;
(void) sd_radv_remove_prefix(link->radv, &route->dst.in6, 64);
if (link->radv)
(void) sd_radv_remove_prefix(link->radv, &route->dst.in6, 64);
dhcp6_pd_free(hashmap_get(link->manager->dhcp6_prefixes, &route->dst.in6));
}
@ -198,7 +199,8 @@ int dhcp6_pd_remove(Link *link) {
if (k < 0)
r = k;
(void) sd_radv_remove_prefix(link->radv, &route->dst.in6, 64);
if (link->radv)
(void) sd_radv_remove_prefix(link->radv, &route->dst.in6, 64);
dhcp6_pd_free(hashmap_get(link->manager->dhcp6_prefixes, &route->dst.in6));
}

View File

@ -681,7 +681,9 @@ int radv_add_prefix(Link *link, const struct in6_addr *prefix, uint8_t prefix_le
int r;
assert(link);
assert(link->radv);
if (!link->radv)
return 0;
r = sd_radv_prefix_new(&p);
if (r < 0)