mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-10-04 15:21:12 +00:00
n-dhcp4: add new client probe function to send RELEASE message
The new function uses the client probe connection to send a RELEASE message. Returns zero if successful otherwise returns non-zero value.
This commit is contained in:
parent
0f0f1bbf8a
commit
243cc433fb
|
@ -1319,3 +1319,30 @@ int n_dhcp4_client_probe_dispatch_io(NDhcp4ClientProbe *probe, uint32_t events)
|
|||
int n_dhcp4_client_probe_update_mtu(NDhcp4ClientProbe *probe, uint16_t mtu) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* n_dhcp4_client_probe_release() - send a release request
|
||||
* @probe: probe to operate on
|
||||
*
|
||||
* This sends a RELEASE message on the connection used by the probe.
|
||||
*
|
||||
* Return: 0 if successful otherwise non-zero value is returned.
|
||||
*/
|
||||
int n_dhcp4_client_probe_release(NDhcp4ClientProbe *probe) {
|
||||
_c_cleanup_(n_dhcp4_outgoing_freep) NDhcp4Outgoing *request_out = NULL;
|
||||
int r;
|
||||
|
||||
r = n_dhcp4_c_connection_release_new(&probe->connection, &request_out, NULL);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
r = n_dhcp4_c_connection_start_request(&probe->connection, request_out, 0);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
probe->state = N_DHCP4_CLIENT_PROBE_STATE_INIT;
|
||||
n_dhcp4_client_lease_unlink(probe->current_lease);
|
||||
request_out = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -161,6 +161,7 @@ NDhcp4ClientProbe *n_dhcp4_client_probe_free(NDhcp4ClientProbe *probe);
|
|||
|
||||
void n_dhcp4_client_probe_set_userdata(NDhcp4ClientProbe *probe, void *userdata);
|
||||
void n_dhcp4_client_probe_get_userdata(NDhcp4ClientProbe *probe, void **userdatap);
|
||||
int n_dhcp4_client_probe_release(NDhcp4ClientProbe *probe);
|
||||
|
||||
/* client leases */
|
||||
|
||||
|
|
Loading…
Reference in a new issue