Interworking: Fix already-connected check to verify network priority

Commit d28f4e44f1 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>
This commit is contained in:
Jouni Malinen 2014-02-27 14:06:23 +02:00 committed by Jouni Malinen
parent 7c373ac267
commit b7fb98f072

View 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;
}