From: Susant Sahani <145210+ssahani@users.noreply.github.com>
Date: Mon, 22 Jan 2018 08:09:18 +0000 (+0530)
Subject: networkd: DHCPv6 client allow to configure Rapid Commit (#6930)
X-Git-Tag: v237~66
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fb5c8216646ecfb8b13b4867094c7032242de765;p=platform%2Fupstream%2Fsystemd.git
networkd: DHCPv6 client allow to configure Rapid Commit (#6930)
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
---
diff --git a/man/systemd.network.xml b/man/systemd.network.xml
index dfd9ea2..80d2802 100644
--- a/man/systemd.network.xml
+++ b/man/systemd.network.xml
@@ -1312,6 +1312,20 @@
Allow setting custom port for the DHCP client to listen on.
+
+
+ RapidCommit=
+
+ 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 RFC 3315 for details.
+ Defaults to true.
+
+
+
diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
index f98a182..6ff8712 100644
--- a/src/libsystemd-network/sd-dhcp6-client.c
+++ b/src/libsystemd-network/sd-dhcp6-client.c
@@ -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:
diff --git a/src/network/networkd-dhcp6.c b/src/network/networkd-dhcp6.c
index d54fb05..234e0a4 100644
--- a/src/network/networkd-dhcp6.c
+++ b/src/network/networkd-dhcp6.c
@@ -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;
diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf
index 6181f35..281ba65 100644
--- a/src/network/networkd-network-gperf.gperf
+++ b/src/network/networkd-network-gperf.gperf
@@ -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)
diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c
index b037fc6..2dc3de3 100644
--- a/src/network/networkd-network.c
+++ b/src/network/networkd-network.c
@@ -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;
diff --git a/src/network/networkd-network.h b/src/network/networkd-network.h
index ad56fc5..7b40ba5 100644
--- a/src/network/networkd-network.h
+++ b/src/network/networkd-network.h
@@ -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;