assert isset key
fi
+ # With channel 0, ACS must be supported
+ if [ ${channel} -eq 0 ] && ! wireless_supports_acs "${device}"; then
+ error "ACS requested, but not supported by ${device}"
+ return ${EXIT_ERROR}
+ fi
+
# Check channel bandwidth for validity
if isset channel_bandwidth && ! wireless_channel_bandwidth_is_valid "${mode}" "${channel_bandwidth}"; then
error "Invalid channel bandwidth for ${mode}: ${channel_bandwidth}"
list_match "${capability}" $(__phy_list_ht_capabilities "${phy}")
}
+# Returns TRUE if the PHY supports ACS
+phy_supports_acs() {
+ local phy="${1}"
+ assert isset phy
+
+ local driver="$(phy_get_driver "${phy}")"
+ if ! isset driver; then
+ return ${EXIT_ERROR}
+ fi
+
+ # This is basically a whilelist of drivers which support this
+ # There is no better detection
+ case "${driver}" in
+ ath10k_*|ath9k|ath5k)
+ return ${EXIT_TRUE}
+ ;;
+ *)
+ return ${EXIT_FALSE}
+ ;;
+ esac
+}
+
# Returns TRUE if the PHY supports DFS
phy_supports_dfs() {
local phy="${1}"
network-phy-list-vht-caps "${phy}"
}
+wireless_supports_acs() {
+ local device="${1}"
+ assert isset device
+
+ local phy="$(device_get_phy "${device}")"
+ if ! isset phy; then
+ log ERROR "Could not determine PHY for ${device}"
+ return ${EXIT_ERROR}
+ fi
+
+ phy_supports_acs "${phy}"
+}
+
wireless_supports_dfs() {
local device="${1}"
assert isset device
ADDRESS=$(mac_generate)
BROADCAST_SSID=on
-CHANNEL=0
+CHANNEL=
CHANNEL_BANDWIDTH=
ENCRYPTION=""
KEY=""
return ${EXIT_ERROR}
fi
+ # Automatically enable ACS if no channel is set and ACS is available
+ if ! isset CHANNEL && phy_supports_acs "${PHY}"; then
+ CHANNEL="0"
+
+ log INFO "Automatic Channel Selection (ACS) enabled"
+ fi
+
# Channel bandwidth must match the mode
if isset CHANNEL_BANDWIDTH && ! wireless_channel_bandwidth_is_valid "${MODE}" "${CHANNEL_BANDWIDTH}"; then
error "Channel Bandwidth '${CHANNEL_BANDWIDTH}' is not supported for ${MODE}"