]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Split nl80211_check_bss_status() into a separate function
authorJouni Malinen <jouni@qca.qualcomm.com>
Fri, 2 Dec 2016 18:54:49 +0000 (20:54 +0200)
committerJouni Malinen <j@w1.fi>
Fri, 2 Dec 2016 18:54:49 +0000 (20:54 +0200)
This allows a single scan result to be checked at a time. This is a step
towards optimizing scan result fetching without having to allocate
memory for all entries at the same time.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
src/drivers/driver_nl80211_scan.c

index b46c7f1b3a971c40d5c374f3591631f0a2509098..610bbb5a87b6f2b93917dc5a534cbcb7b2c31a33 100644 (file)
@@ -819,37 +819,37 @@ static void clear_state_mismatch(struct wpa_driver_nl80211_data *drv,
 }
 
 
+static void nl80211_check_bss_status(struct wpa_driver_nl80211_data *drv,
+                                    struct wpa_scan_res *r)
+{
+       if (!(r->flags & WPA_SCAN_ASSOCIATED))
+               return;
+
+       wpa_printf(MSG_DEBUG, "nl80211: Scan results indicate BSS status with "
+                  MACSTR " as associated", MAC2STR(r->bssid));
+       if (is_sta_interface(drv->nlmode) && !drv->associated) {
+               wpa_printf(MSG_DEBUG,
+                          "nl80211: Local state (not associated) does not match with BSS state");
+               clear_state_mismatch(drv, r->bssid);
+       } else if (is_sta_interface(drv->nlmode) &&
+                  os_memcmp(drv->bssid, r->bssid, ETH_ALEN) != 0) {
+               wpa_printf(MSG_DEBUG,
+                          "nl80211: Local state (associated with " MACSTR
+                          ") does not match with BSS state",
+                          MAC2STR(drv->bssid));
+               clear_state_mismatch(drv, r->bssid);
+               clear_state_mismatch(drv, drv->bssid);
+       }
+}
+
+
 static void wpa_driver_nl80211_check_bss_status(
        struct wpa_driver_nl80211_data *drv, struct wpa_scan_results *res)
 {
        size_t i;
 
-       for (i = 0; i < res->num; i++) {
-               struct wpa_scan_res *r = res->res[i];
-
-               if (r->flags & WPA_SCAN_ASSOCIATED) {
-                       wpa_printf(MSG_DEBUG, "nl80211: Scan results "
-                                  "indicate BSS status with " MACSTR
-                                  " as associated",
-                                  MAC2STR(r->bssid));
-                       if (is_sta_interface(drv->nlmode) &&
-                           !drv->associated) {
-                               wpa_printf(MSG_DEBUG, "nl80211: Local state "
-                                          "(not associated) does not match "
-                                          "with BSS state");
-                               clear_state_mismatch(drv, r->bssid);
-                       } else if (is_sta_interface(drv->nlmode) &&
-                                  os_memcmp(drv->bssid, r->bssid, ETH_ALEN) !=
-                                  0) {
-                               wpa_printf(MSG_DEBUG, "nl80211: Local state "
-                                          "(associated with " MACSTR ") does "
-                                          "not match with BSS state",
-                                          MAC2STR(drv->bssid));
-                               clear_state_mismatch(drv, r->bssid);
-                               clear_state_mismatch(drv, drv->bssid);
-                       }
-               }
-       }
+       for (i = 0; i < res->num; i++)
+               nl80211_check_bss_status(drv, res->res[i]);
 }