hostapd: add 802.11r support
authorFelix Fietkau <nbd@openwrt.org>
Thu, 26 Mar 2015 23:34:33 +0000 (23:34 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Thu, 26 Mar 2015 23:34:33 +0000 (23:34 +0000)
Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
SVN-Revision: 45051

package/network/services/hostapd/files/hostapd.sh
package/network/services/hostapd/files/netifd.sh

index a4b38d7c4fc7d617d7a40ed13331e7e7254ee3e5..7aec7ad8a40ae843453e2c3e8f812a93c9635320 100644 (file)
@@ -219,6 +219,35 @@ hostapd_set_bss_options() {
        then
                config_get nasid "$vif" nasid
                [ -n "$nasid" ] && append "$var" "nas_identifier=$nasid" "$N"
+
+               config_get_bool ieee80211r "$vif" ieee80211r 0
+               if [ "$ieee80211r" -gt 0 ]
+               then
+                       config_get mobility_domain "$vif" mobility_domain "4f57"
+                       config_get r0_key_lifetime "$vif" r0_key_lifetime "10000"
+                       config_get r1_key_holder "$vif" r1_key_holder "00004f577274"
+                       config_get reassociation_deadline "$vif" reassociation_deadline "1000"
+                       config_get r0kh "$vif" r0kh
+                       config_get r1kh "$vif" r1kh
+                       config_get_bool pmk_r1_push "$vif" pmk_r1_push 0
+
+                       append "$var" "mobility_domain=$mobility_domain" "$N"
+                       append "$var" "r0_key_lifetime=$r0_key_lifetime" "$N"
+                       append "$var" "r1_key_holder=$r1_key_holder" "$N"
+                       append "$var" "reassociation_deadline=$reassociation_deadline" "$N"
+                       append "$var" "pmk_r1_push=$pmk_r1_push" "$N"
+
+                       for kh in $r0kh; do
+                               "$var" "r0kh=${kh//,/ }" "$N"
+                       done
+                       for kh in $r1kh; do
+                               "$var" "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
+
                [ -n "wpa_key_mgmt" ] && append "$var" "wpa_key_mgmt=$wpa_key_mgmt"
        fi
 
index a5abdce1ce7a486ed899e30642eb97452bd5ee86..6e4b23b73e68de150414ab319b58703916196bee 100644 (file)
@@ -148,6 +148,11 @@ hostapd_common_add_bss_config() {
        config_add_boolean wps_pushbutton wps_label ext_registrar wps_pbc_in_m1
        config_add_string wps_device_type wps_device_name wps_manufacturer wps_pin
 
+       config_add_boolean ieee80211r pmk_r1_push
+       config_add_int r0_key_lifetime reassociation_deadline
+       config_add_string mobility_domain r1_key_holder
+       config_add_array r0kh r1kh
+
        config_add_int ieee80211w_max_timeout ieee80211w_retry_timeout
 
        config_add_string macfilter 'macfile:file'
@@ -340,8 +345,38 @@ hostapd_set_bss_options() {
        }
 
        if [ "$wpa" -ge "1" ]; then
-               json_get_vars nasid
+               json_get_vars nasid ieee80211r
                [ -n "$nasid" ] && append bss_conf "nas_identifier=$nasid" "$N"
+
+               if [ "$ieee80211r" -gt "0" ]; then
+                       json_get_vars mobility_domain r0_key_lifetime r1_key_holder \
+                       reassociation_deadline pmk_r1_push
+                       json_get_values r0kh r0kh
+                       json_get_values r1kh r1kh
+
+                       set_default mobility_domain "4f57"
+                       set_default r0_key_lifetime 10000
+                       set_default r1_key_holder "00004f577274"
+                       set_default reassociation_deadline 1000
+                       set_default pmk_r1_push 0
+
+                       append bss_conf "mobility_domain=$mobility_domain" "$N"
+                       append bss_conf "r0_key_lifetime=$r0_key_lifetime" "$N"
+                       append bss_conf "r1_key_holder=$r1_key_holder" "$N"
+                       append bss_conf "reassociation_deadline=$reassociation_deadline" "$N"
+                       append bss_conf "pmk_r1_push=$pmk_r1_push" "$N"
+
+                       for kh in $r0kh; do
+                               append bss_conf "r0kh=${kh//,/ }" "$N"
+                       done
+                       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
+
                [ -n "$wpa_key_mgmt" ] && append bss_conf "wpa_key_mgmt=$wpa_key_mgmt" "$N"
        fi