OpenWrt – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | From 89db76eeff6502dfa39b011962ec9d560ed4c2ee Mon Sep 17 00:00:00 2001 |
2 | From: Peter Oh <peter.oh@bowerswilkins.com> |
||
3 | Date: Tue, 29 May 2018 14:39:06 -0700 |
||
4 | Subject: [PATCH 02/18] mesh: factor out rsn initialization |
||
5 | |||
6 | RSN initialization can be used in different phases |
||
7 | if mesh initialization and mesh join don't happen |
||
8 | in sequence such as DFS CAC is done in between, |
||
9 | hence factor it out to help convering the case. |
||
10 | |||
11 | Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com> |
||
12 | --- |
||
13 | wpa_supplicant/mesh.c | 84 +++++++++++++++++++++++++------------------ |
||
14 | wpa_supplicant/mesh.h | 1 + |
||
15 | 2 files changed, 50 insertions(+), 35 deletions(-) |
||
16 | |||
17 | --- a/wpa_supplicant/mesh.c |
||
18 | +++ b/wpa_supplicant/mesh.c |
||
19 | @@ -147,6 +147,53 @@ static void wpas_mesh_copy_groups(struct |
||
20 | } |
||
21 | |||
22 | |||
23 | +int wpas_mesh_init_rsn(struct wpa_supplicant *wpa_s) |
||
24 | +{ |
||
25 | + struct hostapd_iface *ifmsh = wpa_s->ifmsh; |
||
26 | + struct mesh_conf *mconf = wpa_s->ifmsh->mconf; |
||
27 | + struct wpa_ssid *ssid = wpa_s->current_ssid; |
||
28 | + struct hostapd_data *bss = ifmsh->bss[0]; |
||
29 | + static int default_groups[] = { 19, 20, 21, 25, 26, -1 }; |
||
30 | + const char *password; |
||
31 | + size_t len; |
||
32 | + |
||
33 | + if (mconf->security != MESH_CONF_SEC_NONE) { |
||
34 | + password = ssid->sae_password; |
||
35 | + if (!password) |
||
36 | + password = ssid->passphrase; |
||
37 | + if (!password) { |
||
38 | + wpa_printf(MSG_ERROR, |
||
39 | + "mesh: Passphrase for SAE not configured"); |
||
40 | + return -1; |
||
41 | + } |
||
42 | + |
||
43 | + bss->conf->wpa = ssid->proto; |
||
44 | + bss->conf->wpa_key_mgmt = ssid->key_mgmt; |
||
45 | + |
||
46 | + if (wpa_s->conf->sae_groups && |
||
47 | + wpa_s->conf->sae_groups[0] > 0) { |
||
48 | + wpas_mesh_copy_groups(bss, wpa_s); |
||
49 | + } else { |
||
50 | + bss->conf->sae_groups = |
||
51 | + os_memdup(default_groups, |
||
52 | + sizeof(default_groups)); |
||
53 | + if (!bss->conf->sae_groups) |
||
54 | + return -1; |
||
55 | + } |
||
56 | + |
||
57 | + len = os_strlen(password); |
||
58 | + bss->conf->ssid.wpa_passphrase = |
||
59 | + dup_binstr(password, len); |
||
60 | + |
||
61 | + wpa_s->mesh_rsn = mesh_rsn_auth_init(wpa_s, mconf); |
||
62 | + if (!wpa_s->mesh_rsn) |
||
63 | + return -1; |
||
64 | + } |
||
65 | + |
||
66 | + return 0; |
||
67 | +} |
||
68 | + |
||
69 | + |
||
70 | static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, |
||
71 | struct wpa_ssid *ssid, |
||
72 | struct hostapd_freq_params *freq) |
||
73 | @@ -156,9 +203,6 @@ static int wpa_supplicant_mesh_init(stru |
||
74 | struct hostapd_config *conf; |
||
75 | struct mesh_conf *mconf; |
||
76 | int basic_rates_erp[] = { 10, 20, 55, 60, 110, 120, 240, -1 }; |
||
77 | - static int default_groups[] = { 19, 20, 21, 25, 26, -1 }; |
||
78 | - const char *password; |
||
79 | - size_t len; |
||
80 | int rate_len; |
||
81 | int frequency; |
||
82 | |||
83 | @@ -292,38 +336,8 @@ static int wpa_supplicant_mesh_init(stru |
||
84 | return -1; |
||
85 | } |
||
86 | |||
87 | - if (mconf->security != MESH_CONF_SEC_NONE) { |
||
88 | - password = ssid->sae_password; |
||
89 | - if (!password) |
||
90 | - password = ssid->passphrase; |
||
91 | - if (!password) { |
||
92 | - wpa_printf(MSG_ERROR, |
||
93 | - "mesh: Passphrase for SAE not configured"); |
||
94 | - goto out_free; |
||
95 | - } |
||
96 | - |
||
97 | - bss->conf->wpa = ssid->proto; |
||
98 | - bss->conf->wpa_key_mgmt = ssid->key_mgmt; |
||
99 | - |
||
100 | - if (wpa_s->conf->sae_groups && |
||
101 | - wpa_s->conf->sae_groups[0] > 0) { |
||
102 | - wpas_mesh_copy_groups(bss, wpa_s); |
||
103 | - } else { |
||
104 | - bss->conf->sae_groups = |
||
105 | - os_memdup(default_groups, |
||
106 | - sizeof(default_groups)); |
||
107 | - if (!bss->conf->sae_groups) |
||
108 | - goto out_free; |
||
109 | - } |
||
110 | - |
||
111 | - len = os_strlen(password); |
||
112 | - bss->conf->ssid.wpa_passphrase = |
||
113 | - dup_binstr(password, len); |
||
114 | - |
||
115 | - wpa_s->mesh_rsn = mesh_rsn_auth_init(wpa_s, mconf); |
||
116 | - if (!wpa_s->mesh_rsn) |
||
117 | - goto out_free; |
||
118 | - } |
||
119 | + if (wpas_mesh_init_rsn(wpa_s)) |
||
120 | + goto out_free; |
||
121 | |||
122 | wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf); |
||
123 | |||
124 | --- a/wpa_supplicant/mesh.h |
||
125 | +++ b/wpa_supplicant/mesh.h |
||
126 | @@ -22,6 +22,7 @@ int wpas_mesh_peer_remove(struct wpa_sup |
||
127 | int wpas_mesh_peer_add(struct wpa_supplicant *wpa_s, const u8 *addr, |
||
128 | int duration); |
||
129 | void wpas_join_mesh(struct wpa_supplicant *wpa_s); |
||
130 | +int wpas_mesh_init_rsn(struct wpa_supplicant *wpa_s); |
||
131 | |||
132 | #ifdef CONFIG_MESH |
||
133 |