hostapd: enter DFS state if no available channel is found
[openwrt/staging/dedeckeh.git] / package / network / services / hostapd / patches / 800-dfs-enter-DFS-state-if-no-available-channel-is-found.patch
1 From cefc52e6b93731c713f1bba1cb5e7e92105b758b Mon Sep 17 00:00:00 2001
2 From: David Bauer <mail@david-bauer.net>
3 Date: Fri, 3 Jul 2020 23:00:34 +0200
4 Subject: [PATCH] dfs: enter DFS state if no available channel is found
5
6 Previously hostapd would not stop transmitting when a DFS event was
7 detected and no available channel to switch to was available.
8
9 Disable and re-enable the interface to enter DFS state. This way, TX
10 does not happen until the kernel notifies hostapd about the NOP
11 expiring.
12
13 Signed-off-by: David Bauer <mail@david-bauer.net>
14 ---
15 src/ap/dfs.c | 11 +++++++++--
16 1 file changed, 9 insertions(+), 2 deletions(-)
17
18 --- a/src/ap/dfs.c
19 +++ b/src/ap/dfs.c
20 @@ -1066,8 +1066,15 @@ static int hostapd_dfs_start_channel_swi
21 &oper_centr_freq_seg0_idx,
22 &oper_centr_freq_seg1_idx,
23 &skip_radar);
24 - if (!channel)
25 - return err;
26 + if (!channel) {
27 + /*
28 + * Toggle interface state to enter DFS state
29 + * until NOP is finished.
30 + */
31 + hostapd_disable_iface(iface);
32 + hostapd_enable_iface(iface);
33 + return 0;
34 + }
35 if (!skip_radar) {
36 iface->freq = channel->freq;
37 iface->conf->channel = channel->chan;