]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: introduce Announce= in [DHCPv6PrefixDelegation]
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 16 Oct 2020 07:00:49 +0000 (16:00 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 19 Oct 2020 03:09:36 +0000 (12:09 +0900)
When disabled, the delegated prefixes are not emit by RA.

Closes #17353.

src/network/networkd-dhcp6.c
src/network/networkd-network-gperf.gperf
src/network/networkd-network.c
src/network/networkd-network.h
test/fuzz/fuzz-network-parser/directives.network

index 81cf44b082c183c986388bd3849c965d0e600384..d9cc4ccf41326ef4517dd261947c480c8ecd94a6 100644 (file)
@@ -421,11 +421,14 @@ static int dhcp6_pd_assign_prefix(Link *link, const union in_addr_union *prefix,
         int r;
 
         assert(link);
+        assert(link->network);
         assert(prefix);
 
-        r = radv_add_prefix(link, &prefix->in6, prefix_len, lifetime_preferred, lifetime_valid);
-        if (r < 0)
-                return r;
+        if (link->network->dhcp6_pd_announce) {
+                r = radv_add_prefix(link, &prefix->in6, prefix_len, lifetime_preferred, lifetime_valid);
+                if (r < 0)
+                        return r;
+        }
 
         r = dhcp6_set_pd_route(link, prefix, pd_prefix);
         if (r < 0)
index cdf77391b0f9b4def3316bafe95d8ce00e09269c..d0ddd4c5729a0f476aad13c76ab340183b859255 100644 (file)
@@ -283,6 +283,7 @@ BridgeVLAN.PVID,                             config_parse_brvlan_pvid,
 BridgeVLAN.VLAN,                             config_parse_brvlan_vlan,                                 0,                             0
 BridgeVLAN.EgressUntagged,                   config_parse_brvlan_untagged,                             0,                             0
 DHCPv6PrefixDelegation.SubnetId,             config_parse_dhcp6_pd_subnet_id,                          0,                             offsetof(Network, dhcp6_pd_subnet_id)
+DHCPv6PrefixDelegation.Announce,             config_parse_bool,                                        0,                             offsetof(Network, dhcp6_pd_announce)
 DHCPv6PrefixDelegation.Assign,               config_parse_bool,                                        0,                             offsetof(Network, dhcp6_pd_assign)
 DHCPv6PrefixDelegation.Token,                config_parse_dhcp6_pd_token,                              0,                             offsetof(Network, dhcp6_pd_token)
 IPv6PrefixDelegation.RouterLifetimeSec,      config_parse_sec,                                         0,                             offsetof(Network, router_lifetime_usec)
index 111a11ee0d848dda02237fd86237c7693a957d69..c72b56b2bb9069efff58643a748fa2845de413d6 100644 (file)
@@ -368,8 +368,9 @@ int network_load_one(Manager *manager, OrderedHashmap **networks, const char *fi
                 .dhcp6_use_dns = true,
 
                 .dhcp6_pd = -1,
-                .dhcp6_pd_subnet_id = -1,
+                .dhcp6_pd_announce = true,
                 .dhcp6_pd_assign = true,
+                .dhcp6_pd_subnet_id = -1,
 
                 .dhcp_server_emit[SD_DHCP_LEASE_DNS].emit = true,
                 .dhcp_server_emit[SD_DHCP_LEASE_NTP].emit = true,
index 5a8aca31333012fb5b1ccbed1d5c56b737721296..2cf89857baa455a03add1f8cbf42633e7ab49069 100644 (file)
@@ -202,6 +202,7 @@ struct Network {
 
         /* DHCPv6 Prefix Delegation support */
         int dhcp6_pd;
+        bool dhcp6_pd_announce;
         bool dhcp6_pd_assign;
         int64_t dhcp6_pd_subnet_id;
         union in_addr_union dhcp6_pd_token;
index 2a11156dbca2dcdb1e0a7aed2b9e2557c4dc5cdc..c187b1b2f87040d3de2febab2fb11e0ae84fe157 100644 (file)
@@ -137,6 +137,7 @@ SendVendorOption=
 RouteMetric=
 [DHCPv6PrefixDelegation]
 SubnetId=
+Announce=
 Assign=
 Token=
 [Route]