]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Fix sending ANQP request to an unknown BSS while associated
authorMatti Gottlieb <matti.gottlieb@intel.com>
Tue, 28 Apr 2015 11:01:04 +0000 (14:01 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 3 May 2015 14:32:32 +0000 (17:32 +0300)
While being associated, if an ANQP request is received for a different
AP that doesn't exist in the BSS list, the ANQP request will be sent on
the frequency of the AP that we are currently associated to.

In such a case, it is possible that the ANQP request would be sent on
a channel different than that of the requested AP, potentially delaying
other requests/activities.

Avoid sending the ANQP request to an AP that is not in the BSS list.

Signed-off-by: Matti Gottlieb <matti.gottlieb@intel.com>
wpa_supplicant/hs20_supplicant.c
wpa_supplicant/interworking.c

index 98af5305f12dd7015342024f74225007973ac88e..a1afc85ff9bb693a7eb28d0741ce315fc9fb98ad 100644 (file)
@@ -188,14 +188,16 @@ int hs20_anqp_send_req(struct wpa_supplicant *wpa_s, const u8 *dst, u32 stypes,
        struct wpa_bss *bss;
        int res;
 
-       freq = wpa_s->assoc_freq;
        bss = wpa_bss_get_bssid(wpa_s, dst);
-       if (bss) {
-               wpa_bss_anqp_unshare_alloc(bss);
-               freq = bss->freq;
-       }
-       if (freq <= 0)
+       if (!bss) {
+               wpa_printf(MSG_WARNING,
+                          "ANQP: Cannot send query to unknown BSS "
+                          MACSTR, MAC2STR(dst));
                return -1;
+       }
+
+       wpa_bss_anqp_unshare_alloc(bss);
+       freq = bss->freq;
 
        wpa_printf(MSG_DEBUG, "HS20: ANQP Query Request to " MACSTR " for "
                   "subtypes 0x%x", MAC2STR(dst), stypes);
index 35885ee2a7109c549200bcfaf2e7fc5fd18c2ec1..fd47c179ea4b17af3dbeef1b2a5257971aa37a97 100644 (file)
@@ -2673,14 +2673,16 @@ int anqp_send_req(struct wpa_supplicant *wpa_s, const u8 *dst,
        struct wpa_bss *bss;
        int res;
 
-       freq = wpa_s->assoc_freq;
        bss = wpa_bss_get_bssid(wpa_s, dst);
-       if (bss) {
-               wpa_bss_anqp_unshare_alloc(bss);
-               freq = bss->freq;
-       }
-       if (freq <= 0)
+       if (!bss) {
+               wpa_printf(MSG_WARNING,
+                          "ANQP: Cannot send query to unknown BSS "
+                          MACSTR, MAC2STR(dst));
                return -1;
+       }
+
+       wpa_bss_anqp_unshare_alloc(bss);
+       freq = bss->freq;
 
        wpa_msg(wpa_s, MSG_DEBUG,
                "ANQP: Query Request to " MACSTR " for %u id(s)",