Compare commits

...

2 Commits

Author SHA1 Message Date
Serge bf9012bbf6 sd-dhcp-client: anonymize DHCPDISCOVER (fixes #13992)
According to RFC7844 section 3 the DHCPDISCOVER message should not contain option 50 («Requested IP Address») when Anonymize is true
2019-11-18 00:06:01 +09:00
Tom Fitzhenry a0fa3ef7ff Error, rather than warn, if failing to start DHCP server
This would have made diagnosing https://github.com/systemd/systemd/issues/14050 easier.
2019-11-17 22:31:43 +09:00
2 changed files with 6 additions and 4 deletions

View File

@ -875,7 +875,9 @@ static int client_send_discover(sd_dhcp_client *client) {
address be assigned, and may include the IP address lease time address be assigned, and may include the IP address lease time
option to suggest the lease time it would like. option to suggest the lease time it would like.
*/ */
if (client->last_addr != INADDR_ANY) { /* RFC7844 section 3:
SHOULD NOT contain any other option. */
if (!client->anonymize && client->last_addr != INADDR_ANY) {
r = dhcp_option_append(&discover->dhcp, optlen, &optoffset, 0, r = dhcp_option_append(&discover->dhcp, optlen, &optoffset, 0,
SD_DHCP_OPTION_REQUESTED_IP_ADDRESS, SD_DHCP_OPTION_REQUESTED_IP_ADDRESS,
4, &client->last_addr); 4, &client->last_addr);

View File

@ -284,7 +284,7 @@ int dhcp4_server_configure(Link *link) {
r = sd_dhcp_server_set_emit_router(link->dhcp_server, link->network->dhcp_server_emit_router); r = sd_dhcp_server_set_emit_router(link->dhcp_server, link->network->dhcp_server_emit_router);
if (r < 0) if (r < 0)
return log_link_warning_errno(link, r, "Failed to set router emission for DHCP server: %m"); return log_link_error_errno(link, r, "Failed to set router emission for DHCP server: %m");
if (link->network->dhcp_server_emit_timezone) { if (link->network->dhcp_server_emit_timezone) {
_cleanup_free_ char *buffer = NULL; _cleanup_free_ char *buffer = NULL;
@ -295,7 +295,7 @@ int dhcp4_server_configure(Link *link) {
else { else {
r = get_timezone(&buffer); r = get_timezone(&buffer);
if (r < 0) if (r < 0)
return log_warning_errno(r, "Failed to determine timezone: %m"); return log_error_errno(r, "Failed to determine timezone: %m");
tz = buffer; tz = buffer;
} }
@ -316,7 +316,7 @@ int dhcp4_server_configure(Link *link) {
if (!sd_dhcp_server_is_running(link->dhcp_server)) { if (!sd_dhcp_server_is_running(link->dhcp_server)) {
r = sd_dhcp_server_start(link->dhcp_server); r = sd_dhcp_server_start(link->dhcp_server);
if (r < 0) if (r < 0)
return log_link_warning_errno(link, r, "Could not start DHCPv4 server instance: %m"); return log_link_error_errno(link, r, "Could not start DHCPv4 server instance: %m");
} }
return 0; return 0;