HOSTAPD_CONTROL_INTERFACE_DIR="/run/hostapd/ctrl"
-function hostapd_config_write() {
+hostapd_config_write() {
local device=${1}
assert isset device
local broadcast_ssid
local channel
- local country_code
+ local country_code="$(wireless_get_reg_domain)"
local encryption
- local ieee80211d="1"
local key
local mode
local ssid
while [ $# -gt 0 ]; do
case "${1}" in
--broadcast-ssid=*)
- broadcast_ssid=$(cli_get_val ${1})
+ broadcast_ssid=$(cli_get_val "${1}")
;;
--channel=*)
- channel=$(cli_get_val ${1})
- ;;
- --country-code=*)
- country_code=$(cli_get_val ${1})
+ channel=$(cli_get_val "${1}")
;;
--encryption=*)
- encryption=$(cli_get_val ${1})
- ;;
- --ieee80211d=*)
- local val="$(cli_get_val "${1}")"
- if enabled val; then
- ieee80211d="1"
- else
- ieee80211d="0"
- fi
+ encryption=$(cli_get_val "${1}")
;;
--key=*)
- key=$(cli_get_val ${1})
+ key=$(cli_get_val "${1}")
;;
--mode=*)
- mode=$(cli_get_val ${1})
+ mode=$(cli_get_val "${1}")
;;
--ssid=*)
- ssid=$(cli_get_val ${1})
+ ssid=$(cli_get_val "${1}")
;;
--wmm=*)
local val="$(cli_get_val "${1}")"
assert isset channel
assert isinteger channel
- assert isset country_code
assert isset mode
assert isset ssid
assert isset key
fi
+ # Get VHT caps
+ local vht_caps="$(wireless_get_vht_caps "${device}")"
+
+ # Get HT caps
+ local ht_caps="$(wireless_get_ht_caps "${device}")"
+
# Create configuration directory.
local config_dir=$(dirname ${file})
mkdir -p ${HOSTAPD_CONTROL_INTERFACE_DIR} ${config_dir} 2>/dev/null
fi
(
+ print "# Default settings"
+
+ # Advertise country code and maximum transmission power
+ print "ieee80211d=1"
+
print "# Wireless configuration"
print "channel=${channel}"
print "country_code=${country_code}"
print "hw_mode=${hw_mode}"
- print "ieee80211d=${ieee80211d}"
print "ieee80211n=${ieee80211n}"
print "ignore_broadcast_ssid=${ignore_broadcast_ssid}"
# WMM
print "wmm_enabled=${wmm}"
+ # Enable VHT caps
+ if isset vht_caps; then
+ print "vht_capab=${vht_caps}"
+ fi
+
+ # Enable HT caps
+ print "ht_capab=${ht_caps}"
+
print
) >> ${file}
return ${EXIT_OK}
}
-function hostapd_start() {
+hostapd_start() {
local device=${1}
assert isset device
return ${EXIT_OK}
}
-function hostapd_stop() {
+hostapd_stop() {
local device=${1}
assert isset device