aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/interworking.c
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2013-11-06 21:20:27 (GMT)
committerJouni Malinen <j@w1.fi>2013-11-06 22:12:30 (GMT)
commitd28f4e44f10a8549d969e5434f7d4d16f462dfcc (patch)
tree828f0d3b86392e2e8a81ab4847ae83b7ee336b3e /wpa_supplicant/interworking.c
parentdd6f538ea59e0cfb3da0c86631835fc83bef9c43 (diff)
downloadhostap-d28f4e44f10a8549d969e5434f7d4d16f462dfcc.zip
hostap-d28f4e44f10a8549d969e5434f7d4d16f462dfcc.tar.gz
hostap-d28f4e44f10a8549d969e5434f7d4d16f462dfcc.tar.bz2
Interworking: Do not reconnect if already connected
If we are already connected to the selected AP with a network block that was created based on the selected credential, do not force a reconnection or network block update. Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
Diffstat (limited to 'wpa_supplicant/interworking.c')
-rw-r--r--wpa_supplicant/interworking.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/wpa_supplicant/interworking.c b/wpa_supplicant/interworking.c
index 8667221..22e28a2 100644
--- a/wpa_supplicant/interworking.c
+++ b/wpa_supplicant/interworking.c
@@ -750,6 +750,26 @@ static int set_root_nai(struct wpa_ssid *ssid, const char *imsi, char prefix)
#endif /* INTERWORKING_3GPP */
+static int already_connected(struct wpa_supplicant *wpa_s,
+ struct wpa_cred *cred, struct wpa_bss *bss)
+{
+ struct wpa_ssid *ssid;
+
+ if (wpa_s->wpa_state < WPA_ASSOCIATED || wpa_s->current_ssid == NULL)
+ return 0;
+
+ ssid = wpa_s->current_ssid;
+ if (ssid->parent_cred != cred)
+ return 0;
+
+ if (ssid->ssid_len != bss->ssid_len ||
+ os_memcmp(ssid->ssid, bss->ssid, bss->ssid_len) != 0)
+ return 0;
+
+ return 1;
+}
+
+
static int interworking_set_hs20_params(struct wpa_supplicant *wpa_s,
struct wpa_ssid *ssid)
{
@@ -785,6 +805,12 @@ static int interworking_connect_3gpp(struct wpa_supplicant *wpa_s,
wpa_printf(MSG_DEBUG, "Interworking: Connect with " MACSTR " (3GPP)",
MAC2STR(bss->bssid));
+ if (already_connected(wpa_s, cred, bss)) {
+ wpa_msg(wpa_s, MSG_INFO, INTERWORKING_ALREADY_CONNECTED MACSTR,
+ MAC2STR(bss->bssid));
+ return 0;
+ }
+
ssid = wpa_config_add_network(wpa_s->conf);
if (ssid == NULL)
return -1;
@@ -1144,6 +1170,12 @@ static int interworking_connect_roaming_consortium(
wpa_printf(MSG_DEBUG, "Interworking: Connect with " MACSTR " based on "
"roaming consortium match", MAC2STR(bss->bssid));
+ if (already_connected(wpa_s, cred, bss)) {
+ wpa_msg(wpa_s, MSG_INFO, INTERWORKING_ALREADY_CONNECTED MACSTR,
+ MAC2STR(bss->bssid));
+ return 0;
+ }
+
ssid = wpa_config_add_network(wpa_s->conf);
if (ssid == NULL)
return -1;
@@ -1279,6 +1311,13 @@ int interworking_connect(struct wpa_supplicant *wpa_s, struct wpa_bss *bss)
wpa_printf(MSG_DEBUG, "Interworking: Connect with " MACSTR,
MAC2STR(bss->bssid));
+ if (already_connected(wpa_s, cred, bss)) {
+ wpa_msg(wpa_s, MSG_INFO, INTERWORKING_ALREADY_CONNECTED MACSTR,
+ MAC2STR(bss->bssid));
+ nai_realm_free(realm, count);
+ return 0;
+ }
+
ssid = wpa_config_add_network(wpa_s->conf);
if (ssid == NULL) {
nai_realm_free(realm, count);