From patchwork Wed May 1 00:16:51 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Greear X-Patchwork-Id: 240708 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from maxx.maxx.shmoo.com (maxx.shmoo.com [205.134.188.171]) by ozlabs.org (Postfix) with ESMTP id D35EC2C00AE for ; Wed, 1 May 2013 10:17:46 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id BFFA19C119; Tue, 30 Apr 2013 20:17:44 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8RSBUGRjuv37; Tue, 30 Apr 2013 20:17:44 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id CABCB9C123; Tue, 30 Apr 2013 20:17:33 -0400 (EDT) X-Original-To: mailman-post+hostap@maxx.shmoo.com Delivered-To: mailman-post+hostap@maxx.shmoo.com Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 9129A9C115 for ; Tue, 30 Apr 2013 20:17:32 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aTxxjpYzHEQL for ; Tue, 30 Apr 2013 20:17:26 -0400 (EDT) Received: from ns3.lanforge.com (mail.candelatech.com [208.74.158.172]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by maxx.maxx.shmoo.com (Postfix) with ESMTPS id 422389C123 for ; Tue, 30 Apr 2013 20:17:19 -0400 (EDT) Received: from localhost.localdomain (firewall.candelatech.com [70.89.124.249]) by ns3.lanforge.com (8.14.2/8.14.2) with ESMTP id r410GuSr030278 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 30 Apr 2013 17:16:59 -0700 From: greearb@candelatech.com To: hostap@lists.shmoo.com Subject: [PATCH] wpa_supplicant: Allow vifs to scan only current channel. Date: Tue, 30 Apr 2013 17:16:51 -0700 Message-Id: <1367367411-21172-2-git-send-email-greearb@candelatech.com> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <1367367411-21172-1-git-send-email-greearb@candelatech.com> References: <1367367411-21172-1-git-send-email-greearb@candelatech.com> Cc: Ben Greear X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.11 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com From: Ben Greear 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 --- :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 +}