From 7b297fb22fb16db920d68224b232e5acc652688a Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Mon, 18 Mar 2019 19:58:25 +0100 Subject: [PATCH] wireless-ap: Allow to disable DFS in configuration Signed-off-by: Michael Tremer --- src/functions/functions.hostapd | 10 +++++++++- src/helpers/hostapd-config-helper | 1 + src/hooks/ports/wireless-ap | 16 ++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/functions/functions.hostapd b/src/functions/functions.hostapd index 3f64e79b..e19f9b3f 100644 --- a/src/functions/functions.hostapd +++ b/src/functions/functions.hostapd @@ -36,6 +36,7 @@ hostapd_config_write() { local broadcast_ssid local channel local country_code="$(wireless_get_reg_domain)" + local dfs="on" local encryption local key local mode @@ -50,6 +51,9 @@ hostapd_config_write() { --channel=*) channel=$(cli_get_val "${1}") ;; + --dfs=*) + dfs="$(cli_get_val "${1}")" + ;; --encryption=*) encryption=$(cli_get_val "${1}") ;; @@ -177,7 +181,11 @@ hostapd_config_write() { print "ieee80211d=1" # Enable Radar Detection - print "ieee80211h=1" + if enabled dfs; then + print "ieee80211h=1" + else + print "ieee80211h=0" + fi print # empty line diff --git a/src/helpers/hostapd-config-helper b/src/helpers/hostapd-config-helper index cb12af0a..30d3456f 100644 --- a/src/helpers/hostapd-config-helper +++ b/src/helpers/hostapd-config-helper @@ -40,6 +40,7 @@ case "${action}" in hostapd_config_write ${port} ${config_file} \ --broadcast-ssid="${BROADCAST_SSID}" \ --channel="${CHANNEL}" \ + --dfs="${DFS}" \ --encryption="${ENCRYPTION}" \ --key="${KEY}" \ --mode="${MODE}" \ diff --git a/src/hooks/ports/wireless-ap b/src/hooks/ports/wireless-ap index 52ca2389..49c0a843 100644 --- a/src/hooks/ports/wireless-ap +++ b/src/hooks/ports/wireless-ap @@ -33,12 +33,16 @@ ENCRYPTION="" KEY="" SSID= +# Perform radar detection by default when possible +DFS="on" + hook_check_settings() { assert isset ADDRESS assert ismac ADDRESS assert isset BROADCAST_SSID assert isbool BROADCAST_SSID assert isset CHANNEL + assert isbool DFS assert isset MODE assert isoneof MODE ${HOSTAPD_SUPPORTED_MODES} assert isset PHY @@ -63,6 +67,18 @@ hook_parse_cmdline() { --channel=*) CHANNEL=$(cli_get_val "${1}") ;; + --dfs=*) + DFS="$(cli_get_val "${1}")" + + if enabled DFS; then + DFS="on" + elif disabled DFS; then + DFS="off" + else + error "Invalid value for DFS: ${DFS}" + return ${EXIT_ERROR} + fi + ;; --encryption=*) ENCRYPTION=$(cli_get_val "${1}") ;; -- 2.39.2