. /usr/lib/network/header-zone
-HOOK_SETTINGS="HOOK PHY MAC MTU SSID KEY ENCRYPTION"
+HOOK_SETTINGS="HOOK PHY MAC SSID KEY ENCRYPTION_MODE"
# Default values
ADDRESS=$(mac_generate)
PHY=
-MTU=1500
SSID=
KEY=
ENCRYPTION_MODE=
-function hook_check() {
+hook_check_settings() {
assert isset SSID
if isset ADDRESS; then
assert ismac ADDRESS
fi
- assert isinteger MTU
assert ismac PHY
if [ -n "${ENCRYPTION_MODE}" ]; then
fi
}
-function hook_parse_cmdline() {
+hook_parse_cmdline() {
while [ $# -gt 0 ]; do
case "${1}" in
--phy=*|--parent-device=*)
- PHY=$(cli_get_val ${1})
+ PHY=$(cli_get_val "${1}")
;;
--encryption-mode=*)
- ENCRYPTION_MODE=$(cli_get_val ${1})
+ ENCRYPTION_MODE=$(cli_get_val "${1}")
;;
--address=*)
- ADDRESS=$(cli_get_val ${1})
+ ADDRESS=$(cli_get_val "${1}")
;;
--ssid=*)
- SSID=$(cli_get_val ${1})
+ SSID=$(cli_get_val "${1}")
;;
--key=*)
- KEY=$(cli_get_val ${1})
+ KEY=$(cli_get_val "${1}")
;;
*)
warning "Unrecognized option: ${1}"
PHY=$(phy_get_address ${PHY})
}
-function hook_up() {
+hook_up() {
local zone=${1}
assert isset zone
# Read zone configuration.
- zone_config_read ${zone}
+ zone_settings_read "${zone}"
if ! device_exists ${zone}; then
# Create the wireless interface.
exit ${EXIT_OK}
}
-function hook_down() {
+hook_down() {
local zone=${1}
shift
exit ${EXIT_OK}
}
-function hook_status() {
+hook_status() {
local zone=${1}
assert isset zone
local bssid=$(wpa_cli_status_get ${zone} bssid)
assert isset bssid
+ local frequency=$(wpa_cli_bss_get_frequency "${zone}" "${bssid}")
+ cli_print_fmt1 3 "Channel" "$(wireless_frequency_to_channel ${frequency}) (${frequency} MHz)"
cli_print_fmt1 3 "BSSID" "${bssid}"
- cli_print_fmt1 3 "Frequency" \
- "$(wpa_cli_bss_get_frequency ${zone} ${bssid}) MHz"
cli_print_fmt1 3 "Noise" \
"$(wpa_cli_bss_get_noise ${zone} ${bssid})"
cli_print_fmt1 3 "Quality" \
- "$(wpa_cli_bss_get_quality ${zone} ${bssid})"
+ "$(wpa_cli_bss_get_quality ${zone} ${bssid})%%"
cli_print_fmt1 3 "Flags" \
"$(wpa_cli_bss_get_flags ${zone} ${bssid})"
cli_space