]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
networkd: DHCPv6 client allow to configure Rapid Commit (#6930)
authorSusant Sahani <145210+ssahani@users.noreply.github.com>
Mon, 22 Jan 2018 08:09:18 +0000 (13:39 +0530)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 22 Jan 2018 08:09:18 +0000 (17:09 +0900)
The DHCPv6 client can obtain configuration parameters from a
DHCPv6 server through a rapid two-message exchange solicit and reply).
When the rapid commit option is enabled by both the DHCPv6 client and
the DHCPv6 server, the two-message exchange is used, rather than the default
four-method exchange (solicit, advertise, request, and reply). The two-message
exchange provides faster client configuration and is beneficial in environments
in which networks are under a heavy load.

Closes #5845

man/systemd.network.xml
src/libsystemd-network/sd-dhcp6-client.c
src/network/networkd-dhcp6.c
src/network/networkd-network-gperf.gperf
src/network/networkd-network.c
src/network/networkd-network.h

index dfd9ea25695652e4fa90b9a963e8c99a79115446..80d2802610b56c679631d8bdd2502354b1fa7934 100644 (file)
             <para>Allow setting custom port for the DHCP client to listen on.</para>
           </listitem>
         </varlistentry>
+
+        <varlistentry>
+          <term><varname>RapidCommit=</varname></term>
+          <listitem>
+            <para>A boolean. The DHCPv6 client can obtain configuration parameters from a DHCPv6 server through
+            a rapid two-message exchange (solicit and reply). When the rapid commit option is enabled by both
+            the DHCPv6 client and the DHCPv6 server, the two-message exchange is used, rather than the default
+            four-method exchange (solicit, advertise, request, and reply). The two-message exchange provides
+            faster client configuration and is beneficial in environments in which networks are under a heavy load.
+            See <ulink url="https://tools.ietf.org/html/rfc3315#section-17.2.1">RFC 3315</ulink> for details.
+            Defaults to true.</para>
+          </listitem>
+        </varlistentry>
+
       </variablelist>
     </refsect1>
 
index f98a18268f9476fbb2dd5963b6fd6f15e4665659..6ff871264869c8d2e1bd64493e7e1334509241ab 100644 (file)
@@ -282,6 +282,7 @@ int sd_dhcp6_client_set_request_option(sd_dhcp6_client *client, uint16_t option)
         case SD_DHCP6_OPTION_DOMAIN_LIST:
         case SD_DHCP6_OPTION_SNTP_SERVERS:
         case SD_DHCP6_OPTION_NTP_SERVER:
+        case SD_DHCP6_OPTION_RAPID_COMMIT:
                 break;
 
         default:
index d54fb05d402727cf9bc00bed5191f26b04fd4d37..234e0a4602a0bbe2db66e9781a514fb42909bffd 100644 (file)
@@ -471,10 +471,11 @@ static int dhcp6_set_hostname(sd_dhcp6_client *client, Link *link) {
 
 int dhcp6_configure(Link *link) {
         sd_dhcp6_client *client = NULL;
-        int r;
         const DUID *duid;
+        int r;
 
         assert(link);
+        assert(link->network);
 
         if (link->dhcp6_client)
                 return 0;
@@ -513,6 +514,12 @@ int dhcp6_configure(Link *link) {
         if (r < 0)
                 goto error;
 
+        if (link->network->rapid_commit) {
+                r = sd_dhcp6_client_set_request_option(client, SD_DHCP6_OPTION_RAPID_COMMIT);
+                if (r < 0)
+                        goto error;
+        }
+
         r = sd_dhcp6_client_set_callback(client, dhcp6_handler, link);
         if (r < 0)
                 goto error;
index 6181f35a2aa4c9c234f5e860c7cb46d51baf880c..281ba657b3f1951f70d69d391af8f09dde3f9cc5 100644 (file)
@@ -131,6 +131,7 @@ DHCP.RouteTable,                        config_parse_dhcp_route_table,
 DHCP.UseTimezone,                       config_parse_bool,                              0,                             offsetof(Network, dhcp_use_timezone)
 DHCP.IAID,                              config_parse_iaid,                              0,                             offsetof(Network, iaid)
 DHCP.ListenPort,                        config_parse_uint16,                            0,                             offsetof(Network, dhcp_client_port)
+DHCP.RapidCommit,                       config_parse_bool,                              0,                             offsetof(Network, rapid_commit)
 IPv6AcceptRA.UseDNS,                    config_parse_bool,                              0,                             offsetof(Network, ipv6_accept_ra_use_dns)
 IPv6AcceptRA.UseDomains,                config_parse_dhcp_use_domains,                  0,                             offsetof(Network, ipv6_accept_ra_use_domains)
 IPv6AcceptRA.RouteTable,                config_parse_uint32,                            0,                             offsetof(Network, ipv6_accept_ra_route_table)
index b037fc67e3706ddee8b962f2ce351a57c1aad997..2dc3de3f6a005b649447e03d3ea962654365c0e3 100644 (file)
@@ -228,6 +228,7 @@ static int network_load_one(Manager *manager, const char *filename) {
         network->dhcp_use_mtu = false;
         /* NOTE: from man: UseTimezone=... Defaults to "no".*/
         network->dhcp_use_timezone = false;
+        network->rapid_commit = true;
 
         network->dhcp_server_emit_dns = true;
         network->dhcp_server_emit_ntp = true;
index ad56fc5f68054541696c2ebcdc78b656ca1de781..7b40ba51e6e2b5c465fa0593a80e861f14a8e4f0 100644 (file)
@@ -148,6 +148,7 @@ struct Network {
         bool dhcp_use_mtu;
         bool dhcp_use_routes;
         bool dhcp_use_timezone;
+        bool rapid_commit;
         bool dhcp_use_hostname;
         bool dhcp_route_table_set;
         DHCPUseDomains dhcp_use_domains;