14e18322f63557a1f3daef2ccb20c79c03e98380
[openwrt/staging/dedeckeh.git] /
1 From 32044a7bb26858bedaf147c77f49f5cef1133de3 Mon Sep 17 00:00:00 2001
2 From: Peter Oh <peter.oh@bowerswilkins.com>
3 Date: Tue, 17 Apr 2018 21:55:01 -0700
4 Subject: [PATCH 04/16] 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. Moreover current design of mesh join that is called
12 directly after mesh initialization is not suitable for DFS channels
13 to use, since mesh join process should be paused until DFS CAC is
14 done and resumed once it's done.
15 Using setup completion callback is how AP mode is using for DFS channels
16 and mesh can use the same way.
17 The callback will be called by hostapd_setup_interface_complete_sync.
18
19 Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
20 ---
21 wpa_supplicant/mesh.c | 7 +++++--
22 wpa_supplicant/mesh.h | 2 +-
23 2 files changed, 6 insertions(+), 3 deletions(-)
24
25 --- a/wpa_supplicant/mesh.c
26 +++ b/wpa_supplicant/mesh.c
27 @@ -217,6 +217,7 @@ static int wpa_supplicant_mesh_init(stru
28 if (!ifmsh)
29 return -ENOMEM;
30
31 + ifmsh->owner = wpa_s;
32 ifmsh->drv_flags = wpa_s->drv_flags;
33 ifmsh->num_bss = 1;
34 ifmsh->bss = os_calloc(wpa_s->ifmsh->num_bss,
35 @@ -233,6 +234,8 @@ static int wpa_supplicant_mesh_init(stru
36 bss->drv_priv = wpa_s->drv_priv;
37 bss->iface = ifmsh;
38 bss->mesh_sta_free_cb = mesh_mpm_free_sta;
39 + bss->setup_complete_cb = wpas_mesh_complete_cb;
40 + bss->setup_complete_cb_ctx = wpa_s;
41 frequency = ssid->frequency;
42 if (frequency != freq->freq &&
43 frequency == freq->freq + freq->sec_channel_offset * 20) {
44 @@ -374,8 +377,9 @@ void wpa_supplicant_mesh_add_scan_ie(str
45 }
46
47
48 -void wpas_join_mesh(struct wpa_supplicant *wpa_s)
49 +void wpas_mesh_complete_cb(void *ctx)
50 {
51 + struct wpa_supplicant *wpa_s = (struct wpa_supplicant *)ctx;
52 struct wpa_driver_mesh_join_params *params = wpa_s->mesh_params;
53 struct wpa_ssid *ssid = wpa_s->current_ssid;
54 int ret = 0;
55 @@ -497,7 +501,6 @@ int wpa_supplicant_join_mesh(struct wpa_
56 goto out;
57 }
58
59 - wpas_join_mesh(wpa_s);
60 out:
61 return ret;
62 }
63 --- a/wpa_supplicant/mesh.h
64 +++ b/wpa_supplicant/mesh.h
65 @@ -21,7 +21,7 @@ int wpas_mesh_add_interface(struct wpa_s
66 int wpas_mesh_peer_remove(struct wpa_supplicant *wpa_s, const u8 *addr);
67 int wpas_mesh_peer_add(struct wpa_supplicant *wpa_s, const u8 *addr,
68 int duration);
69 -void wpas_join_mesh(struct wpa_supplicant *wpa_s);
70 +void wpas_mesh_complete_cb(void *ctx);
71 int wpas_mesh_init_rsn(struct wpa_supplicant *wpa_s);
72
73 #ifdef CONFIG_MESH