wpa_supplicant: Support scanning single channel.
PATCH 1/1 wpa_supplicant: Support scanning single channel.
From: Ben Greear <[email protected]>
This depends on patches recently submitted to the kernel. When the can_scan_one flag is true, the kernel will not scan other channels if at least one interface on this phy is already associated.
---
:100644 100644 96dec77... 24e222d... M src/drivers/driver.h
:100644 100644 b884acc... d812eb5... M src/drivers/driver_nl80211.c
:100644 100644 2ea3ede... 24e5f37... M src/drivers/nl80211_copy.h
:100644 100644 6e03760... 2c41622... M wpa_supplicant/config.c
:100644 100644 246c65f... 49128cf... M wpa_supplicant/config.h
:100644 100644 ee105d9... 52807e9... M wpa_supplicant/scan.c
src/drivers/driver.h | 6 ++++++ src/drivers/driver_nl80211.c | 3 +++ src/drivers/nl80211_copy.h | 12 ++++++++++++ wpa_supplicant/config.c | 2 ++ wpa_supplicant/config.h | 7 +++++++ wpa_supplicant/scan.c | 2 ++ 6 files changed, 32 insertions(+), 0 deletions(-)
src/drivers/driver.h +6 -0
@@ -261,6 +261,12 @@ struct wpa_driver_scan_params {* num_filter_ssids - Number of entries in filter_ssids array */ size_t num_filter_ssids; + +/* If true, attempt to only scan the current active channel if at least +* one VIF on this interface's phy is associated. This can help when +* you are running lots of virtual interfaces. +*/ +int can_scan_one; };/**
src/drivers/driver_nl80211.c +3 -0
@@ -1835,6 +1835,9 @@ static int wpa_driver_nl80211_scan(void *priv,NLA_PUT_U32 (msg,NL80211_ATTR_IFINDEX , drv->ifindex); +if (params->can_scan_one) +NLA_PUT_FLAG (msg,NL80211_ATTR_SCAN_ONE_IF_ASSOC ); +for (i =0 ; i < params->num_ssids; i++) { wpa_hexdump_ascii(MSG_MSGDUMP, "nl80211: Scan SSID", params->ssids[i].ssid,
src/drivers/nl80211_copy.h +12 -0
@@ -864,6 +864,18 @@ enum nl80211_attrs {NL80211_ATTR_LOCAL_STATE_CHANGE , +NL80211_ATTR_WIPHY_TX_POWER_SETTING , +NL80211_ATTR_WIPHY_TX_POWER_LEVEL , + +NL80211_ATTR_TX_FRAME_TYPES , +NL80211_ATTR_RX_FRAME_TYPES , +NL80211_ATTR_FRAME_TYPE , + +NL80211_ATTR_CONTROL_PORT_ETHERTYPE , +NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT , + +NL80211_ATTR_SCAN_ONE_IF_ASSOC , +/* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST,
wpa_supplicant/config.c +2 -0
@@ -2143,6 +2143,7 @@ struct wpa_config * wpa_config_alloc_empty(const char *ctrl_interface, config->eapol_version =DEFAULT_EAPOL_VERSION ; config->ap_scan =DEFAULT_AP_SCAN ; config->fast_reauth =DEFAULT_FAST_REAUTH ; + config->can_scan_one =DEFAULT_CAN_SCAN_ONE ; config->p2p_go_intent =DEFAULT_P2P_GO_INTENT ; config->p2p_intra_bss =DEFAULT_P2P_INTRA_BSS ; config->bss_max_count =DEFAULT_BSS_MAX_COUNT ;
@@ -2369,6 +2370,7 @@ static const struct global_parse_data global_fields[] = { { INT_RANGE(eapol_version, 1, 2), 0 }, { INT(ap_scan), 0 }, { INT(fast_reauth), 0 }, + { INT(can_scan_one), 0 }, { STR(opensc_engine_path), 0 }, { STR(pkcs11_engine_path), 0 }, { STR(pkcs11_module_path), 0 },
wpa_supplicant/config.h +7 -0
@@ -22,6 +22,7 @@#define DEFAULT_AP_SCAN 1#endif /* CONFIG_NO_SCAN_PROCESSING */ #define DEFAULT_FAST_REAUTH 1 +#define DEFAULT_CAN_SCAN_ONE 0#define DEFAULT_P2P_GO_INTENT 7#define DEFAULT_P2P_INTRA_BSS 1#define DEFAULT_BSS_MAX_COUNT 200
@@ -382,6 +383,12 @@ struct wpa_config {* changed_parameters - Bitmap of changed parameters since last update */ unsigned int changed_parameters; + +/* If true, attempt to only scan the current active channel if at least +* one VIF on this interface's phy is associated. This can help when +* you are running lots of virtual interfaces. +*/ +int can_scan_one; };
wpa_supplicant/scan.c +2 -0
@@ -383,6 +383,8 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)wpa_printf (MSG_DEBUG ,"Starting AP scan for wildcard SSID" ); } + params.can_scan_one = wpa_s->conf->can_scan_one; +#ifdef CONFIG_P2P wpa_s->wps->dev.p2p =1 ;if (!wps) {
Signature · 1 line
1.7.2.2
Quoted 4 lines · On Mon, Sep 27, 2010 at 05:14:19PM -0700, [email protected] wrote:
This depends on patches recently submitted to the kernel. When the
can_scan_oneflag is true, the kernel will not scan other channels if at least one interface on this phy is already associated.
Could you please send wpa_supplicant patches to [email protected] or at least cc me if you want to get this in. It is way too easy for me to miss the patch if it does not get in the correct mail folder.. Though, in case of this particular change, I'm not going to be including it before the matching change for nl80211 goes in into wireless-testing.git, so a reminder at that point would be appreciated.
wpa_supplicant/config.c struct wpa_config * wpa_config_alloc_empty(const char *ctrl_interface, · line 2143
Quoted 4 lines
wpa_supplicant/config.c +1
-0@@ -2143,6 +2143,7 @@ struct wpa_config * wpa_config_alloc_empty(const char *ctrl_interface, + config->can_scan_one =DEFAULT_CAN_SCAN_ONE ;
This doesn't sound like a parameter that should be a global one in wpa_supplicant. Doesn't it depend on what you are doing whether it is acceptable to scan only a single channel? For example, in P2P Search scans, all the social channels must be scanned and a global override here does not seem to make much sense.
Signature · 1 line
Jouni Malinen PGP id EFC895FA