[PATCH] interworking: Allow user to specify key-mgmt, proto, pairwise defaults.
greearb at candelatech.com
greearb
Thu May 8 12:31:13 PDT 2014
From: Ben Greear <greearb at candelatech.com>
This enables inteworking + .11r configs.
Signed-off-by: Ben Greear <greearb at candelatech.com>
---
NOTE: This sits on top of my entire patch set, though I think the
main prereq is the 7/15 patch I posted about earlier today.
Entire patch set found here:
https://github.com/greearb/hostap-ct/commits/master
wpa_supplicant/config.c | 13 ++++++++++++-
wpa_supplicant/config.h | 2 +-
wpa_supplicant/events.c | 3 ++-
wpa_supplicant/interworking.c | 27 ++++++++++++++++++---------
4 files changed, 33 insertions(+), 12 deletions(-)
diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c
index b90720e..284c6d5 100644
--- a/wpa_supplicant/config.c
+++ b/wpa_supplicant/config.c
@@ -2150,14 +2150,17 @@ int wpa_config_remove_network(struct wpa_config *config, int id)
* disable_ht40=0
* etc.
* If no ssid is found, no action is taken.
+ * Returns: 1 if found user-default section, 0 otherwise.
*/
-void wpa_config_set_user_network_defaults(struct wpa_config *config, struct wpa_ssid *ssid)
+int wpa_config_set_user_network_defaults(struct wpa_config *config, struct wpa_ssid *ssid)
{
struct wpa_ssid *s = config->ssid;
int i;
+ int rv = 0;
while (s) {
if (s->interworking_defaults) {
+ rv = 1;
os_free(ssid->scan_freq);
ssid->scan_freq = NULL;
int_array_concat(&ssid->scan_freq, s->scan_freq);
@@ -2167,6 +2170,13 @@ void wpa_config_set_user_network_defaults(struct wpa_config *config, struct wpa_
int_array_concat(&ssid->freq_list, s->freq_list);
ssid->bg_scan_period = s->bg_scan_period;
+
+ /* Relates to that set in interworking_set_hs20_params */
+ ssid->pairwise_cipher = s->pairwise_cipher;
+ ssid->group_cipher = s->group_cipher;
+ ssid->key_mgmt = s->key_mgmt;
+ ssid->proto = s->proto;
+
#ifdef CONFIG_HT_OVERRIDES
ssid->disable_ht = s->disable_ht;
ssid->disable_ht40 = s->disable_ht40;
@@ -2208,6 +2218,7 @@ void wpa_config_set_user_network_defaults(struct wpa_config *config, struct wpa_
ssid = ssid->next;
}
}
+ return rv;
} /* wpa_set_user_network_defaults */
/**
diff --git a/wpa_supplicant/config.h b/wpa_supplicant/config.h
index 3e13f68..bda46ed 100644
--- a/wpa_supplicant/config.h
+++ b/wpa_supplicant/config.h
@@ -1046,7 +1046,7 @@ struct wpa_ssid * wpa_config_get_network(struct wpa_config *config, int id);
struct wpa_ssid * wpa_config_add_network(struct wpa_config *config);
int wpa_config_remove_network(struct wpa_config *config, int id);
void wpa_config_set_network_defaults(struct wpa_ssid *ssid);
-void wpa_config_set_user_network_defaults(struct wpa_config *config, struct wpa_ssid *ssid);
+int wpa_config_set_user_network_defaults(struct wpa_config *config, struct wpa_ssid *ssid);
int wpa_config_set(struct wpa_ssid *ssid, const char *var, const char *value,
int line);
int wpa_config_set_quoted(struct wpa_ssid *ssid, const char *var,
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 40b5c47..06436b9 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -466,7 +466,8 @@ static int wpa_supplicant_ssid_bss_match(struct wpa_supplicant *wpa_s,
if (!(ie.key_mgmt & ssid->key_mgmt)) {
wpa_dbg(wpa_s, MSG_DEBUG, " skip RSN IE - key mgmt "
- "mismatch");
+ "mismatch, IE: 0x%x ssid: 0x%x",
+ ie.key_mgmt, ssid->key_mgmt);
break;
}
diff --git a/wpa_supplicant/interworking.c b/wpa_supplicant/interworking.c
index fca6562..56aa925 100644
--- a/wpa_supplicant/interworking.c
+++ b/wpa_supplicant/interworking.c
@@ -935,6 +935,7 @@ static int interworking_connect_3gpp(struct wpa_supplicant *wpa_s,
int eap_type;
int res;
char prefix;
+ int user_defaults;
if (bss->anqp == NULL || bss->anqp->anqp_3gpp == NULL)
return -1;
@@ -957,7 +958,7 @@ static int interworking_connect_3gpp(struct wpa_supplicant *wpa_s,
wpas_notify_network_added(wpa_s, ssid);
wpa_config_set_network_defaults(ssid);
- wpa_config_set_user_network_defaults(wpa_s->conf, ssid);
+ user_defaults = wpa_config_set_user_network_defaults(wpa_s->conf, ssid);
ssid->priority = cred->priority;
ssid->temporary = 1;
ssid->ssid = os_zalloc(bss->ssid_len + 1);
@@ -966,8 +967,10 @@ static int interworking_connect_3gpp(struct wpa_supplicant *wpa_s,
os_memcpy(ssid->ssid, bss->ssid, bss->ssid_len);
ssid->ssid_len = bss->ssid_len;
- if (interworking_set_hs20_params(wpa_s, ssid) < 0)
- goto fail;
+ if (!user_defaults) {
+ if (interworking_set_hs20_params(wpa_s, ssid) < 0)
+ goto fail;
+ }
eap_type = EAP_TYPE_SIM;
if (cred->pcsc && wpa_s->scard && scard_supports_umts(wpa_s->scard))
@@ -1475,6 +1478,7 @@ static int interworking_connect_roaming_consortium(
struct wpa_bss *bss)
{
struct wpa_ssid *ssid;
+ int user_defaults;
wpa_msg(wpa_s, MSG_DEBUG, "Interworking: Connect with " MACSTR " based on "
"roaming consortium match", MAC2STR(bss->bssid));
@@ -1493,7 +1497,7 @@ static int interworking_connect_roaming_consortium(
ssid->parent_cred = cred;
wpas_notify_network_added(wpa_s, ssid);
wpa_config_set_network_defaults(ssid);
- wpa_config_set_user_network_defaults(wpa_s->conf, ssid);
+ user_defaults = wpa_config_set_user_network_defaults(wpa_s->conf, ssid);
ssid->priority = cred->priority;
ssid->temporary = 1;
ssid->ssid = os_zalloc(bss->ssid_len + 1);
@@ -1502,8 +1506,10 @@ static int interworking_connect_roaming_consortium(
os_memcpy(ssid->ssid, bss->ssid, bss->ssid_len);
ssid->ssid_len = bss->ssid_len;
- if (interworking_set_hs20_params(wpa_s, ssid) < 0)
- goto fail;
+ if (!user_defaults) {
+ if (interworking_set_hs20_params(wpa_s, ssid) < 0)
+ goto fail;
+ }
if (cred->eap_method == NULL) {
wpa_msg(wpa_s, MSG_DEBUG, "Interworking: No EAP method set for "
@@ -1540,6 +1546,7 @@ static int interworking_connect_helper(struct wpa_supplicant *wpa_s,
u16 count, i;
char buf[100];
int excluded = 0, *excl = allow_excluded ? &excluded : NULL;
+ int user_defaults;
if (wpa_s->conf->cred == NULL || bss == NULL)
return -1;
@@ -1692,7 +1699,7 @@ static int interworking_connect_helper(struct wpa_supplicant *wpa_s,
ssid->parent_cred = cred;
wpas_notify_network_added(wpa_s, ssid);
wpa_config_set_network_defaults(ssid);
- wpa_config_set_user_network_defaults(wpa_s->conf, ssid);
+ user_defaults = wpa_config_set_user_network_defaults(wpa_s->conf, ssid);
ssid->priority = cred->priority;
ssid->temporary = 1;
ssid->ssid = os_zalloc(bss->ssid_len + 1);
@@ -1701,8 +1708,10 @@ static int interworking_connect_helper(struct wpa_supplicant *wpa_s,
os_memcpy(ssid->ssid, bss->ssid, bss->ssid_len);
ssid->ssid_len = bss->ssid_len;
- if (interworking_set_hs20_params(wpa_s, ssid) < 0)
- goto fail;
+ if (!user_defaults) {
+ if (interworking_set_hs20_params(wpa_s, ssid) < 0)
+ goto fail;
+ }
if (wpa_config_set(ssid, "eap", eap_get_name(EAP_VENDOR_IETF,
eap->method), 0) < 0)
--
1.7.11.7
More information about the Hostap
mailing list