aboutsummaryrefslogtreecommitdiffstats
path: root/package/network/services/hostapd/patches/018-mesh-move-mesh-freq-setting-to-own-function.patch
blob: 1dd7d374119effe5fa7457cf5822cb156a58ad68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
From 1eab0e62920f443f8814bad846f6439843223b69 Mon Sep 17 00:00:00 2001
From: Markus Theil <markus.theil@tu-ilmenau.de>
Date: Tue, 30 Jun 2020 14:19:06 +0200
Subject: [PATCH 18/19] mesh: move mesh freq setting to own function

Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
---
 wpa_supplicant/mesh.c | 59 ++++++++++++++++++++++++++-----------------
 1 file changed, 36 insertions(+), 23 deletions(-)

--- a/wpa_supplicant/mesh.c
+++ b/wpa_supplicant/mesh.c
@@ -201,6 +201,40 @@ static int wpas_mesh_init_rsn(struct wpa
 	return !wpa_s->mesh_rsn ? -1 : 0;
 }
 
+
+static int wpas_mesh_update_freq_params(struct wpa_supplicant *wpa_s)
+{
+	struct wpa_driver_mesh_join_params *params = wpa_s->mesh_params;
+	struct hostapd_iface *ifmsh = wpa_s->ifmsh;
+	struct he_capabilities *he_capab = NULL;
+
+	if (ifmsh->current_mode)
+		he_capab = &ifmsh->current_mode->he_capab[IEEE80211_MODE_MESH];
+
+	if (hostapd_set_freq_params(&params->freq,
+			ifmsh->conf->hw_mode,
+			ifmsh->freq,
+			ifmsh->conf->channel,
+			ifmsh->conf->enable_edmg,
+			ifmsh->conf->edmg_channel,
+			ifmsh->conf->ieee80211n,
+			ifmsh->conf->ieee80211ac,
+			ifmsh->conf->ieee80211ax,
+			ifmsh->conf->secondary_channel,
+			hostapd_get_oper_chwidth(ifmsh->conf),
+			hostapd_get_oper_centr_freq_seg0_idx(ifmsh->conf),
+			hostapd_get_oper_centr_freq_seg1_idx(ifmsh->conf),
+			ifmsh->conf->vht_capab,
+			he_capab)) {
+		wpa_printf(MSG_ERROR, "Error updating mesh frequency params.");
+		wpa_supplicant_mesh_deinit(wpa_s, true);
+		return -1;
+	}
+
+	return 0;
+}
+
+
 static int wpas_mesh_complete(struct wpa_supplicant *wpa_s)
 {
 	struct hostapd_iface *ifmsh = wpa_s->ifmsh;
@@ -221,30 +255,8 @@ static int wpas_mesh_complete(struct wpa
 	if (ifmsh->freq > 0 && ifmsh->freq != params->freq.freq) {
 		wpa_s->assoc_freq = ifmsh->freq;
 		ssid->frequency = ifmsh->freq;
-		struct he_capabilities *he_capab = NULL;
-
-		if (ifmsh->current_mode)
-			he_capab = &ifmsh->current_mode->he_capab[IEEE80211_MODE_MESH];
-
-		if (hostapd_set_freq_params(&params->freq,
-				ifmsh->conf->hw_mode,
-				ifmsh->freq,
-				ifmsh->conf->channel,
-				ifmsh->conf->enable_edmg,
-				ifmsh->conf->edmg_channel,
-				ifmsh->conf->ieee80211n,
-				ifmsh->conf->ieee80211ac,
-				ifmsh->conf->ieee80211ax,
-				ifmsh->conf->secondary_channel,
-				hostapd_get_oper_chwidth(ifmsh->conf),
-				hostapd_get_oper_centr_freq_seg0_idx(ifmsh->conf),
-				hostapd_get_oper_centr_freq_seg1_idx(ifmsh->conf),
-				ifmsh->conf->vht_capab,
-				he_capab)) {
-			wpa_printf(MSG_ERROR, "Error updating mesh frequency params.");
-			wpa_supplicant_mesh_deinit(wpa_s, true);
+		if (wpas_mesh_update_freq_params(wpa_s) != 0)
 			return -1;
-		}
 	}
 
 	if (ifmsh->mconf->security != MESH_CONF_SEC_NONE &&
@@ -518,6 +530,7 @@ static int wpa_supplicant_mesh_init(stru
 	}
 
 	return 0;
+
 out_free:
 	wpa_supplicant_mesh_deinit(wpa_s, true);
 	return -ENOMEM;