@@ -125,6 +125,8 @@ hostapd_common_add_bss_config() {
config_add_string auth_secret
config_add_int 'auth_port:port' 'port:port'
+ config_add_array auth_servers
+
config_add_string acct_server
config_add_string acct_secret
config_add_int acct_port
@@ -269,10 +271,31 @@ hostapd_set_bss_options() {
set_default vlan_naming 1
+ # leave the default option for legacy compatibility
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"
+ # List of fallback RADIUS servers, ip_add@secret[:port]
+ json_select "auth_servers"
+ local Index="1"
+ while json_get_type Var $Index && [ "$Var" = string ]; do
+ json_get_var Var "$((Index++))"
+
+ ip_addr=$(echo "$Var" | cut -d"@" -f2 | cut -d":" -f1)
+ append bss_conf "auth_server_addr=$ip_addr" "$N"
+
+ port=$(echo "$Var" | cut -d"@" -f2 | cut -d":" -f2)
+ if ! echo "$port" | egrep -q '^[0-9]+$' ; then
+ port=1812
+ fi
+ append bss_conf "auth_server_port=$port" "$N"
+
+ secret=$(echo "$Var" | cut -d"@" -f1)
+ append bss_conf "auth_server_shared_secret=$secret" "$N"
+ done
+ json_select ".."
+
[ -n "$acct_server" ] && {
append bss_conf "acct_server_addr=$acct_server" "$N"
append bss_conf "acct_server_port=$acct_port" "$N"
Hostapd allows more than one RADIUS server to be added in case the main server goes down. This allows netifd to load a list of RADIUS servers from the wireless confid file and add them to hostapd. The format of the list in the config file is as follow: list auth_servers 'secret@server_addr[:port]' Signed-off-by: Amine Hamed <amine.ahd@gmail.com> --- .../network/services/hostapd/files/netifd.sh | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+)