mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-26 10:39:23 +01:00
ap: Expire client's leases on disconnect
If netconfig is enabled tell the DHCP server to expire any leases owned by the client that is disconnecting by using l_dhcp_server_expire_by_mac to return the IPs to the IP pool. They're added to the expired list so they'd only be used if there are no other addresses left in the pool and can be reactivated if the client comes back before the address is used by somebody else. This should ensure that we're always able to offer an address to a new client as long as there are fewer concurrent clients than addresses in the configured subnet or IP range.
This commit is contained in:
parent
3eff81864c
commit
3045ef0770
11
src/ap.c
11
src/ap.c
@ -268,6 +268,17 @@ static void ap_del_station(struct sta_state *sta, uint16_t reason,
|
|||||||
|
|
||||||
ap_stop_handshake(sta);
|
ap_stop_handshake(sta);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Expire any DHCP leases owned by this client when it disconnects to
|
||||||
|
* make it harder for somebody to DoS the IP pool. If the client
|
||||||
|
* comes back and the lease is still in the expired leases list they
|
||||||
|
* will get their IP back.
|
||||||
|
*/
|
||||||
|
if (ap->netconfig_dhcp) {
|
||||||
|
sta->ip_alloc_lease = NULL;
|
||||||
|
l_dhcp_server_expire_by_mac(ap->netconfig_dhcp, sta->addr);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the event handler tears the AP down, we've made sure above that
|
* If the event handler tears the AP down, we've made sure above that
|
||||||
* a subsequent ap_sta_free(sta) has no need to access sta->ap.
|
* a subsequent ap_sta_free(sta) has no need to access sta->ap.
|
||||||
|
Loading…
Reference in New Issue
Block a user