Revert "Revert "[wpa_supplicant] cumilative patch from commit 4b..."
Revert submission 28102966-revert-26533062-Supplicant_merge_June24-CUATTSRBBR
Fixed the regression issue (ag/28389573)
Bug: 329004037
Reverted changes: /q/submissionid:28102966-revert-26533062-Supplicant_merge_June24-CUATTSRBBR
Test: Turn ON/OFF SoftAp
Change-Id: Ie7ea1ee7f8b1311fce280907d37a2e321542f547
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index bc45579..ff18543 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -164,7 +164,7 @@
struct wpa_bss *bss = wpa_supplicant_get_new_bss(wpa_s, bssid);
if (!bss) {
- wpa_supplicant_update_scan_results(wpa_s);
+ wpa_supplicant_update_scan_results(wpa_s, bssid);
/* Get the BSS from the new scan results */
bss = wpa_supplicant_get_new_bss(wpa_s, bssid);
@@ -183,7 +183,7 @@
struct wpa_bss *bss = wpa_supplicant_get_new_bss(wpa_s, bssid);
if (!bss) {
- wpa_supplicant_update_scan_results(wpa_s);
+ wpa_supplicant_update_scan_results(wpa_s, bssid);
bss = wpa_supplicant_get_new_bss(wpa_s, bssid);
}
@@ -1156,19 +1156,18 @@
static bool wpas_valid_ml_bss(struct wpa_supplicant *wpa_s, struct wpa_bss *bss)
-
{
u16 removed_links;
if (wpa_bss_parse_basic_ml_element(wpa_s, bss, NULL, NULL, NULL, NULL))
return true;
- if (bss->n_mld_links == 0)
+ if (!bss->valid_links)
return true;
/* Check if the current BSS is going to be removed */
removed_links = wpa_bss_parse_reconf_ml_element(wpa_s, bss);
- if (BIT(bss->mld_links[0].link_id) & removed_links)
+ if (BIT(bss->mld_link_id) & removed_links)
return false;
return true;
@@ -1697,13 +1696,11 @@
return NULL;
}
-#ifdef CONFIG_WNM
if (wnm_is_bss_excluded(wpa_s, bss)) {
if (debug_print)
wpa_dbg(wpa_s, MSG_DEBUG, " skip - BSSID excluded");
return NULL;
}
-#endif /* CONFIG_WNM */
for (ssid = group; ssid; ssid = only_first_ssid ? NULL : ssid->pnext) {
if (wpa_scan_res_ok(wpa_s, ssid, match_ssid, match_ssid_len,
@@ -1809,10 +1806,12 @@
break;
}
- if (selected == NULL && wpa_s->bssid_ignore &&
+ if (!selected &&
+ (wpa_s->bssid_ignore || wnm_active_bss_trans_mgmt(wpa_s)) &&
!wpa_s->countermeasures) {
wpa_dbg(wpa_s, MSG_DEBUG,
"No APs found - clear BSSID ignore list and try again");
+ wnm_btm_reset(wpa_s);
wpa_bssid_ignore_clear(wpa_s);
wpa_s->bssid_ignore_cleared = true;
} else if (selected == NULL)
@@ -2409,7 +2408,7 @@
scan_res = wpa_supplicant_get_scan_results(wpa_s,
data ? &data->scan_info :
- NULL, 1);
+ NULL, 1, NULL);
if (scan_res == NULL) {
if (wpa_s->conf->ap_scan == 2 || ap ||
wpa_s->scan_res_handler == scan_only_handler)
@@ -2498,7 +2497,7 @@
return 0;
}
- if (wnm_scan_process(wpa_s, 1) > 0)
+ if (wnm_scan_process(wpa_s, false) > 0)
goto scan_work_done;
if (sme_proc_obss_scan(wpa_s) > 0)
@@ -2941,8 +2940,6 @@
}
-#ifdef CONFIG_INTERWORKING
-
static int wpas_qos_map_set(struct wpa_supplicant *wpa_s, const u8 *qos_map,
size_t len)
{
@@ -2975,8 +2972,6 @@
}
}
-#endif /* CONFIG_INTERWORKING */
-
static void wpa_supplicant_set_4addr_mode(struct wpa_supplicant *wpa_s)
{
@@ -3002,25 +2997,24 @@
const u8 *ies, size_t ies_len)
{
struct ieee802_11_elems elems;
- const u8 *map_sub_elem, *pos;
- size_t len;
+ struct multi_ap_params multi_ap;
+ u16 status;
wpa_s->multi_ap_ie = 0;
if (!ies ||
ieee802_11_parse_elems(ies, ies_len, &elems, 1) == ParseFailed ||
- !elems.multi_ap || elems.multi_ap_len < 7)
+ !elems.multi_ap)
return;
- pos = elems.multi_ap + 4;
- len = elems.multi_ap_len - 4;
-
- map_sub_elem = get_ie(pos, len, MULTI_AP_SUB_ELEM_TYPE);
- if (!map_sub_elem || map_sub_elem[1] < 1)
+ status = check_multi_ap_ie(elems.multi_ap + 4, elems.multi_ap_len - 4,
+ &multi_ap);
+ if (status != WLAN_STATUS_SUCCESS)
return;
- wpa_s->multi_ap_backhaul = !!(map_sub_elem[2] & MULTI_AP_BACKHAUL_BSS);
- wpa_s->multi_ap_fronthaul = !!(map_sub_elem[2] &
+ wpa_s->multi_ap_backhaul = !!(multi_ap.capability &
+ MULTI_AP_BACKHAUL_BSS);
+ wpa_s->multi_ap_fronthaul = !!(multi_ap.capability &
MULTI_AP_FRONTHAUL_BSS);
wpa_s->multi_ap_ie = 1;
}
@@ -3359,10 +3353,8 @@
wnm_process_assoc_resp(wpa_s, data->assoc_info.resp_ies,
data->assoc_info.resp_ies_len);
#endif /* CONFIG_WNM */
-#ifdef CONFIG_INTERWORKING
interworking_process_assoc_resp(wpa_s, data->assoc_info.resp_ies,
data->assoc_info.resp_ies_len);
-#endif /* CONFIG_INTERWORKING */
if (wpa_s->hw_capab == CAPAB_VHT &&
get_ie(data->assoc_info.resp_ies,
data->assoc_info.resp_ies_len, WLAN_EID_VHT_CAP))
@@ -3718,12 +3710,21 @@
if (wpa_found || rsn_found)
wpa_s->ap_ies_from_associnfo = 1;
- if (wpa_s->assoc_freq && data->assoc_info.freq &&
- wpa_s->assoc_freq != data->assoc_info.freq) {
- wpa_printf(MSG_DEBUG, "Operating frequency changed from "
- "%u to %u MHz",
- wpa_s->assoc_freq, data->assoc_info.freq);
- wpa_supplicant_update_scan_results(wpa_s);
+ if (wpa_s->assoc_freq && data->assoc_info.freq) {
+ struct wpa_bss *bss;
+ unsigned int freq = 0;
+
+ if (bssid_known) {
+ bss = wpa_bss_get_bssid_latest(wpa_s, bssid);
+ if (bss)
+ freq = bss->freq;
+ }
+ if (freq != data->assoc_info.freq) {
+ wpa_printf(MSG_DEBUG,
+ "Operating frequency changed from %u to %u MHz",
+ wpa_s->assoc_freq, data->assoc_info.freq);
+ wpa_supplicant_update_scan_results(wpa_s, bssid);
+ }
}
wpa_s->assoc_freq = data->assoc_info.freq;
@@ -4077,10 +4078,7 @@
if (!mlo.valid_links)
return 0;
- for (i = 0; i < MAX_NUM_MLD_LINKS; i++) {
- if (!(mlo.valid_links & BIT(i)))
- continue;
-
+ for_each_link(mlo.valid_links, i) {
if (!ether_addr_equal(wpa_s->links[i].addr,
mlo.links[i].addr) ||
!ether_addr_equal(wpa_s->links[i].bssid,
@@ -4098,10 +4096,7 @@
wpa_s->valid_links = mlo.valid_links;
wpa_s->mlo_assoc_link_id = mlo.assoc_link_id;
os_memcpy(wpa_s->ap_mld_addr, mlo.ap_mld_addr, ETH_ALEN);
- for (i = 0; i < MAX_NUM_MLD_LINKS; i++) {
- if (!(wpa_s->valid_links & BIT(i)))
- continue;
-
+ for_each_link(wpa_s->valid_links, i) {
os_memcpy(wpa_s->links[i].addr, mlo.links[i].addr, ETH_ALEN);
os_memcpy(wpa_s->links[i].bssid, mlo.links[i].bssid, ETH_ALEN);
wpa_s->links[i].freq = mlo.links[i].freq;
@@ -4134,15 +4129,13 @@
wpa_mlo.valid_links = drv_mlo.valid_links;
wpa_mlo.req_links = drv_mlo.req_links;
- for (i = 0; i < MAX_NUM_MLD_LINKS; i++) {
+ for_each_link(drv_mlo.req_links, i) {
struct wpa_bss *bss;
- if (!(drv_mlo.req_links & BIT(i)))
- continue;
-
bss = wpa_supplicant_get_new_bss(wpa_s, drv_mlo.links[i].bssid);
if (!bss) {
- wpa_supplicant_update_scan_results(wpa_s);
+ wpa_supplicant_update_scan_results(
+ wpa_s, drv_mlo.links[i].bssid);
bss = wpa_supplicant_get_new_bss(
wpa_s, drv_mlo.links[i].bssid);
}
@@ -6021,13 +6014,10 @@
pos += res;
if (!info->default_map) {
- for (i = 0; i < MAX_NUM_MLD_LINKS && end > pos; i++) {
+ for_each_link(info->valid_links, i) {
char uplink_map_str[9];
char downlink_map_str[9];
- if (!(info->valid_links & BIT(i)))
- continue;
-
bitmap_to_str(info->t2lmap[i].uplink, uplink_map_str);
bitmap_to_str(info->t2lmap[i].downlink,
downlink_map_str);
@@ -6307,6 +6297,13 @@
" type=%d stype=%d",
MAC2STR(data->tx_status.dst),
data->tx_status.type, data->tx_status.stype);
+#ifdef CONFIG_WNM
+ if (data->tx_status.type == WLAN_FC_TYPE_MGMT &&
+ data->tx_status.stype == WLAN_FC_STYPE_ACTION &&
+ wnm_btm_resp_tx_status(wpa_s, data->tx_status.data,
+ data->tx_status.data_len) == 0)
+ break;
+#endif /* CONFIG_WNM */
#ifdef CONFIG_PASN
if (data->tx_status.type == WLAN_FC_TYPE_MGMT &&
data->tx_status.stype == WLAN_FC_STYPE_AUTH &&