mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-20 09:00:26 +01:00
n-dhcp4: do not send the release message in wrong connection state
We should not send the DHCP release message when udp socket is still in
the PACKET state, this state is typically used during the discovery and
offer phases, where the client broadcasts DHCP packets like DHCPDISCOVER
and receives responses like DHCPOFFER. At this point, the client has no
lease because it has not yet completed the DHCP handshake.
(cherry picked from commit bccf031591)
This commit is contained in:
parent
6b2869bcb6
commit
fc58c3295d
1 changed files with 4 additions and 0 deletions
|
|
@ -1332,6 +1332,10 @@ int n_dhcp4_client_probe_release(NDhcp4ClientProbe *probe) {
|
|||
_c_cleanup_(n_dhcp4_outgoing_freep) NDhcp4Outgoing *request_out = NULL;
|
||||
int r;
|
||||
|
||||
if (probe->connection.state != N_DHCP4_C_CONNECTION_STATE_DRAINING
|
||||
&& probe->connection.state != N_DHCP4_C_CONNECTION_STATE_UDP)
|
||||
return -ENOTRECOVERABLE;
|
||||
|
||||
r = n_dhcp4_c_connection_release_new(&probe->connection, &request_out, NULL);
|
||||
if (r)
|
||||
return r;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue