MBO: Expire non-matching bss_tmp_disallowed entries as part of check
This makes wpa_is_bss_tmp_disallowed() expire old entries from the bss_tmp_disallowed list even if they do not match the BSSID that is being searched for. This allows the list to be kept at shorter length to speed up operations and minimize memory use in cases where the previously disabled BSS is not in radio range anymore. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
f4c74e1360
commit
d010048cf7
1 changed files with 19 additions and 14 deletions
|
@ -6373,25 +6373,30 @@ void wpa_bss_tmp_disallow(struct wpa_supplicant *wpa_s, const u8 *bssid,
|
|||
|
||||
int wpa_is_bss_tmp_disallowed(struct wpa_supplicant *wpa_s, const u8 *bssid)
|
||||
{
|
||||
struct wpa_bss_tmp_disallowed *bss;
|
||||
struct wpa_bss_tmp_disallowed *bss = NULL, *tmp, *prev;
|
||||
struct os_reltime now, age;
|
||||
|
||||
os_get_reltime(&now);
|
||||
|
||||
bss = wpas_get_disallowed_bss(wpa_s, bssid);
|
||||
dl_list_for_each_safe(tmp, prev, &wpa_s->bss_tmp_disallowed,
|
||||
struct wpa_bss_tmp_disallowed, list) {
|
||||
if (!os_reltime_before(&now, &tmp->disallowed_until)) {
|
||||
/* This BSS is not disallowed anymore */
|
||||
dl_list_del(&tmp->list);
|
||||
os_free(tmp);
|
||||
continue;
|
||||
}
|
||||
if (os_memcmp(bssid, tmp->bssid, ETH_ALEN) == 0) {
|
||||
bss = tmp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!bss)
|
||||
return 0;
|
||||
|
||||
if (os_reltime_before(&now, &bss->disallowed_until)) {
|
||||
os_reltime_sub(&bss->disallowed_until, &now, &age);
|
||||
wpa_printf(MSG_DEBUG,
|
||||
"BSS " MACSTR " disabled for %ld.%0ld seconds",
|
||||
MAC2STR(bss->bssid), age.sec, age.usec);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* This BSS is not disallowed anymore */
|
||||
dl_list_del(&bss->list);
|
||||
os_free(bss);
|
||||
return 0;
|
||||
os_reltime_sub(&bss->disallowed_until, &now, &age);
|
||||
wpa_printf(MSG_DEBUG,
|
||||
"BSS " MACSTR " disabled for %ld.%0ld seconds",
|
||||
MAC2STR(bss->bssid), age.sec, age.usec);
|
||||
return 1;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue