aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/wps_supplicant.c
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2014-02-03 08:54:21 (GMT)
committerJouni Malinen <j@w1.fi>2014-02-04 11:23:35 (GMT)
commit0b5ff2ae12de29445e7a61f94f654f8c7e15c2e6 (patch)
treea828b8a173ac686568501015a5416580b905c37c /wpa_supplicant/wps_supplicant.c
parent1536cb5756d35bc1e1d79600f33fae532fd84e40 (diff)
downloadhostap-0b5ff2ae12de29445e7a61f94f654f8c7e15c2e6.zip
hostap-0b5ff2ae12de29445e7a61f94f654f8c7e15c2e6.tar.gz
hostap-0b5ff2ae12de29445e7a61f94f654f8c7e15c2e6.tar.bz2
WPS: Remove unused Credential AP Channel processing
Commit bd3a3737672aaf6eb50dba2b8caa3941c8df42e9 added a mechanism to use AP Channel attribute from within a Credential attribute to optimize scans. However, this design is not actually used with the WPS NFC use cases. With configuration token, the AP Channel attribute is in the same container with the Credential attribute (and that was also handled in the previous implementation). With connection handover, AP Channel information is outside the Credential attribute as well. Simplify implementation by removing the AP Channel within Credential case. This allows wpas_wps_use_cred() to get the AP Channel from the container instead of having to find this during credential iteration. Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
Diffstat (limited to 'wpa_supplicant/wps_supplicant.c')
-rw-r--r--wpa_supplicant/wps_supplicant.c28
1 files changed, 9 insertions, 19 deletions
diff --git a/wpa_supplicant/wps_supplicant.c b/wpa_supplicant/wps_supplicant.c
index 537aac3..3c14bb7 100644
--- a/wpa_supplicant/wps_supplicant.c
+++ b/wpa_supplicant/wps_supplicant.c
@@ -489,9 +489,6 @@ static int wpa_supplicant_wps_cred(void *ctx,
wpas_wps_security_workaround(wpa_s, ssid, cred);
- if (cred->ap_channel)
- wpa_s->wps_ap_channel = cred->ap_channel;
-
wpas_wps_remove_dup_network(wpa_s, ssid);
#ifndef CONFIG_NO_CONFIG_WRITE
@@ -2197,8 +2194,6 @@ int wpas_wps_start_nfc(struct wpa_supplicant *wpa_s, const u8 *go_dev_addr,
static int wpas_wps_use_cred(struct wpa_supplicant *wpa_s,
struct wps_parse_attr *attr)
{
- wpa_s->wps_ap_channel = 0;
-
/*
* Disable existing networks temporarily to allow the newly learned
* credential to be preferred. Enable the temporarily disabled networks
@@ -2214,18 +2209,8 @@ static int wpas_wps_use_cred(struct wpa_supplicant *wpa_s,
if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED)
return 0;
- if (!wpa_s->wps_ap_channel && attr->ap_channel) {
- wpa_s->wps_ap_channel = WPA_GET_BE16(attr->ap_channel);
- wpa_printf(MSG_DEBUG, "WPS: Credential container indicated AP Channel %d",
- wpa_s->wps_ap_channel);
- }
-
- wpa_printf(MSG_DEBUG, "WPS: Request reconnection with new network "
- "based on the received credential added");
- wpa_s->normal_scans = 0;
- wpa_supplicant_reinit_autoscan(wpa_s);
- if (wpa_s->wps_ap_channel) {
- u16 chan = wpa_s->wps_ap_channel;
+ if (attr->ap_channel) {
+ u16 chan = WPA_GET_BE16(attr->ap_channel);
int freq = 0;
if (chan >= 1 && chan <= 13)
@@ -2236,12 +2221,17 @@ static int wpas_wps_use_cred(struct wpa_supplicant *wpa_s,
freq = 5000 + 5 * chan;
if (freq) {
- wpa_printf(MSG_DEBUG, "WPS: Credential indicated "
- "AP channel %u -> %u MHz", chan, freq);
+ wpa_printf(MSG_DEBUG, "WPS: Credential container indicated AP channel %u -> %u MHz",
+ chan, freq);
wpa_s->after_wps = 5;
wpa_s->wps_freq = freq;
}
}
+
+ wpa_printf(MSG_DEBUG, "WPS: Request reconnection with new network "
+ "based on the received credential added");
+ wpa_s->normal_scans = 0;
+ wpa_supplicant_reinit_autoscan(wpa_s);
wpa_s->disconnected = 0;
wpa_s->reassociate = 1;