From 28522b0d8ca58b2d9756af79ad6c11c11488a808 Mon Sep 17 00:00:00 2001 From: juga0 Date: Fri, 10 Nov 2017 15:03:43 +0000 Subject: [PATCH] networkd: set dhcp_use_routes to true when dhcp_anonymize is true (#7209) It does not send duplicated options in the PRL. Fix #7048. --- src/network/networkd-dhcp4.c | 4 ++-- src/network/networkd-network.c | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c index e1e3e88..0b2f88b 100644 --- a/src/network/networkd-dhcp4.c +++ b/src/network/networkd-dhcp4.c @@ -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); diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c index bf54a57..29f1586 100644 --- a/src/network/networkd-network.c +++ b/src/network/networkd-network.c @@ -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; -- 2.7.4