]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Apply CHAN_SWITCH in all BSS for MBSSID case
authorHaribabu Krishnasamy <quic_hkr@quicinc.com>
Thu, 25 Jan 2024 06:47:51 +0000 (12:17 +0530)
committerJouni Malinen <j@w1.fi>
Sun, 18 Feb 2024 09:09:40 +0000 (11:09 +0200)
When the CHAN_SWITCH command is executed during multi BSSID case (say
BSS1, BSS2, and BSS3), if one of the BSS is disabled (say BSS2), the
CHAN_SWITCH command returns an error in BSS2 and does not proceed to the
next BSS (BSS3).

The CHAN_SWITCH command handler iterates over all configured BSSs and
attempts to send the switch_channel to each one. However, if any one of
the BSSs fails, the entire command is aborted and returns a failure.

Continue the iteration even if one BSS is failing to make sure the
configuration is applied to other BSSs.

Signed-off-by: Haribabu Krishnasamy <quic_hkr@quicinc.com>
hostapd/ctrl_iface.c
src/ap/dfs.c

index 5552cce6d406deda263afc71b6fcfe008c61da0c..84d2e83e4eac6115103f59fdba8bc4a6f0098ee7 100644 (file)
@@ -2638,6 +2638,8 @@ static int hostapd_ctrl_iface_chan_switch(struct hostapd_iface *iface,
        unsigned int i;
        int bandwidth;
        u8 chan;
+       unsigned int num_err = 0;
+       int err = 0;
 
        ret = hostapd_parse_csa_settings(pos, &settings);
        if (ret)
@@ -2721,15 +2723,14 @@ static int hostapd_ctrl_iface_chan_switch(struct hostapd_iface *iface,
                hostapd_chan_switch_config(iface->bss[i],
                                           &settings.freq_params);
 
-               ret = hostapd_switch_channel(iface->bss[i], &settings);
-               if (ret) {
-                       /* FIX: What do we do if CSA fails in the middle of
-                        * submitting multi-BSS CSA requests? */
-                       return ret;
+               err = hostapd_switch_channel(iface->bss[i], &settings);
+               if (err) {
+                       ret = err;
+                       num_err++;
                }
        }
 
-       return 0;
+       return (iface->num_bss == num_err) ? ret : 0;
 #else /* NEED_AP_MLME */
        return -1;
 #endif /* NEED_AP_MLME */
index 5e4c8107037962348dd84aae2ecc5ac7162953cf..5e36cff10b67b98ac649a26c3bd7631678dd6f20 100644 (file)
@@ -972,6 +972,7 @@ static int hostapd_dfs_request_channel_switch(struct hostapd_iface *iface,
        struct csa_settings csa_settings;
        u8 new_vht_oper_chwidth;
        unsigned int i;
+       unsigned int num_err = 0;
 
        wpa_printf(MSG_DEBUG, "DFS will switch to a new channel %d", channel);
        wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_NEW_CHANNEL
@@ -1021,10 +1022,10 @@ static int hostapd_dfs_request_channel_switch(struct hostapd_iface *iface,
        for (i = 0; i < iface->num_bss; i++) {
                err = hostapd_switch_channel(iface->bss[i], &csa_settings);
                if (err)
-                       break;
+                       num_err++;
        }
 
-       if (err) {
+       if (num_err == iface->num_bss) {
                wpa_printf(MSG_WARNING,
                           "DFS failed to schedule CSA (%d) - trying fallback",
                           err);