]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Interworking: Fix already-connected check to verify network priority
authorJouni Malinen <jouni@qca.qualcomm.com>
Thu, 27 Feb 2014 12:06:23 +0000 (14:06 +0200)
committerJouni Malinen <j@w1.fi>
Thu, 27 Feb 2014 12:06:23 +0000 (14:06 +0200)
Commit d28f4e44f10a8549d969e5434f7d4d16f462dfcc optimized Interworking
network selection in a case where the operation is run while already
connected to the selected network by skipping the reconnection. However,
this did not take into account that a higher priority network may have
shown up in the new scan results.

Fix this by checking whether network selection based on the latest scan
results (the ones from the interworking_select operation) would result
in a network with higher priority being selected. If so, skip the
optimization and force normal network connection (which will select this
newly found higher priority network). This fixes cases where a
non-Hotspot 2.0 network with higher priority (e.g., home network) shows
up while connected to a Hotspot 2.0 network with lower priority.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
wpa_supplicant/interworking.c

index abf5dee1ff1bd462c2da6d557843b394cc6c620d..42fefb6aa170e22724706105e239b983f09bd1e9 100644 (file)
@@ -814,7 +814,8 @@ static int set_root_nai(struct wpa_ssid *ssid, const char *imsi, char prefix)
 static int already_connected(struct wpa_supplicant *wpa_s,
                             struct wpa_cred *cred, struct wpa_bss *bss)
 {
-       struct wpa_ssid *ssid;
+       struct wpa_ssid *ssid, *sel_ssid;
+       struct wpa_bss *selected;
 
        if (wpa_s->wpa_state < WPA_ASSOCIATED || wpa_s->current_ssid == NULL)
                return 0;
@@ -827,6 +828,11 @@ static int already_connected(struct wpa_supplicant *wpa_s,
            os_memcmp(ssid->ssid, bss->ssid, bss->ssid_len) != 0)
                return 0;
 
+       sel_ssid = NULL;
+       selected = wpa_supplicant_pick_network(wpa_s, &sel_ssid);
+       if (selected && sel_ssid && sel_ssid->priority > ssid->priority)
+               return 0; /* higher priority network in scan results */
+
        return 1;
 }