1dd7d374119effe5fa7457cf5822cb156a58ad68
[openwrt/staging/stintel.git] / package / network / services / hostapd / patches / 018-mesh-move-mesh-freq-setting-to-own-function.patch
1 From 1eab0e62920f443f8814bad846f6439843223b69 Mon Sep 17 00:00:00 2001
2 From: Markus Theil <markus.theil@tu-ilmenau.de>
3 Date: Tue, 30 Jun 2020 14:19:06 +0200
4 Subject: [PATCH 18/19] mesh: move mesh freq setting to own function
5
6 Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
7 ---
8 wpa_supplicant/mesh.c | 59 ++++++++++++++++++++++++++-----------------
9 1 file changed, 36 insertions(+), 23 deletions(-)
10
11 --- a/wpa_supplicant/mesh.c
12 +++ b/wpa_supplicant/mesh.c
13 @@ -201,6 +201,40 @@ static int wpas_mesh_init_rsn(struct wpa
14 return !wpa_s->mesh_rsn ? -1 : 0;
15 }
16
17 +
18 +static int wpas_mesh_update_freq_params(struct wpa_supplicant *wpa_s)
19 +{
20 + struct wpa_driver_mesh_join_params *params = wpa_s->mesh_params;
21 + struct hostapd_iface *ifmsh = wpa_s->ifmsh;
22 + struct he_capabilities *he_capab = NULL;
23 +
24 + if (ifmsh->current_mode)
25 + he_capab = &ifmsh->current_mode->he_capab[IEEE80211_MODE_MESH];
26 +
27 + if (hostapd_set_freq_params(&params->freq,
28 + ifmsh->conf->hw_mode,
29 + ifmsh->freq,
30 + ifmsh->conf->channel,
31 + ifmsh->conf->enable_edmg,
32 + ifmsh->conf->edmg_channel,
33 + ifmsh->conf->ieee80211n,
34 + ifmsh->conf->ieee80211ac,
35 + ifmsh->conf->ieee80211ax,
36 + ifmsh->conf->secondary_channel,
37 + hostapd_get_oper_chwidth(ifmsh->conf),
38 + hostapd_get_oper_centr_freq_seg0_idx(ifmsh->conf),
39 + hostapd_get_oper_centr_freq_seg1_idx(ifmsh->conf),
40 + ifmsh->conf->vht_capab,
41 + he_capab)) {
42 + wpa_printf(MSG_ERROR, "Error updating mesh frequency params.");
43 + wpa_supplicant_mesh_deinit(wpa_s, true);
44 + return -1;
45 + }
46 +
47 + return 0;
48 +}
49 +
50 +
51 static int wpas_mesh_complete(struct wpa_supplicant *wpa_s)
52 {
53 struct hostapd_iface *ifmsh = wpa_s->ifmsh;
54 @@ -221,30 +255,8 @@ static int wpas_mesh_complete(struct wpa
55 if (ifmsh->freq > 0 && ifmsh->freq != params->freq.freq) {
56 wpa_s->assoc_freq = ifmsh->freq;
57 ssid->frequency = ifmsh->freq;
58 - struct he_capabilities *he_capab = NULL;
59 -
60 - if (ifmsh->current_mode)
61 - he_capab = &ifmsh->current_mode->he_capab[IEEE80211_MODE_MESH];
62 -
63 - if (hostapd_set_freq_params(&params->freq,
64 - ifmsh->conf->hw_mode,
65 - ifmsh->freq,
66 - ifmsh->conf->channel,
67 - ifmsh->conf->enable_edmg,
68 - ifmsh->conf->edmg_channel,
69 - ifmsh->conf->ieee80211n,
70 - ifmsh->conf->ieee80211ac,
71 - ifmsh->conf->ieee80211ax,
72 - ifmsh->conf->secondary_channel,
73 - hostapd_get_oper_chwidth(ifmsh->conf),
74 - hostapd_get_oper_centr_freq_seg0_idx(ifmsh->conf),
75 - hostapd_get_oper_centr_freq_seg1_idx(ifmsh->conf),
76 - ifmsh->conf->vht_capab,
77 - he_capab)) {
78 - wpa_printf(MSG_ERROR, "Error updating mesh frequency params.");
79 - wpa_supplicant_mesh_deinit(wpa_s, true);
80 + if (wpas_mesh_update_freq_params(wpa_s) != 0)
81 return -1;
82 - }
83 }
84
85 if (ifmsh->mconf->security != MESH_CONF_SEC_NONE &&
86 @@ -518,6 +530,7 @@ static int wpa_supplicant_mesh_init(stru
87 }
88
89 return 0;
90 +
91 out_free:
92 wpa_supplicant_mesh_deinit(wpa_s, true);
93 return -ENOMEM;