diff mbox series

[v6,03/15] mesh: relocate RSN init function

Message ID c2adfb3c58d0ea72ee75f0a5f4fcb079d21734f6.1527814610.git.peter.oh@bowerswilkins.com
State Changes Requested
Headers show
Series mesh: enable DFS channels in mesh mode | expand

Commit Message

Peter Oh June 1, 2018, 1:01 a.m. UTC
From: Peter Oh <peter.oh@bowerswilkins.com>

RSN init function should work together with mesh join
when it's used. Since mesh join could be called at different stage
if DFS channel is used, relocate the function to mesh join.
It is still the same call flows of mesh join before this changes
if non-DFS channels are used, hence no side effect will occur.

Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
---
 wpa_supplicant/mesh.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Comments

Jouni Malinen June 11, 2018, 5:26 p.m. UTC | #1
On Thu, May 31, 2018 at 06:01:57PM -0700, peter.oh@bowerswilkins.com wrote:
> RSN init function should work together with mesh join
> when it's used. Since mesh join could be called at different stage
> if DFS channel is used, relocate the function to mesh join.
> It is still the same call flows of mesh join before this changes
> if non-DFS channels are used, hence no side effect will occur.

This breaks the wpas_mesh_secure_sae_missing_password test case just
like Masashi pointed out earlier. That would imply that something is
wrong here in checking valid RSN configuration during
wpa_supplicant_mesh_init().
diff mbox series

Patch

diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c
index 4e2814b..2358bc4 100644
--- a/wpa_supplicant/mesh.c
+++ b/wpa_supplicant/mesh.c
@@ -338,9 +338,6 @@  static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s,
 		return -1;
 	}
 
-	if (wpas_mesh_init_rsn(wpa_s))
-		goto out_free;
-
 	wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf);
 
 	return 0;
@@ -386,6 +383,12 @@  void wpas_join_mesh(struct wpa_supplicant *wpa_s)
 	struct wpa_ssid *ssid = wpa_s->current_ssid;
 	int ret = 0;
 
+	if (wpas_mesh_init_rsn(wpa_s)) {
+		wpa_printf(MSG_ERROR, "Init RSN failed. Deinit mesh...");
+		wpa_supplicant_mesh_deinit(wpa_s);
+		return;
+	}
+
 	if (ssid->key_mgmt & WPA_KEY_MGMT_SAE) {
 		wpa_s->pairwise_cipher = wpa_s->mesh_rsn->pairwise_cipher;
 		wpa_s->group_cipher = wpa_s->mesh_rsn->group_cipher;