From c575904761b374e3738120580617c4a83a73e9f7 Mon Sep 17 00:00:00 2001 From: Sreeramya Soratkal Date: Mon, 12 Oct 2020 16:12:14 +0530 Subject: [PATCH] P2P: Consider BSS entry pending for P2P joining as a known BSS Consider the BSS entry that is pending for the P2P group join operation also as a known network along with the existing configured networks. This prevents removal of the BSS entry that is still in the process of P2P join operation from the BSS table when the number of entries exceed bss_max_count. Signed-off-by: Sreeramya Soratkal --- wpa_supplicant/bss.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/wpa_supplicant/bss.c b/wpa_supplicant/bss.c index 127f43e5e..17c5a4e98 100644 --- a/wpa_supplicant/bss.c +++ b/wpa_supplicant/bss.c @@ -351,10 +351,32 @@ static int wpa_bss_is_wps_candidate(struct wpa_supplicant *wpa_s, } +static bool is_p2p_pending_bss(struct wpa_supplicant *wpa_s, + struct wpa_bss *bss) +{ +#ifdef CONFIG_P2P + u8 addr[ETH_ALEN]; + + if (os_memcmp(bss->bssid, wpa_s->pending_join_iface_addr, + ETH_ALEN) == 0) + return true; + if (!is_zero_ether_addr(wpa_s->pending_join_dev_addr) && + p2p_parse_dev_addr((const u8 *) (bss + 1), bss->ie_len, + addr) == 0 && + os_memcmp(addr, wpa_s->pending_join_dev_addr, ETH_ALEN) == 0) + return true; +#endif /* CONFIG_P2P */ + return false; +} + + static int wpa_bss_known(struct wpa_supplicant *wpa_s, struct wpa_bss *bss) { struct wpa_ssid *ssid; + if (is_p2p_pending_bss(wpa_s, bss)) + return 1; + for (ssid = wpa_s->conf->ssid; ssid; ssid = ssid->next) { if (ssid->ssid == NULL || ssid->ssid_len == 0) continue;