1
0
mirror of https://github.com/systemd/systemd.git synced 2025-02-16 13:57:37 +03:00

sd-dhcp-client: reject NAKs from servers that we did not send an offer to ()

To support multiple DHCP servers in a network.
This commit is contained in:
Alexandre Peixoto Ferreira 2023-09-24 21:46:41 -05:00 committed by GitHub
parent fb86af6399
commit 13abd00685
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1591,9 +1591,14 @@ static int client_parse_message(
case DHCP_STATE_REQUESTING:
case DHCP_STATE_RENEWING:
case DHCP_STATE_REBINDING:
if (r == DHCP_NAK)
if (r == DHCP_NAK) {
if (client->lease && client->lease->server_address != lease->server_address)
return log_dhcp_client_errno(client, SYNTHETIC_ERRNO(ENOMSG),
"NAK from unexpected server, ignoring: %s",
strna(error_message));
return log_dhcp_client_errno(client, SYNTHETIC_ERRNO(EADDRNOTAVAIL),
"NAK: %s", strna(error_message));
}
if (r != DHCP_ACK)
return log_dhcp_client_errno(client, SYNTHETIC_ERRNO(ENOMSG),
"received message was not an ACK, ignoring.");