aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/interworking.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2015-02-08 14:56:04 (GMT)
committerJouni Malinen <j@w1.fi>2015-02-08 20:49:58 (GMT)
commitf91a512f1f4964316ab9f00bfc7c70cb1986ff5d (patch)
tree046bafcd8bb9df77394c5a8b8dbe8375eeb84688 /wpa_supplicant/interworking.c
parentc612ae97a419e55bb3e815f68376a0d78c871ccf (diff)
downloadhostap-f91a512f1f4964316ab9f00bfc7c70cb1986ff5d.zip
hostap-f91a512f1f4964316ab9f00bfc7c70cb1986ff5d.tar.gz
hostap-f91a512f1f4964316ab9f00bfc7c70cb1986ff5d.tar.bz2
Add INTERWORKING_ADD_NETWORK command
This can be used to provide more control to upper layers on network blocks generated as part of Interworking network selection. INTERWORKING_ADD_NETWORK behaves otherwise identically to INTERWORKING_CONNECT, but it does not request a new connection after having added the network block and it returns the network id of the added network. INTERWORKING_ADD_NETWORK followed by REASSOCIATE would behave more or less identically to INTERWORKING_CONNECT, but this allows the created network profile to be modified, if desired, and/or stored externally. SELECT_NETWORK can also be used with the network id returned from INTERWORKING_ADD_NETWORK to enforce that specific network profile to be used for the next connection (though, it should be noted that this behavior may not meet all Hotspot 2.0 requirements if there were other enabled networks that could have higher priority). Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'wpa_supplicant/interworking.c')
-rw-r--r--wpa_supplicant/interworking.c38
1 files changed, 22 insertions, 16 deletions
diff --git a/wpa_supplicant/interworking.c b/wpa_supplicant/interworking.c
index 5b66211..0bffe34 100644
--- a/wpa_supplicant/interworking.c
+++ b/wpa_supplicant/interworking.c
@@ -955,7 +955,7 @@ static int interworking_set_hs20_params(struct wpa_supplicant *wpa_s,
static int interworking_connect_3gpp(struct wpa_supplicant *wpa_s,
struct wpa_cred *cred,
- struct wpa_bss *bss)
+ struct wpa_bss *bss, int only_add)
{
#ifdef INTERWORKING_3GPP
struct wpa_ssid *ssid;
@@ -972,7 +972,7 @@ static int interworking_connect_3gpp(struct wpa_supplicant *wpa_s,
if (already_connected(wpa_s, cred, bss)) {
wpa_msg(wpa_s, MSG_INFO, INTERWORKING_ALREADY_CONNECTED MACSTR,
MAC2STR(bss->bssid));
- return 0;
+ return wpa_s->current_ssid->id;
}
remove_duplicate_network(wpa_s, cred, bss);
@@ -1049,9 +1049,10 @@ static int interworking_connect_3gpp(struct wpa_supplicant *wpa_s,
wpa_s->next_ssid = ssid;
wpa_config_update_prio_list(wpa_s->conf);
- interworking_reconnect(wpa_s);
+ if (!only_add)
+ interworking_reconnect(wpa_s);
- return 0;
+ return ssid->id;
fail:
wpas_notify_network_removed(wpa_s, ssid);
@@ -1499,7 +1500,7 @@ static int interworking_set_eap_params(struct wpa_ssid *ssid,
static int interworking_connect_roaming_consortium(
struct wpa_supplicant *wpa_s, struct wpa_cred *cred,
- struct wpa_bss *bss)
+ struct wpa_bss *bss, int only_add)
{
struct wpa_ssid *ssid;
@@ -1509,7 +1510,7 @@ static int interworking_connect_roaming_consortium(
if (already_connected(wpa_s, cred, bss)) {
wpa_msg(wpa_s, MSG_INFO, INTERWORKING_ALREADY_CONNECTED MACSTR,
MAC2STR(bss->bssid));
- return 0;
+ return wpa_s->current_ssid->id;
}
remove_duplicate_network(wpa_s, cred, bss);
@@ -1545,9 +1546,10 @@ static int interworking_connect_roaming_consortium(
wpa_s->next_ssid = ssid;
wpa_config_update_prio_list(wpa_s->conf);
- interworking_reconnect(wpa_s);
+ if (!only_add)
+ interworking_reconnect(wpa_s);
- return 0;
+ return ssid->id;
fail:
wpas_notify_network_removed(wpa_s, ssid);
@@ -1557,7 +1559,8 @@ fail:
static int interworking_connect_helper(struct wpa_supplicant *wpa_s,
- struct wpa_bss *bss, int allow_excluded)
+ struct wpa_bss *bss, int allow_excluded,
+ int only_add)
{
struct wpa_cred *cred, *cred_rc, *cred_3gpp;
struct wpa_ssid *ssid;
@@ -1659,11 +1662,12 @@ static int interworking_connect_helper(struct wpa_supplicant *wpa_s,
(cred == NULL || cred_prio_cmp(cred_rc, cred) >= 0) &&
(cred_3gpp == NULL || cred_prio_cmp(cred_rc, cred_3gpp) >= 0))
return interworking_connect_roaming_consortium(wpa_s, cred_rc,
- bss);
+ bss, only_add);
if (cred_3gpp &&
(cred == NULL || cred_prio_cmp(cred_3gpp, cred) >= 0)) {
- return interworking_connect_3gpp(wpa_s, cred_3gpp, bss);
+ return interworking_connect_3gpp(wpa_s, cred_3gpp, bss,
+ only_add);
}
if (cred == NULL) {
@@ -1801,9 +1805,10 @@ static int interworking_connect_helper(struct wpa_supplicant *wpa_s,
wpa_s->next_ssid = ssid;
wpa_config_update_prio_list(wpa_s->conf);
- interworking_reconnect(wpa_s);
+ if (!only_add)
+ interworking_reconnect(wpa_s);
- return 0;
+ return ssid->id;
fail:
wpas_notify_network_removed(wpa_s, ssid);
@@ -1813,9 +1818,10 @@ fail:
}
-int interworking_connect(struct wpa_supplicant *wpa_s, struct wpa_bss *bss)
+int interworking_connect(struct wpa_supplicant *wpa_s, struct wpa_bss *bss,
+ int only_add)
{
- return interworking_connect_helper(wpa_s, bss, 1);
+ return interworking_connect_helper(wpa_s, bss, 1, only_add);
}
@@ -2495,7 +2501,7 @@ static void interworking_select_network(struct wpa_supplicant *wpa_s)
MAC2STR(selected->bssid));
wpa_msg(wpa_s, MSG_INFO, INTERWORKING_SELECTED MACSTR,
MAC2STR(selected->bssid));
- interworking_connect(wpa_s, selected);
+ interworking_connect(wpa_s, selected, 0);
}
}