mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-10-29 09:32:34 +00:00
751 lines
26 KiB
Diff
751 lines
26 KiB
Diff
From e8d4adc4f6398b0c139bcfc3da0c878f57b09865 Mon Sep 17 00:00:00 2001
|
|
From: John Crispin <john@phrozen.org>
|
|
Date: Thu, 17 Aug 2023 15:54:39 +0200
|
|
Subject: [PATCH 5/6] hostapd: add TIP hostapd.sh version
|
|
|
|
Signed-off-by: John Crispin <john@phrozen.org>
|
|
---
|
|
.../network/services/hostapd/files/hostapd.sh | 385 ++++++++++--------
|
|
1 file changed, 225 insertions(+), 160 deletions(-)
|
|
|
|
diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh
|
|
index 65ae662c4d..90d9210410 100644
|
|
--- a/package/network/services/hostapd/files/hostapd.sh
|
|
+++ b/package/network/services/hostapd/files/hostapd.sh
|
|
@@ -24,12 +24,12 @@ hostapd_append_wep_key() {
|
|
[1234])
|
|
for idx in 1 2 3 4; do
|
|
local zidx
|
|
- zidx="$(($idx - 1))"
|
|
+ zidx=$(($idx - 1))
|
|
json_get_var ckey "key${idx}"
|
|
[ -n "$ckey" ] && \
|
|
append $var "wep_key${zidx}=$(prepare_key_wep "$ckey")" "$N$T"
|
|
done
|
|
- wep_keyidx="$((key - 1))"
|
|
+ wep_keyidx=$((key - 1))
|
|
;;
|
|
*)
|
|
append $var "wep_key0=$(prepare_key_wep "$key")" "$N$T"
|
|
@@ -48,16 +48,17 @@ hostapd_append_wpa_key_mgmt() {
|
|
;;
|
|
eap192)
|
|
append wpa_key_mgmt "WPA-EAP-SUITE-B-192"
|
|
- [ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-EAP-SHA384"
|
|
+ append wpa_key_mgmt "WPA-EAP-SHA256"
|
|
+ [ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-EAP"
|
|
;;
|
|
- eap-eap192)
|
|
- append wpa_key_mgmt "WPA-EAP-SUITE-B-192"
|
|
+ eap-eap256)
|
|
append wpa_key_mgmt "WPA-EAP"
|
|
- [ "${ieee80211r:-0}" -gt 0 ] && {
|
|
- append wpa_key_mgmt "FT-EAP-SHA384"
|
|
- append wpa_key_mgmt "FT-EAP"
|
|
- }
|
|
- [ "${ieee80211w:-0}" -gt 0 ] && append wpa_key_mgmt "WPA-EAP-SHA256"
|
|
+ append wpa_key_mgmt "WPA-EAP-SHA256"
|
|
+ [ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-EAP"
|
|
+ ;;
|
|
+ eap256)
|
|
+ append wpa_key_mgmt "WPA-EAP-SHA256"
|
|
+ [ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-EAP"
|
|
;;
|
|
sae)
|
|
append wpa_key_mgmt "SAE"
|
|
@@ -116,12 +117,15 @@ hostapd_common_add_device_config() {
|
|
config_add_int rssi_reject_assoc_rssi
|
|
config_add_int rssi_ignore_probe_request
|
|
config_add_int maxassoc
|
|
+ config_add_boolean maxassoc_ignore_probe
|
|
|
|
config_add_string acs_chan_bias
|
|
+ config_add_boolean acs_exclude_dfs
|
|
config_add_array hostapd_options
|
|
|
|
config_add_int airtime_mode
|
|
- config_add_int mbssid
|
|
+
|
|
+ config_add_boolean multiple_bssid rnr_beacon he_co_locate ema
|
|
|
|
hostapd_add_log_config
|
|
}
|
|
@@ -132,10 +136,11 @@ hostapd_prepare_device_config() {
|
|
|
|
local base_cfg=
|
|
|
|
- json_get_vars country country3 country_ie beacon_int:100 doth require_mode legacy_rates \
|
|
+ json_get_vars country country3 country_ie beacon_int:100 dtim_period:2 doth require_mode legacy_rates \
|
|
acs_chan_bias local_pwr_constraint spectrum_mgmt_required airtime_mode cell_density \
|
|
rts_threshold beacon_rate rssi_reject_assoc_rssi rssi_ignore_probe_request maxassoc \
|
|
- mbssid:0
|
|
+ multiple_bssid he_co_locate rnr_beacon ema acs_exclude_dfs \
|
|
+ maxassoc_ignore_probe
|
|
|
|
hostapd_set_log_options base_cfg
|
|
|
|
@@ -145,6 +150,11 @@ hostapd_prepare_device_config() {
|
|
set_default legacy_rates 0
|
|
set_default airtime_mode 0
|
|
set_default cell_density 0
|
|
+ set_default he_co_locate 0
|
|
+ set_default rnr_beacon 0
|
|
+ set_default multiple_bssid 0
|
|
+ set_default ema 0
|
|
+ set_default acs_exclude_dfs 0
|
|
|
|
[ -n "$country" ] && {
|
|
append base_cfg "country_code=$country" "$N"
|
|
@@ -234,9 +244,15 @@ hostapd_prepare_device_config() {
|
|
[ -n "$brlist" ] && append base_cfg "basic_rates=$brlist" "$N"
|
|
append base_cfg "beacon_int=$beacon_int" "$N"
|
|
[ -n "$rts_threshold" ] && append base_cfg "rts_threshold=$rts_threshold" "$N"
|
|
+ append base_cfg "dtim_period=$dtim_period" "$N"
|
|
[ "$airtime_mode" -gt 0 ] && append base_cfg "airtime_mode=$airtime_mode" "$N"
|
|
[ -n "$maxassoc" ] && append base_cfg "iface_max_num_sta=$maxassoc" "$N"
|
|
- [ "$mbssid" -gt 0 ] && [ "$mbssid" -le 2 ] && append base_cfg "mbssid=$mbssid" "$N"
|
|
+ [ "$maxassoc_ignore_probe" -gt 0 ] && append base_cfg "no_probe_resp_if_max_sta=1" "$N"
|
|
+ [ "$rnr_beacon" -gt 0 ] && append base_cfg "rnr_beacon=$rnr_beacon" "$N"
|
|
+ [ "$he_co_locate" -gt 0 ] && append base_cfg "he_co_locate=$he_co_locate" "$N"
|
|
+ [ "$multiple_bssid" -gt 0 ] && append base_cfg "multiple_bssid=$multiple_bssid" "$N"
|
|
+ [ "$ema" -gt 0 ] && append base_cfg "ema=$ema" "$N"
|
|
+ [ "$acs_exclude_dfs" -gt 0 ] && append base_cfg "acs_exclude_dfs=$acs_exclude_dfs" "$N"
|
|
|
|
json_get_values opts hostapd_options
|
|
for val in $opts; do
|
|
@@ -251,7 +267,7 @@ EOF
|
|
|
|
hostapd_common_add_bss_config() {
|
|
config_add_string 'bssid:macaddr' 'ssid:string'
|
|
- config_add_boolean wds wmm uapsd hidden utf8_ssid ppsk
|
|
+ config_add_boolean wds wmm uapsd hidden utf8_ssid
|
|
|
|
config_add_int maxassoc max_inactivity
|
|
config_add_boolean disassoc_low_ack isolate short_preamble skip_inactivity_poll
|
|
@@ -268,15 +284,24 @@ hostapd_common_add_bss_config() {
|
|
config_add_int ieee80211w
|
|
config_add_int eapol_version
|
|
|
|
- config_add_array auth_server acct_server
|
|
- config_add_string 'server:host'
|
|
+ config_add_string 'auth_server:host' 'server:host'
|
|
config_add_string auth_secret key
|
|
config_add_int 'auth_port:port' 'port:port'
|
|
|
|
+ config_add_string acct_server
|
|
config_add_string acct_secret
|
|
config_add_int acct_port
|
|
+
|
|
+ config_add_string acct_server_secondary
|
|
+ config_add_string acct_secret_secondary
|
|
+ config_add_int acct_port_secondary
|
|
+
|
|
config_add_int acct_interval
|
|
|
|
+ config_add_string auth_server_secondary
|
|
+ config_add_string auth_secret_secondary
|
|
+ config_add_int auth_port_secondary
|
|
+
|
|
config_add_int bss_load_update_period chan_util_avg_period
|
|
|
|
config_add_string dae_client
|
|
@@ -309,7 +334,7 @@ hostapd_common_add_bss_config() {
|
|
config_add_string wps_device_type wps_device_name wps_manufacturer wps_pin
|
|
config_add_string multi_ap_backhaul_ssid multi_ap_backhaul_key
|
|
|
|
- config_add_boolean wnm_sleep_mode wnm_sleep_mode_no_keys bss_transition mbo
|
|
+ config_add_boolean wnm_sleep_mode wnm_sleep_mode_no_keys bss_transition
|
|
config_add_int time_advertisement
|
|
config_add_string time_zone
|
|
config_add_string vendor_elements
|
|
@@ -351,7 +376,7 @@ hostapd_common_add_bss_config() {
|
|
|
|
config_add_boolean hs20 disable_dgaf osen
|
|
config_add_int anqp_domain_id
|
|
- config_add_int hs20_deauth_req_timeout
|
|
+ config_add_int hs20_deauth_req_timeout hs20_release
|
|
config_add_array hs20_oper_friendly_name
|
|
config_add_array osu_provider
|
|
config_add_array operator_icon
|
|
@@ -378,7 +403,11 @@ hostapd_common_add_bss_config() {
|
|
config_add_boolean fils
|
|
config_add_string fils_dhcp
|
|
|
|
- config_add_int ocv
|
|
+ config_add_boolean ratelimit
|
|
+
|
|
+ config_add_string uci_section
|
|
+
|
|
+ config_add_boolean dynamic_probe_resp
|
|
}
|
|
|
|
hostapd_set_vlan_file() {
|
|
@@ -430,7 +459,7 @@ append_iw_anqp_3gpp_cell_net() {
|
|
if [ -z "$iw_anqp_3gpp_cell_net_conf" ]; then
|
|
iw_anqp_3gpp_cell_net_conf="$1"
|
|
else
|
|
- iw_anqp_3gpp_cell_net_conf="$iw_anqp_3gpp_cell_net_conf:$1"
|
|
+ iw_anqp_3gpp_cell_net_conf="$iw_anqp_3gpp_cell_net_conf;$1"
|
|
fi
|
|
}
|
|
|
|
@@ -527,18 +556,83 @@ append_airtime_sta_weight() {
|
|
[ -n "$1" ] && append bss_conf "airtime_sta_weight=$1" "$N"
|
|
}
|
|
|
|
-append_auth_server() {
|
|
- [ -n "$1" ] || return
|
|
- append bss_conf "auth_server_addr=$1" "$N"
|
|
- append bss_conf "auth_server_port=$auth_port" "$N"
|
|
- [ -n "$auth_secret" ] && append bss_conf "auth_server_shared_secret=$auth_secret" "$N"
|
|
-}
|
|
+append_radius_server() {
|
|
+
|
|
+ json_get_vars \
|
|
+ auth_server auth_secret auth_port \
|
|
+ auth_server_secondary auth_secret_secondary auth_port_secondary \
|
|
+ dae_client dae_secret dae_port \
|
|
+ dynamic_ownip ownip radius_client_addr \
|
|
+ eap_reauth_period request_cui \
|
|
+ erp_domain mobility_domain \
|
|
+ fils_realm fils_dhcp
|
|
+
|
|
+ set_default dynamic_ownip 1
|
|
+
|
|
+ # legacy compatibility
|
|
+ [ -n "$auth_server" ] || json_get_var auth_server server
|
|
+ [ -n "$auth_port" ] || json_get_var auth_port port
|
|
+ [ -n "$auth_secret" ] || json_get_var auth_secret key
|
|
+
|
|
+ [ "$fils" -gt 0 ] && {
|
|
+ set_default erp_domain "$mobility_domain"
|
|
+ set_default erp_domain "$(echo "$ssid" | md5sum | head -c 8)"
|
|
+ set_default fils_realm "$erp_domain"
|
|
+
|
|
+ append bss_conf "erp_send_reauth_start=1" "$N"
|
|
+ append bss_conf "erp_domain=$erp_domain" "$N"
|
|
+ append bss_conf "fils_realm=$fils_realm" "$N"
|
|
+ append bss_conf "fils_cache_id=$(echo "$fils_realm" | md5sum | head -c 4)" "$N"
|
|
+
|
|
+ [ "$fils_dhcp" = "*" ] && {
|
|
+ json_get_values network network
|
|
+ fils_dhcp=
|
|
+ for net in $network; do
|
|
+ fils_dhcp="$(ifstatus "$net" | jsonfilter -e '@.data.dhcpserver')"
|
|
+ [ -n "$fils_dhcp" ] && break
|
|
+ done
|
|
+
|
|
+ [ -z "$fils_dhcp" -a -n "$network_bridge" -a -n "$network_ifname" ] && \
|
|
+ fils_dhcp="$(udhcpc -B -n -q -s /lib/netifd/dhcp-get-server.sh -t 1 -i "$network_ifname" 2>/dev/null)"
|
|
+ }
|
|
+ [ -n "$fils_dhcp" ] && append bss_conf "dhcp_server=$fils_dhcp" "$N"
|
|
+ }
|
|
+
|
|
+ set_default auth_port 1812
|
|
+ set_default auth_port_secondary 1812
|
|
+ set_default dae_port 3799
|
|
+ set_default request_cui 0
|
|
+
|
|
+ [ "$eap_server" -eq 0 ] && {
|
|
+ append bss_conf "auth_server_addr=$auth_server" "$N"
|
|
+ append bss_conf "auth_server_port=$auth_port" "$N"
|
|
+ append bss_conf "auth_server_shared_secret=$auth_secret" "$N"
|
|
+ }
|
|
+
|
|
+ [ -n "$auth_server_secondary" ] && {
|
|
+ append bss_conf "auth_server_addr=$auth_server_secondary" "$N"
|
|
+ append bss_conf "auth_server_port=$auth_port_secondary" "$N"
|
|
+ [ -n "$auth_secret_secondary" ] && \
|
|
+ append bss_conf "auth_server_shared_secret=$auth_secret_secondary" "$N"
|
|
+ }
|
|
+
|
|
+ [ "$request_cui" -gt 0 ] && append bss_conf "radius_request_cui=$request_cui" "$N"
|
|
+ [ -n "$eap_reauth_period" ] && append bss_conf "eap_reauth_period=$eap_reauth_period" "$N"
|
|
+
|
|
+ [ -n "$dae_client" -a -n "$dae_secret" ] && {
|
|
+ append bss_conf "radius_das_port=$dae_port" "$N"
|
|
+ append bss_conf "radius_das_client=$dae_client $dae_secret" "$N"
|
|
+ }
|
|
+ json_for_each_item append_radius_auth_req_attr radius_auth_req_attr
|
|
+
|
|
+ if [ -n "$ownip" ]; then
|
|
+ append bss_conf "own_ip_addr=$ownip" "$N"
|
|
+ elif [ "$dynamic_ownip" -gt 0 ]; then
|
|
+ append bss_conf "dynamic_own_ip_addr=$dynamic_ownip" "$N"
|
|
+ fi
|
|
|
|
-append_acct_server() {
|
|
- [ -n "$1" ] || return
|
|
- append bss_conf "acct_server_addr=$1" "$N"
|
|
- append bss_conf "acct_server_port=$acct_port" "$N"
|
|
- [ -n "$acct_secret" ] && append bss_conf "acct_server_shared_secret=$acct_secret" "$N"
|
|
+ [ -n "$radius_client_addr" ] && append bss_conf "radius_client_addr=$radius_client_addr" "$N"
|
|
+ [ "$macfilter" = radius ] && append bss_conf "macaddr_acl=2" "$N"
|
|
}
|
|
|
|
hostapd_set_bss_options() {
|
|
@@ -548,7 +642,7 @@ hostapd_set_bss_options() {
|
|
|
|
wireless_vif_parse_encryption
|
|
|
|
- local bss_conf bss_md5sum ft_key
|
|
+ local bss_conf bss_md5sum
|
|
local wep_rekey wpa_group_rekey wpa_pair_rekey wpa_master_rekey wpa_key_mgmt
|
|
|
|
json_get_vars \
|
|
@@ -559,13 +653,14 @@ hostapd_set_bss_options() {
|
|
wps_independent wps_device_type wps_device_name wps_manufacturer wps_pin \
|
|
macfilter ssid utf8_ssid wmm uapsd hidden short_preamble rsn_preauth \
|
|
iapp_interface eapol_version dynamic_vlan ieee80211w nasid \
|
|
- acct_secret acct_port acct_interval \
|
|
+ acct_server acct_secret acct_port acct_interval \
|
|
+ acct_server_secondary acct_secret_secondary acct_port_secondary \
|
|
bss_load_update_period chan_util_avg_period sae_require_mfp sae_pwe \
|
|
multi_ap multi_ap_backhaul_ssid multi_ap_backhaul_key skip_inactivity_poll \
|
|
- ppsk airtime_bss_weight airtime_bss_limit airtime_sta_weight \
|
|
+ airtime_bss_weight airtime_bss_limit airtime_sta_weight \
|
|
multicast_to_unicast_all proxy_arp per_sta_vif \
|
|
eap_server eap_user_file ca_cert server_cert private_key private_key_passwd server_id \
|
|
- vendor_elements fils ocv
|
|
+ vendor_elements fils uci_section dynamic_probe_resp
|
|
|
|
set_default fils 0
|
|
set_default isolate 0
|
|
@@ -581,14 +676,15 @@ hostapd_set_bss_options() {
|
|
set_default tdls_prohibit 0
|
|
set_default eapol_version $((wpa & 1))
|
|
set_default acct_port 1813
|
|
+ set_default acct_port_secondary 1813
|
|
set_default bss_load_update_period 60
|
|
set_default chan_util_avg_period 600
|
|
set_default utf8_ssid 1
|
|
set_default multi_ap 0
|
|
- set_default ppsk 0
|
|
set_default airtime_bss_weight 0
|
|
set_default airtime_bss_limit 0
|
|
set_default eap_server 0
|
|
+ set_default dynamic_probe_resp 0
|
|
|
|
/usr/sbin/hostapd -vfils || fils=0
|
|
|
|
@@ -614,6 +710,7 @@ hostapd_set_bss_options() {
|
|
append bss_conf "preamble=$short_preamble" "$N"
|
|
append bss_conf "wmm_enabled=$wmm" "$N"
|
|
append bss_conf "ignore_broadcast_ssid=$hidden" "$N"
|
|
+ append bss_conf "dynamic_probe_resp=$dynamic_probe_resp" "$N"
|
|
append bss_conf "uapsd_advertisement_enabled=$uapsd" "$N"
|
|
append bss_conf "utf8_ssid=$utf8_ssid" "$N"
|
|
append bss_conf "multi_ap=$multi_ap" "$N"
|
|
@@ -631,23 +728,31 @@ hostapd_set_bss_options() {
|
|
set_default nasid "${macaddr//\:}"
|
|
append bss_conf "nas_identifier=$nasid" "$N"
|
|
|
|
- [ -n "$acct_interval" ] && \
|
|
- append bss_conf "radius_acct_interim_interval=$acct_interval" "$N"
|
|
- json_for_each_item append_acct_server acct_server
|
|
- json_for_each_item append_radius_acct_req_attr radius_acct_req_attr
|
|
+ [ -n "$acct_server" ] && {
|
|
+ append bss_conf "acct_server_addr=$acct_server" "$N"
|
|
+ append bss_conf "acct_server_port=$acct_port" "$N"
|
|
+ [ -n "$acct_secret" ] && \
|
|
+ append bss_conf "acct_server_shared_secret=$acct_secret" "$N"
|
|
+ [ -n "$acct_interval" ] && \
|
|
+ append bss_conf "radius_acct_interim_interval=$acct_interval" "$N"
|
|
+ json_for_each_item append_radius_acct_req_attr radius_acct_req_attr
|
|
+ }
|
|
|
|
- [ -n "$ocv" ] && append bss_conf "ocv=$ocv" "$N"
|
|
+ [ -n "$acct_server_secondary" ] && {
|
|
+ append bss_conf "acct_server_addr=$acct_server_secondary" "$N"
|
|
+ append bss_conf "acct_server_port=$acct_port_secondary" "$N"
|
|
+ [ -n "$acct_secret_secondary" ] && \
|
|
+ append bss_conf "acct_server_shared_secret=$acct_secret_secondary" "$N"
|
|
+ }
|
|
|
|
case "$auth_type" in
|
|
- sae|owe|eap192|eap-eap192)
|
|
+ sae|owe|eap192|eap256)
|
|
set_default ieee80211w 2
|
|
set_default sae_require_mfp 1
|
|
- set_default sae_pwe 2
|
|
;;
|
|
- psk-sae)
|
|
+ psk-sae|psk2-radius|eap-eap256)
|
|
set_default ieee80211w 1
|
|
set_default sae_require_mfp 1
|
|
- set_default sae_pwe 2
|
|
;;
|
|
esac
|
|
[ -n "$sae_require_mfp" ] && append bss_conf "sae_require_mfp=$sae_require_mfp" "$N"
|
|
@@ -667,16 +772,14 @@ hostapd_set_bss_options() {
|
|
# Here we make the assumption that if we're in open mode
|
|
# with WPS enabled, we got to be in unconfigured state.
|
|
wps_not_configured=1
|
|
+ vlan_possible=1
|
|
+ [ "$macfilter" = radius ] && {
|
|
+ append_radius_server
|
|
+ }
|
|
;;
|
|
psk|sae|psk-sae)
|
|
json_get_vars key wpa_psk_file
|
|
- if [ "$auth_type" = "psk" ] && [ "$ppsk" -ne 0 ] ; then
|
|
- json_get_vars auth_secret auth_port
|
|
- set_default auth_port 1812
|
|
- json_for_each_item append_auth_server auth_server
|
|
- append bss_conf "macaddr_acl=2" "$N"
|
|
- append bss_conf "wpa_psk_radius=2" "$N"
|
|
- elif [ ${#key} -eq 64 ]; then
|
|
+ if [ ${#key} -eq 64 ]; then
|
|
append bss_conf "wpa_psk=$key" "$N"
|
|
elif [ ${#key} -ge 8 ] && [ ${#key} -le 63 ]; then
|
|
append bss_conf "wpa_passphrase=$key" "$N"
|
|
@@ -695,70 +798,10 @@ hostapd_set_bss_options() {
|
|
vlan_possible=1
|
|
wps_possible=1
|
|
;;
|
|
- eap|eap192|eap-eap192)
|
|
- json_get_vars \
|
|
- auth_server auth_secret auth_port \
|
|
- dae_client dae_secret dae_port \
|
|
- dynamic_ownip ownip radius_client_addr \
|
|
- eap_reauth_period request_cui \
|
|
- erp_domain mobility_domain \
|
|
- fils_realm fils_dhcp
|
|
-
|
|
+ eap|eap192|eap-eap256|eap256)
|
|
+ append_radius_server
|
|
# radius can provide VLAN ID for clients
|
|
vlan_possible=1
|
|
-
|
|
- set_default dynamic_ownip 1
|
|
-
|
|
- # legacy compatibility
|
|
- [ -n "$auth_server" ] || json_get_var auth_server server
|
|
- [ -n "$auth_port" ] || json_get_var auth_port port
|
|
- [ -n "$auth_secret" ] || json_get_var auth_secret key
|
|
-
|
|
- [ "$fils" -gt 0 ] && {
|
|
- set_default erp_domain "$mobility_domain"
|
|
- set_default erp_domain "$(echo "$ssid" | md5sum | head -c 8)"
|
|
- set_default fils_realm "$erp_domain"
|
|
-
|
|
- append bss_conf "erp_send_reauth_start=1" "$N"
|
|
- append bss_conf "erp_domain=$erp_domain" "$N"
|
|
- append bss_conf "fils_realm=$fils_realm" "$N"
|
|
- append bss_conf "fils_cache_id=$(echo "$fils_realm" | md5sum | head -c 4)" "$N"
|
|
-
|
|
- [ "$fils_dhcp" = "*" ] && {
|
|
- json_get_values network network
|
|
- fils_dhcp=
|
|
- for net in $network; do
|
|
- fils_dhcp="$(ifstatus "$net" | jsonfilter -e '@.data.dhcpserver')"
|
|
- [ -n "$fils_dhcp" ] && break
|
|
- done
|
|
-
|
|
- [ -z "$fils_dhcp" -a -n "$network_bridge" -a -n "$network_ifname" ] && \
|
|
- fils_dhcp="$(udhcpc -B -n -q -s /lib/netifd/dhcp-get-server.sh -t 1 -i "$network_ifname" 2>/dev/null)"
|
|
- }
|
|
- [ -n "$fils_dhcp" ] && append bss_conf "dhcp_server=$fils_dhcp" "$N"
|
|
- }
|
|
-
|
|
- set_default auth_port 1812
|
|
- set_default dae_port 3799
|
|
- set_default request_cui 0
|
|
-
|
|
- [ "$eap_server" -eq 0 ] && json_for_each_item append_auth_server auth_server
|
|
- [ "$request_cui" -gt 0 ] && append bss_conf "radius_request_cui=$request_cui" "$N"
|
|
- [ -n "$eap_reauth_period" ] && append bss_conf "eap_reauth_period=$eap_reauth_period" "$N"
|
|
-
|
|
- [ -n "$dae_client" -a -n "$dae_secret" ] && {
|
|
- append bss_conf "radius_das_port=$dae_port" "$N"
|
|
- append bss_conf "radius_das_client=$dae_client $dae_secret" "$N"
|
|
- }
|
|
- json_for_each_item append_radius_auth_req_attr radius_auth_req_attr
|
|
-
|
|
- if [ -n "$ownip" ]; then
|
|
- append bss_conf "own_ip_addr=$ownip" "$N"
|
|
- elif [ "$dynamic_ownip" -gt 0 ]; then
|
|
- append bss_conf "dynamic_own_ip_addr=$dynamic_ownip" "$N"
|
|
- fi
|
|
-
|
|
- [ -n "$radius_client_addr" ] && append bss_conf "radius_client_addr=$radius_client_addr" "$N"
|
|
append bss_conf "eapol_key_index_workaround=1" "$N"
|
|
append bss_conf "ieee8021x=1" "$N"
|
|
|
|
@@ -771,26 +814,14 @@ hostapd_set_bss_options() {
|
|
append bss_conf "wep_default_key=$wep_keyidx" "$N"
|
|
[ -n "$wep_rekey" ] && append bss_conf "wep_rekey_period=$wep_rekey" "$N"
|
|
;;
|
|
- esac
|
|
-
|
|
- case "$auth_type" in
|
|
- none|owe|psk|sae|psk-sae|wep)
|
|
- json_get_vars \
|
|
- auth_server auth_port auth_secret \
|
|
- ownip radius_client_addr
|
|
-
|
|
- [ -n "$auth_server" ] && {
|
|
- set_default auth_port 1812
|
|
-
|
|
- json_for_each_item append_auth_server auth_server
|
|
- [ -n "$ownip" ] && append bss_conf "own_ip_addr=$ownip" "$N"
|
|
- [ -n "$radius_client_addr" ] && append bss_conf "radius_client_addr=$radius_client_addr" "$N"
|
|
- append bss_conf "macaddr_acl=2" "$N"
|
|
- }
|
|
+ psk2-radius)
|
|
+ append bss_conf "wpa_psk_radius=3" "$N"
|
|
+ append_radius_server
|
|
+ vlan_possible=1
|
|
;;
|
|
esac
|
|
|
|
- local auth_algs="$((($auth_mode_shared << 1) | $auth_mode_open))"
|
|
+ local auth_algs=$((($auth_mode_shared << 1) | $auth_mode_open))
|
|
append bss_conf "auth_algs=${auth_algs:-1}" "$N"
|
|
append bss_conf "wpa=$wpa" "$N"
|
|
[ -n "$wpa_pairwise" ] && append bss_conf "wpa_pairwise=$wpa_pairwise" "$N"
|
|
@@ -852,11 +883,10 @@ hostapd_set_bss_options() {
|
|
append bss_conf "iapp_interface=$ifname" "$N"
|
|
}
|
|
|
|
- json_get_vars time_advertisement time_zone wnm_sleep_mode wnm_sleep_mode_no_keys bss_transition mbo
|
|
+ json_get_vars time_advertisement time_zone wnm_sleep_mode wnm_sleep_mode_no_keys bss_transition
|
|
set_default bss_transition 0
|
|
set_default wnm_sleep_mode 0
|
|
set_default wnm_sleep_mode_no_keys 0
|
|
- set_default mbo 0
|
|
|
|
[ -n "$time_advertisement" ] && append bss_conf "time_advertisement=$time_advertisement" "$N"
|
|
[ -n "$time_zone" ] && append bss_conf "time_zone=$time_zone" "$N"
|
|
@@ -865,7 +895,6 @@ hostapd_set_bss_options() {
|
|
[ "$wnm_sleep_mode_no_keys" -eq "1" ] && append bss_conf "wnm_sleep_mode_no_keys=1" "$N"
|
|
fi
|
|
[ "$bss_transition" -eq "1" ] && append bss_conf "bss_transition=1" "$N"
|
|
- [ "$mbo" -eq 1 ] && append bss_conf "mbo=1" "$N"
|
|
|
|
json_get_vars ieee80211k rrm_neighbor_report rrm_beacon_report
|
|
set_default ieee80211k 0
|
|
@@ -900,25 +929,31 @@ hostapd_set_bss_options() {
|
|
json_get_vars mobility_domain ft_psk_generate_local ft_over_ds reassociation_deadline
|
|
|
|
set_default mobility_domain "$(echo "$ssid" | md5sum | head -c 4)"
|
|
- set_default ft_over_ds 0
|
|
+ set_default ft_over_ds 1
|
|
set_default reassociation_deadline 1000
|
|
+ skip_kh_setup=0
|
|
|
|
case "$auth_type" in
|
|
- psk|sae|psk-sae)
|
|
+ psk|psk-sae)
|
|
set_default ft_psk_generate_local 1
|
|
+ skip_kh_setup="$ft_psk_generate_local"
|
|
;;
|
|
*)
|
|
set_default ft_psk_generate_local 0
|
|
;;
|
|
esac
|
|
|
|
+ case "$auth_type" in
|
|
+ *sae*) skip_kh_setup=0;;
|
|
+ esac
|
|
+
|
|
[ -n "$network_ifname" ] && append bss_conf "ft_iface=$network_ifname" "$N"
|
|
append bss_conf "mobility_domain=$mobility_domain" "$N"
|
|
append bss_conf "ft_psk_generate_local=$ft_psk_generate_local" "$N"
|
|
append bss_conf "ft_over_ds=$ft_over_ds" "$N"
|
|
append bss_conf "reassociation_deadline=$reassociation_deadline" "$N"
|
|
|
|
- if [ "$ft_psk_generate_local" -eq "0" ]; then
|
|
+ if [ "$skip_kh_setup" -eq "0" ]; then
|
|
json_get_vars r0_key_lifetime r1_key_holder pmk_r1_push
|
|
json_get_values r0kh r0kh
|
|
json_get_values r1kh r1kh
|
|
@@ -927,10 +962,10 @@ hostapd_set_bss_options() {
|
|
set_default pmk_r1_push 0
|
|
|
|
[ -n "$r0kh" -a -n "$r1kh" ] || {
|
|
- ft_key=`echo -n "$mobility_domain/${auth_secret:-${key}}" | md5sum | awk '{print $1}'`
|
|
+ key=`echo -n "$mobility_domain/$auth_secret" | md5sum | awk '{print $1}'`
|
|
|
|
- set_default r0kh "ff:ff:ff:ff:ff:ff,*,$ft_key"
|
|
- set_default r1kh "00:00:00:00:00:00,00:00:00:00:00:00,$ft_key"
|
|
+ set_default r0kh "ff:ff:ff:ff:ff:ff,*,$key"
|
|
+ set_default r1kh "00:00:00:00:00:00,00:00:00:00:00:00,$key"
|
|
}
|
|
|
|
[ -n "$r1_key_holder" ] && append bss_conf "r1_key_holder=$r1_key_holder" "$N"
|
|
@@ -981,11 +1016,16 @@ hostapd_set_bss_options() {
|
|
json_get_vars ieee80211w_mgmt_cipher ieee80211w_max_timeout ieee80211w_retry_timeout
|
|
append bss_conf "ieee80211w=$ieee80211w" "$N"
|
|
[ "$ieee80211w" -gt "0" ] && {
|
|
- if [ "$auth_type" = "eap192" ]; then
|
|
+ case "$auth_type" in
|
|
+ eap192)
|
|
append bss_conf "group_mgmt_cipher=BIP-GMAC-256" "$N"
|
|
- else
|
|
+ append bss_conf "group_cipher=GCMP-256" "$N"
|
|
+ ;;
|
|
+ *)
|
|
append bss_conf "group_mgmt_cipher=${ieee80211w_mgmt_cipher:-AES-128-CMAC}" "$N"
|
|
- fi
|
|
+ ;;
|
|
+ esac
|
|
+
|
|
[ -n "$ieee80211w_max_timeout" ] && \
|
|
append bss_conf "assoc_sa_query_max_timeout=$ieee80211w_max_timeout" "$N"
|
|
[ -n "$ieee80211w_retry_timeout" ] && \
|
|
@@ -1100,12 +1140,13 @@ hostapd_set_bss_options() {
|
|
|
|
local hs20 disable_dgaf osen anqp_domain_id hs20_deauth_req_timeout \
|
|
osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp \
|
|
- hs20_t_c_server_url
|
|
+ hs20_t_c_server_url hs20_release
|
|
json_get_vars hs20 disable_dgaf osen anqp_domain_id hs20_deauth_req_timeout \
|
|
osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp \
|
|
- hs20_t_c_server_url
|
|
+ hs20_t_c_server_url hs20_release
|
|
|
|
set_default hs20 0
|
|
+ set_default hs20_release 1
|
|
set_default disable_dgaf $hs20
|
|
set_default osen 0
|
|
set_default anqp_domain_id 0
|
|
@@ -1113,6 +1154,7 @@ hostapd_set_bss_options() {
|
|
if [ "$hs20" = "1" ]; then
|
|
append bss_conf "hs20=1" "$N"
|
|
append_hs20_icons
|
|
+ append bss_conf "hs20_release=$hs20_release" "$N"
|
|
append bss_conf "disable_dgaf=$disable_dgaf" "$N"
|
|
append bss_conf "osen=$osen" "$N"
|
|
append bss_conf "anqp_domain_id=$anqp_domain_id" "$N"
|
|
@@ -1154,6 +1196,8 @@ hostapd_set_bss_options() {
|
|
append bss_conf "per_sta_vif=$per_sta_vif" "$N"
|
|
fi
|
|
|
|
+ [ -n "$uci_section" ] && append bss_conf "uci_section=$uci_section" "$N"
|
|
+
|
|
json_get_values opts hostapd_bss_options
|
|
for val in $opts; do
|
|
append bss_conf "$val" "$N"
|
|
@@ -1178,7 +1222,7 @@ hostapd_set_log_options() {
|
|
set_default log_iapp 1
|
|
set_default log_mlme 1
|
|
|
|
- local log_mask="$(( \
|
|
+ local log_mask=$(( \
|
|
($log_80211 << 0) | \
|
|
($log_8021x << 1) | \
|
|
($log_radius << 2) | \
|
|
@@ -1186,7 +1230,7 @@ hostapd_set_log_options() {
|
|
($log_driver << 4) | \
|
|
($log_iapp << 5) | \
|
|
($log_mlme << 6) \
|
|
- ))"
|
|
+ ))
|
|
|
|
append "$var" "logger_syslog=$log_mask" "$N"
|
|
append "$var" "logger_syslog_level=$log_level" "$N"
|
|
@@ -1295,15 +1339,15 @@ wpa_supplicant_add_network() {
|
|
json_get_vars \
|
|
ssid bssid key \
|
|
basic_rate mcast_rate \
|
|
- ieee80211w ieee80211r fils ocv \
|
|
+ ieee80211w ieee80211r fils \
|
|
multi_ap \
|
|
default_disabled
|
|
|
|
case "$auth_type" in
|
|
- sae|owe|eap192|eap-eap192)
|
|
+ sae|owe|eap-eap256)
|
|
set_default ieee80211w 2
|
|
;;
|
|
- psk-sae)
|
|
+ psk-sae|eap192|eap256)
|
|
set_default ieee80211w 1
|
|
;;
|
|
esac
|
|
@@ -1330,7 +1374,7 @@ wpa_supplicant_add_network() {
|
|
}
|
|
|
|
[ "$_w_mode" = "mesh" ] && {
|
|
- json_get_vars mesh_id mesh_fwding mesh_rssi_threshold encryption
|
|
+ json_get_vars mesh_id mesh_fwding mesh_rssi_threshold
|
|
[ -n "$mesh_id" ] && ssid="${mesh_id}"
|
|
|
|
append network_data "mode=5" "$N$T"
|
|
@@ -1338,7 +1382,7 @@ wpa_supplicant_add_network() {
|
|
[ -n "$mesh_rssi_threshold" ] && append network_data "mesh_rssi_threshold=${mesh_rssi_threshold}" "$N$T"
|
|
[ -n "$freq" ] && wpa_supplicant_set_fixed_freq "$freq" "$htmode"
|
|
[ "$noscan" = "1" ] && append network_data "noscan=1" "$N$T"
|
|
- [ "$encryption" = "none" -o -z "$encryption" ] || append wpa_key_mgmt "SAE"
|
|
+ append wpa_key_mgmt "SAE"
|
|
scan_ssid=""
|
|
}
|
|
|
|
@@ -1347,8 +1391,6 @@ wpa_supplicant_add_network() {
|
|
[ "$default_disabled" = 1 ] && append network_data "disabled=1" "$N$T"
|
|
}
|
|
|
|
- [ -n "$ocv" ] && append network_data "ocv=$ocv" "$N$T"
|
|
-
|
|
case "$auth_type" in
|
|
none) ;;
|
|
owe)
|
|
@@ -1372,18 +1414,18 @@ wpa_supplicant_add_network() {
|
|
|
|
key_mgmt="$wpa_key_mgmt"
|
|
|
|
- if [ "$_w_mode" = "mesh" ] || [ "$auth_type" = "sae" ]; then
|
|
- passphrase="sae_password=\"${key}\""
|
|
+ if [ ${#key} -eq 64 ]; then
|
|
+ passphrase="psk=${key}"
|
|
else
|
|
- if [ ${#key} -eq 64 ]; then
|
|
- passphrase="psk=${key}"
|
|
+ if [ "$_w_mode" = "mesh" ]; then
|
|
+ passphrase="sae_password=\"${key}\""
|
|
else
|
|
passphrase="psk=\"${key}\""
|
|
fi
|
|
fi
|
|
append network_data "$passphrase" "$N$T"
|
|
;;
|
|
- eap|eap192|eap-eap192)
|
|
+ eap|eap192|eap-eap256|eap256)
|
|
hostapd_append_wpa_key_mgmt
|
|
key_mgmt="$wpa_key_mgmt"
|
|
|
|
@@ -1588,6 +1630,29 @@ EOF
|
|
return 0
|
|
}
|
|
|
|
+wpa_supplicant_run() {
|
|
+ local ifname="$1"
|
|
+ local hostapd_ctrl="$2"
|
|
+
|
|
+ _wpa_supplicant_common "$ifname"
|
|
+
|
|
+ ubus wait_for wpa_supplicant
|
|
+ local supplicant_res="$(ubus call wpa_supplicant config_add "{ \
|
|
+ \"driver\": \"${_w_driver:-wext}\", \"ctrl\": \"$_rpath\", \
|
|
+ \"iface\": \"$ifname\", \"config\": \"$_config\" \
|
|
+ ${network_bridge:+, \"bridge\": \"$network_bridge\"} \
|
|
+ ${hostapd_ctrl:+, \"hostapd_ctrl\": \"$hostapd_ctrl\"} \
|
|
+ }")"
|
|
+
|
|
+ ret="$?"
|
|
+
|
|
+ [ "$ret" != 0 -o -z "$supplicant_res" ] && wireless_setup_vif_failed WPA_SUPPLICANT_FAILED
|
|
+
|
|
+ wireless_add_process "$(jsonfilter -s "$supplicant_res" -l 1 -e @.pid)" "/usr/sbin/wpa_supplicant" 1 1
|
|
+
|
|
+ return $ret
|
|
+}
|
|
+
|
|
hostapd_common_cleanup() {
|
|
killall meshd-nl80211
|
|
}
|
|
--
|
|
2.34.1
|
|
|