diff mbox series

hostapd: enable background scanning in wpa_supplicant_full

Message ID 20200909193157.32447-1-avalentin@marcant.net
State Superseded
Headers show
Series hostapd: enable background scanning in wpa_supplicant_full | expand

Commit Message

Andre Valentin Sept. 9, 2020, 7:31 p.m. UTC
Activation of autoscanning enables a a wifi client to select the best
accesspoint based on rssi.

This feature is useful in case you have multiple access points in your range
and you do not want to stick the client on the first one it connected to.
Especially when used with 802.11r this allows seamless transition to the
optimal accesspoints.

Setting the config value bgscan to -65 will tell wpa_supplicant to try to
connect to an access points with better rssi.

Example config:
config wifi-iface 'default_radio1'
	option device 'radio1'
	option mode 'sta'
	option ssid 'openwrt'
	option encryption 'psk2'
	option key 'mykey'
	option network 'wlan'
	option bgscan '-65'

The ipk sizes for mipsel_24kc change like this:
old:
wpad-openssl_2020-06-08-5a8b3662-4_mipsel_24kc.ipk 550133

new:
wpad-openssl_2020-06-08-5a8b3662-5_mipsel_24kc.ipk 551961

Signed-off-by: André Valentin <avalentin@marcant.net>
---
 package/network/services/hostapd/files/hostapd.sh          		| 7 +++++++
 package/network/services/hostapd/files/wpa_supplicant-full.config      | 6 +++---
 package/network/services/hostapd/Makefile				| 1 +-
 3 files changed, 11 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh
index 88113cd7ce..85299234c2 100644
--- a/package/network/services/hostapd/files/hostapd.sh
+++ b/package/network/services/hostapd/files/hostapd.sh
@@ -272,6 +272,8 @@  hostapd_common_add_bss_config() {
 	config_add_array operator_icon
 	config_add_array hs20_conn_capab
 	config_add_string osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp
+
+	config_add_string roam_rssi_threshold
 }
 
 hostapd_set_vlan_file() {
@@ -1178,6 +1180,11 @@  wpa_supplicant_add_network() {
 	[ -n "$bssid_blacklist" ] && append network_data "bssid_blacklist=$bssid_blacklist" "$N$T"
 	[ -n "$bssid_whitelist" ] && append network_data "bssid_whitelist=$bssid_whitelist" "$N$T"
 
+	[ -n "$roam_rssi_threshold" ] && {
+		json_get_vars roam_rssi_threshold
+		append network_data "bgscan=\"simple:120:${roam_rssi_threshold}:600\"" "$N$T"
+	}
+
 	[ -n "$basic_rate" ] && {
 		local br rate_list=
 		for br in $basic_rate; do
diff --git a/package/network/services/hostapd/files/wpa_supplicant-full.config b/package/network/services/hostapd/files/wpa_supplicant-full.config
index 982f4d5534..d39ee74a8d 100644
--- a/package/network/services/hostapd/files/wpa_supplicant-full.config
+++ b/package/network/services/hostapd/files/wpa_supplicant-full.config
@@ -527,9 +527,9 @@  CONFIG_WNM=y
 #
 # Enabling directly a module will enable autoscan support.
 # For exponential module:
-#CONFIG_AUTOSCAN_EXPONENTIAL=y
+CONFIG_AUTOSCAN_EXPONENTIAL=y
 # For periodic module:
-#CONFIG_AUTOSCAN_PERIODIC=y
+CONFIG_AUTOSCAN_PERIODIC=y
 
 # Password (and passphrase, etc.) backend for external storage
 # These optional mechanisms can be used to add support for storing passwords
@@ -600,7 +600,7 @@  CONFIG_IBSS_RSN=y
 # operations for roaming within an ESS (same SSID). See the bgscan parameter in
 # the wpa_supplicant.conf file for more details.
 # Periodic background scans based on signal strength
-#CONFIG_BGSCAN_SIMPLE=y
+CONFIG_BGSCAN_SIMPLE=y
 # Learn channels used by the network and try to avoid bgscans on other
 # channels (experimental)
 #CONFIG_BGSCAN_LEARN=y
diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile
index 8f94dce782..8c264854d7 100644
--- a/package/network/services/hostapd/Makefile
+++ b/package/network/services/hostapd/Makefile
@@ -7,7 +7,7 @@ 
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=hostapd
-PKG_RELEASE:=5
+PKG_RELEASE:=6
 
 PKG_SOURCE_URL:=http://w1.fi/hostap.git
 PKG_SOURCE_PROTO:=git