I have a router installed on a mobile device. It only roams once it looses contact to some AP (all APs with same SSID, PSK).
Router: Linksys WRT1900ACS
OS: OpenWrt 18.06.2, r7676-cddd7b4c77
I have uninstalled wpa-mini and installed full wpad. I am using wpa_supplicant v2.7-devel.
What have I tried:
Enabling bgscan in the wireless config. Does not work as the NIC driver does not support it
Enabling CONFIG_BGSCAN_LEARN and CONFIG_BGSCAN_SIMPLE in wpa_supplicant build time configuration, rebuild the OS and exchange the binary
Modifying the var/run/wpa_supplicant-wlan0.conf. Adding bgscan="simple:30:-45:300" to it. However when I either restart the wpa_suppicant (starting as seen in ps | grep wpa_supplicant output) or restart wifi the new option disappears
Setting the bgscan in the wpa_cli
I have further written a script that manually forces roaming (periodically scanning for better wifi and swap once a threshold is reached). This, however, is very unclean as it terminates existing TCP connections
None of the approaches really works. It seems like OpenWRT was never meant to support roaming as a client. But as it uses wpa_suppicant, it must somehow be supported from Software side.
I don't know if that option is actually built in to the build of wpad.
./var/run is a RAM disk. Just prior to starting an instance of wpad, wpad's standard hostapd ./ wpa_supplicant format config file is dynamically built from the OpenWrt config files by the /lib/netifd/hostapd.sh script (script is in the hostapd-common package). This script can be modified to place more options into the /var/run/wpa_supplicant.conf.
This option can also be set outside of all network blocks for the bgscan
parameter to apply for all the networks that have no specific bgscan
parameter.
The current version of the wpa_supplicant/wpad does not support the bgscan parameter. Hence I compiled my own wpa_supplicant binary and modified /lib/netifd/hostapd.sh such that it writes the bgscan parameter into /var/run/wpa_supplicant.conf. Long story short... It works!
I don't really understand why the openwrt team did not initially include it.