hostapd: add an option for 802.11h (enabled by default)
[openwrt/staging/wigyori.git] / package / network / services / hostapd / files / netifd.sh
index 32bf367c53270c7e029fa2329e85b0407e812f60..ab31361ebb09cc5c03b179f726e1447a22ca1c74 100644 (file)
@@ -51,7 +51,7 @@ hostapd_common_add_device_config() {
        config_add_array basic_rate
 
        config_add_string country
-       config_add_boolean country_ie
+       config_add_boolean country_ie doth
 
        hostapd_add_log_config
 }
@@ -63,14 +63,18 @@ hostapd_prepare_device_config() {
        local base="${config%%.conf}"
        local base_cfg=
 
-       json_get_vars country country_ie beacon_int
+       json_get_vars country country_ie beacon_int doth
 
        hostapd_set_log_options base_cfg
 
        set_default country_ie 1
+       set_default doth 1
+
        [ -n "$country" ] && {
                append base_cfg "country_code=$country" "$N"
+
                [ "$country_ie" -gt 0 ] && append base_cfg "ieee80211d=1" "$N"
+               [ "$hwmode" = "a" -a "$doth" -gt 0 ] && append base_cfg "ieee80211h=1" "$N"
        }
        [ -n "$hwmode" ] && append base_cfg "hw_mode=$hwmode" "$N"
 
@@ -89,7 +93,7 @@ EOF
 }
 
 hostapd_common_add_bss_config() {
-       config_add_string bssid ssid
+       config_add_string 'bssid:macaddr' 'ssid:string'
        config_add_boolean wds wmm hidden
 
        config_add_int maxassoc max_inactivity
@@ -102,9 +106,9 @@ hostapd_common_add_bss_config() {
        config_add_boolean rsn_preauth auth_cache
        config_add_int ieee80211w
 
-       config_add_string auth_server server
+       config_add_string 'auth_server:host' 'server:host'
        config_add_string auth_secret
-       config_add_int auth_port port
+       config_add_int 'auth_port:port' 'port:port'
 
        config_add_string acct_server
        config_add_string acct_secret
@@ -118,15 +122,15 @@ hostapd_common_add_bss_config() {
        config_add_string iapp_interface
        config_add_string eap_type ca_cert client_cert identity auth priv_key priv_key_pwd
 
-       config_add_string key1 key2 key3 key4 password
+       config_add_string 'key1:wepkey' 'key2:wepkey' 'key3:wepkey' 'key4:wepkey' 'password:wpakey'
 
-       config_add_boolean wps_pushbutton wps_label ext_registrar
+       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_int ieee80211w_max_timeout ieee80211w_retry_timeout
 
-       config_add_string macfilter macfile
-       config_add_array maclist
+       config_add_string macfilter 'macfile:file'
+       config_add_array 'maclist:list(macaddr)'
 
        config_add_int mcast_rate
        config_add_array basic_rate
@@ -145,7 +149,7 @@ hostapd_set_bss_options() {
        json_get_vars \
                wep_rekey wpa_group_rekey wpa_pair_rekey wpa_master_rekey \
                maxassoc max_inactivity disassoc_low_ack isolate auth_cache \
-               wps_pushbutton wps_label ext_registrar \
+               wps_pushbutton wps_label ext_registrar wps_pbc_in_m1 \
                wps_device_type wps_device_name wps_manufacturer wps_pin \
                macfilter ssid wmm hidden short_preamble
 
@@ -254,6 +258,7 @@ hostapd_set_bss_options() {
 
        set_default wps_pushbutton 0
        set_default wps_label 0
+       set_default wps_pbc_in_m1 0
 
        config_methods=
        [ "$wps_pushbutton" -gt 0 ] && append config_methods push_button
@@ -279,6 +284,7 @@ hostapd_set_bss_options() {
                append bss_conf "device_name=$wps_device_name" "$N"
                append bss_conf "manufacturer=$wps_manufacturer" "$N"
                append bss_conf "config_methods=$config_methods" "$N"
+               [ "$wps_pbc_in_m1" -gt 0 ] && append bss_conf "pbc_in_m1=$wps_pbc_in_m1" "$N"
        }
 
        append bss_conf "ssid=$ssid" "$N"
@@ -584,5 +590,5 @@ wpa_supplicant_run() {
 }
 
 hostapd_common_cleanup() {
-       killall hostapd wpa_supplicant
+       killall hostapd wpa_supplicant meshd-nl80211
 }