diff options
author | Stijn Tintel <stijn@linux-ipv6.be> | 2016-12-28 05:22:00 +0100 |
---|---|---|
committer | Stijn Tintel <stijn@linux-ipv6.be> | 2017-01-03 20:53:48 +0100 |
commit | 30f14f61984591e7481a3fb568ad59dfb6c49ce7 (patch) | |
tree | ed31000ba722dd666d4fe809b5556bf30ad757b0 | |
parent | bdcffb9bb6bcab19a9e8978039760e4c3202a30e (diff) | |
download | mtk-20170518-30f14f61984591e7481a3fb568ad59dfb6c49ce7.zip mtk-20170518-30f14f61984591e7481a3fb568ad59dfb6c49ce7.tar.gz mtk-20170518-30f14f61984591e7481a3fb568ad59dfb6c49ce7.tar.bz2 |
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>
-rw-r--r-- | package/network/services/hostapd/files/netifd.sh | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/package/network/services/hostapd/files/netifd.sh b/package/network/services/hostapd/files/netifd.sh index b87672c..a339e44 100644 --- a/package/network/services/hostapd/files/netifd.sh +++ b/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 |