WNM: Lower rankings of current AP if disassociation imminent bit set

If the current AP advertises disassociation imminent, move it to the
back of the candidate list so we don't select it again while other
candidates are available.

Signed-off-by: Po-Hao Huang <phhuang@realtek.com>
This commit is contained in:
Po-Hao Huang 2023-06-09 17:26:43 +08:00 committed by Jouni Malinen
parent 3242793cb8
commit 0aa44ccf82
2 changed files with 12 additions and 2 deletions

View file

@ -1207,6 +1207,11 @@ static int cand_pref_compar(const void *a, const void *b)
const struct neighbor_report *aa = a;
const struct neighbor_report *bb = b;
if (aa->disassoc_imminent && !bb->disassoc_imminent)
return 1;
if (bb->disassoc_imminent && !aa->disassoc_imminent)
return -1;
if (!aa->preference_present && !bb->preference_present)
return 0;
if (!aa->preference_present)
@ -1485,8 +1490,6 @@ static void ieee802_11_rx_bss_trans_mgmt_req(struct wpa_supplicant *wpa_s,
wpa_msg(wpa_s, MSG_INFO, "WNM: Disassociation Imminent - "
"Disassociation Timer %u", wpa_s->wnm_dissoc_timer);
if (wpa_s->wnm_dissoc_timer && !wpa_s->scanning) {
/* TODO: mark current BSS less preferred for
* selection */
wpa_printf(MSG_DEBUG, "Trying to find another BSS");
wpa_supplicant_req_scan(wpa_s, 0, 0);
}
@ -1526,6 +1529,12 @@ static void ieee802_11_rx_bss_trans_mgmt_req(struct wpa_supplicant *wpa_s,
rep = &wpa_s->wnm_neighbor_report_elements[
wpa_s->wnm_num_neighbor_report];
wnm_parse_neighbor_report(wpa_s, pos, len, rep);
if ((wpa_s->wnm_mode &
WNM_BSS_TM_REQ_DISASSOC_IMMINENT) &&
os_memcmp(rep->bssid, wpa_s->bssid,
ETH_ALEN) == 0)
rep->disassoc_imminent = 1;
wpa_s->wnm_num_neighbor_report++;
#ifdef CONFIG_MBO
if (wpa_s->wnm_mbo_trans_reason_present &&

View file

@ -37,6 +37,7 @@ struct neighbor_report {
u32 distance; /* valid if bearing_present=1 */
u64 bss_term_tsf; /* valid if bss_term_present=1 */
u16 bss_term_dur; /* valid if bss_term_present=1 */
unsigned int disassoc_imminent:1;
unsigned int preference_present:1;
unsigned int tsf_present:1;
unsigned int country_present:1;