hostapd: Fix premature beacon set during association handling

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>
This commit is contained in:
Aditya Kumar Singh 2023-09-26 13:12:39 +05:30 committed by Jouni Malinen
parent ae928e67a1
commit e59d2a31cf
3 changed files with 5 additions and 5 deletions

View file

@ -5405,7 +5405,7 @@ static void handle_assoc(struct hostapd_data *hapd,
sta->nonerp_set = 1; sta->nonerp_set = 1;
hapd->iface->num_sta_non_erp++; hapd->iface->num_sta_non_erp++;
if (hapd->iface->num_sta_non_erp == 1) 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) && 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 == hapd->iface->current_mode->mode ==
HOSTAPD_MODE_IEEE80211G && HOSTAPD_MODE_IEEE80211G &&
hapd->iface->num_sta_no_short_slot_time == 1) 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) if (sta->capability & WLAN_CAPABILITY_SHORT_PREAMBLE)
@ -5431,7 +5431,7 @@ static void handle_assoc(struct hostapd_data *hapd,
if (hapd->iface->current_mode && if (hapd->iface->current_mode &&
hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G
&& hapd->iface->num_sta_no_short_preamble == 1) && 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); update_ht_state(hapd, sta);

View file

@ -487,7 +487,7 @@ void update_ht_state(struct hostapd_data *hapd, struct sta_info *sta)
update_sta_no_ht(hapd, sta); update_sta_no_ht(hapd, sta);
if (hostapd_ht_operation_update(hapd->iface) > 0) if (hostapd_ht_operation_update(hapd->iface) > 0)
ieee802_11_set_beacons(hapd->iface); ieee802_11_update_beacons(hapd->iface);
} }

View file

@ -290,7 +290,7 @@ void ap_free_sta(struct hostapd_data *hapd, struct sta_info *sta)
#endif /* CONFIG_MESH */ #endif /* CONFIG_MESH */
if (set_beacon) 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, wpa_printf(MSG_DEBUG, "%s: cancel ap_handle_timer for " MACSTR,
__func__, MAC2STR(sta->addr)); __func__, MAC2STR(sta->addr));