]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: do not add prefix to RA if radv is not configured
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 11 Sep 2020 09:39:16 +0000 (18:39 +0900)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 11 Sep 2020 17:28:46 +0000 (19:28 +0200)
Fixes #17017.

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

index 05fe679fcfedd88f773fb066acd9c8a5e85b4303..7996e825c29a95d89b111cb84b9a9f8dd2d6fffe 100644 (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));
         }
 
index e0c490babab6a1e6798f062d6bf0876912ca9b4c..003a50b68b06ff2c727c0772d73b754a22a6e9ee 100644 (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)