wpa_supplicant: Allow vifs to scan only current channel

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@candelatech.com>
Signed-off-by: Ben Greear <greearb@candelatech.com>
This commit is contained in:
Ben Greear 2013-05-09 12:43:40 +03:00 committed by Jouni Malinen
parent 893a0a558c
commit 6124e858fd
5 changed files with 31 additions and 2 deletions

View file

@ -2584,6 +2584,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;
@ -3105,6 +3106,7 @@ static const struct global_parse_data global_fields[] = {
{ FUNC(ap_vendor_elements), 0 },
{ INT_RANGE(ignore_old_scan_res, 0, 1), 0 },
{ FUNC(freq_list), 0 },
{ INT(scan_cur_freq), 0 },
{ INT(sched_scan_interval), 0 },
};

View file

@ -24,6 +24,7 @@
#define DEFAULT_BSS_EXPIRATION_SCAN_COUNT 2
#define DEFAULT_MAX_NUM_STA 128
#define DEFAULT_ACCESS_NETWORK_TYPE 15
#define DEFAULT_SCAN_CUR_FREQ 0
#include "config_ssid.h"
#include "wps/wps.h"
@ -652,6 +653,14 @@ struct wpa_config {
*/
int *freq_list;
/**
* scan_cur_freq - Whether to scan only the current channel
*
* 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
*/

View file

@ -1025,6 +1025,8 @@ static void wpa_config_write_global(FILE *f, struct wpa_config *config)
}
fprintf(f, "\n");
}
if (config->scan_cur_freq != DEFAULT_SCAN_CUR_FREQ)
fprintf(f, "scan_cur_freq=%d\n", config->scan_cur_freq);
if (config->sched_scan_interval)
fprintf(f, "sched_scan_interval=%u\n",

View file

@ -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 */
static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
{
@ -756,6 +755,19 @@ ssid_list_set:
int_array_concat(&params.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, &params.num_filter_ssids);
if (extra_ie) {

View file

@ -310,6 +310,10 @@ fast_reauth=1
# allowing it to update the internal BSS table.
#ignore_old_scan_res=0
# scan_cur_freq: Whether to scan only the current frequency
# 0: Scan all available frequencies. (Default)
# 1: Scan current operating frequency if another VIF on the same radio
# is already associated.
# Interworking (IEEE 802.11u)