hostapd: Add config_id parameter

Add a new configuration parameter: config_id.

If set, only do hostapd_clear_old() for the BSSes for which the
config_id changed.

This makes it possible to reconfigure specific BSSes on a radio,
without disconnecting clients connected to other, unchanged BSSes of
the same radio.

This patch adapted from a patch authored by John Crispin in the
OpenWrt repository:
https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=package/network/services/hostapd/patches/700-wifi-reload.patch;h=c5ba631a0fc02f70714cb081b42fcf6cb9694450;hb=60fb4c92b6b0d1582d31e02167b90b424185f3a2

Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
This commit is contained in:
Raphaël Mélotte 2022-08-01 13:08:22 +02:00 committed by Jouni Malinen
parent 46f6a32775
commit b37c3fbad4
4 changed files with 14 additions and 2 deletions

View file

@ -174,6 +174,9 @@ static void hostapd_reload_bss(struct hostapd_data *hapd)
static void hostapd_clear_old_bss(struct hostapd_data *bss)
{
wpa_printf(MSG_DEBUG, "BSS %s changed - clear old state",
bss->conf->iface);
/*
* Deauthenticate all stations since the new configuration may not
* allow them to use the BSS anymore.
@ -240,13 +243,13 @@ int hostapd_reload_config(struct hostapd_iface *iface)
if (newconf == NULL)
return -1;
hostapd_clear_old(iface);
oldconf = hapd->iconf;
if (hostapd_iface_conf_changed(newconf, oldconf)) {
char *fname;
int res;
hostapd_clear_old(iface);
wpa_printf(MSG_DEBUG,
"Configuration changes include interface/BSS modification - force full disable+enable sequence");
fname = os_strdup(iface->config_fname);
@ -276,6 +279,10 @@ int hostapd_reload_config(struct hostapd_iface *iface)
for (j = 0; j < iface->num_bss; j++) {
hapd = iface->bss[j];
if (!hapd->conf->config_id || !newconf->bss[j]->config_id ||
os_strcmp(hapd->conf->config_id,
newconf->bss[j]->config_id) != 0)
hostapd_clear_old_bss(hapd);
hapd->iconf = newconf;
hapd->iconf->channel = oldconf->channel;
hapd->iconf->acs = oldconf->acs;