]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
hostapd: Add config_id parameter
authorRaphaël Mélotte <raphael.melotte@mind.be>
Mon, 1 Aug 2022 11:08:22 +0000 (13:08 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 27 Nov 2022 13:41:19 +0000 (15:41 +0200)
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>
hostapd/config_file.c
src/ap/ap_config.c
src/ap/ap_config.h
src/ap/hostapd.c

index 5715ded42936df20ebd2ce510f85172f905d7795..8a3357c26a6aefa041e3f066d0550d03673de2e6 100644 (file)
@@ -2418,6 +2418,9 @@ static int hostapd_config_fill(struct hostapd_config *conf,
                bss->ap_max_inactivity = atoi(pos);
        } else if (os_strcmp(buf, "skip_inactivity_poll") == 0) {
                bss->skip_inactivity_poll = atoi(pos);
+       } else if (os_strcmp(buf, "config_id") == 0) {
+               os_free(bss->config_id);
+               bss->config_id = os_strdup(pos);
        } else if (os_strcmp(buf, "country_code") == 0) {
                if (pos[0] < 'A' || pos[0] > 'Z' ||
                    pos[1] < 'A' || pos[1] > 'Z') {
index d2d8b95f9d7c453e5fa993887829661dce940309..be2e47122d4f635e3d924527570666844c76a01e 100644 (file)
@@ -796,6 +796,7 @@ void hostapd_config_free_bss(struct hostapd_bss_config *conf)
        os_free(conf->radius_req_attr_sqlite);
        os_free(conf->rsn_preauth_interfaces);
        os_free(conf->ctrl_interface);
+       os_free(conf->config_id);
        os_free(conf->ca_cert);
        os_free(conf->server_cert);
        os_free(conf->server_cert2);
index c5701cc0003abf992b7e4e50775ce131ac70f970..a196d858fb69896255c69e6da517ffb2a62ae0c1 100644 (file)
@@ -916,6 +916,7 @@ struct hostapd_bss_config {
        u8 ext_capa[EXT_CAPA_MAX_LEN];
 
        u8 rnr;
+       char *config_id;
 };
 
 /**
index 4c3b1f05dd2965ff6c21fe7ce37fb3f6a9f10516..1c291c0f6db9e16106e1c88d7bfcf04e380a3e97 100644 (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;