eiwd

no dbus iwd with iwctl functionality
git clone https://git.daat.foo/repos/eiwd.git
Log | Files | Refs | Submodules | README | LICENSE

commit 3045ef0770ba762aa95d29bd0db42893f04aa7e7
parent 3eff81864ced4ea20d7684a248affc2e9d0fc446
Author: Andrew Zaborowski <andrew.zaborowski@intel.com>
Date:   Mon, 23 Aug 2021 16:14:25 +0200

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.

Diffstat:
Msrc/ap.c | 11+++++++++++
1 file changed, 11 insertions(+), 0 deletions(-)

diff --git a/src/ap.c b/src/ap.c @@ -269,6 +269,17 @@ static void ap_del_station(struct sta_state *sta, uint16_t reason, 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 * a subsequent ap_sta_free(sta) has no need to access sta->ap. */