hostapd: update to git snapshot of 2018-04-09
[openwrt/staging/wigyori.git] / package / network / services / hostapd / patches / 020-mesh-properly-handle-sae_password.patch
1 From 30c1693f42326d4f927e76120492bc9593b8f739 Mon Sep 17 00:00:00 2001
2 From: Daniel Golle <daniel@makrotopia.org>
3 Date: Fri, 13 Apr 2018 00:42:10 +0200
4 Subject: [PATCH] mesh: properly handle sae_password
5
6 The recently introduced sae_password parameter is only handled properly
7 in wpa_supplicant/sme.c while wpa_supplicant/mesh.c assumed that
8 ssid->passphrase exclusively holds the secret.
9 Import the logic from sme.c to mesh.c to allow having only sae_password
10 set which otherwise throws this error:
11 AP-ENABLED
12 mesh: Passphrase for SAE not configured
13 Init RSN failed. Deinit mesh...
14 wlan1: interface state ENABLED->DISABLED
15 AP-DISABLED
16 Segmentation fault
17
18 Signed-off-by: Daniel Golle <daniel@makrotopia.org>
19 ---
20 wpa_supplicant/mesh.c | 10 +++++++---
21 1 file changed, 7 insertions(+), 3 deletions(-)
22
23 diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c
24 index 22dec4822..0bf87245d 100644
25 --- a/wpa_supplicant/mesh.c
26 +++ b/wpa_supplicant/mesh.c
27 @@ -154,10 +154,14 @@ int wpas_mesh_init_rsn(struct wpa_supplicant *wpa_s)
28 struct wpa_ssid *ssid = wpa_s->current_ssid;
29 struct hostapd_data *bss = ifmsh->bss[0];
30 static int default_groups[] = { 19, 20, 21, 25, 26, -1 };
31 + const char *password;
32 size_t len;
33
34 if (mconf->security != MESH_CONF_SEC_NONE) {
35 - if (ssid->passphrase == NULL) {
36 + password = ssid->sae_password;
37 + if (!password)
38 + password = ssid->passphrase;
39 + if (!password) {
40 wpa_printf(MSG_ERROR,
41 "mesh: Passphrase for SAE not configured");
42 return -1;
43 @@ -177,9 +181,9 @@ int wpas_mesh_init_rsn(struct wpa_supplicant *wpa_s)
44 return -1;
45 }
46
47 - len = os_strlen(ssid->passphrase);
48 + len = os_strlen(password);
49 bss->conf->ssid.wpa_passphrase =
50 - dup_binstr(ssid->passphrase, len);
51 + dup_binstr(password, len);
52
53 wpa_s->mesh_rsn = mesh_rsn_auth_init(wpa_s, mconf);
54 if (!wpa_s->mesh_rsn)
55 --
56 2.17.0
57