diff options
| author | Jouni Malinen <jouni@qca.qualcomm.com> | 2013-11-06 23:32:43 +0200 |
|---|---|---|
| committer | Naresh Jayaram <njayar@codeaurora.org> | 2013-11-13 20:26:57 +0530 |
| commit | 53a2fe54c4a75b560af0dfba4768067d73aa6580 (patch) | |
| tree | e9c7615f06125cae4f2ce2b032c2e5569c95b70a | |
| parent | e14feed81d12a0130e605c2815a30271fd9aa4e3 (diff) | |
| download | android_external_wpa_supplicant_8-53a2fe54c4a75b560af0dfba4768067d73aa6580.tar.gz android_external_wpa_supplicant_8-53a2fe54c4a75b560af0dfba4768067d73aa6580.tar.bz2 android_external_wpa_supplicant_8-53a2fe54c4a75b560af0dfba4768067d73aa6580.zip | |
Interworking: Avoid duplicated network blocks
Do not add multiple network blocks for the same network from a single
credential. INTERWORKING_CONNECT used to generate a new network block
for each instance regardless of what network blocks have already been
configured. While this allows the connection to go through, it is not
efficient to leave behind potentially large number of network blocks
with the same contents (or worse, changed contents). Address this by
removing an older network block for the same credential before adding a
new one.
Git-commit: 6ede8a7e4d1d4f85d10287be9f399b17a50e1d9f
Git-repo : git://w1.fi/srv/git/hostap.git
CRs-fixed: 574574
Change-Id: I448768707406c1b747536ea46d7bb20999c5d526
Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
| -rw-r--r-- | wpa_supplicant/interworking.c | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/wpa_supplicant/interworking.c b/wpa_supplicant/interworking.c index a9af8b42..d5d39361 100644 --- a/wpa_supplicant/interworking.c +++ b/wpa_supplicant/interworking.c @@ -1,6 +1,6 @@ /* * Interworking (IEEE 802.11u) - * Copyright (c) 2011-2012, Qualcomm Atheros, Inc. + * Copyright (c) 2011-2013, Qualcomm Atheros, Inc. * * This software may be distributed under the terms of the BSD license. * See README for more details. @@ -19,6 +19,7 @@ #include "eap_peer/eap.h" #include "eap_peer/eap_methods.h" #include "eapol_supp/eapol_supp_sm.h" +#include "rsn_supp/wpa.h" #include "wpa_supplicant_i.h" #include "config.h" #include "config_ssid.h" @@ -768,6 +769,39 @@ static int already_connected(struct wpa_supplicant *wpa_s, } +static void remove_duplicate_network(struct wpa_supplicant *wpa_s, + struct wpa_cred *cred, + struct wpa_bss *bss) +{ + struct wpa_ssid *ssid; + + for (ssid = wpa_s->conf->ssid; ssid; ssid = ssid->next) { + if (ssid->parent_cred != cred) + continue; + if (ssid->ssid_len != bss->ssid_len || + os_memcmp(ssid->ssid, bss->ssid, bss->ssid_len) != 0) + continue; + + break; + } + + if (ssid == NULL) + return; + + wpa_printf(MSG_DEBUG, "Interworking: Remove duplicate network entry for the same credential"); + + if (ssid == wpa_s->current_ssid) { + wpa_sm_set_config(wpa_s->wpa, NULL); + eapol_sm_notify_config(wpa_s->eapol, NULL, NULL); + wpa_supplicant_deauthenticate(wpa_s, + WLAN_REASON_DEAUTH_LEAVING); + } + + wpas_notify_network_removed(wpa_s, ssid); + wpa_config_remove_network(wpa_s->conf, ssid->id); +} + + static int interworking_set_hs20_params(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid) { @@ -809,6 +843,8 @@ static int interworking_connect_3gpp(struct wpa_supplicant *wpa_s, return 0; } + remove_duplicate_network(wpa_s, cred, bss); + ssid = wpa_config_add_network(wpa_s->conf); if (ssid == NULL) return -1; @@ -1146,6 +1182,8 @@ static int interworking_connect_roaming_consortium( return 0; } + remove_duplicate_network(wpa_s, cred, bss); + ssid = wpa_config_add_network(wpa_s->conf); if (ssid == NULL) return -1; @@ -1288,6 +1326,8 @@ int interworking_connect(struct wpa_supplicant *wpa_s, struct wpa_bss *bss) return 0; } + remove_duplicate_network(wpa_s, cred, bss); + ssid = wpa_config_add_network(wpa_s->conf); if (ssid == NULL) { nai_realm_free(realm, count); |
