From: juga0 Date: Thu, 3 Aug 2017 17:19:51 +0000 (+0200) Subject: networkd: do not send more PRL options when Anonymize is true. X-Git-Tag: v235~148^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5e77a1468e9388847c3a31f84725808aa0df63af;p=platform%2Fupstream%2Fsystemd.git networkd: do not send more PRL options when Anonymize is true. * check that Client has reserved memory for PRL * do not send duplicated ROUTES option when Anonymize is true --- diff --git a/src/libsystemd-network/sd-dhcp-client.c b/src/libsystemd-network/sd-dhcp-client.c index 9cc5636..b5f8539 100644 --- a/src/libsystemd-network/sd-dhcp-client.c +++ b/src/libsystemd-network/sd-dhcp-client.c @@ -615,11 +615,18 @@ static int client_message_init( it MUST include that list in any subsequent DHCPREQUEST messages. */ - r = dhcp_option_append(&packet->dhcp, optlen, &optoffset, 0, - SD_DHCP_OPTION_PARAMETER_REQUEST_LIST, - client->req_opts_size, client->req_opts); - if (r < 0) - return r; + + /* RFC7844 section 3: + MAY contain the Parameter Request List option. */ + /* NOTE: in case that there would be an option to do not send + * any PRL at all, the size should be checked before sending */ + if (client->req_opts_size > 0) { + r = dhcp_option_append(&packet->dhcp, optlen, &optoffset, 0, + SD_DHCP_OPTION_PARAMETER_REQUEST_LIST, + client->req_opts_size, client->req_opts); + if (r < 0) + return r; + } /* RFC2131 section 3.5: The client SHOULD include the ’maximum DHCP message size’ option to diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c index 07661e3..9c69979 100644 --- a/src/network/networkd-dhcp4.c +++ b/src/network/networkd-dhcp4.c @@ -624,7 +624,12 @@ int dhcp4_configure(Link *link) { return r; } - if (link->network->dhcp_use_routes) { + /* 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?. */ + 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); if (r < 0)