hostapd: bring back mesh patches
[oweals/openwrt.git] / package / network / services / hostapd / patches / 016-mesh-fix-channel-switch-error-during-CAC.patch
1 From 5913d6e2a741683e7c747c046f72ca790bbe1337 Mon Sep 17 00:00:00 2001
2 From: Peter Oh <peter.oh@bowerswilkins.com>
3 Date: Mon, 27 Aug 2018 14:28:47 -0700
4 Subject: [PATCH 5/7] 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 ---
14  wpa_supplicant/mesh.c | 25 +++++++++++++++++++++++++
15  1 file changed, 25 insertions(+)
16
17 --- a/wpa_supplicant/mesh.c
18 +++ b/wpa_supplicant/mesh.c
19 @@ -13,6 +13,7 @@
20  #include "utils/uuid.h"
21  #include "common/ieee802_11_defs.h"
22  #include "common/wpa_ctrl.h"
23 +#include "common/hw_features_common.h"
24  #include "ap/sta_info.h"
25  #include "ap/hostapd.h"
26  #include "ap/ieee802_11.h"
27 @@ -208,6 +209,34 @@ static void wpas_mesh_complete_cb(void *
28                 return;
29         }
30  
31 +       /*
32 +        * inspect if channel's been changed since initialized.
33 +        * i.e. DFS radar detection
34 +        */
35 +       if (ifmsh->freq != params->freq.freq) {
36 +               wpa_s->assoc_freq = ifmsh->freq;
37 +               ssid->frequency = ifmsh->freq;
38 +               if (hostapd_set_freq_params(&params->freq,
39 +                               ifmsh->conf->hw_mode,
40 +                               ifmsh->freq,
41 +                               ifmsh->conf->channel,
42 +                               ifmsh->conf->enable_edmg,
43 +                               ifmsh->conf->edmg_channel,
44 +                               ifmsh->conf->ieee80211n,
45 +                               ifmsh->conf->ieee80211ac,
46 +                               ifmsh->conf->ieee80211ax,
47 +                               ifmsh->conf->secondary_channel,
48 +                               hostapd_get_oper_chwidth(ifmsh->conf),
49 +                               hostapd_get_oper_centr_freq_seg0_idx(ifmsh->conf),
50 +                               hostapd_get_oper_centr_freq_seg1_idx(ifmsh->conf),
51 +                               ifmsh->current_mode->vht_capab,
52 +                               &ifmsh->current_mode->he_capab[IEEE80211_MODE_AP])) {
53 +                       wpa_printf(MSG_ERROR, "Error updating mesh frequency params.");
54 +                       wpa_supplicant_mesh_deinit(wpa_s);
55 +                       return;
56 +               }
57 +       }
58 +
59         if (ifmsh->mconf->security != MESH_CONF_SEC_NONE &&
60             wpas_mesh_init_rsn(wpa_s)) {
61                 wpa_printf(MSG_ERROR,