["802.11g"]="20 40"
)
+WIRELESS_ENVIRONMENTS=( "indoor+outdoor" "indoor" "outdoor" )
+WIRELESS_DEFAULT_ENVIRONMENT="${WIRELESS_ENVIRONMENTS[0]}"
+
cli_wireless() {
local action=${1}
shift 1
}
wireless_pre_shared_key_is_valid() {
- local encryption_mode="${1}"
- local psk="${2}"
+ local psk="${1}"
# Length of the PSK
local l="${#psk}"
- case "${encryption_mode}" in
- # For WPA*, the key must be between 8 and 63 chars
- WPA2-PSK|WPA2-PSK-SHA256|WPA-PSK|WPA-PSK-SHA256)
- if [ ${l} -ge 8 ] && [ ${l} -le 63 ]; then
- return ${EXIT_TRUE}
- fi
+ # For WPA*, the key must be between 8 and 63 chars
+ if [ ${l} -lt 8 ] || [ ${l} -gt 63 ]; then
+ return ${EXIT_FALSE}
+ fi
- return ${EXIT_FALSE}
- ;;
- esac
+ # Can only contain ASCII chararcters
+ if contains_non_ascii_characters "${psk}"; then
+ return ${EXIT_FALSE}
+ fi
- return ${EXIT_ERROR}
+ # Seems OK
+ return ${EXIT_TRUE}
}
wireless_client_is_connected() {
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
phy_supports_dfs "${phy}"
}
+
+wireless_environment_is_valid() {
+ local environment="${1}"
+
+ list_match "${environment}" "${WIRELESS_ENVIRONMENTS[@]}"
+}