From: Raphaël Mélotte Date: Wed, 7 Oct 2020 08:08:14 +0000 (+0200) Subject: hostapd: add default_disabled option to the supplicant X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=acdb7c38c6f4411f5d2e96b45fff942505de58d1;p=openwrt%2Fstaging%2Flinusw.git 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 --- diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh index 4a5f8d61fe..a32e1652ac 100644 --- a/package/network/services/hostapd/files/hostapd.sh +++ b/package/network/services/hostapd/files/hostapd.sh @@ -350,6 +350,7 @@ hostapd_common_add_bss_config() { config_add_boolean multicast_to_unicast proxy_arp per_sta_vif config_add_array hostapd_bss_options + config_add_boolean default_disabled config_add_boolean request_cui config_add_array radius_auth_req_attr @@ -1188,7 +1189,8 @@ wpa_supplicant_add_network() { ssid bssid key \ basic_rate mcast_rate \ ieee80211w ieee80211r \ - multi_ap + multi_ap \ + default_disabled case "$auth_type" in sae|owe|eap192|eap-eap192) @@ -1201,6 +1203,7 @@ wpa_supplicant_add_network() { set_default ieee80211r 0 set_default multi_ap 0 + set_default default_disabled 0 local key_mgmt='NONE' local network_data= @@ -1232,7 +1235,10 @@ wpa_supplicant_add_network() { 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 none) ;;