networkd: set dhcp_use_routes to true when dhcp_anonymize is true (#7209)
authorjuga0 <juga@riseup.net>
Fri, 10 Nov 2017 15:03:43 +0000 (15:03 +0000)
committerLennart Poettering <lennart@poettering.net>
Fri, 10 Nov 2017 15:03:43 +0000 (16:03 +0100)
It does not send duplicated options in the PRL.
Fix #7048.

src/network/networkd-dhcp4.c
src/network/networkd-network.c

index e1e3e88..0b2f88b 100644 (file)
@@ -632,11 +632,11 @@ int dhcp4_configure(Link *link) {
                         return r;
         }
 
-        /* NOTE: when using Anonymity Profiles, routes PRL options are sent
-         * by default, so they should not be added again here. */
         /* NOTE: even if this variable is called "use", it also "sends" PRL
          * options, maybe there should be a different configuration variable
          * to send or not route options?. */
+        /* NOTE: when using Anonymize=yes, routes PRL options are sent
+         * by default, so they don't need to be added here. */
         if (link->network->dhcp_use_routes && !link->network->dhcp_anonymize) {
                 r = sd_dhcp_client_set_request_option(link->dhcp_client,
                                                       SD_DHCP_OPTION_STATIC_ROUTE);
index bf54a57..29f1586 100644 (file)
@@ -113,9 +113,9 @@ void network_apply_anonymize_if_set(Network *network) {
         * (to use the MTU sent by the server but to do not send
         * the option in the PRL). */
         network->dhcp_use_mtu = false;
-        /* RFC7844 section 3.6.
-        * same comments as previous option */
-        network->dhcp_use_routes = false;
+        /* NOTE: when Anonymize=yes, the PRL route options are sent by default,
+         * but this is needed to use them. */
+        network->dhcp_use_routes = true;
         /* RFC7844 section 3.6.
         * same comments as previous option */
         network->dhcp_use_timezone = false;
@@ -208,7 +208,6 @@ static int network_load_one(Manager *manager, const char *filename) {
         network->dhcp_use_ntp = true;
         network->dhcp_use_dns = true;
         network->dhcp_use_hostname = true;
-        /* NOTE: this var might be overwriten by network_apply_anonymize_if_set */
         network->dhcp_use_routes = true;
         /* NOTE: this var might be overwriten by network_apply_anonymize_if_set */
         network->dhcp_send_hostname = true;