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
This commit is contained in:
juga0 2017-08-03 19:19:51 +02:00
parent db3d235820
commit 5e77a1468e
2 changed files with 18 additions and 6 deletions

View file

@ -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

View file

@ -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)