dhcp: Properly handle unsuccessful cases for DHCP Ack
Ignore DHCP Ack packets if they are found to be erroneous or have an unexpected xid by setting the result to zero instead of propagating an error. Also remember to report a DHCP Nak and stop the DHCP client.
This commit is contained in:
committed by
Tom Gundersen
parent
187dc6e554
commit
97b9372db1
@@ -897,6 +897,9 @@ static int client_receive_raw_message(sd_event_source *s, int fd,
|
||||
client->receive_message =
|
||||
sd_event_source_unref(client->receive_message);
|
||||
}
|
||||
|
||||
r = 0;
|
||||
|
||||
break;
|
||||
|
||||
case DHCP_STATE_INIT:
|
||||
@@ -910,7 +913,7 @@ static int client_receive_raw_message(sd_event_source *s, int fd,
|
||||
}
|
||||
|
||||
error:
|
||||
if (r < 0)
|
||||
if (r < 0 || r == DHCP_EVENT_NO_LEASE)
|
||||
return client_stop(client, r);
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user