Multi-AP: Set 4-address mode after network selection

Split multi_ap_process_assoc_resp() to set 4-address mode after network
selection. Previously, wpa_s->current_ssid might have been NULL in some
cases and that would have resulted in 4-address mode not getting enabled
properly.

Signed-off-by: Gurumoorthi Gnanasambandhan <gguru@codeaurora.org>
This commit is contained in:
Gurumoorthi Gnanasambandhan 2020-03-11 16:11:54 +05:30 committed by Jouni Malinen
parent e0fb468a7d
commit 1d9cff86bd
3 changed files with 32 additions and 13 deletions

View file

@ -2465,28 +2465,41 @@ static void multi_ap_process_assoc_resp(struct wpa_supplicant *wpa_s,
const u8 *map_sub_elem, *pos;
size_t len;
if (!wpa_s->current_ssid ||
!wpa_s->current_ssid->multi_ap_backhaul_sta ||
!ies ||
ieee802_11_parse_elems(ies, ies_len, &elems, 1) == ParseFailed)
return;
wpa_s->multi_ap_ie = 0;
if (!elems.multi_ap || elems.multi_ap_len < 7) {
wpa_printf(MSG_INFO, "AP doesn't support Multi-AP protocol");
goto fail;
}
if (!ies ||
ieee802_11_parse_elems(ies, ies_len, &elems, 1) == ParseFailed ||
!elems.multi_ap || elems.multi_ap_len < 7)
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) {
wpa_printf(MSG_INFO, "invalid Multi-AP sub elem type");
if (!map_sub_elem || map_sub_elem[1] < 1)
return;
wpa_s->multi_ap_backhaul = !!(map_sub_elem[2] & MULTI_AP_BACKHAUL_BSS);
wpa_s->multi_ap_fronthaul = !!(map_sub_elem[2] &
MULTI_AP_FRONTHAUL_BSS);
wpa_s->multi_ap_ie = 1;
}
static void multi_ap_set_4addr_mode(struct wpa_supplicant *wpa_s)
{
if (!wpa_s->current_ssid ||
!wpa_s->current_ssid->multi_ap_backhaul_sta)
return;
if (!wpa_s->multi_ap_ie) {
wpa_printf(MSG_INFO,
"AP does not include valid Multi-AP element");
goto fail;
}
if (!(map_sub_elem[2] & MULTI_AP_BACKHAUL_BSS)) {
if ((map_sub_elem[2] & MULTI_AP_FRONTHAUL_BSS) &&
if (!wpa_s->multi_ap_backhaul) {
if (wpa_s->multi_ap_fronthaul &&
wpa_s->current_ssid->key_mgmt & WPA_KEY_MGMT_WPS) {
wpa_printf(MSG_INFO,
"WPS active, accepting fronthaul-only BSS");
@ -2988,6 +3001,8 @@ static void wpa_supplicant_event_assoc(struct wpa_supplicant *wpa_s,
}
}
multi_ap_set_4addr_mode(wpa_s);
if (wpa_s->conf->ap_scan == 1 &&
wpa_s->drv_flags & WPA_DRIVER_FLAGS_BSS_SELECTION) {
if (wpa_supplicant_assoc_update_ie(wpa_s) < 0 && new_bss)

View file

@ -2091,6 +2091,7 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
else
rand_style = ssid->mac_addr;
wpa_s->multi_ap_ie = 0;
wmm_ac_clear_saved_tspecs(wpa_s);
wpa_s->reassoc_same_bss = 0;
wpa_s->reassoc_same_ess = 0;

View file

@ -1287,6 +1287,9 @@ struct wpa_supplicant {
unsigned int enabled_4addr_mode:1;
unsigned int multi_bss_support:1;
unsigned int drv_authorized_port:1;
unsigned int multi_ap_ie:1;
unsigned int multi_ap_backhaul:1;
unsigned int multi_ap_fronthaul:1;
};