hostapd: update mesh DFS patches and add mesh HE support
[openwrt/openwrt.git] / package / network / services / hostapd / patches / 008-mesh-use-setup-completion-callback-to-complete-mesh-.patch
1 From 11e5bbe58eebdb10793eec374b6c8ccc7daf7ec8 Mon Sep 17 00:00:00 2001
2 From: Peter Oh <peter.oh@bowerswilkins.com>
3 Date: Tue, 30 Jun 2020 14:18:56 +0200
4 Subject: [PATCH 08/19] mesh: use setup completion callback to complete mesh
5 join
6
7 mesh join function is the last function to be called during
8 mesh join process, but it's been called a bit earlier than
9 it's supposed to be, so that some mesh parameter values
10 such as VHT capabilities not applied correct when mesh join
11 is in process.
12 Moreover current design of mesh join that is called directly
13 after mesh initialization isn't suitable for DFS channels to use,
14 since mesh join process should be paused until DFS CAC is
15 done and resumed after it's done.
16 The callback will be called by hostapd_setup_interface_complete_sync.
17 There is possiblity that completing mesh init fails, so add error
18 handle codes.
19
20 Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
21 ---
22 src/ap/hostapd.c | 11 ++++++++++-
23 wpa_supplicant/mesh.c | 12 ++++++++++--
24 2 files changed, 20 insertions(+), 3 deletions(-)
25
26 --- a/src/ap/hostapd.c
27 +++ b/src/ap/hostapd.c
28 @@ -434,6 +434,8 @@ static void hostapd_free_hapd_data(struc
29 #ifdef CONFIG_MESH
30 wpabuf_free(hapd->mesh_pending_auth);
31 hapd->mesh_pending_auth = NULL;
32 + /* handling setup failure is already done */
33 + hapd->setup_complete_cb = NULL;
34 #endif /* CONFIG_MESH */
35
36 hostapd_clean_rrm(hapd);
37 @@ -2156,6 +2158,13 @@ dfs_offload:
38 if (hapd->setup_complete_cb)
39 hapd->setup_complete_cb(hapd->setup_complete_cb_ctx);
40
41 +#ifdef CONFIG_MESH
42 + if (delay_apply_cfg && iface->mconf == NULL) {
43 + wpa_printf(MSG_ERROR, "Error while completing mesh init");
44 + goto fail;
45 + }
46 +#endif /* CONFIG_MESH */
47 +
48 wpa_printf(MSG_DEBUG, "%s: Setup of interface done.",
49 iface->bss[0]->conf->iface);
50 if (iface->interfaces && iface->interfaces->terminate_on_error > 0)
51 @@ -2299,7 +2308,7 @@ int hostapd_setup_interface(struct hosta
52 ret = setup_interface(iface);
53 if (ret) {
54 wpa_printf(MSG_ERROR, "%s: Unable to setup interface.",
55 - iface->bss[0]->conf->iface);
56 + iface->conf ? iface->conf->bss[0]->iface : "N/A");
57 return -1;
58 }
59
60 --- a/wpa_supplicant/mesh.c
61 +++ b/wpa_supplicant/mesh.c
62 @@ -193,7 +193,6 @@ static int wpas_mesh_init_rsn(struct wpa
63 return !wpa_s->mesh_rsn ? -1 : 0;
64 }
65
66 -
67 static int wpas_mesh_complete(struct wpa_supplicant *wpa_s)
68 {
69 struct hostapd_iface *ifmsh = wpa_s->ifmsh;
70 @@ -244,6 +243,13 @@ static int wpas_mesh_complete(struct wpa
71 }
72
73
74 +static void wpas_mesh_complete_cb(void *arg)
75 +{
76 + struct wpa_supplicant *wpa_s = arg;
77 + wpas_mesh_complete(wpa_s);
78 +}
79 +
80 +
81 static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s,
82 struct wpa_ssid *ssid,
83 struct hostapd_freq_params *freq)
84 @@ -267,6 +273,7 @@ static int wpa_supplicant_mesh_init(stru
85 if (!ifmsh)
86 return -ENOMEM;
87
88 + ifmsh->owner = wpa_s;
89 ifmsh->drv_flags = wpa_s->drv_flags;
90 ifmsh->drv_flags2 = wpa_s->drv_flags2;
91 ifmsh->num_bss = 1;
92 @@ -285,6 +292,8 @@ static int wpa_supplicant_mesh_init(stru
93 bss->drv_priv = wpa_s->drv_priv;
94 bss->iface = ifmsh;
95 bss->mesh_sta_free_cb = mesh_mpm_free_sta;
96 + bss->setup_complete_cb = wpas_mesh_complete_cb;
97 + bss->setup_complete_cb_ctx = wpa_s;
98 frequency = ssid->frequency;
99 if (frequency != freq->freq &&
100 frequency == freq->freq + freq->sec_channel_offset * 20) {
101 @@ -523,7 +532,6 @@ int wpa_supplicant_join_mesh(struct wpa_
102 goto out;
103 }
104
105 - ret = wpas_mesh_complete(wpa_s);
106 out:
107 return ret;
108 }