diff mbox series

DFS: enter DFS state if no available channel is found

Message ID 20200704081221.85554-1-mail@david-bauer.net
State Accepted
Headers show
Series DFS: enter DFS state if no available channel is found | expand

Commit Message

David Bauer July 4, 2020, 8:12 a.m. UTC
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 | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

Comments

Jouni Malinen Dec. 2, 2020, 4:04 p.m. UTC | #1
On Sat, Jul 04, 2020 at 10:12:21AM +0200, David Bauer wrote:
> 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.

Thanks, applied.
diff mbox series

Patch

diff --git a/src/ap/dfs.c b/src/ap/dfs.c
index 3c078b9cb..9dddca338 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -1066,8 +1066,16 @@  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;