2018-05-30 22:10:49 +00:00
|
|
|
From 89db76eeff6502dfa39b011962ec9d560ed4c2ee Mon Sep 17 00:00:00 2001
|
2018-04-12 11:07:22 +00:00
|
|
|
From: Peter Oh <peter.oh@bowerswilkins.com>
|
2018-05-30 22:10:49 +00:00
|
|
|
Date: Tue, 29 May 2018 14:39:06 -0700
|
|
|
|
Subject: [PATCH 02/18] mesh: factor out rsn initialization
|
2018-04-12 11:07:22 +00:00
|
|
|
|
|
|
|
RSN initialization can be used in different phases
|
|
|
|
if mesh initialization and mesh join don't happen
|
|
|
|
in sequence such as DFS CAC is done in between,
|
|
|
|
hence factor it out to help convering the case.
|
|
|
|
|
|
|
|
Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
|
|
|
|
---
|
2018-04-28 19:12:19 +00:00
|
|
|
wpa_supplicant/mesh.c | 84 +++++++++++++++++++++++++------------------
|
2018-04-12 11:07:22 +00:00
|
|
|
wpa_supplicant/mesh.h | 1 +
|
2018-04-28 19:12:19 +00:00
|
|
|
2 files changed, 50 insertions(+), 35 deletions(-)
|
2018-04-12 11:07:22 +00:00
|
|
|
|
|
|
|
--- a/wpa_supplicant/mesh.c
|
|
|
|
+++ b/wpa_supplicant/mesh.c
|
2018-04-28 19:12:19 +00:00
|
|
|
@@ -147,6 +147,53 @@ static void wpas_mesh_copy_groups(struct
|
2018-04-12 11:07:22 +00:00
|
|
|
}
|
|
|
|
|
2018-04-28 19:12:19 +00:00
|
|
|
|
2018-04-12 11:07:22 +00:00
|
|
|
+int wpas_mesh_init_rsn(struct wpa_supplicant *wpa_s)
|
|
|
|
+{
|
|
|
|
+ struct hostapd_iface *ifmsh = wpa_s->ifmsh;
|
|
|
|
+ struct mesh_conf *mconf = wpa_s->ifmsh->mconf;
|
|
|
|
+ struct wpa_ssid *ssid = wpa_s->current_ssid;
|
|
|
|
+ struct hostapd_data *bss = ifmsh->bss[0];
|
|
|
|
+ static int default_groups[] = { 19, 20, 21, 25, 26, -1 };
|
2018-04-28 19:12:19 +00:00
|
|
|
+ const char *password;
|
2018-04-12 11:07:22 +00:00
|
|
|
+ size_t len;
|
|
|
|
+
|
|
|
|
+ if (mconf->security != MESH_CONF_SEC_NONE) {
|
2018-04-28 19:12:19 +00:00
|
|
|
+ password = ssid->sae_password;
|
|
|
|
+ if (!password)
|
|
|
|
+ password = ssid->passphrase;
|
|
|
|
+ if (!password) {
|
2018-04-12 11:07:22 +00:00
|
|
|
+ wpa_printf(MSG_ERROR,
|
|
|
|
+ "mesh: Passphrase for SAE not configured");
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ bss->conf->wpa = ssid->proto;
|
|
|
|
+ bss->conf->wpa_key_mgmt = ssid->key_mgmt;
|
|
|
|
+
|
|
|
|
+ if (wpa_s->conf->sae_groups &&
|
|
|
|
+ wpa_s->conf->sae_groups[0] > 0) {
|
|
|
|
+ wpas_mesh_copy_groups(bss, wpa_s);
|
|
|
|
+ } else {
|
|
|
|
+ bss->conf->sae_groups =
|
|
|
|
+ os_memdup(default_groups,
|
|
|
|
+ sizeof(default_groups));
|
|
|
|
+ if (!bss->conf->sae_groups)
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
|
|
+
|
2018-04-28 19:12:19 +00:00
|
|
|
+ len = os_strlen(password);
|
2018-04-12 11:07:22 +00:00
|
|
|
+ bss->conf->ssid.wpa_passphrase =
|
2018-04-28 19:12:19 +00:00
|
|
|
+ dup_binstr(password, len);
|
2018-04-12 11:07:22 +00:00
|
|
|
+
|
|
|
|
+ wpa_s->mesh_rsn = mesh_rsn_auth_init(wpa_s, mconf);
|
|
|
|
+ if (!wpa_s->mesh_rsn)
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
2018-04-28 19:12:19 +00:00
|
|
|
+
|
2018-04-12 11:07:22 +00:00
|
|
|
static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s,
|
|
|
|
struct wpa_ssid *ssid,
|
2018-04-28 19:12:19 +00:00
|
|
|
struct hostapd_freq_params *freq)
|
|
|
|
@@ -156,9 +203,6 @@ static int wpa_supplicant_mesh_init(stru
|
|
|
|
struct hostapd_config *conf;
|
|
|
|
struct mesh_conf *mconf;
|
|
|
|
int basic_rates_erp[] = { 10, 20, 55, 60, 110, 120, 240, -1 };
|
|
|
|
- static int default_groups[] = { 19, 20, 21, 25, 26, -1 };
|
|
|
|
- const char *password;
|
|
|
|
- size_t len;
|
|
|
|
int rate_len;
|
|
|
|
int frequency;
|
|
|
|
|
|
|
|
@@ -292,38 +336,8 @@ static int wpa_supplicant_mesh_init(stru
|
2018-04-12 11:07:22 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
- if (mconf->security != MESH_CONF_SEC_NONE) {
|
2018-04-28 19:12:19 +00:00
|
|
|
- password = ssid->sae_password;
|
|
|
|
- if (!password)
|
|
|
|
- password = ssid->passphrase;
|
|
|
|
- if (!password) {
|
2018-04-12 11:07:22 +00:00
|
|
|
- wpa_printf(MSG_ERROR,
|
|
|
|
- "mesh: Passphrase for SAE not configured");
|
|
|
|
- goto out_free;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- bss->conf->wpa = ssid->proto;
|
|
|
|
- bss->conf->wpa_key_mgmt = ssid->key_mgmt;
|
|
|
|
-
|
|
|
|
- if (wpa_s->conf->sae_groups &&
|
|
|
|
- wpa_s->conf->sae_groups[0] > 0) {
|
|
|
|
- wpas_mesh_copy_groups(bss, wpa_s);
|
|
|
|
- } else {
|
|
|
|
- bss->conf->sae_groups =
|
|
|
|
- os_memdup(default_groups,
|
|
|
|
- sizeof(default_groups));
|
|
|
|
- if (!bss->conf->sae_groups)
|
|
|
|
- goto out_free;
|
|
|
|
- }
|
|
|
|
-
|
2018-04-28 19:12:19 +00:00
|
|
|
- len = os_strlen(password);
|
2018-04-12 11:07:22 +00:00
|
|
|
- bss->conf->ssid.wpa_passphrase =
|
2018-04-28 19:12:19 +00:00
|
|
|
- dup_binstr(password, len);
|
2018-04-12 11:07:22 +00:00
|
|
|
-
|
|
|
|
- wpa_s->mesh_rsn = mesh_rsn_auth_init(wpa_s, mconf);
|
|
|
|
- if (!wpa_s->mesh_rsn)
|
|
|
|
- goto out_free;
|
|
|
|
- }
|
|
|
|
+ if (wpas_mesh_init_rsn(wpa_s))
|
|
|
|
+ goto out_free;
|
|
|
|
|
|
|
|
wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf);
|
|
|
|
|
|
|
|
--- a/wpa_supplicant/mesh.h
|
|
|
|
+++ b/wpa_supplicant/mesh.h
|
|
|
|
@@ -22,6 +22,7 @@ int wpas_mesh_peer_remove(struct wpa_sup
|
|
|
|
int wpas_mesh_peer_add(struct wpa_supplicant *wpa_s, const u8 *addr,
|
|
|
|
int duration);
|
|
|
|
void wpas_join_mesh(struct wpa_supplicant *wpa_s);
|
|
|
|
+int wpas_mesh_init_rsn(struct wpa_supplicant *wpa_s);
|
|
|
|
|
|
|
|
#ifdef CONFIG_MESH
|
|
|
|
|