[PATCH] wpa_supplicant: Allow vifs to scan only current channel.
greearb at candelatech.com
greearb
Tue Apr 30 17:16:51 PDT 2013
From: Ben Greear <greearb at candelatech.com>
If a VIF is already associated, then only scan on the associated
frequency if user requests such. This is a big help when using
lots of virtual stations.
Signed-hostap: Ben Greear <greearb at candelatech.com>
---
:100644 100644 28c40a1... 0dd951c... M wpa_supplicant/config.c
:100644 100644 ef95650... 60c6f59... M wpa_supplicant/config.h
:100644 100644 5ed4097... ad0a83a... M wpa_supplicant/scan.c
:100644 100644 6aed57a... 0af8e80... M wpa_supplicant/wpa_supplicant.conf
wpa_supplicant/config.c | 2 ++
wpa_supplicant/config.h | 7 +++++++
wpa_supplicant/scan.c | 17 +++++++++++++++--
wpa_supplicant/wpa_supplicant.conf | 13 +++++++++++++
4 files changed, 37 insertions(+), 2 deletions(-)
diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c
index 28c40a1..0dd951c 100644
--- a/wpa_supplicant/config.c
+++ b/wpa_supplicant/config.c
@@ -2585,6 +2585,7 @@ struct wpa_config * wpa_config_alloc_empty(const char *ctrl_interface,
config->bss_expiration_scan_count = DEFAULT_BSS_EXPIRATION_SCAN_COUNT;
config->max_num_sta = DEFAULT_MAX_NUM_STA;
config->access_network_type = DEFAULT_ACCESS_NETWORK_TYPE;
+ config->scan_cur_freq = DEFAULT_SCAN_CUR_FREQ;
config->wmm_ac_params[0] = ac_be;
config->wmm_ac_params[1] = ac_bk;
config->wmm_ac_params[2] = ac_vi;
@@ -3040,6 +3041,7 @@ static const struct global_parse_data global_fields[] = {
{ STR(pcsc_pin), 0 },
{ STR(driver_param), 0 },
{ FUNC(freq_list), 0 },
+ { INT(scan_cur_freq), 0 },
{ INT(dot11RSNAConfigPMKLifetime), 0 },
{ INT(dot11RSNAConfigPMKReauthThreshold), 0 },
{ INT(dot11RSNAConfigSATimeout), 0 },
diff --git a/wpa_supplicant/config.h b/wpa_supplicant/config.h
index ef95650..60c6f59 100644
--- a/wpa_supplicant/config.h
+++ b/wpa_supplicant/config.h
@@ -21,6 +21,7 @@
#define DEFAULT_P2P_INTRA_BSS 1
#define DEFAULT_P2P_GO_MAX_INACTIVITY (5 * 60)
#define DEFAULT_BSS_MAX_COUNT 200
+#define DEFAULT_SCAN_CUR_FREQ 0
#define DEFAULT_BSS_EXPIRATION_AGE 180
#define DEFAULT_BSS_EXPIRATION_SCAN_COUNT 2
#define DEFAULT_MAX_NUM_STA 128
@@ -655,6 +656,12 @@ struct wpa_config {
*/
int *freq_list;
+
+ /* If true, attempt to scan only the current channel if any other
+ * VIFs on this radio are already associated on a particular channel.
+ */
+ int scan_cur_freq;
+
/**
* changed_parameters - Bitmap of changed parameters since last update
*/
diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index 5ed4097..ad0a83a 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -476,6 +476,7 @@ static int non_p2p_network_enabled(struct wpa_supplicant *wpa_s)
return 0;
}
+#endif /* CONFIG_P2P */
/*
* Find the operating frequency of any other virtual interface that is using
@@ -515,8 +516,6 @@ static int shared_vif_oper_freq(struct wpa_supplicant *wpa_s)
return 0;
}
-#endif /* CONFIG_P2P */
-
void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
{
@@ -757,6 +756,20 @@ ssid_list_set:
int_array_concat(¶ms.freqs, wpa_s->conf->freq_list);
}
+ /* Use current associated channel? */
+ if (wpa_s->conf->scan_cur_freq && !params.freqs) {
+ int freq = shared_vif_oper_freq(wpa_s);
+ if (freq > 0) {
+ wpa_dbg(wpa_s, MSG_DEBUG, "Scan only the current "
+ "operating channel (%d MHz) since "
+ "scan_cur_freq is enabled.", freq);
+ params.freqs = os_zalloc(sizeof(int) * 2);
+ if (params.freqs)
+ params.freqs[0] = freq;
+ }
+ }
+
+
params.filter_ssids = wpa_supplicant_build_filter_ssids(
wpa_s->conf, ¶ms.num_filter_ssids);
if (extra_ie) {
diff --git a/wpa_supplicant/wpa_supplicant.conf b/wpa_supplicant/wpa_supplicant.conf
index 6aed57a..0af8e80 100644
--- a/wpa_supplicant/wpa_supplicant.conf
+++ b/wpa_supplicant/wpa_supplicant.conf
@@ -527,6 +527,11 @@ fast_reauth=1
# This can also be set on the outside of the network block. In this case,
# it limits the frequencies that will be scanned.
#
+# scan_cur_freq: Scan current frequency.
+# 0: Scan all available frequencies. (Default)
+# 1: Scan current operating frequency if another VIF on the same radio
+# is already associated.
+#
# bgscan: Background scanning
# wpa_supplicant behavior for background scanning can be specified by
# configuring a bgscan module. These modules are responsible for requesting
@@ -1241,3 +1246,11 @@ freq_list=5180
network={
key_mgmt=NONE
}
+
+
+# Example config file that will scan on existing frequency if
+# another VIF on the same radio is already associated.
+scan_cur_freq=1
+network={
+ key_mgmt=NONE
+}
--
1.7.3.4
More information about the Hostap
mailing list