]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
hostapd: Fix premature beacon set during association handling
authorAditya Kumar Singh <quic_adisi@quicinc.com>
Tue, 26 Sep 2023 07:42:39 +0000 (13:12 +0530)
committerJouni Malinen <j@w1.fi>
Tue, 26 Sep 2023 08:41:53 +0000 (11:41 +0300)
Currently, during association handling, if any of the iface parameters
changes due to some reason, it calls ieee802_11_set_beacons() function.
This function sets beacon for the all the BSSes in that iface even if
the beacon was not set already. This leads to setting the beacon
prematurely for some BSSes which was intentionally not started.

Fix the above issue by calling ieee802_11_update_beacons() function
instead. This function only updates the beacon if it was already set.

While at it, do the same while freeing STA entry.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
src/ap/ieee802_11.c
src/ap/ieee802_11_ht.c
src/ap/sta_info.c

index aa02fc624b03480b3b63bd178587ccc5f3f21969..02948fd58016b6f5f388a7d8c2e5882a38f02dd9 100644 (file)
@@ -5405,7 +5405,7 @@ static void handle_assoc(struct hostapd_data *hapd,
                sta->nonerp_set = 1;
                hapd->iface->num_sta_non_erp++;
                if (hapd->iface->num_sta_non_erp == 1)
-                       ieee802_11_set_beacons(hapd->iface);
+                       ieee802_11_update_beacons(hapd->iface);
        }
 
        if (!(sta->capability & WLAN_CAPABILITY_SHORT_SLOT_TIME) &&
@@ -5416,7 +5416,7 @@ static void handle_assoc(struct hostapd_data *hapd,
                    hapd->iface->current_mode->mode ==
                    HOSTAPD_MODE_IEEE80211G &&
                    hapd->iface->num_sta_no_short_slot_time == 1)
-                       ieee802_11_set_beacons(hapd->iface);
+                       ieee802_11_update_beacons(hapd->iface);
        }
 
        if (sta->capability & WLAN_CAPABILITY_SHORT_PREAMBLE)
@@ -5431,7 +5431,7 @@ static void handle_assoc(struct hostapd_data *hapd,
                if (hapd->iface->current_mode &&
                    hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G
                    && hapd->iface->num_sta_no_short_preamble == 1)
-                       ieee802_11_set_beacons(hapd->iface);
+                       ieee802_11_update_beacons(hapd->iface);
        }
 
        update_ht_state(hapd, sta);
index 59ecbdce7bf1bbb5c3f08240cf872a84de1bfab8..cf3867c86c2987ed7ce9d232850320c3435b9d0c 100644 (file)
@@ -487,7 +487,7 @@ void update_ht_state(struct hostapd_data *hapd, struct sta_info *sta)
                update_sta_no_ht(hapd, sta);
 
        if (hostapd_ht_operation_update(hapd->iface) > 0)
-               ieee802_11_set_beacons(hapd->iface);
+               ieee802_11_update_beacons(hapd->iface);
 }
 
 
index 1d9becea3165dc20cecfba8021abcff763005c4a..d87214ec7626c46c96bb9b1c68e0b0cff79d5afd 100644 (file)
@@ -290,7 +290,7 @@ void ap_free_sta(struct hostapd_data *hapd, struct sta_info *sta)
 #endif /* CONFIG_MESH */
 
        if (set_beacon)
-               ieee802_11_set_beacons(hapd->iface);
+               ieee802_11_update_beacons(hapd->iface);
 
        wpa_printf(MSG_DEBUG, "%s: cancel ap_handle_timer for " MACSTR,
                   __func__, MAC2STR(sta->addr));