path: root/wpa_supplicant/interworking.c
diff options
authorJouni Malinen <jouni@qca.qualcomm.com>2014-02-27 12:06:23 (GMT)
committerJouni Malinen <j@w1.fi>2014-02-27 12:06:23 (GMT)
commitb7fb98f0728934467fced4d41af08343574dde3f (patch)
tree69966f26b5b5263e559ed90d926fa9cc15476598 /wpa_supplicant/interworking.c
parent7c373ac267c3c1f91c1552c0191d2e42850b7a0c (diff)
Interworking: Fix already-connected check to verify network priority
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>
Diffstat (limited to 'wpa_supplicant/interworking.c')
1 files changed, 7 insertions, 1 deletions
diff --git a/wpa_supplicant/interworking.c b/wpa_supplicant/interworking.c
index abf5dee..42fefb6 100644
--- a/wpa_supplicant/interworking.c
+++ b/wpa_supplicant/interworking.c
@@ -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;