]> git.ipfire.org Git - people/ms/network.git/commitdiff
wireless-ap: Allow to disable DFS in configuration
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 18 Mar 2019 18:58:25 +0000 (19:58 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 18 Mar 2019 18:58:25 +0000 (19:58 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/functions/functions.hostapd
src/helpers/hostapd-config-helper
src/hooks/ports/wireless-ap

index 3f64e79b9f24cc0463ba1c551c73694d0471a705..e19f9b3f16d34103d00c9b4dcc75227439313044 100644 (file)
@@ -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
 
index cb12af0a3c122ab70d036d60534060e0db0c3a7f..30d3456f1ba54b65b4d254608d87dd34daed6c34 100644 (file)
@@ -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}" \
index 52ca2389212cb016c66e36b0afd08b9b21ff7e96..49c0a84396dfe8252a4c72fdc4e4b626ee24bdb6 100644 (file)
@@ -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}")
                                ;;