STA: Update scan results when BSS entry with current SSID is not found
wpa_supplicant might use a wrong BSS entry with the SSID different from the current SSID of the current BSS while processing a roam event from the driver when wpa_supplicant has a stale BSS entry with the old SSID and the driver roams to the same BSS after it is restarted with a new SSID. To avoid this, update scan results from the driver when a BSS entry is not found with the current SSID and try to fetch the BSS entry again with the current SSID after this. Also, with this change wpa_supplicant_get_new_bss() itself will update the BSS table and search for the current BSS entry if it is not found in the BSS table. So, remove the BSS table update and search logic from the callers of wpa_supplicant_get_new_bss(). Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
This commit is contained in:
parent
cb5c4e49c7
commit
9a022cdc70
1 changed files with 41 additions and 24 deletions
|
@ -137,6 +137,33 @@ void wpas_network_reenabled(void *eloop_ctx, void *timeout_ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static struct wpa_bss * __wpa_supplicant_get_new_bss(
|
||||||
|
struct wpa_supplicant *wpa_s, const u8 *bssid, const u8 *ssid,
|
||||||
|
size_t ssid_len)
|
||||||
|
{
|
||||||
|
if (ssid && ssid_len > 0)
|
||||||
|
return wpa_bss_get(wpa_s, bssid, ssid, ssid_len);
|
||||||
|
else
|
||||||
|
return wpa_bss_get_bssid(wpa_s, bssid);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static struct wpa_bss * _wpa_supplicant_get_new_bss(
|
||||||
|
struct wpa_supplicant *wpa_s, const u8 *bssid, const u8 *ssid,
|
||||||
|
size_t ssid_len, bool try_update_scan_results)
|
||||||
|
{
|
||||||
|
struct wpa_bss *bss = __wpa_supplicant_get_new_bss(wpa_s, bssid, ssid,
|
||||||
|
ssid_len);
|
||||||
|
|
||||||
|
if (bss || !try_update_scan_results)
|
||||||
|
return bss;
|
||||||
|
|
||||||
|
wpa_supplicant_update_scan_results(wpa_s, bssid);
|
||||||
|
|
||||||
|
return __wpa_supplicant_get_new_bss(wpa_s, bssid, ssid, ssid_len);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static struct wpa_bss * wpa_supplicant_get_new_bss(
|
static struct wpa_bss * wpa_supplicant_get_new_bss(
|
||||||
struct wpa_supplicant *wpa_s, const u8 *bssid)
|
struct wpa_supplicant *wpa_s, const u8 *bssid)
|
||||||
{
|
{
|
||||||
|
@ -144,14 +171,23 @@ static struct wpa_bss * wpa_supplicant_get_new_bss(
|
||||||
struct wpa_ssid *ssid = wpa_s->current_ssid;
|
struct wpa_ssid *ssid = wpa_s->current_ssid;
|
||||||
u8 drv_ssid[SSID_MAX_LEN];
|
u8 drv_ssid[SSID_MAX_LEN];
|
||||||
int res;
|
int res;
|
||||||
|
bool try_update_scan_results = true;
|
||||||
|
|
||||||
res = wpa_drv_get_ssid(wpa_s, drv_ssid);
|
res = wpa_drv_get_ssid(wpa_s, drv_ssid);
|
||||||
if (res > 0)
|
if (res > 0) {
|
||||||
bss = wpa_bss_get(wpa_s, bssid, drv_ssid, res);
|
bss = _wpa_supplicant_get_new_bss(wpa_s, bssid, drv_ssid, res,
|
||||||
if (!bss && ssid && ssid->ssid_len > 0)
|
try_update_scan_results);
|
||||||
bss = wpa_bss_get(wpa_s, bssid, ssid->ssid, ssid->ssid_len);
|
try_update_scan_results = false;
|
||||||
|
}
|
||||||
|
if (!bss && ssid && ssid->ssid_len > 0) {
|
||||||
|
bss = _wpa_supplicant_get_new_bss(wpa_s, bssid, ssid->ssid,
|
||||||
|
ssid->ssid_len,
|
||||||
|
try_update_scan_results);
|
||||||
|
try_update_scan_results = false;
|
||||||
|
}
|
||||||
if (!bss)
|
if (!bss)
|
||||||
bss = wpa_bss_get_bssid(wpa_s, bssid);
|
bss = _wpa_supplicant_get_new_bss(wpa_s, bssid, NULL, 0,
|
||||||
|
try_update_scan_results);
|
||||||
|
|
||||||
return bss;
|
return bss;
|
||||||
}
|
}
|
||||||
|
@ -162,13 +198,6 @@ wpa_supplicant_update_current_bss(struct wpa_supplicant *wpa_s, const u8 *bssid)
|
||||||
{
|
{
|
||||||
struct wpa_bss *bss = wpa_supplicant_get_new_bss(wpa_s, bssid);
|
struct wpa_bss *bss = wpa_supplicant_get_new_bss(wpa_s, bssid);
|
||||||
|
|
||||||
if (!bss) {
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bss)
|
if (bss)
|
||||||
wpa_s->current_bss = bss;
|
wpa_s->current_bss = bss;
|
||||||
|
|
||||||
|
@ -181,11 +210,6 @@ static void wpa_supplicant_update_link_bss(struct wpa_supplicant *wpa_s,
|
||||||
{
|
{
|
||||||
struct wpa_bss *bss = wpa_supplicant_get_new_bss(wpa_s, bssid);
|
struct wpa_bss *bss = wpa_supplicant_get_new_bss(wpa_s, bssid);
|
||||||
|
|
||||||
if (!bss) {
|
|
||||||
wpa_supplicant_update_scan_results(wpa_s, bssid);
|
|
||||||
bss = wpa_supplicant_get_new_bss(wpa_s, bssid);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bss)
|
if (bss)
|
||||||
wpa_s->links[link_id].bss = bss;
|
wpa_s->links[link_id].bss = bss;
|
||||||
}
|
}
|
||||||
|
@ -4053,13 +4077,6 @@ static int wpa_sm_set_ml_info(struct wpa_supplicant *wpa_s)
|
||||||
struct wpa_bss *bss;
|
struct wpa_bss *bss;
|
||||||
|
|
||||||
bss = wpa_supplicant_get_new_bss(wpa_s, drv_mlo.links[i].bssid);
|
bss = wpa_supplicant_get_new_bss(wpa_s, drv_mlo.links[i].bssid);
|
||||||
if (!bss) {
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!bss) {
|
if (!bss) {
|
||||||
wpa_dbg(wpa_s, MSG_INFO,
|
wpa_dbg(wpa_s, MSG_INFO,
|
||||||
"Failed to get MLO link %d BSS", i);
|
"Failed to get MLO link %d BSS", i);
|
||||||
|
|
Loading…
Reference in a new issue