hostapd: add default_disabled option to the supplicant

With the default configuration we generate, the supplicant starts
scanning and tries to connect to any open network when the interface
is enabled.

In some cases it can be desirable to prevent the supplicant from
scanning by itself. For example, if on the same radio an AP is
configured and an unconfigured STA is added (to be configured with
WPS), the AP might not be able to beacon until the STA stops
scanning.

In such a case, the STA configuration can still be required to set
specific settings (e.g. multi_ap_backhaul_sta) so it can't be set to
"disabled" in uci (because that would prevent the supplicant from
being run at all). The alternative is to add the "disabled" parameter
to the default network block in the supplicant configuration.

This patch adds a "default_disabled" setting in UCI which, when set,
adds the "disabled" parameter to the supplicant default network block.

Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
This commit is contained in:
Raphaël Mélotte 2020-10-07 10:08:14 +02:00 committed by Paul Spooren
parent 8af62ede18
commit acdb7c38c6

View File

@ -350,6 +350,7 @@ hostapd_common_add_bss_config() {
config_add_boolean multicast_to_unicast proxy_arp per_sta_vif config_add_boolean multicast_to_unicast proxy_arp per_sta_vif
config_add_array hostapd_bss_options config_add_array hostapd_bss_options
config_add_boolean default_disabled
config_add_boolean request_cui config_add_boolean request_cui
config_add_array radius_auth_req_attr config_add_array radius_auth_req_attr
@ -1188,7 +1189,8 @@ wpa_supplicant_add_network() {
ssid bssid key \ ssid bssid key \
basic_rate mcast_rate \ basic_rate mcast_rate \
ieee80211w ieee80211r \ ieee80211w ieee80211r \
multi_ap multi_ap \
default_disabled
case "$auth_type" in case "$auth_type" in
sae|owe|eap192|eap-eap192) sae|owe|eap192|eap-eap192)
@ -1201,6 +1203,7 @@ wpa_supplicant_add_network() {
set_default ieee80211r 0 set_default ieee80211r 0
set_default multi_ap 0 set_default multi_ap 0
set_default default_disabled 0
local key_mgmt='NONE' local key_mgmt='NONE'
local network_data= local network_data=
@ -1232,7 +1235,10 @@ wpa_supplicant_add_network() {
scan_ssid="" scan_ssid=""
} }
[ "$multi_ap" = 1 -a "$_w_mode" = "sta" ] && append network_data "multi_ap_backhaul_sta=1" "$N$T" [ "$_w_mode" = "sta" ] && {
[ "$multi_ap" = 1 ] && append network_data "multi_ap_backhaul_sta=1" "$N$T"
[ "$default_disabled" = 1 ] && append network_data "disabled=1" "$N$T"
}
case "$auth_type" in case "$auth_type" in
none) ;; none) ;;