Ok, this version will load up profiles from /etc/config/radius in /etc/config/wireless, the previous options are still valid:
radius: config profile Default option server x.x.x.x option shared_secret mysecret config profile option server x.x.x.x option shared_secret mysecret wireless: config wifi-iface ath0 option encryption "wpa" option radius_profiles Default config wifi-iface ath1 option encryption "wpa" # with no profiles set, all profiles will be used # as hostapd support more than one radius profile Signed-off-by: David Bird <[EMAIL PROTECTED]> Index: package/hostapd/files/hostapd.sh =================================================================== --- package/hostapd/files/hostapd.sh (revision 11362) +++ package/hostapd/files/hostapd.sh (working copy) @@ -44,13 +44,56 @@ *wpa*|*WPA*) # required fields? formats? # hostapd is particular, maybe a default configuration for failures + + # fetch all or specific radius profiles + config_get profiles "$vif" radius_profiles + local specific_cfg= + local available_cfg= + + config_cb() { + local cfg="$CONFIG_SECTION" + local cfgtype + config_get cfgtype "$cfg" TYPE + [ "$cfgtype" = "profile" ] && { + config_get server "$cfg" server + [ -n "$server" ] && { + config_get authport "$cfg" authport + config_get shared_secret "$cfg" shared_secret + append available_cfg "auth_server_addr=$server" "$N" + append available_cfg "auth_server_port=${authport:-1812}" "$N" + append available_cfg "auth_server_shared_secret=$shared_secret" "$N" + [ -n "$profiles" ] && { + for n in "$profiles"; do + [ "$n" = "$cfg" ] && { + append specific_cfg "auth_server_addr=$server" "$N" + append specific_cfg "auth_server_port=${authport:-1812}" "$N" + append specific_cfg "auth_server_shared_secret=$shared_secret" "$N" + } + done + } + } + } + } + + config_load radius + + # use specific, if found, otherwise use all (or fail?) + if [ -n "$specific_cfg" ]; then + hostapd_cfg="$hostapd_cfg$specific_cfg" + else + hostapd_cfg="$hostapd_cfg$available_cfg" + fi + + # direct, non-profile settings, per Wiki docs config_get server "$vif" server - append hostapd_cfg "auth_server_addr=$server" "$N" - config_get port "$vif" port - port=${port:-1812} - append hostapd_cfg "auth_server_port=$port" "$N" - config_get secret "$vif" key - append hostapd_cfg "auth_server_shared_secret=$secret" "$N" + [ -n "$server" ] && { + append hostapd_cfg "auth_server_addr=$server" "$N" + config_get port "$vif" port + append hostapd_cfg "auth_server_port=${port:-1812}" "$N" + config_get secret "$vif" key + append hostapd_cfg "auth_server_shared_secret=$secret" "$N" + } + config_get nasid "$vif" nasid append hostapd_cfg "nas_identifier=$nasid" "$N" append hostapd_cfg "eapol_key_index_workaround=1" "$N" _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org http://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel