hostapd: add function to handle wpa_key_mgmt

Now that wpa_key_mgmt handling for hostapd and wpa_supplicant are
consistent, we can move parts of it to a dedicated function.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
Tested-by: Sebastian Kemper <sebastian_ml@gmx.net>
master
Stijn Tintel 8 years ago
parent bdcffb9bb6
commit 30f14f6198
  1. 19
      package/network/services/hostapd/files/netifd.sh

@ -36,6 +36,13 @@ hostapd_append_wep_key() {
esac
}
hostapd_append_wpa_key_mgmt() {
local auth_type="$(echo $auth_type | tr 'a-z' 'A-Z')"
append wpa_key_mgmt "WPA-$auth_type"
[ "$ieee80211r" -gt 0 ] && append wpa_key_mgmt "FT-${auth_type}"
}
hostapd_add_log_config() {
config_add_boolean \
log_80211 \
@ -256,7 +263,6 @@ hostapd_set_bss_options() {
[ "$eapol_version" -ge "1" -a "$eapol_version" -le "2" ] && append bss_conf "eapol_version=$eapol_version" "$N"
wps_possible=1
append wpa_key_mgmt "WPA-PSK"
;;
eap)
json_get_vars \
@ -291,7 +297,6 @@ hostapd_set_bss_options() {
[ -n "$ownip" ] && append bss_conf "own_ip_addr=$ownip" "$N"
append bss_conf "eapol_key_index_workaround=1" "$N"
append bss_conf "ieee8021x=1" "$N"
append wpa_key_mgmt "WPA-EAP"
[ "$eapol_version" -ge "1" -a "$eapol_version" -le "2" ] && append bss_conf "eapol_version=$eapol_version" "$N"
;;
@ -376,11 +381,9 @@ hostapd_set_bss_options() {
for kh in $r1kh; do
append bss_conf "r1kh=${kh//,/ }" "$N"
done
[ "$wpa_key_mgmt" != "${wpa_key_mgmt/EAP/}" ] && append wpa_key_mgmt "FT-EAP"
[ "$wpa_key_mgmt" != "${wpa_key_mgmt/PSK/}" ] && append wpa_key_mgmt "FT-PSK"
fi
hostapd_append_wpa_key_mgmt
[ -n "$wpa_key_mgmt" ] && append bss_conf "wpa_key_mgmt=$wpa_key_mgmt" "$N"
fi
@ -614,8 +617,7 @@ wpa_supplicant_add_network() {
psk)
local passphrase
append wpa_key_mgmt "WPA-PSK"
[ "$ieee80211r" -gt 0 ] && append wpa_key_mgmt "FT-PSK"
hostapd_append_wpa_key_mgmt
key_mgmt="$wpa_key_mgmt"
if [ ${#key} -eq 64 ]; then
@ -626,8 +628,7 @@ wpa_supplicant_add_network() {
append network_data "$passphrase" "$N$T"
;;
eap)
append wpa_key_mgmt "WPA-EAP"
[ "$ieee80211r" -gt 0 ] && append wpa_key_mgmt "FT-EAP"
hostapd_append_wpa_key_mgmt
key_mgmt="$wpa_key_mgmt"
json_get_vars eap_type identity anonymous_identity ca_cert

Loading…
Cancel
Save