]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: introduce new UseAddress= setting in [DHCPv6] section
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 11 Jan 2021 15:02:09 +0000 (00:02 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 12 Jan 2021 05:19:03 +0000 (14:19 +0900)
If it is disabled, then the addresses provided by the DHCPv6 server will
be ignored.

Closes #18203.

man/systemd.network.xml
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 68e549320490128c620e55eb9d59ec538fa2a6b5..5ad9a846f03561633088559a5902cce8aab4cec3 100644 (file)
@@ -1866,6 +1866,14 @@ IPv6Token=prefixstable:2002:da8:1::</programlisting></para>
       <varname>DHCP=</varname> setting described above, or invoked by the IPv6 Router Advertisement:</para>
 
       <variablelist class='network-directives'>
+        <varlistentry>
+          <term><varname>UseAddress=</varname></term>
+          <listitem>
+            <para>When true (the default), the IP addresses provided by the DHCPv6 server will be
+            assigned.</para>
+          </listitem>
+        </varlistentry>
+
         <varlistentry>
           <term><varname>UseDNS=</varname></term>
           <term><varname>UseNTP=</varname></term>
index 51a34693c2d316835393f3c6ca72c64338d8c660..89b22c35e3636a50a5f9fa552f00c9701a6d1742 100644 (file)
@@ -1078,8 +1078,12 @@ static int dhcp6_address_acquired(Link *link) {
         int r;
 
         assert(link);
+        assert(link->network);
         assert(link->dhcp6_lease);
 
+        if (!link->network->dhcp6_use_address)
+                return 0;
+
         for (sd_dhcp6_lease_reset_address_iter(link->dhcp6_lease);;) {
                 uint32_t lifetime_preferred, lifetime_valid;
                 struct in6_addr ip6_addr;
index 8b15548f6ffe95664ebdf9f0a43c9f9814495b76..afa97a6da44b7b1c7427ea723d0866da1c5fb7e9 100644 (file)
@@ -221,6 +221,7 @@ DHCPv4.SendOption,                           config_parse_dhcp_send_option,
 DHCPv4.SendVendorOption,                     config_parse_dhcp_send_option,                            0,                             offsetof(Network, dhcp_client_send_vendor_options)
 DHCPv4.RouteMTUBytes,                        config_parse_mtu,                                         AF_INET,                       offsetof(Network, dhcp_route_mtu)
 DHCPv4.FallbackLeaseLifetimeSec,             config_parse_dhcp_fallback_lease_lifetime,                0,                             0
+DHCPv6.UseAddress,                           config_parse_bool,                                        0,                             offsetof(Network, dhcp6_use_address)
 DHCPv6.UseDNS,                               config_parse_dhcp_use_dns,                                0,                             0
 DHCPv6.UseNTP,                               config_parse_dhcp_use_ntp,                                0,                             0
 DHCPv6.RapidCommit,                          config_parse_bool,                                        0,                             offsetof(Network, dhcp6_rapid_commit)
index 783f455a9fcc8e3eee86ca4f4b8f195b771c46a4..a8d6c58ac4d83deaaeed50982ec5c48b5b8870e7 100644 (file)
@@ -352,10 +352,11 @@ int network_load_one(Manager *manager, OrderedHashmap **networks, const char *fi
                 .dhcp_use_timezone = false,
                 .dhcp_ip_service_type = -1,
 
+                .dhcp6_use_address = true,
+                .dhcp6_use_dns = true,
+                .dhcp6_use_ntp = true,
                 .dhcp6_rapid_commit = true,
                 .dhcp6_route_metric = DHCP_ROUTE_METRIC,
-                .dhcp6_use_ntp = true,
-                .dhcp6_use_dns = true,
 
                 .dhcp6_pd = -1,
                 .dhcp6_pd_announce = true,
index 2b7dc4e94b3cdc2b647a012e23583f9eee261d34..656bf6c3669c4923a3f8693ed384b8320e1d686f 100644 (file)
@@ -146,6 +146,7 @@ struct Network {
         OrderedHashmap *dhcp_client_send_vendor_options;
 
         /* DHCPv6 Client support*/
+        bool dhcp6_use_address;
         bool dhcp6_use_dns;
         bool dhcp6_use_dns_set;
         bool dhcp6_use_ntp;
index 797d81cdf8458ab4b459f13c13e71bf84558ffda..3024c65713b362bfc9b1861a9195882c8bcc8bbf 100644 (file)
@@ -125,6 +125,7 @@ MUDURL=
 RouteMTUBytes=
 FallbackLeaseLifetimeSec=
 [DHCPv6]
+UseAddress=
 UseNTP=
 UseDNS=
 RapidCommit=