]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Interworking: Share ANQP data within homogenous ESS
authorJouni Malinen <jouni@qca.qualcomm.com>
Tue, 4 Sep 2012 14:22:42 +0000 (17:22 +0300)
committerJouni Malinen <j@w1.fi>
Tue, 4 Sep 2012 14:22:42 +0000 (17:22 +0300)
If two BSS entries have the same HESSID and SSID, share the fetched ANQP
information between these BSS entries to save memory and GAS/ANQP
operations.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

wpa_supplicant/interworking.c

index 8cf9244b08fe348d95c53312e7a5da46511b0571..b362bcba3a2187d9ad64f4eaaf6427a9a0feeee3 100644 (file)
@@ -1590,6 +1590,38 @@ static void interworking_select_network(struct wpa_supplicant *wpa_s)
 }
 
 
+static struct wpa_bss_anqp *
+interworking_match_anqp_info(struct wpa_supplicant *wpa_s, struct wpa_bss *bss)
+{
+       struct wpa_bss *other;
+
+       if (is_zero_ether_addr(bss->hessid))
+               return NULL; /* Cannot be in the same homegenous ESS */
+
+       dl_list_for_each(other, &wpa_s->bss, struct wpa_bss, list) {
+               if (other == bss)
+                       continue;
+               if (other->anqp == NULL)
+                       continue;
+               if (!(other->flags & WPA_BSS_ANQP_FETCH_TRIED))
+                       continue;
+               if (os_memcmp(bss->hessid, other->hessid, ETH_ALEN) != 0)
+                       continue;
+               if (bss->ssid_len != other->ssid_len ||
+                   os_memcmp(bss->ssid, other->ssid, bss->ssid_len) != 0)
+                       continue;
+
+               wpa_printf(MSG_DEBUG, "Interworking: Share ANQP data with "
+                          "already fetched BSSID " MACSTR " and " MACSTR,
+                          MAC2STR(other->bssid), MAC2STR(bss->bssid));
+               other->anqp->users++;
+               return other->anqp;
+       }
+
+       return NULL;
+}
+
+
 static void interworking_next_anqp_fetch(struct wpa_supplicant *wpa_s)
 {
        struct wpa_bss *bss;
@@ -1608,6 +1640,12 @@ static void interworking_next_anqp_fetch(struct wpa_supplicant *wpa_s)
 
                if (!(bss->flags & WPA_BSS_ANQP_FETCH_TRIED)) {
                        if (bss->anqp == NULL) {
+                               bss->anqp = interworking_match_anqp_info(wpa_s,
+                                                                        bss);
+                               if (bss->anqp) {
+                                       /* Shared data already fetched */
+                                       continue;
+                               }
                                bss->anqp = wpa_bss_anqp_alloc();
                                if (bss->anqp == NULL)
                                        break;