@@ -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;
@@ -3039,6 +3040,7 @@ static const struct global_parse_data global_fields[] = {
{ STR(pkcs11_module_path), 0 },
{ STR(pcsc_reader), 0 },
{ STR(pcsc_pin), 0 },
+ { INT(scan_cur_freq), 0 },
{ STR(driver_param), 0 },
{ INT(dot11RSNAConfigPMKLifetime), 0 },
{ INT(dot11RSNAConfigPMKReauthThreshold), 0 },
@@ -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
*/
@@ -945,6 +945,9 @@ static void wpa_config_write_global(FILE *f, struct wpa_config *config)
fprintf(f, "filter_ssids=%d\n", config->filter_ssids);
if (config->max_num_sta != DEFAULT_MAX_NUM_STA)
fprintf(f, "max_num_sta=%u\n", config->max_num_sta);
+ if (config->scan_cur_freq != DEFAULT_SCAN_CUR_FREQ)
+ fprintf(f, "scan_cur_freq=%d\n", config->scan_cur_freq);
+
if (config->disassoc_low_ack)
fprintf(f, "disassoc_low_ack=%u\n", config->disassoc_low_ack);
#ifdef CONFIG_HS20
@@ -481,6 +481,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
@@ -520,8 +521,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) {
@@ -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
+}