summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2018-12-03 16:08:34 +0100
committerThomas Haller <thaller@redhat.com>2018-12-19 09:23:08 +0100
commit2f2b489d38509c5efdd17c72351749dd1fefa8bd (patch)
tree7a063791c8fd9f3e7fccbddefeeb9fdde5f06fc1
parent795facc2bab15251f228304913287f43db26aa58 (diff)
downloadNetworkManager-2f2b489d38509c5efdd17c72351749dd1fefa8bd.tar.gz
dhcp: request classless-static-route option first according to RFC 3442
In ip4_start(), we iterate over @dhcp4_requests array and add the options that are to be included. We do so, by calling sd_dhcp_client_set_request_option(). Note that sd_dhcp_client_set_request_option() only appends the options to a list, not taking special care about the order in which options are added. RFC 3442 (The Classless Static Route Option for Dynamic Host Configuration Protocol (DHCP) version 4) says: DHCP clients that support this option and send a parameter request list MAY also request the Static Routes option, for compatibility with older servers that don't support Classless Static Routes. The Classless Static Routes option code MUST appear in the parameter request list prior to both the Router option code and the Static Routes option code, if present. Compare to RFC 2132 (DHCP Options and BOOTP Vendor Extensions) which says about the parameter request list: The client MAY list the options in order of preference. Note, with RFC 7844 (Anonymity Profiles for DHCP Clients), the order should be randomized. But since we don't follow RFC 7844 (yet), let's follow at least RFC 3442.
-rw-r--r--src/dhcp/nm-dhcp-systemd.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/dhcp/nm-dhcp-systemd.c b/src/dhcp/nm-dhcp-systemd.c
index 688fcd71eb..2aa8b6bf1a 100644
--- a/src/dhcp/nm-dhcp-systemd.c
+++ b/src/dhcp/nm-dhcp-systemd.c
@@ -115,19 +115,24 @@ typedef struct {
static const ReqOption dhcp4_requests[] = {
REQ (SD_DHCP_OPTION_SUBNET_MASK, "subnet_mask", TRUE ),
REQ (SD_DHCP_OPTION_TIME_OFFSET, "time_offset", TRUE ),
- REQ (SD_DHCP_OPTION_ROUTER, "routers", TRUE ),
REQ (SD_DHCP_OPTION_DOMAIN_NAME_SERVER, "domain_name_servers", TRUE ),
REQ (SD_DHCP_OPTION_HOST_NAME, "host_name", TRUE ),
REQ (SD_DHCP_OPTION_DOMAIN_NAME, "domain_name", TRUE ),
REQ (SD_DHCP_OPTION_INTERFACE_MTU, "interface_mtu", TRUE ),
REQ (SD_DHCP_OPTION_BROADCAST, "broadcast_address", TRUE ),
+
+ /* RFC 3442: The Classless Static Routes option code MUST appear in the parameter
+ * request list prior to both the Router option code and the Static
+ * Routes option code, if present. */
+ REQ (SD_DHCP_OPTION_CLASSLESS_STATIC_ROUTE, "rfc3442_classless_static_routes", TRUE ),
+ REQ (SD_DHCP_OPTION_ROUTER, "routers", TRUE ),
REQ (SD_DHCP_OPTION_STATIC_ROUTE, "static_routes", TRUE ),
+
REQ (DHCP_OPTION_NIS_DOMAIN, "nis_domain", TRUE ),
REQ (DHCP_OPTION_NIS_SERVERS, "nis_servers", TRUE ),
REQ (SD_DHCP_OPTION_NTP_SERVER, "ntp_servers", TRUE ),
REQ (SD_DHCP_OPTION_SERVER_IDENTIFIER, "dhcp_server_identifier", TRUE ),
REQ (SD_DHCP_OPTION_DOMAIN_SEARCH_LIST, "domain_search", TRUE ),
- REQ (SD_DHCP_OPTION_CLASSLESS_STATIC_ROUTE, "rfc3442_classless_static_routes", TRUE ),
REQ (SD_DHCP_OPTION_PRIVATE_CLASSLESS_STATIC_ROUTE, "ms_classless_static_routes", TRUE ),
REQ (SD_DHCP_OPTION_PRIVATE_PROXY_AUTODISCOVERY, "wpad", TRUE ),
REQ (SD_DHCP_OPTION_ROOT_PATH, "root_path", TRUE ),