5071ae51514a12b8d55862bc808fde4682efd058
[openwrt/openwrt.git] / package / network / services / hostapd / patches / 016-mesh-fix-channel-switch-error-during-CAC.patch
1 From fa9d565fe8841b288f29137c23a7ab2584dd9510 Mon Sep 17 00:00:00 2001
2 From: Peter Oh <peter.oh@bowerswilkins.com>
3 Date: Tue, 29 May 2018 14:39:20 -0700
4 Subject: [PATCH 16/18] mesh: fix channel switch error during CAC
5
6 Mesh interface has used its channel parameters that configured
7 during its initialization even after channel switched due to
8 DFS radar detection during CAC which caused channel switch error.
9 This change fixes the error by updating its channel parameters
10 when channel's been changed from initial one.
11
12 Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
13 Signed-off-by: Daniel Golle <daniel@makrotopia.org>
14 [daniel@makrotopia.org: added hw_features_common.h include]
15 ---
16 wpa_supplicant/mesh.c | 25 +++++++++++++++++++++++++
17 1 file changed, 25 insertions(+)
18
19 --- a/wpa_supplicant/mesh.c
20 +++ b/wpa_supplicant/mesh.c
21 @@ -11,6 +11,7 @@
22 #include "utils/common.h"
23 #include "utils/eloop.h"
24 #include "utils/uuid.h"
25 +#include "common/hw_features_common.h"
26 #include "common/ieee802_11_defs.h"
27 #include "common/wpa_ctrl.h"
28 #include "ap/sta_info.h"
29 @@ -394,10 +395,35 @@ void wpa_supplicant_mesh_add_scan_ie(str
30 void wpas_mesh_complete_cb(void *ctx)
31 {
32 struct wpa_supplicant *wpa_s = (struct wpa_supplicant *)ctx;
33 + struct hostapd_iface *ifmsh = wpa_s->ifmsh;
34 struct wpa_driver_mesh_join_params *params = wpa_s->mesh_params;
35 struct wpa_ssid *ssid = wpa_s->current_ssid;
36 int ret = 0;
37
38 + /*
39 + * inspect if channel's been changed since initialized.
40 + * i.e. DFS radar detection
41 + */
42 + if (ifmsh->freq != params->freq.freq) {
43 + wpa_s->assoc_freq = ifmsh->freq;
44 + ssid->frequency = ifmsh->freq;
45 + if (hostapd_set_freq_params(&params->freq,
46 + ifmsh->conf->hw_mode,
47 + ifmsh->freq,
48 + ifmsh->conf->channel,
49 + ifmsh->conf->ieee80211n,
50 + ifmsh->conf->ieee80211ac,
51 + ifmsh->conf->secondary_channel,
52 + ifmsh->conf->vht_oper_chwidth,
53 + ifmsh->conf->vht_oper_centr_freq_seg0_idx,
54 + ifmsh->conf->vht_oper_centr_freq_seg1_idx,
55 + ifmsh->conf->vht_capab)) {
56 + wpa_printf(MSG_ERROR, "Error updating mesh frequency params.");
57 + wpa_supplicant_mesh_deinit(wpa_s);
58 + return;
59 + }
60 + }
61 +
62 if (wpas_mesh_init_rsn(wpa_s)) {
63 wpa_printf(MSG_ERROR, "Init RSN failed. Deinit mesh...");
64 wpa_supplicant_mesh_deinit(wpa_s);