Shortening CAC time when DFS scanning from 60 s to 2 s

The goal is to reduce the time of no radio while the DFS scanning is in effect from 60 sec to 2 sec.

Not being a programmer, I was playing around with the source for hostapd after grepping for some key words. I found what I thought might accomplish this in src/ap/dfs.c and edited it as shown in the below patch. This did not have the effect of waiting 2 sec; it still took 60 sec. Any thoughts or suggestions?

From 036dbd9177aa1e79ad0137e6952a8cfecaf63b35 Mon Sep 17 00:00:00 2001
Date: Tue, 8 Nov 2022 09:59:43 -0500
Subject: [PATCH] hack: make default DFS time 2 sec not 60 sec

---
 ...ke-default-DFS-time-2-sec-not-60-sec.patch | 21 +++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 package/network/services/hostapd/patches/0001-hack-make-default-DFS-time-2-sec-not-60-sec.patch

diff --git a/package/network/services/hostapd/patches/0001-hack-make-default-DFS-time-2-sec-not-60-sec.patch b/package/network/services/hostapd/patches/0001-hack-make-default-DFS-time-2-sec-not-60-sec.patch
new file mode 100644
index 0000000000..acfab2f462
--- /dev/null
+++ b/package/network/services/hostapd/patches/0001-hack-make-default-DFS-time-2-sec-not-60-sec.patch
@@ -0,0 +1,21 @@
+From 000f26e91a986c7354ec43a88ce04801ac5a5d1e Mon Sep 17 00:00:00 2001
+Date: Tue, 8 Nov 2022 09:21:39 -0500
+Subject: [PATCH] hack: make default DFS time 2 sec not 60 sec
+
+---
+ src/ap/dfs.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/src/ap/dfs.c
++++ b/src/ap/dfs.c
+@@ -1537,7 +1537,8 @@ int hostapd_dfs_start_cac(struct hostapd
+               iface->cac_started = 1;
+       }
+       /* TODO: How to check CAC time for ETSI weather channels? */
+-      iface->dfs_cac_ms = 60000;
++      /* change the default of 60000 ms to 2000 ms */
++      iface->dfs_cac_ms = 2000;
+       wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_CAC_START
+               "freq=%d chan=%d chan_offset=%d width=%d seg0=%d "
+               "seg1=%d cac_time=%ds%s",
-- 
2.38.1

Is it possible the minimum time is hardcoded? I'm pretty sure the minimum scanning time is mandated by law in a lot of places (and tends to be at least 60 seconds).

2 Likes

Regulations require waiting for 60 seconds to wait for the weather radar antenna beam to sweep around.

6 Likes

I don't want to break any laws, maybe it's more of a proof of concept/conceptual goal. Seems like something in the code dictates the minimum time.

Much of the radar detection and avoidance code is in the wifi driver kmod and even in the chip firmware.

4 Likes

Ah, likely barking up the wrong tree here then...

Code that breaks the law can't be condoned here. It gives open-source a bad name.

3 Likes

This is exactly the reason that FCC and others use when introducing more and more obstructions to running custom code as this is illegal, you cannot reduce DFS time just because you dont like it.

3 Likes

Thanks for the discussion, all. The spirit of my post was never to do anything illegal.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.