meta-netmodule-wlan/recipes-connectivity/hostapd/files/800-dfs-enter-DFS-state-if-...

41 lines
1.2 KiB
Diff

From 45e2411ad553ed6a89fb2c4f9058e27de91c689d Mon Sep 17 00:00:00 2001
From: David Bauer <mail@david-bauer.net>
Date: Fri, 3 Jul 2020 23:00:34 +0200
Subject: [PATCH] dfs: enter DFS state if no available channel is found
Previously hostapd would not stop transmitting when a DFS event was
detected and no available channel to switch to was available.
Disable and re-enable the interface to enter DFS state. This way, TX
does not happen until the kernel notifies hostapd about the NOP
expiring.
Signed-off-by: David Bauer <mail@david-bauer.net>
---
src/ap/dfs.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/ap/dfs.c b/src/ap/dfs.c
index 8f3630bf8..54a61b0a7 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -1086,8 +1086,15 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface)
&oper_centr_freq_seg0_idx,
&oper_centr_freq_seg1_idx,
&skip_radar);
- if (!channel)
- return err;
+ if (!channel) {
+ /*
+ * Toggle interface state to enter DFS state
+ * until NOP is finished.
+ */
+ hostapd_disable_iface(iface);
+ hostapd_enable_iface(iface);
+ return 0;
+ }
if (!skip_radar) {
iface->freq = channel->freq;
iface->conf->channel = channel->chan;