]>
Commit | Line | Data |
---|---|---|
c2a04078 JM |
1 | /* |
2 | * wpa_supplicant - SME | |
6ac4b15e | 3 | * Copyright (c) 2009-2014, Jouni Malinen <j@w1.fi> |
c2a04078 | 4 | * |
0f3d578e JM |
5 | * This software may be distributed under the terms of the BSD license. |
6 | * See README for more details. | |
c2a04078 JM |
7 | */ |
8 | ||
9 | #include "includes.h" | |
10 | ||
11 | #include "common.h" | |
7d878ca7 | 12 | #include "utils/eloop.h" |
90973fb2 | 13 | #include "common/ieee802_11_defs.h" |
d9a27b04 | 14 | #include "common/ieee802_11_common.h" |
f9da7505 | 15 | #include "common/ocv.h" |
c2a04078 | 16 | #include "eapol_supp/eapol_supp_sm.h" |
90973fb2 | 17 | #include "common/wpa_common.h" |
98efcc41 | 18 | #include "common/sae.h" |
3acb5005 JM |
19 | #include "rsn_supp/wpa.h" |
20 | #include "rsn_supp/pmksa_cache.h" | |
c2a04078 JM |
21 | #include "config.h" |
22 | #include "wpa_supplicant_i.h" | |
2d5b792d | 23 | #include "driver_i.h" |
c2a04078 JM |
24 | #include "wpas_glue.h" |
25 | #include "wps_supplicant.h" | |
5f3a6aa0 | 26 | #include "p2p_supplicant.h" |
8bac466b | 27 | #include "notify.h" |
6fa81a3b | 28 | #include "bss.h" |
9ba9fa07 | 29 | #include "scan.h" |
c2a04078 | 30 | #include "sme.h" |
cb418324 | 31 | #include "hs20_supplicant.h" |
c2a04078 | 32 | |
e29853bb BG |
33 | #define SME_AUTH_TIMEOUT 5 |
34 | #define SME_ASSOC_TIMEOUT 5 | |
35 | ||
36 | static void sme_auth_timer(void *eloop_ctx, void *timeout_ctx); | |
37 | static void sme_assoc_timer(void *eloop_ctx, void *timeout_ctx); | |
c3701c66 | 38 | static void sme_obss_scan_timeout(void *eloop_ctx, void *timeout_ctx); |
e29853bb BG |
39 | #ifdef CONFIG_IEEE80211W |
40 | static void sme_stop_sa_query(struct wpa_supplicant *wpa_s); | |
41 | #endif /* CONFIG_IEEE80211W */ | |
42 | ||
43 | ||
c10347f2 JM |
44 | #ifdef CONFIG_SAE |
45 | ||
625f202a JM |
46 | static int index_within_array(const int *array, int idx) |
47 | { | |
48 | int i; | |
49 | for (i = 0; i < idx; i++) { | |
18ca7332 | 50 | if (array[i] <= 0) |
625f202a JM |
51 | return 0; |
52 | } | |
53 | return 1; | |
54 | } | |
55 | ||
56 | ||
57 | static int sme_set_sae_group(struct wpa_supplicant *wpa_s) | |
58 | { | |
59 | int *groups = wpa_s->conf->sae_groups; | |
18ca7332 | 60 | int default_groups[] = { 19, 20, 21, 25, 26, 0 }; |
625f202a | 61 | |
18ca7332 | 62 | if (!groups || groups[0] <= 0) |
625f202a JM |
63 | groups = default_groups; |
64 | ||
65 | /* Configuration may have changed, so validate current index */ | |
66 | if (!index_within_array(groups, wpa_s->sme.sae_group_index)) | |
67 | return -1; | |
68 | ||
69 | for (;;) { | |
70 | int group = groups[wpa_s->sme.sae_group_index]; | |
04e6c4cc | 71 | if (group <= 0) |
625f202a JM |
72 | break; |
73 | if (sae_set_group(&wpa_s->sme.sae, group) == 0) { | |
74 | wpa_dbg(wpa_s, MSG_DEBUG, "SME: Selected SAE group %d", | |
75 | wpa_s->sme.sae.group); | |
3d1d4691 | 76 | return 0; |
625f202a JM |
77 | } |
78 | wpa_s->sme.sae_group_index++; | |
79 | } | |
80 | ||
81 | return -1; | |
82 | } | |
83 | ||
84 | ||
8e31e955 JM |
85 | static struct wpabuf * sme_auth_build_sae_commit(struct wpa_supplicant *wpa_s, |
86 | struct wpa_ssid *ssid, | |
5ff39c13 | 87 | const u8 *bssid, int external) |
c10347f2 JM |
88 | { |
89 | struct wpabuf *buf; | |
d136c376 | 90 | size_t len; |
a34ca59e | 91 | const char *password; |
c10347f2 | 92 | |
a0f19e9c JM |
93 | #ifdef CONFIG_TESTING_OPTIONS |
94 | if (wpa_s->sae_commit_override) { | |
95 | wpa_printf(MSG_DEBUG, "SAE: TESTING - commit override"); | |
96 | buf = wpabuf_alloc(4 + wpabuf_len(wpa_s->sae_commit_override)); | |
97 | if (!buf) | |
98 | return NULL; | |
99 | wpabuf_put_le16(buf, 1); /* Transaction seq# */ | |
100 | wpabuf_put_le16(buf, WLAN_STATUS_SUCCESS); | |
101 | wpabuf_put_buf(buf, wpa_s->sae_commit_override); | |
102 | return buf; | |
103 | } | |
104 | #endif /* CONFIG_TESTING_OPTIONS */ | |
105 | ||
a34ca59e JM |
106 | password = ssid->sae_password; |
107 | if (!password) | |
108 | password = ssid->passphrase; | |
109 | if (!password) { | |
8e31e955 JM |
110 | wpa_printf(MSG_DEBUG, "SAE: No password available"); |
111 | return NULL; | |
112 | } | |
113 | ||
625f202a JM |
114 | if (sme_set_sae_group(wpa_s) < 0) { |
115 | wpa_printf(MSG_DEBUG, "SAE: Failed to select group"); | |
a46d72d7 | 116 | return NULL; |
625f202a | 117 | } |
a46d72d7 | 118 | |
8e31e955 | 119 | if (sae_prepare_commit(wpa_s->own_addr, bssid, |
a34ca59e | 120 | (u8 *) password, os_strlen(password), |
9be19d0b | 121 | ssid->sae_password_id, |
8e31e955 JM |
122 | &wpa_s->sme.sae) < 0) { |
123 | wpa_printf(MSG_DEBUG, "SAE: Could not pick PWE"); | |
124 | return NULL; | |
125 | } | |
126 | ||
d136c376 | 127 | len = wpa_s->sme.sae_token ? wpabuf_len(wpa_s->sme.sae_token) : 0; |
9be19d0b JM |
128 | if (ssid->sae_password_id) |
129 | len += 4 + os_strlen(ssid->sae_password_id); | |
d136c376 | 130 | buf = wpabuf_alloc(4 + SAE_COMMIT_MAX_LEN + len); |
c10347f2 JM |
131 | if (buf == NULL) |
132 | return NULL; | |
5ff39c13 SD |
133 | if (!external) { |
134 | wpabuf_put_le16(buf, 1); /* Transaction seq# */ | |
135 | wpabuf_put_le16(buf, WLAN_STATUS_SUCCESS); | |
136 | } | |
9be19d0b JM |
137 | sae_write_commit(&wpa_s->sme.sae, buf, wpa_s->sme.sae_token, |
138 | ssid->sae_password_id); | |
c10347f2 JM |
139 | |
140 | return buf; | |
141 | } | |
142 | ||
143 | ||
5ff39c13 SD |
144 | static struct wpabuf * sme_auth_build_sae_confirm(struct wpa_supplicant *wpa_s, |
145 | int external) | |
c10347f2 JM |
146 | { |
147 | struct wpabuf *buf; | |
148 | ||
fb8fcc29 | 149 | buf = wpabuf_alloc(4 + SAE_CONFIRM_MAX_LEN); |
c10347f2 JM |
150 | if (buf == NULL) |
151 | return NULL; | |
152 | ||
5ff39c13 SD |
153 | if (!external) { |
154 | wpabuf_put_le16(buf, 2); /* Transaction seq# */ | |
155 | wpabuf_put_le16(buf, WLAN_STATUS_SUCCESS); | |
156 | } | |
fb8fcc29 | 157 | sae_write_confirm(&wpa_s->sme.sae, buf); |
c10347f2 JM |
158 | |
159 | return buf; | |
160 | } | |
161 | ||
162 | #endif /* CONFIG_SAE */ | |
163 | ||
164 | ||
b361d580 AK |
165 | /** |
166 | * sme_auth_handle_rrm - Handle RRM aspects of current authentication attempt | |
167 | * @wpa_s: Pointer to wpa_supplicant data | |
168 | * @bss: Pointer to the bss which is the target of authentication attempt | |
169 | */ | |
170 | static void sme_auth_handle_rrm(struct wpa_supplicant *wpa_s, | |
171 | struct wpa_bss *bss) | |
172 | { | |
173 | const u8 rrm_ie_len = 5; | |
174 | u8 *pos; | |
175 | const u8 *rrm_ie; | |
176 | ||
177 | wpa_s->rrm.rrm_used = 0; | |
178 | ||
179 | wpa_printf(MSG_DEBUG, | |
180 | "RRM: Determining whether RRM can be used - device support: 0x%x", | |
181 | wpa_s->drv_rrm_flags); | |
182 | ||
183 | rrm_ie = wpa_bss_get_ie(bss, WLAN_EID_RRM_ENABLED_CAPABILITIES); | |
184 | if (!rrm_ie || !(bss->caps & IEEE80211_CAP_RRM)) { | |
185 | wpa_printf(MSG_DEBUG, "RRM: No RRM in network"); | |
186 | return; | |
187 | } | |
188 | ||
00ed0aa2 BL |
189 | if (!((wpa_s->drv_rrm_flags & |
190 | WPA_DRIVER_FLAGS_DS_PARAM_SET_IE_IN_PROBES) && | |
191 | (wpa_s->drv_rrm_flags & WPA_DRIVER_FLAGS_QUIET)) && | |
192 | !(wpa_s->drv_rrm_flags & WPA_DRIVER_FLAGS_SUPPORT_RRM)) { | |
b361d580 AK |
193 | wpa_printf(MSG_DEBUG, |
194 | "RRM: Insufficient RRM support in driver - do not use RRM"); | |
195 | return; | |
196 | } | |
197 | ||
849367af JM |
198 | if (sizeof(wpa_s->sme.assoc_req_ie) < |
199 | wpa_s->sme.assoc_req_ie_len + rrm_ie_len + 2) { | |
b361d580 AK |
200 | wpa_printf(MSG_INFO, |
201 | "RRM: Unable to use RRM, no room for RRM IE"); | |
202 | return; | |
203 | } | |
204 | ||
205 | wpa_printf(MSG_DEBUG, "RRM: Adding RRM IE to Association Request"); | |
206 | pos = wpa_s->sme.assoc_req_ie + wpa_s->sme.assoc_req_ie_len; | |
b361d580 AK |
207 | os_memset(pos, 0, 2 + rrm_ie_len); |
208 | *pos++ = WLAN_EID_RRM_ENABLED_CAPABILITIES; | |
209 | *pos++ = rrm_ie_len; | |
70d1e728 AO |
210 | |
211 | /* Set supported capabilites flags */ | |
212 | if (wpa_s->drv_rrm_flags & WPA_DRIVER_FLAGS_TX_POWER_INSERTION) | |
213 | *pos |= WLAN_RRM_CAPS_LINK_MEASUREMENT; | |
214 | ||
d7342014 JM |
215 | *pos |= WLAN_RRM_CAPS_BEACON_REPORT_PASSIVE | |
216 | WLAN_RRM_CAPS_BEACON_REPORT_ACTIVE | | |
217 | WLAN_RRM_CAPS_BEACON_REPORT_TABLE; | |
76196ddb | 218 | |
4a742011 DS |
219 | if (wpa_s->lci) |
220 | pos[1] |= WLAN_RRM_CAPS_LCI_MEASUREMENT; | |
221 | ||
b361d580 AK |
222 | wpa_s->sme.assoc_req_ie_len += rrm_ie_len + 2; |
223 | wpa_s->rrm.rrm_used = 1; | |
224 | } | |
225 | ||
226 | ||
215ae884 JM |
227 | static void sme_send_authentication(struct wpa_supplicant *wpa_s, |
228 | struct wpa_bss *bss, struct wpa_ssid *ssid, | |
229 | int start) | |
c2a04078 JM |
230 | { |
231 | struct wpa_driver_auth_params params; | |
8bac466b | 232 | struct wpa_ssid *old_ssid; |
fdbe50ed | 233 | #ifdef CONFIG_IEEE80211R |
c2a04078 | 234 | const u8 *ie; |
fdbe50ed | 235 | #endif /* CONFIG_IEEE80211R */ |
af3e362f | 236 | #if defined(CONFIG_IEEE80211R) || defined(CONFIG_FILS) |
c2a04078 | 237 | const u8 *md = NULL; |
af3e362f | 238 | #endif /* CONFIG_IEEE80211R || CONFIG_FILS */ |
8bac466b | 239 | int i, bssid_changed; |
c10347f2 | 240 | struct wpabuf *resp = NULL; |
0bbaa9b9 | 241 | u8 ext_capab[18]; |
03e47c9c | 242 | int ext_capab_len; |
59b416c7 | 243 | int skip_auth; |
170244a1 IP |
244 | u8 *wpa_ie; |
245 | size_t wpa_ie_len; | |
077232f6 BL |
246 | #ifdef CONFIG_MBO |
247 | const u8 *mbo_ie; | |
248 | #endif /* CONFIG_MBO */ | |
c2a04078 JM |
249 | |
250 | if (bss == NULL) { | |
f049052b BG |
251 | wpa_msg(wpa_s, MSG_ERROR, "SME: No scan result available for " |
252 | "the network"); | |
6ac4b15e | 253 | wpas_connect_work_done(wpa_s); |
c2a04078 JM |
254 | return; |
255 | } | |
256 | ||
59b416c7 JM |
257 | skip_auth = wpa_s->conf->reassoc_same_bss_optim && |
258 | wpa_s->reassoc_same_bss; | |
8f770587 JM |
259 | wpa_s->current_bss = bss; |
260 | ||
c2a04078 JM |
261 | os_memset(¶ms, 0, sizeof(params)); |
262 | wpa_s->reassociate = 0; | |
263 | ||
264 | params.freq = bss->freq; | |
265 | params.bssid = bss->bssid; | |
6fa81a3b JM |
266 | params.ssid = bss->ssid; |
267 | params.ssid_len = bss->ssid_len; | |
2f4f73b1 | 268 | params.p2p = ssid->p2p_group; |
c2a04078 | 269 | |
62fa124c JM |
270 | if (wpa_s->sme.ssid_len != params.ssid_len || |
271 | os_memcmp(wpa_s->sme.ssid, params.ssid, params.ssid_len) != 0) | |
272 | wpa_s->sme.prev_bssid_set = 0; | |
273 | ||
c2a04078 JM |
274 | wpa_s->sme.freq = params.freq; |
275 | os_memcpy(wpa_s->sme.ssid, params.ssid, params.ssid_len); | |
276 | wpa_s->sme.ssid_len = params.ssid_len; | |
277 | ||
abd9fafa | 278 | params.auth_alg = WPA_AUTH_ALG_OPEN; |
c2a04078 JM |
279 | #ifdef IEEE8021X_EAPOL |
280 | if (ssid->key_mgmt & WPA_KEY_MGMT_IEEE8021X_NO_WPA) { | |
281 | if (ssid->leap) { | |
282 | if (ssid->non_leap == 0) | |
abd9fafa | 283 | params.auth_alg = WPA_AUTH_ALG_LEAP; |
c2a04078 | 284 | else |
abd9fafa | 285 | params.auth_alg |= WPA_AUTH_ALG_LEAP; |
c2a04078 JM |
286 | } |
287 | } | |
288 | #endif /* IEEE8021X_EAPOL */ | |
f049052b BG |
289 | wpa_dbg(wpa_s, MSG_DEBUG, "Automatic auth_alg selection: 0x%x", |
290 | params.auth_alg); | |
c2a04078 | 291 | if (ssid->auth_alg) { |
abd9fafa | 292 | params.auth_alg = ssid->auth_alg; |
f049052b BG |
293 | wpa_dbg(wpa_s, MSG_DEBUG, "Overriding auth_alg selection: " |
294 | "0x%x", params.auth_alg); | |
c2a04078 | 295 | } |
c10347f2 | 296 | #ifdef CONFIG_SAE |
bc26ac50 | 297 | wpa_s->sme.sae_pmksa_caching = 0; |
c10347f2 JM |
298 | if (wpa_key_mgmt_sae(ssid->key_mgmt)) { |
299 | const u8 *rsn; | |
300 | struct wpa_ie_data ied; | |
301 | ||
302 | rsn = wpa_bss_get_ie(bss, WLAN_EID_RSN); | |
267ac3bc JM |
303 | if (!rsn) { |
304 | wpa_dbg(wpa_s, MSG_DEBUG, | |
305 | "SAE enabled, but target BSS does not advertise RSN"); | |
306 | } else if (wpa_parse_wpa_ie(rsn, 2 + rsn[1], &ied) == 0 && | |
307 | wpa_key_mgmt_sae(ied.key_mgmt)) { | |
308 | wpa_dbg(wpa_s, MSG_DEBUG, "Using SAE auth_alg"); | |
309 | params.auth_alg = WPA_AUTH_ALG_SAE; | |
310 | } else { | |
311 | wpa_dbg(wpa_s, MSG_DEBUG, | |
312 | "SAE enabled, but target BSS does not advertise SAE AKM for RSN"); | |
c10347f2 JM |
313 | } |
314 | } | |
315 | #endif /* CONFIG_SAE */ | |
c2a04078 | 316 | |
a0b2f99b JM |
317 | for (i = 0; i < NUM_WEP_KEYS; i++) { |
318 | if (ssid->wep_key_len[i]) | |
319 | params.wep_key[i] = ssid->wep_key[i]; | |
320 | params.wep_key_len[i] = ssid->wep_key_len[i]; | |
321 | } | |
322 | params.wep_tx_keyidx = ssid->wep_tx_keyidx; | |
323 | ||
8bac466b | 324 | bssid_changed = !is_zero_ether_addr(wpa_s->bssid); |
c2a04078 JM |
325 | os_memset(wpa_s->bssid, 0, ETH_ALEN); |
326 | os_memcpy(wpa_s->pending_bssid, bss->bssid, ETH_ALEN); | |
8bac466b JM |
327 | if (bssid_changed) |
328 | wpas_notify_bssid_changed(wpa_s); | |
c2a04078 | 329 | |
f337f0e9 JM |
330 | if ((wpa_bss_get_vendor_ie(bss, WPA_IE_VENDOR_TYPE) || |
331 | wpa_bss_get_ie(bss, WLAN_EID_RSN)) && | |
0bf927a0 | 332 | wpa_key_mgmt_wpa(ssid->key_mgmt)) { |
c2a04078 | 333 | int try_opportunistic; |
869af307 JM |
334 | const u8 *cache_id = NULL; |
335 | ||
6e202021 JM |
336 | try_opportunistic = (ssid->proactive_key_caching < 0 ? |
337 | wpa_s->conf->okc : | |
338 | ssid->proactive_key_caching) && | |
c2a04078 | 339 | (ssid->proto & WPA_PROTO_RSN); |
869af307 JM |
340 | #ifdef CONFIG_FILS |
341 | if (wpa_key_mgmt_fils(ssid->key_mgmt)) | |
342 | cache_id = wpa_bss_get_fils_cache_id(bss); | |
343 | #endif /* CONFIG_FILS */ | |
c2a04078 JM |
344 | if (pmksa_cache_set_current(wpa_s->wpa, NULL, bss->bssid, |
345 | wpa_s->current_ssid, | |
852b2f27 JM |
346 | try_opportunistic, cache_id, |
347 | 0) == 0) | |
ba422613 | 348 | eapol_sm_notify_pmkid_attempt(wpa_s->eapol); |
c2a04078 JM |
349 | wpa_s->sme.assoc_req_ie_len = sizeof(wpa_s->sme.assoc_req_ie); |
350 | if (wpa_supplicant_set_suites(wpa_s, bss, ssid, | |
351 | wpa_s->sme.assoc_req_ie, | |
352 | &wpa_s->sme.assoc_req_ie_len)) { | |
f049052b BG |
353 | wpa_msg(wpa_s, MSG_WARNING, "SME: Failed to set WPA " |
354 | "key management and encryption suites"); | |
6ac4b15e | 355 | wpas_connect_work_done(wpa_s); |
c2a04078 JM |
356 | return; |
357 | } | |
dc673aec JM |
358 | #ifdef CONFIG_HS20 |
359 | } else if (wpa_bss_get_vendor_ie(bss, OSEN_IE_VENDOR_TYPE) && | |
360 | (ssid->key_mgmt & WPA_KEY_MGMT_OSEN)) { | |
361 | /* No PMKSA caching, but otherwise similar to RSN/WPA */ | |
362 | wpa_s->sme.assoc_req_ie_len = sizeof(wpa_s->sme.assoc_req_ie); | |
363 | if (wpa_supplicant_set_suites(wpa_s, bss, ssid, | |
364 | wpa_s->sme.assoc_req_ie, | |
365 | &wpa_s->sme.assoc_req_ie_len)) { | |
366 | wpa_msg(wpa_s, MSG_WARNING, "SME: Failed to set WPA " | |
367 | "key management and encryption suites"); | |
368 | wpas_connect_work_done(wpa_s); | |
369 | return; | |
370 | } | |
371 | #endif /* CONFIG_HS20 */ | |
a3f7e518 JM |
372 | } else if ((ssid->key_mgmt & WPA_KEY_MGMT_IEEE8021X_NO_WPA) && |
373 | wpa_key_mgmt_wpa_ieee8021x(ssid->key_mgmt)) { | |
374 | /* | |
375 | * Both WPA and non-WPA IEEE 802.1X enabled in configuration - | |
376 | * use non-WPA since the scan results did not indicate that the | |
377 | * AP is using WPA or WPA2. | |
378 | */ | |
379 | wpa_supplicant_set_non_wpa_policy(wpa_s, ssid); | |
380 | wpa_s->sme.assoc_req_ie_len = 0; | |
0bf927a0 | 381 | } else if (wpa_key_mgmt_wpa_any(ssid->key_mgmt)) { |
c2a04078 JM |
382 | wpa_s->sme.assoc_req_ie_len = sizeof(wpa_s->sme.assoc_req_ie); |
383 | if (wpa_supplicant_set_suites(wpa_s, NULL, ssid, | |
384 | wpa_s->sme.assoc_req_ie, | |
385 | &wpa_s->sme.assoc_req_ie_len)) { | |
f049052b BG |
386 | wpa_msg(wpa_s, MSG_WARNING, "SME: Failed to set WPA " |
387 | "key management and encryption suites (no " | |
388 | "scan results)"); | |
6ac4b15e | 389 | wpas_connect_work_done(wpa_s); |
c2a04078 JM |
390 | return; |
391 | } | |
392 | #ifdef CONFIG_WPS | |
393 | } else if (ssid->key_mgmt & WPA_KEY_MGMT_WPS) { | |
394 | struct wpabuf *wps_ie; | |
395 | wps_ie = wps_build_assoc_req_ie(wpas_wps_get_req_type(ssid)); | |
396 | if (wps_ie && wpabuf_len(wps_ie) <= | |
397 | sizeof(wpa_s->sme.assoc_req_ie)) { | |
398 | wpa_s->sme.assoc_req_ie_len = wpabuf_len(wps_ie); | |
399 | os_memcpy(wpa_s->sme.assoc_req_ie, wpabuf_head(wps_ie), | |
400 | wpa_s->sme.assoc_req_ie_len); | |
401 | } else | |
402 | wpa_s->sme.assoc_req_ie_len = 0; | |
403 | wpabuf_free(wps_ie); | |
404 | wpa_supplicant_set_non_wpa_policy(wpa_s, ssid); | |
405 | #endif /* CONFIG_WPS */ | |
406 | } else { | |
407 | wpa_supplicant_set_non_wpa_policy(wpa_s, ssid); | |
408 | wpa_s->sme.assoc_req_ie_len = 0; | |
409 | } | |
410 | ||
170244a1 IP |
411 | /* In case the WPA vendor IE is used, it should be placed after all the |
412 | * non-vendor IEs, as the lower layer expects the IEs to be ordered as | |
413 | * defined in the standard. Store the WPA IE so it can later be | |
414 | * inserted at the correct location. | |
415 | */ | |
416 | wpa_ie = NULL; | |
417 | wpa_ie_len = 0; | |
418 | if (wpa_s->wpa_proto == WPA_PROTO_WPA) { | |
419 | wpa_ie = os_memdup(wpa_s->sme.assoc_req_ie, | |
420 | wpa_s->sme.assoc_req_ie_len); | |
421 | if (wpa_ie) { | |
422 | wpa_dbg(wpa_s, MSG_DEBUG, "WPA: Storing WPA IE"); | |
423 | ||
424 | wpa_ie_len = wpa_s->sme.assoc_req_ie_len; | |
425 | wpa_s->sme.assoc_req_ie_len = 0; | |
426 | } else { | |
427 | wpa_msg(wpa_s, MSG_WARNING, "WPA: Failed copy WPA IE"); | |
428 | wpas_connect_work_done(wpa_s); | |
429 | return; | |
430 | } | |
431 | } | |
432 | ||
c2a04078 | 433 | #ifdef CONFIG_IEEE80211R |
6fa81a3b | 434 | ie = wpa_bss_get_ie(bss, WLAN_EID_MOBILITY_DOMAIN); |
c2a04078 JM |
435 | if (ie && ie[1] >= MOBILITY_DOMAIN_ID_LEN) |
436 | md = ie + 2; | |
e7846b68 | 437 | wpa_sm_set_ft_params(wpa_s->wpa, ie, ie ? 2 + ie[1] : 0); |
c2a04078 JM |
438 | if (md) { |
439 | /* Prepare for the next transition */ | |
76b7981d | 440 | wpa_ft_prepare_auth_request(wpa_s->wpa, ie); |
c2a04078 JM |
441 | } |
442 | ||
af3e362f JM |
443 | if (md && !wpa_key_mgmt_ft(ssid->key_mgmt)) |
444 | md = NULL; | |
445 | if (md) { | |
446 | wpa_dbg(wpa_s, MSG_DEBUG, "SME: FT mobility domain %02x%02x", | |
447 | md[0], md[1]); | |
448 | ||
c2a04078 JM |
449 | if (wpa_s->sme.assoc_req_ie_len + 5 < |
450 | sizeof(wpa_s->sme.assoc_req_ie)) { | |
451 | struct rsn_mdie *mdie; | |
452 | u8 *pos = wpa_s->sme.assoc_req_ie + | |
453 | wpa_s->sme.assoc_req_ie_len; | |
454 | *pos++ = WLAN_EID_MOBILITY_DOMAIN; | |
455 | *pos++ = sizeof(*mdie); | |
456 | mdie = (struct rsn_mdie *) pos; | |
457 | os_memcpy(mdie->mobility_domain, md, | |
458 | MOBILITY_DOMAIN_ID_LEN); | |
f4ec630d | 459 | mdie->ft_capab = md[MOBILITY_DOMAIN_ID_LEN]; |
c2a04078 JM |
460 | wpa_s->sme.assoc_req_ie_len += 5; |
461 | } | |
462 | ||
463 | if (wpa_s->sme.ft_used && | |
0d7b4409 JM |
464 | os_memcmp(md, wpa_s->sme.mobility_domain, 2) == 0 && |
465 | wpa_sm_has_ptk(wpa_s->wpa)) { | |
f049052b BG |
466 | wpa_dbg(wpa_s, MSG_DEBUG, "SME: Trying to use FT " |
467 | "over-the-air"); | |
abd9fafa | 468 | params.auth_alg = WPA_AUTH_ALG_FT; |
c2a04078 JM |
469 | params.ie = wpa_s->sme.ft_ies; |
470 | params.ie_len = wpa_s->sme.ft_ies_len; | |
471 | } | |
472 | } | |
473 | #endif /* CONFIG_IEEE80211R */ | |
474 | ||
475 | #ifdef CONFIG_IEEE80211W | |
3f56a2b7 | 476 | wpa_s->sme.mfp = wpas_get_ssid_pmf(wpa_s, ssid); |
62d49803 | 477 | if (wpa_s->sme.mfp != NO_MGMT_FRAME_PROTECTION) { |
6fa81a3b | 478 | const u8 *rsn = wpa_bss_get_ie(bss, WLAN_EID_RSN); |
c2a04078 JM |
479 | struct wpa_ie_data _ie; |
480 | if (rsn && wpa_parse_wpa_ie(rsn, 2 + rsn[1], &_ie) == 0 && | |
481 | _ie.capabilities & | |
482 | (WPA_CAPABILITY_MFPC | WPA_CAPABILITY_MFPR)) { | |
f049052b BG |
483 | wpa_dbg(wpa_s, MSG_DEBUG, "SME: Selected AP supports " |
484 | "MFP: require MFP"); | |
c2a04078 JM |
485 | wpa_s->sme.mfp = MGMT_FRAME_PROTECTION_REQUIRED; |
486 | } | |
487 | } | |
488 | #endif /* CONFIG_IEEE80211W */ | |
489 | ||
5f3a6aa0 JM |
490 | #ifdef CONFIG_P2P |
491 | if (wpa_s->global->p2p) { | |
492 | u8 *pos; | |
493 | size_t len; | |
494 | int res; | |
5f3a6aa0 JM |
495 | pos = wpa_s->sme.assoc_req_ie + wpa_s->sme.assoc_req_ie_len; |
496 | len = sizeof(wpa_s->sme.assoc_req_ie) - | |
497 | wpa_s->sme.assoc_req_ie_len; | |
ffad8858 JM |
498 | res = wpas_p2p_assoc_req_ie(wpa_s, bss, pos, len, |
499 | ssid->p2p_group); | |
5f3a6aa0 JM |
500 | if (res >= 0) |
501 | wpa_s->sme.assoc_req_ie_len += res; | |
502 | } | |
503 | #endif /* CONFIG_P2P */ | |
504 | ||
b36a3a65 AN |
505 | #ifdef CONFIG_FST |
506 | if (wpa_s->fst_ies) { | |
507 | int fst_ies_len = wpabuf_len(wpa_s->fst_ies); | |
508 | ||
509 | if (wpa_s->sme.assoc_req_ie_len + fst_ies_len <= | |
510 | sizeof(wpa_s->sme.assoc_req_ie)) { | |
511 | os_memcpy(wpa_s->sme.assoc_req_ie + | |
512 | wpa_s->sme.assoc_req_ie_len, | |
513 | wpabuf_head(wpa_s->fst_ies), | |
514 | fst_ies_len); | |
515 | wpa_s->sme.assoc_req_ie_len += fst_ies_len; | |
516 | } | |
517 | } | |
518 | #endif /* CONFIG_FST */ | |
519 | ||
a0c38e5d AS |
520 | sme_auth_handle_rrm(wpa_s, bss); |
521 | ||
065c029a | 522 | wpa_s->sme.assoc_req_ie_len += wpas_supp_op_class_ie( |
523 | wpa_s, bss->freq, | |
524 | wpa_s->sme.assoc_req_ie + wpa_s->sme.assoc_req_ie_len, | |
525 | sizeof(wpa_s->sme.assoc_req_ie) - wpa_s->sme.assoc_req_ie_len); | |
5e57ba25 | 526 | |
cc9a2575 KV |
527 | if (params.p2p) |
528 | wpa_drv_get_ext_capa(wpa_s, WPA_IF_P2P_CLIENT); | |
529 | else | |
530 | wpa_drv_get_ext_capa(wpa_s, WPA_IF_STATION); | |
531 | ||
0bbaa9b9 JM |
532 | ext_capab_len = wpas_build_ext_capab(wpa_s, ext_capab, |
533 | sizeof(ext_capab)); | |
03e47c9c | 534 | if (ext_capab_len > 0) { |
92cbcf91 JM |
535 | u8 *pos = wpa_s->sme.assoc_req_ie; |
536 | if (wpa_s->sme.assoc_req_ie_len > 0 && pos[0] == WLAN_EID_RSN) | |
537 | pos += 2 + pos[1]; | |
03e47c9c | 538 | os_memmove(pos + ext_capab_len, pos, |
92cbcf91 JM |
539 | wpa_s->sme.assoc_req_ie_len - |
540 | (pos - wpa_s->sme.assoc_req_ie)); | |
03e47c9c JM |
541 | wpa_s->sme.assoc_req_ie_len += ext_capab_len; |
542 | os_memcpy(pos, ext_capab, ext_capab_len); | |
92cbcf91 | 543 | } |
92cbcf91 | 544 | |
c484b198 AS |
545 | #ifdef CONFIG_HS20 |
546 | if (is_hs20_network(wpa_s, ssid, bss)) { | |
547 | struct wpabuf *hs20; | |
548 | ||
4204669c | 549 | hs20 = wpabuf_alloc(20 + MAX_ROAMING_CONS_OI_LEN); |
c484b198 AS |
550 | if (hs20) { |
551 | int pps_mo_id = hs20_get_pps_mo_id(wpa_s, ssid); | |
552 | size_t len; | |
553 | ||
ec2cf403 JM |
554 | wpas_hs20_add_indication(hs20, pps_mo_id, |
555 | get_hs20_version(bss)); | |
4204669c | 556 | wpas_hs20_add_roam_cons_sel(hs20, ssid); |
c484b198 AS |
557 | len = sizeof(wpa_s->sme.assoc_req_ie) - |
558 | wpa_s->sme.assoc_req_ie_len; | |
559 | if (wpabuf_len(hs20) <= len) { | |
560 | os_memcpy(wpa_s->sme.assoc_req_ie + | |
561 | wpa_s->sme.assoc_req_ie_len, | |
562 | wpabuf_head(hs20), wpabuf_len(hs20)); | |
563 | wpa_s->sme.assoc_req_ie_len += wpabuf_len(hs20); | |
564 | } | |
565 | wpabuf_free(hs20); | |
566 | } | |
567 | } | |
568 | #endif /* CONFIG_HS20 */ | |
569 | ||
170244a1 IP |
570 | if (wpa_ie) { |
571 | size_t len; | |
572 | ||
573 | wpa_dbg(wpa_s, MSG_DEBUG, "WPA: Reinsert WPA IE"); | |
574 | ||
575 | len = sizeof(wpa_s->sme.assoc_req_ie) - | |
576 | wpa_s->sme.assoc_req_ie_len; | |
577 | ||
578 | if (len > wpa_ie_len) { | |
579 | os_memcpy(wpa_s->sme.assoc_req_ie + | |
580 | wpa_s->sme.assoc_req_ie_len, | |
581 | wpa_ie, wpa_ie_len); | |
582 | wpa_s->sme.assoc_req_ie_len += wpa_ie_len; | |
583 | } else { | |
584 | wpa_dbg(wpa_s, MSG_DEBUG, "WPA: Failed to add WPA IE"); | |
585 | } | |
586 | ||
587 | os_free(wpa_ie); | |
588 | } | |
589 | ||
d29fa3a7 JM |
590 | if (wpa_s->vendor_elem[VENDOR_ELEM_ASSOC_REQ]) { |
591 | struct wpabuf *buf = wpa_s->vendor_elem[VENDOR_ELEM_ASSOC_REQ]; | |
592 | size_t len; | |
593 | ||
594 | len = sizeof(wpa_s->sme.assoc_req_ie) - | |
595 | wpa_s->sme.assoc_req_ie_len; | |
596 | if (wpabuf_len(buf) <= len) { | |
597 | os_memcpy(wpa_s->sme.assoc_req_ie + | |
598 | wpa_s->sme.assoc_req_ie_len, | |
599 | wpabuf_head(buf), wpabuf_len(buf)); | |
600 | wpa_s->sme.assoc_req_ie_len += wpabuf_len(buf); | |
601 | } | |
602 | } | |
603 | ||
92c6e2e3 | 604 | #ifdef CONFIG_MBO |
077232f6 BL |
605 | mbo_ie = wpa_bss_get_vendor_ie(bss, MBO_IE_VENDOR_TYPE); |
606 | if (mbo_ie) { | |
5e57ba25 | 607 | int len; |
92c6e2e3 | 608 | |
5e57ba25 AS |
609 | len = wpas_mbo_ie(wpa_s, wpa_s->sme.assoc_req_ie + |
610 | wpa_s->sme.assoc_req_ie_len, | |
611 | sizeof(wpa_s->sme.assoc_req_ie) - | |
077232f6 BL |
612 | wpa_s->sme.assoc_req_ie_len, |
613 | !!mbo_attr_from_mbo_ie(mbo_ie, | |
614 | OCE_ATTR_ID_CAPA_IND)); | |
5e57ba25 AS |
615 | if (len >= 0) |
616 | wpa_s->sme.assoc_req_ie_len += len; | |
92c6e2e3 DS |
617 | } |
618 | #endif /* CONFIG_MBO */ | |
619 | ||
c10347f2 | 620 | #ifdef CONFIG_SAE |
59b416c7 | 621 | if (!skip_auth && params.auth_alg == WPA_AUTH_ALG_SAE && |
869af307 | 622 | pmksa_cache_set_current(wpa_s->wpa, NULL, bss->bssid, ssid, 0, |
852b2f27 | 623 | NULL, WPA_KEY_MGMT_SAE) == 0) { |
bc26ac50 JM |
624 | wpa_dbg(wpa_s, MSG_DEBUG, |
625 | "PMKSA cache entry found - try to use PMKSA caching instead of new SAE authentication"); | |
06b1a104 | 626 | wpa_sm_set_pmk_from_pmksa(wpa_s->wpa); |
bc26ac50 JM |
627 | params.auth_alg = WPA_AUTH_ALG_OPEN; |
628 | wpa_s->sme.sae_pmksa_caching = 1; | |
629 | } | |
630 | ||
59b416c7 | 631 | if (!skip_auth && params.auth_alg == WPA_AUTH_ALG_SAE) { |
c10347f2 | 632 | if (start) |
8e31e955 | 633 | resp = sme_auth_build_sae_commit(wpa_s, ssid, |
5ff39c13 | 634 | bss->bssid, 0); |
c10347f2 | 635 | else |
5ff39c13 | 636 | resp = sme_auth_build_sae_confirm(wpa_s, 0); |
6ac4b15e | 637 | if (resp == NULL) { |
81648d00 | 638 | wpas_connection_failed(wpa_s, bss->bssid); |
c10347f2 | 639 | return; |
6ac4b15e | 640 | } |
ce16c489 JM |
641 | params.auth_data = wpabuf_head(resp); |
642 | params.auth_data_len = wpabuf_len(resp); | |
dd43026a | 643 | wpa_s->sme.sae.state = start ? SAE_COMMITTED : SAE_CONFIRMED; |
c10347f2 JM |
644 | } |
645 | #endif /* CONFIG_SAE */ | |
646 | ||
f00b9b88 JM |
647 | old_ssid = wpa_s->current_ssid; |
648 | wpa_s->current_ssid = ssid; | |
649 | wpa_supplicant_rsn_supp_set_config(wpa_s, wpa_s->current_ssid); | |
650 | wpa_supplicant_initiate_eapol(wpa_s); | |
651 | ||
652 | #ifdef CONFIG_FILS | |
653 | /* TODO: FILS operations can in some cases be done between different | |
654 | * network_ctx (i.e., same credentials can be used with multiple | |
655 | * networks). */ | |
656 | if (params.auth_alg == WPA_AUTH_ALG_OPEN && | |
657 | wpa_key_mgmt_fils(ssid->key_mgmt)) { | |
64983516 JM |
658 | const u8 *indic; |
659 | u16 fils_info; | |
af835d75 AB |
660 | const u8 *realm, *username, *rrk; |
661 | size_t realm_len, username_len, rrk_len; | |
662 | u16 next_seq_num; | |
64983516 JM |
663 | |
664 | /* | |
665 | * Check FILS Indication element (FILS Information field) bits | |
666 | * indicating supported authentication algorithms against local | |
667 | * configuration (ssid->fils_dh_group). Try to use FILS | |
668 | * authentication only if the AP supports the combination in the | |
669 | * network profile. */ | |
670 | indic = wpa_bss_get_ie(bss, WLAN_EID_FILS_INDICATION); | |
671 | if (!indic || indic[1] < 2) { | |
672 | wpa_printf(MSG_DEBUG, "SME: " MACSTR | |
673 | " does not include FILS Indication element - cannot use FILS authentication with it", | |
674 | MAC2STR(bss->bssid)); | |
675 | goto no_fils; | |
676 | } | |
677 | ||
678 | fils_info = WPA_GET_LE16(indic + 2); | |
679 | if (ssid->fils_dh_group == 0 && !(fils_info & BIT(9))) { | |
680 | wpa_printf(MSG_DEBUG, "SME: " MACSTR | |
681 | " does not support FILS SK without PFS - cannot use FILS authentication with it", | |
682 | MAC2STR(bss->bssid)); | |
683 | goto no_fils; | |
684 | } | |
685 | if (ssid->fils_dh_group != 0 && !(fils_info & BIT(10))) { | |
686 | wpa_printf(MSG_DEBUG, "SME: " MACSTR | |
687 | " does not support FILS SK with PFS - cannot use FILS authentication with it", | |
688 | MAC2STR(bss->bssid)); | |
689 | goto no_fils; | |
690 | } | |
691 | ||
af835d75 AB |
692 | if (wpa_s->last_con_fail_realm && |
693 | eapol_sm_get_erp_info(wpa_s->eapol, &ssid->eap, | |
694 | &username, &username_len, | |
695 | &realm, &realm_len, &next_seq_num, | |
696 | &rrk, &rrk_len) == 0 && | |
697 | realm && realm_len == wpa_s->last_con_fail_realm_len && | |
698 | os_memcmp(realm, wpa_s->last_con_fail_realm, | |
699 | realm_len) == 0) { | |
700 | wpa_printf(MSG_DEBUG, | |
701 | "SME: FILS authentication for this realm failed last time - try to regenerate ERP key hierarchy"); | |
702 | goto no_fils; | |
703 | } | |
704 | ||
f00b9b88 | 705 | if (pmksa_cache_set_current(wpa_s->wpa, NULL, bss->bssid, |
869af307 | 706 | ssid, 0, |
852b2f27 JM |
707 | wpa_bss_get_fils_cache_id(bss), |
708 | 0) == 0) | |
f00b9b88 JM |
709 | wpa_printf(MSG_DEBUG, |
710 | "SME: Try to use FILS with PMKSA caching"); | |
af3e362f | 711 | resp = fils_build_auth(wpa_s->wpa, ssid->fils_dh_group, md); |
f00b9b88 | 712 | if (resp) { |
76e20f4f JM |
713 | int auth_alg; |
714 | ||
715 | if (ssid->fils_dh_group) | |
716 | wpa_printf(MSG_DEBUG, | |
717 | "SME: Try to use FILS SK authentication with PFS (DH Group %u)", | |
718 | ssid->fils_dh_group); | |
719 | else | |
720 | wpa_printf(MSG_DEBUG, | |
721 | "SME: Try to use FILS SK authentication without PFS"); | |
722 | auth_alg = ssid->fils_dh_group ? | |
723 | WPA_AUTH_ALG_FILS_SK_PFS : WPA_AUTH_ALG_FILS; | |
724 | params.auth_alg = auth_alg; | |
f00b9b88 JM |
725 | params.auth_data = wpabuf_head(resp); |
726 | params.auth_data_len = wpabuf_len(resp); | |
76e20f4f | 727 | wpa_s->sme.auth_alg = auth_alg; |
f00b9b88 JM |
728 | } |
729 | } | |
64983516 | 730 | no_fils: |
f00b9b88 JM |
731 | #endif /* CONFIG_FILS */ |
732 | ||
a4cba8f1 | 733 | wpa_supplicant_cancel_sched_scan(wpa_s); |
c2a04078 JM |
734 | wpa_supplicant_cancel_scan(wpa_s); |
735 | ||
f049052b | 736 | wpa_msg(wpa_s, MSG_INFO, "SME: Trying to authenticate with " MACSTR |
c2a04078 JM |
737 | " (SSID='%s' freq=%d MHz)", MAC2STR(params.bssid), |
738 | wpa_ssid_txt(params.ssid, params.ssid_len), params.freq); | |
739 | ||
6aea02e5 | 740 | eapol_sm_notify_portValid(wpa_s->eapol, FALSE); |
c2a04078 JM |
741 | wpa_clear_keys(wpa_s, bss->bssid); |
742 | wpa_supplicant_set_state(wpa_s, WPA_AUTHENTICATING); | |
8bac466b JM |
743 | if (old_ssid != wpa_s->current_ssid) |
744 | wpas_notify_network_changed(wpa_s); | |
c2a04078 | 745 | |
ece4ac5f MG |
746 | #ifdef CONFIG_HS20 |
747 | hs20_configure_frame_filters(wpa_s); | |
748 | #endif /* CONFIG_HS20 */ | |
749 | ||
d0df6437 IP |
750 | #ifdef CONFIG_P2P |
751 | /* | |
752 | * If multi-channel concurrency is not supported, check for any | |
753 | * frequency conflict. In case of any frequency conflict, remove the | |
754 | * least prioritized connection. | |
755 | */ | |
756 | if (wpa_s->num_multichan_concurrent < 2) { | |
757 | int freq, num; | |
758 | num = get_shared_radio_freqs(wpa_s, &freq, 1); | |
759 | if (num > 0 && freq > 0 && freq != params.freq) { | |
760 | wpa_printf(MSG_DEBUG, | |
761 | "Conflicting frequency found (%d != %d)", | |
762 | freq, params.freq); | |
763 | if (wpas_p2p_handle_frequency_conflicts(wpa_s, | |
764 | params.freq, | |
765 | ssid) < 0) { | |
766 | wpas_connection_failed(wpa_s, bss->bssid); | |
767 | wpa_supplicant_mark_disassoc(wpa_s); | |
768 | wpabuf_free(resp); | |
769 | wpas_connect_work_done(wpa_s); | |
770 | return; | |
771 | } | |
772 | } | |
773 | } | |
774 | #endif /* CONFIG_P2P */ | |
775 | ||
59b416c7 JM |
776 | if (skip_auth) { |
777 | wpa_msg(wpa_s, MSG_DEBUG, | |
778 | "SME: Skip authentication step on reassoc-to-same-BSS"); | |
779 | wpabuf_free(resp); | |
780 | sme_associate(wpa_s, ssid->mode, bss->bssid, WLAN_AUTH_OPEN); | |
781 | return; | |
782 | } | |
783 | ||
784 | ||
62c72d72 | 785 | wpa_s->sme.auth_alg = params.auth_alg; |
c2a04078 | 786 | if (wpa_drv_authenticate(wpa_s, ¶ms) < 0) { |
f049052b | 787 | wpa_msg(wpa_s, MSG_INFO, "SME: Authentication request to the " |
c2a04078 | 788 | "driver failed"); |
ed57c590 | 789 | wpas_connection_failed(wpa_s, bss->bssid); |
1193dc8f | 790 | wpa_supplicant_mark_disassoc(wpa_s); |
c10347f2 | 791 | wpabuf_free(resp); |
6ac4b15e | 792 | wpas_connect_work_done(wpa_s); |
c2a04078 JM |
793 | return; |
794 | } | |
795 | ||
e29853bb BG |
796 | eloop_register_timeout(SME_AUTH_TIMEOUT, 0, sme_auth_timer, wpa_s, |
797 | NULL); | |
c2a04078 JM |
798 | |
799 | /* | |
800 | * Association will be started based on the authentication event from | |
801 | * the driver. | |
802 | */ | |
c10347f2 JM |
803 | |
804 | wpabuf_free(resp); | |
805 | } | |
806 | ||
807 | ||
6ac4b15e JM |
808 | static void sme_auth_start_cb(struct wpa_radio_work *work, int deinit) |
809 | { | |
810 | struct wpa_connect_work *cwork = work->ctx; | |
811 | struct wpa_supplicant *wpa_s = work->wpa_s; | |
812 | ||
813 | if (deinit) { | |
b3253ebb AO |
814 | if (work->started) |
815 | wpa_s->connect_work = NULL; | |
816 | ||
6ac4b15e JM |
817 | wpas_connect_work_free(cwork); |
818 | return; | |
819 | } | |
820 | ||
821 | wpa_s->connect_work = work; | |
822 | ||
a7f5271d | 823 | if (cwork->bss_removed || |
6108536d HW |
824 | !wpas_valid_bss_ssid(wpa_s, cwork->bss, cwork->ssid) || |
825 | wpas_network_disabled(wpa_s, cwork->ssid)) { | |
6ac4b15e JM |
826 | wpa_dbg(wpa_s, MSG_DEBUG, "SME: BSS/SSID entry for authentication not valid anymore - drop connection attempt"); |
827 | wpas_connect_work_done(wpa_s); | |
828 | return; | |
829 | } | |
830 | ||
2c2c5579 JM |
831 | /* Starting new connection, so clear the possibly used WPA IE from the |
832 | * previous association. */ | |
833 | wpa_sm_set_assoc_wpa_ie(wpa_s->wpa, NULL, 0); | |
834 | ||
6ac4b15e JM |
835 | sme_send_authentication(wpa_s, cwork->bss, cwork->ssid, 1); |
836 | } | |
837 | ||
838 | ||
c10347f2 JM |
839 | void sme_authenticate(struct wpa_supplicant *wpa_s, |
840 | struct wpa_bss *bss, struct wpa_ssid *ssid) | |
841 | { | |
6ac4b15e JM |
842 | struct wpa_connect_work *cwork; |
843 | ||
844 | if (bss == NULL || ssid == NULL) | |
845 | return; | |
846 | if (wpa_s->connect_work) { | |
847 | wpa_dbg(wpa_s, MSG_DEBUG, "SME: Reject sme_authenticate() call since connect_work exist"); | |
848 | return; | |
849 | } | |
850 | ||
f0e30c84 | 851 | if (radio_work_pending(wpa_s, "sme-connect")) { |
f1c4dbf5 IP |
852 | /* |
853 | * The previous sme-connect work might no longer be valid due to | |
854 | * the fact that the BSS list was updated. In addition, it makes | |
855 | * sense to adhere to the 'newer' decision. | |
856 | */ | |
857 | wpa_dbg(wpa_s, MSG_DEBUG, | |
858 | "SME: Remove previous pending sme-connect"); | |
859 | radio_remove_works(wpa_s, "sme-connect", 0); | |
f0e30c84 JM |
860 | } |
861 | ||
4ead7cfd KV |
862 | wpas_abort_ongoing_scan(wpa_s); |
863 | ||
6ac4b15e JM |
864 | cwork = os_zalloc(sizeof(*cwork)); |
865 | if (cwork == NULL) | |
866 | return; | |
867 | cwork->bss = bss; | |
868 | cwork->ssid = ssid; | |
869 | cwork->sme = 1; | |
870 | ||
98efcc41 | 871 | #ifdef CONFIG_SAE |
dd43026a | 872 | wpa_s->sme.sae.state = SAE_NOTHING; |
98efcc41 | 873 | wpa_s->sme.sae.send_confirm = 0; |
18ca7332 | 874 | wpa_s->sme.sae_group_index = 0; |
98efcc41 | 875 | #endif /* CONFIG_SAE */ |
6ac4b15e JM |
876 | |
877 | if (radio_add_work(wpa_s, bss->freq, "sme-connect", 1, | |
878 | sme_auth_start_cb, cwork) < 0) | |
879 | wpas_connect_work_free(cwork); | |
c2a04078 JM |
880 | } |
881 | ||
882 | ||
c10347f2 | 883 | #ifdef CONFIG_SAE |
21af6d15 | 884 | |
5ff39c13 SD |
885 | static int sme_external_auth_build_buf(struct wpabuf *buf, |
886 | struct wpabuf *params, | |
887 | const u8 *sa, const u8 *da, | |
888 | u16 auth_transaction, u16 seq_num) | |
889 | { | |
890 | struct ieee80211_mgmt *resp; | |
891 | ||
892 | resp = wpabuf_put(buf, offsetof(struct ieee80211_mgmt, | |
893 | u.auth.variable)); | |
894 | ||
895 | resp->frame_control = host_to_le16((WLAN_FC_TYPE_MGMT << 2) | | |
896 | (WLAN_FC_STYPE_AUTH << 4)); | |
897 | os_memcpy(resp->da, da, ETH_ALEN); | |
898 | os_memcpy(resp->sa, sa, ETH_ALEN); | |
899 | os_memcpy(resp->bssid, da, ETH_ALEN); | |
fcb3f11e AP |
900 | resp->u.auth.auth_alg = host_to_le16(WLAN_AUTH_SAE); |
901 | resp->seq_ctrl = host_to_le16(seq_num << 4); | |
902 | resp->u.auth.auth_transaction = host_to_le16(auth_transaction); | |
903 | resp->u.auth.status_code = host_to_le16(WLAN_STATUS_SUCCESS); | |
5ff39c13 SD |
904 | if (params) |
905 | wpabuf_put_buf(buf, params); | |
906 | ||
907 | return 0; | |
908 | } | |
909 | ||
910 | ||
911 | static void sme_external_auth_send_sae_commit(struct wpa_supplicant *wpa_s, | |
912 | const u8 *bssid, | |
913 | struct wpa_ssid *ssid) | |
914 | { | |
915 | struct wpabuf *resp, *buf; | |
916 | ||
917 | resp = sme_auth_build_sae_commit(wpa_s, ssid, bssid, 1); | |
918 | if (!resp) | |
919 | return; | |
920 | ||
921 | wpa_s->sme.sae.state = SAE_COMMITTED; | |
922 | buf = wpabuf_alloc(4 + SAE_COMMIT_MAX_LEN + wpabuf_len(resp)); | |
923 | if (!buf) { | |
924 | wpabuf_free(resp); | |
925 | return; | |
926 | } | |
927 | ||
928 | wpa_s->sme.seq_num++; | |
929 | sme_external_auth_build_buf(buf, resp, wpa_s->own_addr, | |
930 | bssid, 1, wpa_s->sme.seq_num); | |
931 | wpa_drv_send_mlme(wpa_s, wpabuf_head(buf), wpabuf_len(buf), 1, 0); | |
932 | wpabuf_free(resp); | |
933 | wpabuf_free(buf); | |
934 | } | |
935 | ||
936 | ||
937 | static void sme_send_external_auth_status(struct wpa_supplicant *wpa_s, | |
938 | u16 status) | |
939 | { | |
940 | struct external_auth params; | |
941 | ||
942 | os_memset(¶ms, 0, sizeof(params)); | |
943 | params.status = status; | |
944 | os_memcpy(params.ssid, wpa_s->sme.ext_auth.ssid, | |
945 | wpa_s->sme.ext_auth.ssid_len); | |
946 | params.ssid_len = wpa_s->sme.ext_auth.ssid_len; | |
947 | os_memcpy(params.bssid, wpa_s->sme.ext_auth.bssid, ETH_ALEN); | |
948 | wpa_drv_send_external_auth_status(wpa_s, ¶ms); | |
949 | } | |
950 | ||
951 | ||
952 | static void sme_handle_external_auth_start(struct wpa_supplicant *wpa_s, | |
953 | union wpa_event_data *data) | |
954 | { | |
955 | struct wpa_ssid *ssid; | |
956 | size_t ssid_str_len = data->external_auth.ssid_len; | |
957 | u8 *ssid_str = data->external_auth.ssid; | |
958 | ||
959 | /* Get the SSID conf from the ssid string obtained */ | |
960 | for (ssid = wpa_s->conf->ssid; ssid; ssid = ssid->next) { | |
961 | if (!wpas_network_disabled(wpa_s, ssid) && | |
962 | ssid_str_len == ssid->ssid_len && | |
18a0508a CI |
963 | os_memcmp(ssid_str, ssid->ssid, ssid_str_len) == 0 && |
964 | (ssid->key_mgmt & WPA_KEY_MGMT_SAE)) | |
5ff39c13 SD |
965 | break; |
966 | } | |
967 | if (ssid) | |
968 | sme_external_auth_send_sae_commit(wpa_s, | |
969 | data->external_auth.bssid, | |
970 | ssid); | |
971 | else | |
972 | sme_send_external_auth_status(wpa_s, | |
973 | WLAN_STATUS_UNSPECIFIED_FAILURE); | |
974 | } | |
975 | ||
976 | ||
977 | static void sme_external_auth_send_sae_confirm(struct wpa_supplicant *wpa_s, | |
978 | const u8 *da) | |
979 | { | |
980 | struct wpabuf *resp, *buf; | |
981 | ||
982 | resp = sme_auth_build_sae_confirm(wpa_s, 1); | |
983 | if (!resp) { | |
984 | wpa_printf(MSG_DEBUG, "SAE: Confirm message buf alloc failure"); | |
985 | return; | |
986 | } | |
987 | ||
988 | wpa_s->sme.sae.state = SAE_CONFIRMED; | |
989 | buf = wpabuf_alloc(4 + SAE_CONFIRM_MAX_LEN + wpabuf_len(resp)); | |
990 | if (!buf) { | |
991 | wpa_printf(MSG_DEBUG, "SAE: Auth Confirm buf alloc failure"); | |
992 | wpabuf_free(resp); | |
993 | return; | |
994 | } | |
995 | wpa_s->sme.seq_num++; | |
996 | sme_external_auth_build_buf(buf, resp, wpa_s->own_addr, | |
997 | da, 2, wpa_s->sme.seq_num); | |
998 | wpa_drv_send_mlme(wpa_s, wpabuf_head(buf), wpabuf_len(buf), 1, 0); | |
999 | wpabuf_free(resp); | |
1000 | wpabuf_free(buf); | |
1001 | } | |
1002 | ||
1003 | ||
1004 | void sme_external_auth_trigger(struct wpa_supplicant *wpa_s, | |
1005 | union wpa_event_data *data) | |
1006 | { | |
1007 | if (RSN_SELECTOR_GET(&data->external_auth.key_mgmt_suite) != | |
1008 | RSN_AUTH_KEY_MGMT_SAE) | |
1009 | return; | |
1010 | ||
1011 | if (data->external_auth.action == EXT_AUTH_START) { | |
1012 | os_memcpy(&wpa_s->sme.ext_auth, data, | |
1013 | sizeof(struct external_auth)); | |
1014 | wpa_s->sme.seq_num = 0; | |
1015 | wpa_s->sme.sae.state = SAE_NOTHING; | |
1016 | wpa_s->sme.sae.send_confirm = 0; | |
1017 | wpa_s->sme.sae_group_index = 0; | |
1018 | sme_handle_external_auth_start(wpa_s, data); | |
1019 | } else if (data->external_auth.action == EXT_AUTH_ABORT) { | |
1020 | /* Report failure to driver for the wrong trigger */ | |
1021 | sme_send_external_auth_status(wpa_s, | |
1022 | WLAN_STATUS_UNSPECIFIED_FAILURE); | |
1023 | } | |
1024 | } | |
1025 | ||
1026 | ||
c10347f2 | 1027 | static int sme_sae_auth(struct wpa_supplicant *wpa_s, u16 auth_transaction, |
5ff39c13 SD |
1028 | u16 status_code, const u8 *data, size_t len, |
1029 | int external, const u8 *sa) | |
c10347f2 | 1030 | { |
a959a3b6 MH |
1031 | int *groups; |
1032 | ||
c10347f2 JM |
1033 | wpa_dbg(wpa_s, MSG_DEBUG, "SME: SAE authentication transaction %u " |
1034 | "status code %u", auth_transaction, status_code); | |
c10347f2 | 1035 | |
d136c376 JM |
1036 | if (auth_transaction == 1 && |
1037 | status_code == WLAN_STATUS_ANTI_CLOGGING_TOKEN_REQ && | |
1038 | wpa_s->sme.sae.state == SAE_COMMITTED && | |
5ff39c13 | 1039 | (external || wpa_s->current_bss) && wpa_s->current_ssid) { |
a959a3b6 MH |
1040 | int default_groups[] = { 19, 20, 21, 25, 26, 0 }; |
1041 | u16 group; | |
1042 | ||
1043 | groups = wpa_s->conf->sae_groups; | |
1044 | if (!groups || groups[0] <= 0) | |
1045 | groups = default_groups; | |
1046 | ||
1047 | if (len < sizeof(le16)) { | |
1048 | wpa_dbg(wpa_s, MSG_DEBUG, | |
1049 | "SME: Too short SAE anti-clogging token request"); | |
1050 | return -1; | |
1051 | } | |
1052 | group = WPA_GET_LE16(data); | |
1053 | wpa_dbg(wpa_s, MSG_DEBUG, | |
1054 | "SME: SAE anti-clogging token requested (group %u)", | |
1055 | group); | |
1056 | if (sae_group_allowed(&wpa_s->sme.sae, groups, group) != | |
1057 | WLAN_STATUS_SUCCESS) { | |
1058 | wpa_dbg(wpa_s, MSG_ERROR, | |
1059 | "SME: SAE group %u of anti-clogging request is invalid", | |
1060 | group); | |
1061 | return -1; | |
1062 | } | |
d136c376 | 1063 | wpabuf_free(wpa_s->sme.sae_token); |
a959a3b6 MH |
1064 | wpa_s->sme.sae_token = wpabuf_alloc_copy(data + sizeof(le16), |
1065 | len - sizeof(le16)); | |
5ff39c13 SD |
1066 | if (!external) |
1067 | sme_send_authentication(wpa_s, wpa_s->current_bss, | |
1068 | wpa_s->current_ssid, 1); | |
1069 | else | |
1070 | sme_external_auth_send_sae_commit( | |
1071 | wpa_s, wpa_s->sme.ext_auth.bssid, | |
1072 | wpa_s->current_ssid); | |
d136c376 JM |
1073 | return 0; |
1074 | } | |
1075 | ||
625f202a JM |
1076 | if (auth_transaction == 1 && |
1077 | status_code == WLAN_STATUS_FINITE_CYCLIC_GROUP_NOT_SUPPORTED && | |
1078 | wpa_s->sme.sae.state == SAE_COMMITTED && | |
5ff39c13 | 1079 | (external || wpa_s->current_bss) && wpa_s->current_ssid) { |
625f202a JM |
1080 | wpa_dbg(wpa_s, MSG_DEBUG, "SME: SAE group not supported"); |
1081 | wpa_s->sme.sae_group_index++; | |
1082 | if (sme_set_sae_group(wpa_s) < 0) | |
1083 | return -1; /* no other groups enabled */ | |
1084 | wpa_dbg(wpa_s, MSG_DEBUG, "SME: Try next enabled SAE group"); | |
5ff39c13 SD |
1085 | if (!external) |
1086 | sme_send_authentication(wpa_s, wpa_s->current_bss, | |
1087 | wpa_s->current_ssid, 1); | |
1088 | else | |
1089 | sme_external_auth_send_sae_commit( | |
1090 | wpa_s, wpa_s->sme.ext_auth.bssid, | |
1091 | wpa_s->current_ssid); | |
625f202a JM |
1092 | return 0; |
1093 | } | |
1094 | ||
9be19d0b JM |
1095 | if (auth_transaction == 1 && |
1096 | status_code == WLAN_STATUS_UNKNOWN_PASSWORD_IDENTIFIER) { | |
1097 | const u8 *bssid = sa ? sa : wpa_s->pending_bssid; | |
1098 | ||
1099 | wpa_msg(wpa_s, MSG_INFO, | |
1100 | WPA_EVENT_SAE_UNKNOWN_PASSWORD_IDENTIFIER MACSTR, | |
1101 | MAC2STR(bssid)); | |
1102 | return -1; | |
1103 | } | |
1104 | ||
c10347f2 JM |
1105 | if (status_code != WLAN_STATUS_SUCCESS) |
1106 | return -1; | |
1107 | ||
1108 | if (auth_transaction == 1) { | |
6a58444d JM |
1109 | u16 res; |
1110 | ||
a959a3b6 | 1111 | groups = wpa_s->conf->sae_groups; |
18ca7332 | 1112 | |
c10347f2 | 1113 | wpa_dbg(wpa_s, MSG_DEBUG, "SME SAE commit"); |
5ff39c13 | 1114 | if ((!external && wpa_s->current_bss == NULL) || |
c10347f2 JM |
1115 | wpa_s->current_ssid == NULL) |
1116 | return -1; | |
dd43026a | 1117 | if (wpa_s->sme.sae.state != SAE_COMMITTED) |
21af6d15 | 1118 | return -1; |
18ca7332 JM |
1119 | if (groups && groups[0] <= 0) |
1120 | groups = NULL; | |
6a58444d JM |
1121 | res = sae_parse_commit(&wpa_s->sme.sae, data, len, NULL, NULL, |
1122 | groups); | |
1123 | if (res == SAE_SILENTLY_DISCARD) { | |
1124 | wpa_printf(MSG_DEBUG, | |
1125 | "SAE: Drop commit message due to reflection attack"); | |
1126 | return 0; | |
1127 | } | |
1128 | if (res != WLAN_STATUS_SUCCESS) | |
21af6d15 | 1129 | return -1; |
146f6c9a JM |
1130 | |
1131 | if (sae_process_commit(&wpa_s->sme.sae) < 0) { | |
1132 | wpa_printf(MSG_DEBUG, "SAE: Failed to process peer " | |
1133 | "commit"); | |
1134 | return -1; | |
1135 | } | |
1136 | ||
d136c376 JM |
1137 | wpabuf_free(wpa_s->sme.sae_token); |
1138 | wpa_s->sme.sae_token = NULL; | |
5ff39c13 SD |
1139 | if (!external) |
1140 | sme_send_authentication(wpa_s, wpa_s->current_bss, | |
1141 | wpa_s->current_ssid, 0); | |
1142 | else | |
1143 | sme_external_auth_send_sae_confirm(wpa_s, sa); | |
c10347f2 JM |
1144 | return 0; |
1145 | } else if (auth_transaction == 2) { | |
1146 | wpa_dbg(wpa_s, MSG_DEBUG, "SME SAE confirm"); | |
dd43026a | 1147 | if (wpa_s->sme.sae.state != SAE_CONFIRMED) |
21af6d15 | 1148 | return -1; |
f2e9818f | 1149 | if (sae_check_confirm(&wpa_s->sme.sae, data, len) < 0) |
21af6d15 | 1150 | return -1; |
dd43026a | 1151 | wpa_s->sme.sae.state = SAE_ACCEPTED; |
b4fd3613 | 1152 | sae_clear_temp_data(&wpa_s->sme.sae); |
5ff39c13 SD |
1153 | |
1154 | if (external) { | |
1155 | /* Report success to driver */ | |
1156 | sme_send_external_auth_status(wpa_s, | |
1157 | WLAN_STATUS_SUCCESS); | |
1158 | } | |
1159 | ||
c10347f2 JM |
1160 | return 1; |
1161 | } | |
1162 | ||
1163 | return -1; | |
1164 | } | |
5ff39c13 SD |
1165 | |
1166 | ||
1167 | void sme_external_auth_mgmt_rx(struct wpa_supplicant *wpa_s, | |
1168 | const u8 *auth_frame, size_t len) | |
1169 | { | |
1170 | const struct ieee80211_mgmt *header; | |
1171 | size_t auth_length; | |
1172 | ||
1173 | header = (const struct ieee80211_mgmt *) auth_frame; | |
1174 | auth_length = IEEE80211_HDRLEN + sizeof(header->u.auth); | |
1175 | ||
1176 | if (len < auth_length) { | |
1177 | /* Notify failure to the driver */ | |
1178 | sme_send_external_auth_status(wpa_s, | |
1179 | WLAN_STATUS_UNSPECIFIED_FAILURE); | |
1180 | return; | |
1181 | } | |
1182 | ||
fcb3f11e | 1183 | if (le_to_host16(header->u.auth.auth_alg) == WLAN_AUTH_SAE) { |
5ff39c13 SD |
1184 | int res; |
1185 | ||
fcb3f11e AP |
1186 | res = sme_sae_auth( |
1187 | wpa_s, le_to_host16(header->u.auth.auth_transaction), | |
1188 | le_to_host16(header->u.auth.status_code), | |
1189 | header->u.auth.variable, | |
1190 | len - auth_length, 1, header->sa); | |
5ff39c13 SD |
1191 | if (res < 0) { |
1192 | /* Notify failure to the driver */ | |
1193 | sme_send_external_auth_status( | |
1194 | wpa_s, WLAN_STATUS_UNSPECIFIED_FAILURE); | |
1195 | return; | |
1196 | } | |
1197 | if (res != 1) | |
1198 | return; | |
1199 | ||
1200 | wpa_printf(MSG_DEBUG, | |
1201 | "SME: SAE completed - setting PMK for 4-way handshake"); | |
1202 | wpa_sm_set_pmk(wpa_s->wpa, wpa_s->sme.sae.pmk, PMK_LEN, | |
1203 | wpa_s->sme.sae.pmkid, wpa_s->pending_bssid); | |
1204 | } | |
1205 | } | |
1206 | ||
c10347f2 JM |
1207 | #endif /* CONFIG_SAE */ |
1208 | ||
1209 | ||
c2a04078 JM |
1210 | void sme_event_auth(struct wpa_supplicant *wpa_s, union wpa_event_data *data) |
1211 | { | |
c2a04078 JM |
1212 | struct wpa_ssid *ssid = wpa_s->current_ssid; |
1213 | ||
1214 | if (ssid == NULL) { | |
f049052b BG |
1215 | wpa_dbg(wpa_s, MSG_DEBUG, "SME: Ignore authentication event " |
1216 | "when network is not selected"); | |
c2a04078 JM |
1217 | return; |
1218 | } | |
1219 | ||
1220 | if (wpa_s->wpa_state != WPA_AUTHENTICATING) { | |
f049052b BG |
1221 | wpa_dbg(wpa_s, MSG_DEBUG, "SME: Ignore authentication event " |
1222 | "when not in authenticating state"); | |
c2a04078 JM |
1223 | return; |
1224 | } | |
1225 | ||
1226 | if (os_memcmp(wpa_s->pending_bssid, data->auth.peer, ETH_ALEN) != 0) { | |
f049052b BG |
1227 | wpa_dbg(wpa_s, MSG_DEBUG, "SME: Ignore authentication with " |
1228 | "unexpected peer " MACSTR, | |
1229 | MAC2STR(data->auth.peer)); | |
c2a04078 JM |
1230 | return; |
1231 | } | |
1232 | ||
f049052b | 1233 | wpa_dbg(wpa_s, MSG_DEBUG, "SME: Authentication response: peer=" MACSTR |
c10347f2 | 1234 | " auth_type=%d auth_transaction=%d status_code=%d", |
f049052b | 1235 | MAC2STR(data->auth.peer), data->auth.auth_type, |
c10347f2 | 1236 | data->auth.auth_transaction, data->auth.status_code); |
c2a04078 JM |
1237 | wpa_hexdump(MSG_MSGDUMP, "SME: Authentication response IEs", |
1238 | data->auth.ies, data->auth.ies_len); | |
1239 | ||
e29853bb BG |
1240 | eloop_cancel_timeout(sme_auth_timer, wpa_s, NULL); |
1241 | ||
c10347f2 JM |
1242 | #ifdef CONFIG_SAE |
1243 | if (data->auth.auth_type == WLAN_AUTH_SAE) { | |
21af6d15 JM |
1244 | int res; |
1245 | res = sme_sae_auth(wpa_s, data->auth.auth_transaction, | |
1246 | data->auth.status_code, data->auth.ies, | |
5ff39c13 | 1247 | data->auth.ies_len, 0, NULL); |
21af6d15 JM |
1248 | if (res < 0) { |
1249 | wpas_connection_failed(wpa_s, wpa_s->pending_bssid); | |
1250 | wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED); | |
1251 | ||
1252 | } | |
1253 | if (res != 1) | |
c10347f2 | 1254 | return; |
47b55a3e JM |
1255 | |
1256 | wpa_printf(MSG_DEBUG, "SME: SAE completed - setting PMK for " | |
1257 | "4-way handshake"); | |
bc26ac50 | 1258 | wpa_sm_set_pmk(wpa_s->wpa, wpa_s->sme.sae.pmk, PMK_LEN, |
70c93963 | 1259 | wpa_s->sme.sae.pmkid, wpa_s->pending_bssid); |
c10347f2 JM |
1260 | } |
1261 | #endif /* CONFIG_SAE */ | |
1262 | ||
c2a04078 | 1263 | if (data->auth.status_code != WLAN_STATUS_SUCCESS) { |
ec4387f9 JM |
1264 | char *ie_txt = NULL; |
1265 | ||
1266 | if (data->auth.ies && data->auth.ies_len) { | |
1267 | size_t buflen = 2 * data->auth.ies_len + 1; | |
1268 | ie_txt = os_malloc(buflen); | |
1269 | if (ie_txt) { | |
1270 | wpa_snprintf_hex(ie_txt, buflen, data->auth.ies, | |
1271 | data->auth.ies_len); | |
1272 | } | |
1273 | } | |
1274 | wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_AUTH_REJECT MACSTR | |
5f11880f | 1275 | " auth_type=%u auth_transaction=%u status_code=%u%s%s", |
ec4387f9 JM |
1276 | MAC2STR(data->auth.peer), data->auth.auth_type, |
1277 | data->auth.auth_transaction, data->auth.status_code, | |
5f11880f JM |
1278 | ie_txt ? " ie=" : "", |
1279 | ie_txt ? ie_txt : ""); | |
ec4387f9 | 1280 | os_free(ie_txt); |
cb1583f6 | 1281 | |
af835d75 AB |
1282 | #ifdef CONFIG_FILS |
1283 | if (wpa_s->sme.auth_alg == WPA_AUTH_ALG_FILS || | |
1284 | wpa_s->sme.auth_alg == WPA_AUTH_ALG_FILS_SK_PFS) | |
1285 | fils_connection_failure(wpa_s); | |
1286 | #endif /* CONFIG_FILS */ | |
1287 | ||
cb1583f6 SO |
1288 | if (data->auth.status_code != |
1289 | WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG || | |
1290 | wpa_s->sme.auth_alg == data->auth.auth_type || | |
7e6646c7 | 1291 | wpa_s->current_ssid->auth_alg == WPA_AUTH_ALG_LEAP) { |
0fb337c1 | 1292 | wpas_connection_failed(wpa_s, wpa_s->pending_bssid); |
c1c02342 | 1293 | wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED); |
cb1583f6 | 1294 | return; |
7e6646c7 | 1295 | } |
cb1583f6 | 1296 | |
d9504779 JM |
1297 | wpas_connect_work_done(wpa_s); |
1298 | ||
cb1583f6 SO |
1299 | switch (data->auth.auth_type) { |
1300 | case WLAN_AUTH_OPEN: | |
1301 | wpa_s->current_ssid->auth_alg = WPA_AUTH_ALG_SHARED; | |
1302 | ||
f049052b | 1303 | wpa_dbg(wpa_s, MSG_DEBUG, "SME: Trying SHARED auth"); |
cb1583f6 SO |
1304 | wpa_supplicant_associate(wpa_s, wpa_s->current_bss, |
1305 | wpa_s->current_ssid); | |
1306 | return; | |
1307 | ||
1308 | case WLAN_AUTH_SHARED_KEY: | |
1309 | wpa_s->current_ssid->auth_alg = WPA_AUTH_ALG_LEAP; | |
1310 | ||
f049052b | 1311 | wpa_dbg(wpa_s, MSG_DEBUG, "SME: Trying LEAP auth"); |
cb1583f6 SO |
1312 | wpa_supplicant_associate(wpa_s, wpa_s->current_bss, |
1313 | wpa_s->current_ssid); | |
1314 | return; | |
1315 | ||
1316 | default: | |
1317 | return; | |
1318 | } | |
c2a04078 JM |
1319 | } |
1320 | ||
1321 | #ifdef CONFIG_IEEE80211R | |
1322 | if (data->auth.auth_type == WLAN_AUTH_FT) { | |
c6c41f6e JM |
1323 | const u8 *ric_ies = NULL; |
1324 | size_t ric_ies_len = 0; | |
1325 | ||
1326 | if (wpa_s->ric_ies) { | |
1327 | ric_ies = wpabuf_head(wpa_s->ric_ies); | |
1328 | ric_ies_len = wpabuf_len(wpa_s->ric_ies); | |
1329 | } | |
ee140ef9 JM |
1330 | if (wpa_ft_process_response(wpa_s->wpa, data->auth.ies, |
1331 | data->auth.ies_len, 0, | |
c6c41f6e JM |
1332 | data->auth.peer, |
1333 | ric_ies, ric_ies_len) < 0) { | |
ee140ef9 JM |
1334 | wpa_dbg(wpa_s, MSG_DEBUG, |
1335 | "SME: FT Authentication response processing failed"); | |
1336 | wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_DISCONNECTED "bssid=" | |
1337 | MACSTR | |
1338 | " reason=%d locally_generated=1", | |
1339 | MAC2STR(wpa_s->pending_bssid), | |
1340 | WLAN_REASON_DEAUTH_LEAVING); | |
1341 | wpas_connection_failed(wpa_s, wpa_s->pending_bssid); | |
1342 | wpa_supplicant_mark_disassoc(wpa_s); | |
1343 | return; | |
1344 | } | |
c2a04078 JM |
1345 | } |
1346 | #endif /* CONFIG_IEEE80211R */ | |
1347 | ||
a6609937 | 1348 | #ifdef CONFIG_FILS |
76e20f4f JM |
1349 | if (data->auth.auth_type == WLAN_AUTH_FILS_SK || |
1350 | data->auth.auth_type == WLAN_AUTH_FILS_SK_PFS) { | |
1351 | u16 expect_auth_type; | |
1352 | ||
1353 | expect_auth_type = wpa_s->sme.auth_alg == | |
1354 | WPA_AUTH_ALG_FILS_SK_PFS ? WLAN_AUTH_FILS_SK_PFS : | |
1355 | WLAN_AUTH_FILS_SK; | |
1356 | if (data->auth.auth_type != expect_auth_type) { | |
1357 | wpa_dbg(wpa_s, MSG_DEBUG, | |
1358 | "SME: FILS Authentication response used different auth alg (%u; expected %u)", | |
1359 | data->auth.auth_type, expect_auth_type); | |
1360 | wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_DISCONNECTED "bssid=" | |
1361 | MACSTR | |
1362 | " reason=%d locally_generated=1", | |
1363 | MAC2STR(wpa_s->pending_bssid), | |
1364 | WLAN_REASON_DEAUTH_LEAVING); | |
1365 | wpas_connection_failed(wpa_s, wpa_s->pending_bssid); | |
1366 | wpa_supplicant_mark_disassoc(wpa_s); | |
1367 | return; | |
1368 | } | |
1369 | ||
ba9774bd JM |
1370 | if (fils_process_auth(wpa_s->wpa, wpa_s->pending_bssid, |
1371 | data->auth.ies, data->auth.ies_len) < 0) { | |
a6609937 JM |
1372 | wpa_dbg(wpa_s, MSG_DEBUG, |
1373 | "SME: FILS Authentication response processing failed"); | |
1374 | wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_DISCONNECTED "bssid=" | |
1375 | MACSTR | |
1376 | " reason=%d locally_generated=1", | |
1377 | MAC2STR(wpa_s->pending_bssid), | |
1378 | WLAN_REASON_DEAUTH_LEAVING); | |
1379 | wpas_connection_failed(wpa_s, wpa_s->pending_bssid); | |
1380 | wpa_supplicant_mark_disassoc(wpa_s); | |
1381 | return; | |
1382 | } | |
1383 | } | |
1384 | #endif /* CONFIG_FILS */ | |
1385 | ||
71024cb2 JM |
1386 | sme_associate(wpa_s, ssid->mode, data->auth.peer, |
1387 | data->auth.auth_type); | |
1388 | } | |
1389 | ||
1390 | ||
7d440a3b JM |
1391 | #ifdef CONFIG_IEEE80211R |
1392 | static void remove_ie(u8 *buf, size_t *len, u8 eid) | |
1393 | { | |
1394 | u8 *pos, *next, *end; | |
1395 | ||
1396 | pos = (u8 *) get_ie(buf, *len, eid); | |
1397 | if (pos) { | |
1398 | next = pos + 2 + pos[1]; | |
1399 | end = buf + *len; | |
1400 | *len -= 2 + pos[1]; | |
1401 | os_memmove(pos, next, end - next); | |
1402 | } | |
1403 | } | |
1404 | #endif /* CONFIG_IEEE80211R */ | |
1405 | ||
1406 | ||
71024cb2 JM |
1407 | void sme_associate(struct wpa_supplicant *wpa_s, enum wpas_mode mode, |
1408 | const u8 *bssid, u16 auth_type) | |
1409 | { | |
1410 | struct wpa_driver_associate_params params; | |
d9a27b04 | 1411 | struct ieee802_11_elems elems; |
86cd6928 JM |
1412 | #ifdef CONFIG_FILS |
1413 | u8 nonces[2 * FILS_NONCE_LEN]; | |
1414 | #endif /* CONFIG_FILS */ | |
80e8a5ee BG |
1415 | #ifdef CONFIG_HT_OVERRIDES |
1416 | struct ieee80211_ht_capabilities htcaps; | |
1417 | struct ieee80211_ht_capabilities htcaps_mask; | |
1418 | #endif /* CONFIG_HT_OVERRIDES */ | |
e9ee8dc3 JB |
1419 | #ifdef CONFIG_VHT_OVERRIDES |
1420 | struct ieee80211_vht_capabilities vhtcaps; | |
1421 | struct ieee80211_vht_capabilities vhtcaps_mask; | |
1422 | #endif /* CONFIG_VHT_OVERRIDES */ | |
71024cb2 | 1423 | |
c2a04078 | 1424 | os_memset(¶ms, 0, sizeof(params)); |
86cd6928 JM |
1425 | |
1426 | #ifdef CONFIG_FILS | |
76e20f4f JM |
1427 | if (auth_type == WLAN_AUTH_FILS_SK || |
1428 | auth_type == WLAN_AUTH_FILS_SK_PFS) { | |
86cd6928 JM |
1429 | struct wpabuf *buf; |
1430 | const u8 *snonce, *anonce; | |
5732b770 JM |
1431 | const unsigned int max_hlp = 20; |
1432 | struct wpabuf *hlp[max_hlp]; | |
1433 | unsigned int i, num_hlp = 0; | |
1434 | struct fils_hlp_req *req; | |
1435 | ||
1436 | dl_list_for_each(req, &wpa_s->fils_hlp_req, struct fils_hlp_req, | |
1437 | list) { | |
1438 | hlp[num_hlp] = wpabuf_alloc(2 * ETH_ALEN + 6 + | |
1439 | wpabuf_len(req->pkt)); | |
1440 | if (!hlp[num_hlp]) | |
1441 | break; | |
1442 | wpabuf_put_data(hlp[num_hlp], req->dst, ETH_ALEN); | |
1443 | wpabuf_put_data(hlp[num_hlp], wpa_s->own_addr, | |
1444 | ETH_ALEN); | |
1445 | wpabuf_put_data(hlp[num_hlp], | |
1446 | "\xaa\xaa\x03\x00\x00\x00", 6); | |
1447 | wpabuf_put_buf(hlp[num_hlp], req->pkt); | |
1448 | num_hlp++; | |
1449 | if (num_hlp >= max_hlp) | |
1450 | break; | |
1451 | } | |
86cd6928 JM |
1452 | |
1453 | buf = fils_build_assoc_req(wpa_s->wpa, ¶ms.fils_kek, | |
1454 | ¶ms.fils_kek_len, &snonce, | |
5732b770 JM |
1455 | &anonce, |
1456 | (const struct wpabuf **) hlp, | |
1457 | num_hlp); | |
1458 | for (i = 0; i < num_hlp; i++) | |
1459 | wpabuf_free(hlp[i]); | |
86cd6928 JM |
1460 | if (!buf) |
1461 | return; | |
7d440a3b JM |
1462 | wpa_hexdump(MSG_DEBUG, "FILS: assoc_req before FILS elements", |
1463 | wpa_s->sme.assoc_req_ie, | |
1464 | wpa_s->sme.assoc_req_ie_len); | |
1465 | #ifdef CONFIG_IEEE80211R | |
1466 | if (wpa_key_mgmt_ft(wpa_s->key_mgmt)) { | |
1467 | /* Remove RSNE and MDE to allow them to be overridden | |
1468 | * with FILS+FT specific values from | |
1469 | * fils_build_assoc_req(). */ | |
1470 | remove_ie(wpa_s->sme.assoc_req_ie, | |
1471 | &wpa_s->sme.assoc_req_ie_len, | |
1472 | WLAN_EID_RSN); | |
1473 | wpa_hexdump(MSG_DEBUG, | |
1474 | "FILS: assoc_req after RSNE removal", | |
1475 | wpa_s->sme.assoc_req_ie, | |
1476 | wpa_s->sme.assoc_req_ie_len); | |
1477 | remove_ie(wpa_s->sme.assoc_req_ie, | |
1478 | &wpa_s->sme.assoc_req_ie_len, | |
1479 | WLAN_EID_MOBILITY_DOMAIN); | |
1480 | wpa_hexdump(MSG_DEBUG, | |
1481 | "FILS: assoc_req after MDE removal", | |
1482 | wpa_s->sme.assoc_req_ie, | |
1483 | wpa_s->sme.assoc_req_ie_len); | |
1484 | } | |
1485 | #endif /* CONFIG_IEEE80211R */ | |
86cd6928 JM |
1486 | /* TODO: Make wpa_s->sme.assoc_req_ie use dynamic allocation */ |
1487 | if (wpa_s->sme.assoc_req_ie_len + wpabuf_len(buf) > | |
1488 | sizeof(wpa_s->sme.assoc_req_ie)) { | |
1489 | wpa_printf(MSG_ERROR, | |
1490 | "FILS: Not enough buffer room for own AssocReq elements"); | |
1491 | wpabuf_free(buf); | |
1492 | return; | |
1493 | } | |
1494 | os_memcpy(wpa_s->sme.assoc_req_ie + wpa_s->sme.assoc_req_ie_len, | |
1495 | wpabuf_head(buf), wpabuf_len(buf)); | |
1496 | wpa_s->sme.assoc_req_ie_len += wpabuf_len(buf); | |
1497 | wpabuf_free(buf); | |
7d440a3b JM |
1498 | wpa_hexdump(MSG_DEBUG, "FILS: assoc_req after FILS elements", |
1499 | wpa_s->sme.assoc_req_ie, | |
1500 | wpa_s->sme.assoc_req_ie_len); | |
86cd6928 JM |
1501 | |
1502 | os_memcpy(nonces, snonce, FILS_NONCE_LEN); | |
1503 | os_memcpy(nonces + FILS_NONCE_LEN, anonce, FILS_NONCE_LEN); | |
1504 | params.fils_nonces = nonces; | |
1505 | params.fils_nonces_len = sizeof(nonces); | |
1506 | } | |
1507 | #endif /* CONFIG_FILS */ | |
1508 | ||
0a614799 | 1509 | #ifdef CONFIG_OWE |
265bda34 JM |
1510 | #ifdef CONFIG_TESTING_OPTIONS |
1511 | if (get_ie_ext(wpa_s->sme.assoc_req_ie, wpa_s->sme.assoc_req_ie_len, | |
1512 | WLAN_EID_EXT_OWE_DH_PARAM)) { | |
1513 | wpa_printf(MSG_INFO, "TESTING: Override OWE DH element"); | |
1514 | } else | |
1515 | #endif /* CONFIG_TESTING_OPTIONS */ | |
0a614799 JM |
1516 | if (auth_type == WLAN_AUTH_OPEN && |
1517 | wpa_s->key_mgmt == WPA_KEY_MGMT_OWE) { | |
1518 | struct wpabuf *owe_ie; | |
2cb40e9f | 1519 | u16 group; |
0a614799 | 1520 | |
2cb40e9f | 1521 | if (wpa_s->current_ssid && wpa_s->current_ssid->owe_group) { |
ec9f4837 | 1522 | group = wpa_s->current_ssid->owe_group; |
698c9e20 AK |
1523 | } else if (wpa_s->assoc_status_code == |
1524 | WLAN_STATUS_FINITE_CYCLIC_GROUP_NOT_SUPPORTED) { | |
2cb40e9f JM |
1525 | if (wpa_s->last_owe_group == 19) |
1526 | group = 20; | |
1527 | else if (wpa_s->last_owe_group == 20) | |
1528 | group = 21; | |
1529 | else | |
1530 | group = OWE_DH_GROUP; | |
698c9e20 AK |
1531 | } else { |
1532 | group = OWE_DH_GROUP; | |
2cb40e9f | 1533 | } |
698c9e20 | 1534 | |
2cb40e9f JM |
1535 | wpa_s->last_owe_group = group; |
1536 | wpa_printf(MSG_DEBUG, "OWE: Try to use group %u", group); | |
ec9f4837 | 1537 | owe_ie = owe_build_assoc_req(wpa_s->wpa, group); |
0a614799 JM |
1538 | if (!owe_ie) { |
1539 | wpa_printf(MSG_ERROR, | |
1540 | "OWE: Failed to build IE for Association Request frame"); | |
1541 | return; | |
1542 | } | |
1543 | if (wpa_s->sme.assoc_req_ie_len + wpabuf_len(owe_ie) > | |
1544 | sizeof(wpa_s->sme.assoc_req_ie)) { | |
1545 | wpa_printf(MSG_ERROR, | |
1546 | "OWE: Not enough buffer room for own Association Request frame elements"); | |
1547 | wpabuf_free(owe_ie); | |
1548 | return; | |
1549 | } | |
1550 | os_memcpy(wpa_s->sme.assoc_req_ie + wpa_s->sme.assoc_req_ie_len, | |
1551 | wpabuf_head(owe_ie), wpabuf_len(owe_ie)); | |
1552 | wpa_s->sme.assoc_req_ie_len += wpabuf_len(owe_ie); | |
1553 | wpabuf_free(owe_ie); | |
1554 | } | |
1555 | #endif /* CONFIG_OWE */ | |
1556 | ||
5abc7823 VN |
1557 | if (wpa_s->current_ssid && wpa_s->current_ssid->multi_ap_backhaul_sta) { |
1558 | size_t multi_ap_ie_len; | |
1559 | ||
1560 | multi_ap_ie_len = add_multi_ap_ie( | |
1561 | wpa_s->sme.assoc_req_ie + wpa_s->sme.assoc_req_ie_len, | |
1562 | sizeof(wpa_s->sme.assoc_req_ie) - | |
1563 | wpa_s->sme.assoc_req_ie_len, | |
1564 | MULTI_AP_BACKHAUL_STA); | |
1565 | if (multi_ap_ie_len == 0) { | |
1566 | wpa_printf(MSG_ERROR, | |
1567 | "Multi-AP: Failed to build Multi-AP IE"); | |
1568 | return; | |
1569 | } | |
1570 | wpa_s->sme.assoc_req_ie_len += multi_ap_ie_len; | |
1571 | } | |
1572 | ||
71024cb2 | 1573 | params.bssid = bssid; |
c2a04078 JM |
1574 | params.ssid = wpa_s->sme.ssid; |
1575 | params.ssid_len = wpa_s->sme.ssid_len; | |
4ec68377 | 1576 | params.freq.freq = wpa_s->sme.freq; |
1f6c0ab8 BS |
1577 | params.bg_scan_period = wpa_s->current_ssid ? |
1578 | wpa_s->current_ssid->bg_scan_period : -1; | |
c2a04078 JM |
1579 | params.wpa_ie = wpa_s->sme.assoc_req_ie_len ? |
1580 | wpa_s->sme.assoc_req_ie : NULL; | |
1581 | params.wpa_ie_len = wpa_s->sme.assoc_req_ie_len; | |
8c41734e JM |
1582 | wpa_hexdump(MSG_DEBUG, "SME: Association Request IEs", |
1583 | params.wpa_ie, params.wpa_ie_len); | |
4848a38d JM |
1584 | params.pairwise_suite = wpa_s->pairwise_cipher; |
1585 | params.group_suite = wpa_s->group_cipher; | |
61a56c14 | 1586 | params.mgmt_group_suite = wpa_s->mgmt_group_cipher; |
163f801e JM |
1587 | params.key_mgmt_suite = wpa_s->key_mgmt; |
1588 | params.wpa_proto = wpa_s->wpa_proto; | |
80e8a5ee BG |
1589 | #ifdef CONFIG_HT_OVERRIDES |
1590 | os_memset(&htcaps, 0, sizeof(htcaps)); | |
1591 | os_memset(&htcaps_mask, 0, sizeof(htcaps_mask)); | |
1592 | params.htcaps = (u8 *) &htcaps; | |
1593 | params.htcaps_mask = (u8 *) &htcaps_mask; | |
1594 | wpa_supplicant_apply_ht_overrides(wpa_s, wpa_s->current_ssid, ¶ms); | |
1595 | #endif /* CONFIG_HT_OVERRIDES */ | |
e9ee8dc3 JB |
1596 | #ifdef CONFIG_VHT_OVERRIDES |
1597 | os_memset(&vhtcaps, 0, sizeof(vhtcaps)); | |
1598 | os_memset(&vhtcaps_mask, 0, sizeof(vhtcaps_mask)); | |
1599 | params.vhtcaps = &vhtcaps; | |
1600 | params.vhtcaps_mask = &vhtcaps_mask; | |
1601 | wpa_supplicant_apply_vht_overrides(wpa_s, wpa_s->current_ssid, ¶ms); | |
1602 | #endif /* CONFIG_VHT_OVERRIDES */ | |
c2a04078 | 1603 | #ifdef CONFIG_IEEE80211R |
8c41734e JM |
1604 | if (auth_type == WLAN_AUTH_FT && wpa_s->sme.ft_ies && |
1605 | get_ie(wpa_s->sme.ft_ies, wpa_s->sme.ft_ies_len, | |
1606 | WLAN_EID_RIC_DATA)) { | |
1607 | /* There seems to be a pretty inconvenient bug in the Linux | |
1608 | * kernel IE splitting functionality when RIC is used. For now, | |
1609 | * skip correct behavior in IE construction here (i.e., drop the | |
1610 | * additional non-FT-specific IEs) to avoid kernel issues. This | |
1611 | * is fine since RIC is used only for testing purposes in the | |
1612 | * current implementation. */ | |
1613 | wpa_printf(MSG_INFO, | |
1614 | "SME: Linux kernel workaround - do not try to include additional IEs with RIC"); | |
c2a04078 JM |
1615 | params.wpa_ie = wpa_s->sme.ft_ies; |
1616 | params.wpa_ie_len = wpa_s->sme.ft_ies_len; | |
8c41734e JM |
1617 | } else if (auth_type == WLAN_AUTH_FT && wpa_s->sme.ft_ies) { |
1618 | const u8 *rm_en, *pos, *end; | |
1619 | size_t rm_en_len = 0; | |
1620 | u8 *rm_en_dup = NULL, *wpos; | |
1621 | ||
1622 | /* Remove RSNE, MDE, FTE to allow them to be overridden with | |
1623 | * FT specific values */ | |
1624 | remove_ie(wpa_s->sme.assoc_req_ie, | |
1625 | &wpa_s->sme.assoc_req_ie_len, | |
1626 | WLAN_EID_RSN); | |
1627 | remove_ie(wpa_s->sme.assoc_req_ie, | |
1628 | &wpa_s->sme.assoc_req_ie_len, | |
1629 | WLAN_EID_MOBILITY_DOMAIN); | |
1630 | remove_ie(wpa_s->sme.assoc_req_ie, | |
1631 | &wpa_s->sme.assoc_req_ie_len, | |
1632 | WLAN_EID_FAST_BSS_TRANSITION); | |
1633 | rm_en = get_ie(wpa_s->sme.assoc_req_ie, | |
1634 | wpa_s->sme.assoc_req_ie_len, | |
1635 | WLAN_EID_RRM_ENABLED_CAPABILITIES); | |
1636 | if (rm_en) { | |
1637 | /* Need to remove RM Enabled Capabilities element as | |
1638 | * well temporarily, so that it can be placed between | |
1639 | * RSNE and MDE. */ | |
1640 | rm_en_len = 2 + rm_en[1]; | |
1641 | rm_en_dup = os_memdup(rm_en, rm_en_len); | |
1642 | remove_ie(wpa_s->sme.assoc_req_ie, | |
1643 | &wpa_s->sme.assoc_req_ie_len, | |
1644 | WLAN_EID_RRM_ENABLED_CAPABILITIES); | |
1645 | } | |
1646 | wpa_hexdump(MSG_DEBUG, | |
1647 | "SME: Association Request IEs after FT IE removal", | |
1648 | wpa_s->sme.assoc_req_ie, | |
1649 | wpa_s->sme.assoc_req_ie_len); | |
1650 | if (wpa_s->sme.assoc_req_ie_len + wpa_s->sme.ft_ies_len + | |
1651 | rm_en_len > sizeof(wpa_s->sme.assoc_req_ie)) { | |
1652 | wpa_printf(MSG_ERROR, | |
1653 | "SME: Not enough buffer room for FT IEs in Association Request frame"); | |
1654 | os_free(rm_en_dup); | |
1655 | return; | |
1656 | } | |
1657 | ||
1658 | os_memmove(wpa_s->sme.assoc_req_ie + wpa_s->sme.ft_ies_len + | |
1659 | rm_en_len, | |
1660 | wpa_s->sme.assoc_req_ie, | |
1661 | wpa_s->sme.assoc_req_ie_len); | |
1662 | pos = wpa_s->sme.ft_ies; | |
1663 | end = pos + wpa_s->sme.ft_ies_len; | |
1664 | wpos = wpa_s->sme.assoc_req_ie; | |
1665 | if (*pos == WLAN_EID_RSN) { | |
1666 | os_memcpy(wpos, pos, 2 + pos[1]); | |
1667 | wpos += 2 + pos[1]; | |
1668 | pos += 2 + pos[1]; | |
1669 | } | |
1670 | if (rm_en_dup) { | |
1671 | os_memcpy(wpos, rm_en_dup, rm_en_len); | |
1672 | wpos += rm_en_len; | |
1673 | os_free(rm_en_dup); | |
1674 | } | |
1675 | os_memcpy(wpos, pos, end - pos); | |
1676 | wpa_s->sme.assoc_req_ie_len += wpa_s->sme.ft_ies_len + | |
1677 | rm_en_len; | |
1678 | params.wpa_ie = wpa_s->sme.assoc_req_ie; | |
1679 | params.wpa_ie_len = wpa_s->sme.assoc_req_ie_len; | |
1680 | wpa_hexdump(MSG_DEBUG, | |
1681 | "SME: Association Request IEs after FT override", | |
1682 | params.wpa_ie, params.wpa_ie_len); | |
c2a04078 JM |
1683 | } |
1684 | #endif /* CONFIG_IEEE80211R */ | |
71024cb2 | 1685 | params.mode = mode; |
c2a04078 | 1686 | params.mgmt_frame_protection = wpa_s->sme.mfp; |
b361d580 | 1687 | params.rrm_used = wpa_s->rrm.rrm_used; |
62fa124c JM |
1688 | if (wpa_s->sme.prev_bssid_set) |
1689 | params.prev_bssid = wpa_s->sme.prev_bssid; | |
c2a04078 JM |
1690 | |
1691 | wpa_msg(wpa_s, MSG_INFO, "Trying to associate with " MACSTR | |
1692 | " (SSID='%s' freq=%d MHz)", MAC2STR(params.bssid), | |
1693 | params.ssid ? wpa_ssid_txt(params.ssid, params.ssid_len) : "", | |
4ec68377 | 1694 | params.freq.freq); |
c2a04078 JM |
1695 | |
1696 | wpa_supplicant_set_state(wpa_s, WPA_ASSOCIATING); | |
1697 | ||
9efc3f2a JM |
1698 | if (params.wpa_ie == NULL || |
1699 | ieee802_11_parse_elems(params.wpa_ie, params.wpa_ie_len, &elems, 0) | |
d9a27b04 | 1700 | < 0) { |
f049052b | 1701 | wpa_dbg(wpa_s, MSG_DEBUG, "SME: Could not parse own IEs?!"); |
d9a27b04 JM |
1702 | os_memset(&elems, 0, sizeof(elems)); |
1703 | } | |
64fa840a JM |
1704 | if (elems.rsn_ie) { |
1705 | params.wpa_proto = WPA_PROTO_RSN; | |
d9a27b04 JM |
1706 | wpa_sm_set_assoc_wpa_ie(wpa_s->wpa, elems.rsn_ie - 2, |
1707 | elems.rsn_ie_len + 2); | |
64fa840a JM |
1708 | } else if (elems.wpa_ie) { |
1709 | params.wpa_proto = WPA_PROTO_WPA; | |
d9a27b04 JM |
1710 | wpa_sm_set_assoc_wpa_ie(wpa_s->wpa, elems.wpa_ie - 2, |
1711 | elems.wpa_ie_len + 2); | |
df0f01d9 JM |
1712 | } else if (elems.osen) { |
1713 | params.wpa_proto = WPA_PROTO_OSEN; | |
1714 | wpa_sm_set_assoc_wpa_ie(wpa_s->wpa, elems.osen - 2, | |
1715 | elems.osen_len + 2); | |
64fa840a | 1716 | } else |
d9a27b04 | 1717 | wpa_sm_set_assoc_wpa_ie(wpa_s->wpa, NULL, 0); |
ffad8858 | 1718 | if (wpa_s->current_ssid && wpa_s->current_ssid->p2p_group) |
6e3f4b89 | 1719 | params.p2p = 1; |
d9a27b04 | 1720 | |
ba307f85 LD |
1721 | if (wpa_s->p2pdev->set_sta_uapsd) |
1722 | params.uapsd = wpa_s->p2pdev->sta_uapsd; | |
eea2fd9e JM |
1723 | else |
1724 | params.uapsd = -1; | |
1725 | ||
c2a04078 | 1726 | if (wpa_drv_associate(wpa_s, ¶ms) < 0) { |
f049052b BG |
1727 | wpa_msg(wpa_s, MSG_INFO, "SME: Association request to the " |
1728 | "driver failed"); | |
e5ad96b7 | 1729 | wpas_connection_failed(wpa_s, wpa_s->pending_bssid); |
c1c02342 | 1730 | wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED); |
e5ad96b7 | 1731 | os_memset(wpa_s->pending_bssid, 0, ETH_ALEN); |
c2a04078 JM |
1732 | return; |
1733 | } | |
1734 | ||
e29853bb BG |
1735 | eloop_register_timeout(SME_ASSOC_TIMEOUT, 0, sme_assoc_timer, wpa_s, |
1736 | NULL); | |
daa40960 JM |
1737 | |
1738 | #ifdef CONFIG_TESTING_OPTIONS | |
1739 | wpabuf_free(wpa_s->last_assoc_req_wpa_ie); | |
1740 | wpa_s->last_assoc_req_wpa_ie = NULL; | |
1741 | if (params.wpa_ie) | |
1742 | wpa_s->last_assoc_req_wpa_ie = | |
1743 | wpabuf_alloc_copy(params.wpa_ie, params.wpa_ie_len); | |
1744 | #endif /* CONFIG_TESTING_OPTIONS */ | |
c2a04078 JM |
1745 | } |
1746 | ||
1747 | ||
1748 | int sme_update_ft_ies(struct wpa_supplicant *wpa_s, const u8 *md, | |
1749 | const u8 *ies, size_t ies_len) | |
1750 | { | |
1751 | if (md == NULL || ies == NULL) { | |
f049052b | 1752 | wpa_dbg(wpa_s, MSG_DEBUG, "SME: Remove mobility domain"); |
c2a04078 JM |
1753 | os_free(wpa_s->sme.ft_ies); |
1754 | wpa_s->sme.ft_ies = NULL; | |
1755 | wpa_s->sme.ft_ies_len = 0; | |
1756 | wpa_s->sme.ft_used = 0; | |
1757 | return 0; | |
1758 | } | |
1759 | ||
1760 | os_memcpy(wpa_s->sme.mobility_domain, md, MOBILITY_DOMAIN_ID_LEN); | |
1761 | wpa_hexdump(MSG_DEBUG, "SME: FT IEs", ies, ies_len); | |
1762 | os_free(wpa_s->sme.ft_ies); | |
a1f11e34 | 1763 | wpa_s->sme.ft_ies = os_memdup(ies, ies_len); |
c2a04078 JM |
1764 | if (wpa_s->sme.ft_ies == NULL) |
1765 | return -1; | |
c2a04078 JM |
1766 | wpa_s->sme.ft_ies_len = ies_len; |
1767 | return 0; | |
1768 | } | |
efa46078 JM |
1769 | |
1770 | ||
e29853bb | 1771 | static void sme_deauth(struct wpa_supplicant *wpa_s) |
efa46078 | 1772 | { |
8bac466b JM |
1773 | int bssid_changed; |
1774 | ||
8bac466b | 1775 | bssid_changed = !is_zero_ether_addr(wpa_s->bssid); |
76d11d3f | 1776 | |
76d11d3f JM |
1777 | if (wpa_drv_deauthenticate(wpa_s, wpa_s->pending_bssid, |
1778 | WLAN_REASON_DEAUTH_LEAVING) < 0) { | |
f049052b BG |
1779 | wpa_msg(wpa_s, MSG_INFO, "SME: Deauth request to the driver " |
1780 | "failed"); | |
76d11d3f | 1781 | } |
62fa124c | 1782 | wpa_s->sme.prev_bssid_set = 0; |
76d11d3f | 1783 | |
0fb337c1 | 1784 | wpas_connection_failed(wpa_s, wpa_s->pending_bssid); |
76d11d3f | 1785 | wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED); |
efa46078 JM |
1786 | os_memset(wpa_s->bssid, 0, ETH_ALEN); |
1787 | os_memset(wpa_s->pending_bssid, 0, ETH_ALEN); | |
8bac466b JM |
1788 | if (bssid_changed) |
1789 | wpas_notify_bssid_changed(wpa_s); | |
efa46078 | 1790 | } |
da1fb17c JM |
1791 | |
1792 | ||
e29853bb BG |
1793 | void sme_event_assoc_reject(struct wpa_supplicant *wpa_s, |
1794 | union wpa_event_data *data) | |
1795 | { | |
1796 | wpa_dbg(wpa_s, MSG_DEBUG, "SME: Association with " MACSTR " failed: " | |
1797 | "status code %d", MAC2STR(wpa_s->pending_bssid), | |
1798 | data->assoc_reject.status_code); | |
1799 | ||
1800 | eloop_cancel_timeout(sme_assoc_timer, wpa_s, NULL); | |
1801 | ||
bc26ac50 JM |
1802 | #ifdef CONFIG_SAE |
1803 | if (wpa_s->sme.sae_pmksa_caching && wpa_s->current_ssid && | |
1804 | wpa_key_mgmt_sae(wpa_s->current_ssid->key_mgmt)) { | |
1805 | wpa_dbg(wpa_s, MSG_DEBUG, | |
1806 | "PMKSA caching attempt rejected - drop PMKSA cache entry and fall back to SAE authentication"); | |
1807 | wpa_sm_aborted_cached(wpa_s->wpa); | |
1808 | wpa_sm_pmksa_cache_flush(wpa_s->wpa, wpa_s->current_ssid); | |
1809 | if (wpa_s->current_bss) { | |
1810 | struct wpa_bss *bss = wpa_s->current_bss; | |
1811 | struct wpa_ssid *ssid = wpa_s->current_ssid; | |
1812 | ||
1813 | wpa_drv_deauthenticate(wpa_s, wpa_s->pending_bssid, | |
1814 | WLAN_REASON_DEAUTH_LEAVING); | |
1815 | wpas_connect_work_done(wpa_s); | |
1816 | wpa_supplicant_mark_disassoc(wpa_s); | |
1817 | wpa_supplicant_connect(wpa_s, bss, ssid); | |
1818 | return; | |
1819 | } | |
1820 | } | |
1821 | #endif /* CONFIG_SAE */ | |
1822 | ||
e29853bb BG |
1823 | /* |
1824 | * For now, unconditionally terminate the previous authentication. In | |
1825 | * theory, this should not be needed, but mac80211 gets quite confused | |
1826 | * if the authentication is left pending.. Some roaming cases might | |
1827 | * benefit from using the previous authentication, so this could be | |
1828 | * optimized in the future. | |
1829 | */ | |
1830 | sme_deauth(wpa_s); | |
1831 | } | |
1832 | ||
1833 | ||
da1fb17c JM |
1834 | void sme_event_auth_timed_out(struct wpa_supplicant *wpa_s, |
1835 | union wpa_event_data *data) | |
1836 | { | |
f049052b | 1837 | wpa_dbg(wpa_s, MSG_DEBUG, "SME: Authentication timed out"); |
0fb337c1 | 1838 | wpas_connection_failed(wpa_s, wpa_s->pending_bssid); |
1193dc8f | 1839 | wpa_supplicant_mark_disassoc(wpa_s); |
da1fb17c JM |
1840 | } |
1841 | ||
1842 | ||
1843 | void sme_event_assoc_timed_out(struct wpa_supplicant *wpa_s, | |
1844 | union wpa_event_data *data) | |
1845 | { | |
f049052b | 1846 | wpa_dbg(wpa_s, MSG_DEBUG, "SME: Association timed out"); |
0fb337c1 | 1847 | wpas_connection_failed(wpa_s, wpa_s->pending_bssid); |
da1fb17c | 1848 | wpa_supplicant_mark_disassoc(wpa_s); |
da1fb17c | 1849 | } |
a84ed99e JM |
1850 | |
1851 | ||
1852 | void sme_event_disassoc(struct wpa_supplicant *wpa_s, | |
d7df0fa7 | 1853 | struct disassoc_info *info) |
a84ed99e | 1854 | { |
f049052b | 1855 | wpa_dbg(wpa_s, MSG_DEBUG, "SME: Disassociation event received"); |
17fbb751 | 1856 | if (wpa_s->sme.prev_bssid_set) { |
a84ed99e JM |
1857 | /* |
1858 | * cfg80211/mac80211 can get into somewhat confused state if | |
1859 | * the AP only disassociates us and leaves us in authenticated | |
1860 | * state. For now, force the state to be cleared to avoid | |
1861 | * confusing errors if we try to associate with the AP again. | |
1862 | */ | |
f049052b BG |
1863 | wpa_dbg(wpa_s, MSG_DEBUG, "SME: Deauthenticate to clear " |
1864 | "driver state"); | |
7e26053a | 1865 | wpa_drv_deauthenticate(wpa_s, wpa_s->sme.prev_bssid, |
a84ed99e JM |
1866 | WLAN_REASON_DEAUTH_LEAVING); |
1867 | } | |
1868 | } | |
7d878ca7 JM |
1869 | |
1870 | ||
e29853bb BG |
1871 | static void sme_auth_timer(void *eloop_ctx, void *timeout_ctx) |
1872 | { | |
1873 | struct wpa_supplicant *wpa_s = eloop_ctx; | |
1874 | if (wpa_s->wpa_state == WPA_AUTHENTICATING) { | |
1875 | wpa_msg(wpa_s, MSG_DEBUG, "SME: Authentication timeout"); | |
1876 | sme_deauth(wpa_s); | |
1877 | } | |
1878 | } | |
1879 | ||
1880 | ||
1881 | static void sme_assoc_timer(void *eloop_ctx, void *timeout_ctx) | |
1882 | { | |
1883 | struct wpa_supplicant *wpa_s = eloop_ctx; | |
1884 | if (wpa_s->wpa_state == WPA_ASSOCIATING) { | |
1885 | wpa_msg(wpa_s, MSG_DEBUG, "SME: Association timeout"); | |
1886 | sme_deauth(wpa_s); | |
1887 | } | |
1888 | } | |
1889 | ||
1890 | ||
1891 | void sme_state_changed(struct wpa_supplicant *wpa_s) | |
1892 | { | |
1893 | /* Make sure timers are cleaned up appropriately. */ | |
1894 | if (wpa_s->wpa_state != WPA_ASSOCIATING) | |
1895 | eloop_cancel_timeout(sme_assoc_timer, wpa_s, NULL); | |
1896 | if (wpa_s->wpa_state != WPA_AUTHENTICATING) | |
1897 | eloop_cancel_timeout(sme_auth_timer, wpa_s, NULL); | |
1898 | } | |
1899 | ||
1900 | ||
1901 | void sme_disassoc_while_authenticating(struct wpa_supplicant *wpa_s, | |
1902 | const u8 *prev_pending_bssid) | |
1903 | { | |
1904 | /* | |
1905 | * mac80211-workaround to force deauth on failed auth cmd, | |
1906 | * requires us to remain in authenticating state to allow the | |
1907 | * second authentication attempt to be continued properly. | |
1908 | */ | |
1909 | wpa_dbg(wpa_s, MSG_DEBUG, "SME: Allow pending authentication " | |
1910 | "to proceed after disconnection event"); | |
1911 | wpa_supplicant_set_state(wpa_s, WPA_AUTHENTICATING); | |
1912 | os_memcpy(wpa_s->pending_bssid, prev_pending_bssid, ETH_ALEN); | |
1913 | ||
1914 | /* | |
1915 | * Re-arm authentication timer in case auth fails for whatever reason. | |
1916 | */ | |
1917 | eloop_cancel_timeout(sme_auth_timer, wpa_s, NULL); | |
1918 | eloop_register_timeout(SME_AUTH_TIMEOUT, 0, sme_auth_timer, wpa_s, | |
1919 | NULL); | |
1920 | } | |
1921 | ||
1922 | ||
4e70bbf1 JM |
1923 | void sme_clear_on_disassoc(struct wpa_supplicant *wpa_s) |
1924 | { | |
1925 | wpa_s->sme.prev_bssid_set = 0; | |
1926 | #ifdef CONFIG_SAE | |
1927 | wpabuf_free(wpa_s->sme.sae_token); | |
1928 | wpa_s->sme.sae_token = NULL; | |
1929 | sae_clear_data(&wpa_s->sme.sae); | |
1930 | #endif /* CONFIG_SAE */ | |
1931 | #ifdef CONFIG_IEEE80211R | |
60a5737e | 1932 | if (wpa_s->sme.ft_ies || wpa_s->sme.ft_used) |
4e70bbf1 JM |
1933 | sme_update_ft_ies(wpa_s, NULL, NULL, 0); |
1934 | #endif /* CONFIG_IEEE80211R */ | |
1935 | } | |
1936 | ||
1937 | ||
e29853bb BG |
1938 | void sme_deinit(struct wpa_supplicant *wpa_s) |
1939 | { | |
1940 | os_free(wpa_s->sme.ft_ies); | |
1941 | wpa_s->sme.ft_ies = NULL; | |
1942 | wpa_s->sme.ft_ies_len = 0; | |
1943 | #ifdef CONFIG_IEEE80211W | |
1944 | sme_stop_sa_query(wpa_s); | |
1945 | #endif /* CONFIG_IEEE80211W */ | |
4e70bbf1 | 1946 | sme_clear_on_disassoc(wpa_s); |
e29853bb BG |
1947 | |
1948 | eloop_cancel_timeout(sme_assoc_timer, wpa_s, NULL); | |
1949 | eloop_cancel_timeout(sme_auth_timer, wpa_s, NULL); | |
c3701c66 RM |
1950 | eloop_cancel_timeout(sme_obss_scan_timeout, wpa_s, NULL); |
1951 | } | |
1952 | ||
1953 | ||
1954 | static void sme_send_2040_bss_coex(struct wpa_supplicant *wpa_s, | |
1955 | const u8 *chan_list, u8 num_channels, | |
1956 | u8 num_intol) | |
1957 | { | |
1958 | struct ieee80211_2040_bss_coex_ie *bc_ie; | |
1959 | struct ieee80211_2040_intol_chan_report *ic_report; | |
1960 | struct wpabuf *buf; | |
1961 | ||
31ded52e JM |
1962 | wpa_printf(MSG_DEBUG, "SME: Send 20/40 BSS Coexistence to " MACSTR |
1963 | " (num_channels=%u num_intol=%u)", | |
1964 | MAC2STR(wpa_s->bssid), num_channels, num_intol); | |
1965 | wpa_hexdump(MSG_DEBUG, "SME: 20/40 BSS Intolerant Channels", | |
1966 | chan_list, num_channels); | |
c3701c66 RM |
1967 | |
1968 | buf = wpabuf_alloc(2 + /* action.category + action_code */ | |
1969 | sizeof(struct ieee80211_2040_bss_coex_ie) + | |
1970 | sizeof(struct ieee80211_2040_intol_chan_report) + | |
1971 | num_channels); | |
1972 | if (buf == NULL) | |
1973 | return; | |
1974 | ||
1975 | wpabuf_put_u8(buf, WLAN_ACTION_PUBLIC); | |
1976 | wpabuf_put_u8(buf, WLAN_PA_20_40_BSS_COEX); | |
1977 | ||
1978 | bc_ie = wpabuf_put(buf, sizeof(*bc_ie)); | |
1979 | bc_ie->element_id = WLAN_EID_20_40_BSS_COEXISTENCE; | |
1980 | bc_ie->length = 1; | |
1981 | if (num_intol) | |
1982 | bc_ie->coex_param |= WLAN_20_40_BSS_COEX_20MHZ_WIDTH_REQ; | |
1983 | ||
1984 | if (num_channels > 0) { | |
1985 | ic_report = wpabuf_put(buf, sizeof(*ic_report)); | |
1986 | ic_report->element_id = WLAN_EID_20_40_BSS_INTOLERANT; | |
1987 | ic_report->length = num_channels + 1; | |
1988 | ic_report->op_class = 0; | |
1989 | os_memcpy(wpabuf_put(buf, num_channels), chan_list, | |
1990 | num_channels); | |
1991 | } | |
1992 | ||
1993 | if (wpa_drv_send_action(wpa_s, wpa_s->assoc_freq, 0, wpa_s->bssid, | |
1994 | wpa_s->own_addr, wpa_s->bssid, | |
1995 | wpabuf_head(buf), wpabuf_len(buf), 0) < 0) { | |
1996 | wpa_msg(wpa_s, MSG_INFO, | |
1997 | "SME: Failed to send 20/40 BSS Coexistence frame"); | |
1998 | } | |
1999 | ||
2000 | wpabuf_free(buf); | |
2001 | } | |
2002 | ||
2003 | ||
c3701c66 RM |
2004 | int sme_proc_obss_scan(struct wpa_supplicant *wpa_s) |
2005 | { | |
2006 | struct wpa_bss *bss; | |
2007 | const u8 *ie; | |
2008 | u16 ht_cap; | |
2009 | u8 chan_list[P2P_MAX_CHANNELS], channel; | |
2010 | u8 num_channels = 0, num_intol = 0, i; | |
2011 | ||
2012 | if (!wpa_s->sme.sched_obss_scan) | |
2013 | return 0; | |
2014 | ||
2015 | wpa_s->sme.sched_obss_scan = 0; | |
2016 | if (!wpa_s->current_bss || wpa_s->wpa_state != WPA_COMPLETED) | |
2017 | return 1; | |
2018 | ||
2019 | /* | |
2020 | * Check whether AP uses regulatory triplet or channel triplet in | |
2021 | * country info. Right now the operating class of the BSS channel | |
2022 | * width trigger event is "unknown" (IEEE Std 802.11-2012 10.15.12), | |
2023 | * based on the assumption that operating class triplet is not used in | |
2024 | * beacon frame. If the First Channel Number/Operating Extension | |
2025 | * Identifier octet has a positive integer value of 201 or greater, | |
2026 | * then its operating class triplet. | |
2027 | * | |
2028 | * TODO: If Supported Operating Classes element is present in beacon | |
2029 | * frame, have to lookup operating class in Annex E and fill them in | |
2030 | * 2040 coex frame. | |
2031 | */ | |
2032 | ie = wpa_bss_get_ie(wpa_s->current_bss, WLAN_EID_COUNTRY); | |
2033 | if (ie && (ie[1] >= 6) && (ie[5] >= 201)) | |
2034 | return 1; | |
2035 | ||
2036 | os_memset(chan_list, 0, sizeof(chan_list)); | |
2037 | ||
2038 | dl_list_for_each(bss, &wpa_s->bss, struct wpa_bss, list) { | |
2039 | /* Skip other band bss */ | |
e864c0ae JM |
2040 | enum hostapd_hw_mode mode; |
2041 | mode = ieee80211_freq_to_chan(bss->freq, &channel); | |
2042 | if (mode != HOSTAPD_MODE_IEEE80211G && | |
2043 | mode != HOSTAPD_MODE_IEEE80211B) | |
c3701c66 RM |
2044 | continue; |
2045 | ||
2046 | ie = wpa_bss_get_ie(bss, WLAN_EID_HT_CAP); | |
2047 | ht_cap = (ie && (ie[1] == 26)) ? WPA_GET_LE16(ie + 2) : 0; | |
31ded52e JM |
2048 | wpa_printf(MSG_DEBUG, "SME OBSS scan BSS " MACSTR |
2049 | " freq=%u chan=%u ht_cap=0x%x", | |
2050 | MAC2STR(bss->bssid), bss->freq, channel, ht_cap); | |
c3701c66 RM |
2051 | |
2052 | if (!ht_cap || (ht_cap & HT_CAP_INFO_40MHZ_INTOLERANT)) { | |
7f8eb34d JM |
2053 | if (ht_cap & HT_CAP_INFO_40MHZ_INTOLERANT) |
2054 | num_intol++; | |
2055 | ||
c3701c66 RM |
2056 | /* Check whether the channel is already considered */ |
2057 | for (i = 0; i < num_channels; i++) { | |
2058 | if (channel == chan_list[i]) | |
2059 | break; | |
2060 | } | |
2061 | if (i != num_channels) | |
2062 | continue; | |
2063 | ||
c3701c66 RM |
2064 | chan_list[num_channels++] = channel; |
2065 | } | |
2066 | } | |
2067 | ||
2068 | sme_send_2040_bss_coex(wpa_s, chan_list, num_channels, num_intol); | |
2069 | return 1; | |
2070 | } | |
2071 | ||
2072 | ||
d97a3c48 JM |
2073 | static void wpa_obss_scan_freqs_list(struct wpa_supplicant *wpa_s, |
2074 | struct wpa_driver_scan_params *params) | |
6434ad09 | 2075 | { |
d97a3c48 | 2076 | /* Include only affected channels */ |
6434ad09 JM |
2077 | struct hostapd_hw_modes *mode; |
2078 | int count, i; | |
d97a3c48 | 2079 | int start, end; |
6434ad09 | 2080 | |
d97a3c48 JM |
2081 | mode = get_mode(wpa_s->hw.modes, wpa_s->hw.num_modes, |
2082 | HOSTAPD_MODE_IEEE80211G); | |
6434ad09 JM |
2083 | if (mode == NULL) { |
2084 | /* No channels supported in this band - use empty list */ | |
2085 | params->freqs = os_zalloc(sizeof(int)); | |
2086 | return; | |
2087 | } | |
2088 | ||
d97a3c48 JM |
2089 | if (wpa_s->sme.ht_sec_chan == HT_SEC_CHAN_UNKNOWN && |
2090 | wpa_s->current_bss) { | |
2091 | const u8 *ie; | |
2092 | ||
2093 | ie = wpa_bss_get_ie(wpa_s->current_bss, WLAN_EID_HT_OPERATION); | |
2094 | if (ie && ie[1] >= 2) { | |
2095 | u8 o; | |
2096 | ||
2097 | o = ie[3] & HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK; | |
2098 | if (o == HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE) | |
2099 | wpa_s->sme.ht_sec_chan = HT_SEC_CHAN_ABOVE; | |
2100 | else if (o == HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW) | |
2101 | wpa_s->sme.ht_sec_chan = HT_SEC_CHAN_BELOW; | |
2102 | } | |
2103 | } | |
2104 | ||
2105 | start = wpa_s->assoc_freq - 10; | |
2106 | end = wpa_s->assoc_freq + 10; | |
2107 | switch (wpa_s->sme.ht_sec_chan) { | |
2108 | case HT_SEC_CHAN_UNKNOWN: | |
2109 | /* HT40+ possible on channels 1..9 */ | |
2110 | if (wpa_s->assoc_freq <= 2452) | |
2111 | start -= 20; | |
2112 | /* HT40- possible on channels 5-13 */ | |
2113 | if (wpa_s->assoc_freq >= 2432) | |
2114 | end += 20; | |
2115 | break; | |
2116 | case HT_SEC_CHAN_ABOVE: | |
2117 | end += 20; | |
2118 | break; | |
2119 | case HT_SEC_CHAN_BELOW: | |
2120 | start -= 20; | |
2121 | break; | |
2122 | } | |
2123 | wpa_printf(MSG_DEBUG, | |
2124 | "OBSS: assoc_freq %d possible affected range %d-%d", | |
2125 | wpa_s->assoc_freq, start, end); | |
2126 | ||
f9884c09 | 2127 | params->freqs = os_calloc(mode->num_channels + 1, sizeof(int)); |
6434ad09 JM |
2128 | if (params->freqs == NULL) |
2129 | return; | |
2130 | for (count = 0, i = 0; i < mode->num_channels; i++) { | |
d97a3c48 JM |
2131 | int freq; |
2132 | ||
6434ad09 JM |
2133 | if (mode->channels[i].flag & HOSTAPD_CHAN_DISABLED) |
2134 | continue; | |
d97a3c48 JM |
2135 | freq = mode->channels[i].freq; |
2136 | if (freq - 10 >= end || freq + 10 <= start) | |
2137 | continue; /* not affected */ | |
2138 | params->freqs[count++] = freq; | |
6434ad09 JM |
2139 | } |
2140 | } | |
2141 | ||
2142 | ||
c3701c66 RM |
2143 | static void sme_obss_scan_timeout(void *eloop_ctx, void *timeout_ctx) |
2144 | { | |
2145 | struct wpa_supplicant *wpa_s = eloop_ctx; | |
2146 | struct wpa_driver_scan_params params; | |
2147 | ||
2148 | if (!wpa_s->current_bss) { | |
2149 | wpa_printf(MSG_DEBUG, "SME OBSS: Ignore scan request"); | |
2150 | return; | |
2151 | } | |
2152 | ||
2153 | os_memset(¶ms, 0, sizeof(params)); | |
d97a3c48 | 2154 | wpa_obss_scan_freqs_list(wpa_s, ¶ms); |
57a8f8af | 2155 | params.low_priority = 1; |
c3701c66 RM |
2156 | wpa_printf(MSG_DEBUG, "SME OBSS: Request an OBSS scan"); |
2157 | ||
2158 | if (wpa_supplicant_trigger_scan(wpa_s, ¶ms)) | |
2159 | wpa_printf(MSG_DEBUG, "SME OBSS: Failed to trigger scan"); | |
2160 | else | |
2161 | wpa_s->sme.sched_obss_scan = 1; | |
6434ad09 | 2162 | os_free(params.freqs); |
c3701c66 RM |
2163 | |
2164 | eloop_register_timeout(wpa_s->sme.obss_scan_int, 0, | |
2165 | sme_obss_scan_timeout, wpa_s, NULL); | |
2166 | } | |
2167 | ||
2168 | ||
2169 | void sme_sched_obss_scan(struct wpa_supplicant *wpa_s, int enable) | |
2170 | { | |
2171 | const u8 *ie; | |
2172 | struct wpa_bss *bss = wpa_s->current_bss; | |
2173 | struct wpa_ssid *ssid = wpa_s->current_ssid; | |
b6871ebb AN |
2174 | struct hostapd_hw_modes *hw_mode = NULL; |
2175 | int i; | |
c3701c66 RM |
2176 | |
2177 | eloop_cancel_timeout(sme_obss_scan_timeout, wpa_s, NULL); | |
2178 | wpa_s->sme.sched_obss_scan = 0; | |
d97a3c48 | 2179 | wpa_s->sme.ht_sec_chan = HT_SEC_CHAN_UNKNOWN; |
c3701c66 RM |
2180 | if (!enable) |
2181 | return; | |
2182 | ||
368b1957 AK |
2183 | /* |
2184 | * Schedule OBSS scan if driver is using station SME in wpa_supplicant | |
2185 | * or it expects OBSS scan to be performed by wpa_supplicant. | |
2186 | */ | |
2187 | if (!((wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME) || | |
2188 | (wpa_s->drv_flags & WPA_DRIVER_FLAGS_OBSS_SCAN)) || | |
2189 | ssid == NULL || ssid->mode != IEEE80211_MODE_INFRA) | |
2190 | return; | |
c3701c66 | 2191 | |
b6871ebb AN |
2192 | if (!wpa_s->hw.modes) |
2193 | return; | |
2194 | ||
2195 | /* only HT caps in 11g mode are relevant */ | |
2196 | for (i = 0; i < wpa_s->hw.num_modes; i++) { | |
2197 | hw_mode = &wpa_s->hw.modes[i]; | |
2198 | if (hw_mode->mode == HOSTAPD_MODE_IEEE80211G) | |
2199 | break; | |
2200 | } | |
2201 | ||
2202 | /* Driver does not support HT40 for 11g or doesn't have 11g. */ | |
2203 | if (i == wpa_s->hw.num_modes || !hw_mode || | |
2204 | !(hw_mode->ht_capab & HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET)) | |
2205 | return; | |
c3701c66 RM |
2206 | |
2207 | if (bss == NULL || bss->freq < 2400 || bss->freq > 2500) | |
2208 | return; /* Not associated on 2.4 GHz band */ | |
2209 | ||
2210 | /* Check whether AP supports HT40 */ | |
2211 | ie = wpa_bss_get_ie(wpa_s->current_bss, WLAN_EID_HT_CAP); | |
2212 | if (!ie || ie[1] < 2 || | |
2213 | !(WPA_GET_LE16(ie + 2) & HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET)) | |
2214 | return; /* AP does not support HT40 */ | |
2215 | ||
2216 | ie = wpa_bss_get_ie(wpa_s->current_bss, | |
2217 | WLAN_EID_OVERLAPPING_BSS_SCAN_PARAMS); | |
2218 | if (!ie || ie[1] < 14) | |
2219 | return; /* AP does not request OBSS scans */ | |
2220 | ||
2221 | wpa_s->sme.obss_scan_int = WPA_GET_LE16(ie + 6); | |
2222 | if (wpa_s->sme.obss_scan_int < 10) { | |
2223 | wpa_printf(MSG_DEBUG, "SME: Invalid OBSS Scan Interval %u " | |
2224 | "replaced with the minimum 10 sec", | |
2225 | wpa_s->sme.obss_scan_int); | |
2226 | wpa_s->sme.obss_scan_int = 10; | |
2227 | } | |
2228 | wpa_printf(MSG_DEBUG, "SME: OBSS Scan Interval %u sec", | |
2229 | wpa_s->sme.obss_scan_int); | |
2230 | eloop_register_timeout(wpa_s->sme.obss_scan_int, 0, | |
2231 | sme_obss_scan_timeout, wpa_s, NULL); | |
e29853bb BG |
2232 | } |
2233 | ||
2234 | ||
7d878ca7 JM |
2235 | #ifdef CONFIG_IEEE80211W |
2236 | ||
2237 | static const unsigned int sa_query_max_timeout = 1000; | |
2238 | static const unsigned int sa_query_retry_timeout = 201; | |
f91e68e9 | 2239 | static const unsigned int sa_query_ch_switch_max_delay = 5000; /* in usec */ |
7d878ca7 JM |
2240 | |
2241 | static int sme_check_sa_query_timeout(struct wpa_supplicant *wpa_s) | |
2242 | { | |
2243 | u32 tu; | |
46b8d4c0 JB |
2244 | struct os_reltime now, passed; |
2245 | os_get_reltime(&now); | |
2246 | os_reltime_sub(&now, &wpa_s->sme.sa_query_start, &passed); | |
7d878ca7 JM |
2247 | tu = (passed.sec * 1000000 + passed.usec) / 1024; |
2248 | if (sa_query_max_timeout < tu) { | |
f049052b | 2249 | wpa_dbg(wpa_s, MSG_DEBUG, "SME: SA Query timed out"); |
7d878ca7 JM |
2250 | sme_stop_sa_query(wpa_s); |
2251 | wpa_supplicant_deauthenticate( | |
2252 | wpa_s, WLAN_REASON_PREV_AUTH_NOT_VALID); | |
2253 | return 1; | |
2254 | } | |
2255 | ||
2256 | return 0; | |
2257 | } | |
2258 | ||
2259 | ||
2260 | static void sme_send_sa_query_req(struct wpa_supplicant *wpa_s, | |
2261 | const u8 *trans_id) | |
2262 | { | |
f9da7505 MV |
2263 | u8 req[2 + WLAN_SA_QUERY_TR_ID_LEN + OCV_OCI_EXTENDED_LEN]; |
2264 | u8 req_len = 2 + WLAN_SA_QUERY_TR_ID_LEN; | |
2265 | ||
f049052b BG |
2266 | wpa_dbg(wpa_s, MSG_DEBUG, "SME: Sending SA Query Request to " |
2267 | MACSTR, MAC2STR(wpa_s->bssid)); | |
7d878ca7 JM |
2268 | wpa_hexdump(MSG_DEBUG, "SME: SA Query Transaction ID", |
2269 | trans_id, WLAN_SA_QUERY_TR_ID_LEN); | |
2270 | req[0] = WLAN_ACTION_SA_QUERY; | |
2271 | req[1] = WLAN_SA_QUERY_REQUEST; | |
2272 | os_memcpy(req + 2, trans_id, WLAN_SA_QUERY_TR_ID_LEN); | |
f9da7505 MV |
2273 | |
2274 | #ifdef CONFIG_OCV | |
2275 | if (wpa_sm_ocv_enabled(wpa_s->wpa)) { | |
2276 | struct wpa_channel_info ci; | |
2277 | ||
2278 | if (wpa_drv_channel_info(wpa_s, &ci) != 0) { | |
2279 | wpa_printf(MSG_WARNING, | |
2280 | "Failed to get channel info for OCI element in SA Query Request frame"); | |
2281 | return; | |
2282 | } | |
2283 | ||
2284 | if (ocv_insert_extended_oci(&ci, req + req_len) < 0) | |
2285 | return; | |
2286 | ||
2287 | req_len += OCV_OCI_EXTENDED_LEN; | |
2288 | } | |
2289 | #endif /* CONFIG_OCV */ | |
2290 | ||
190b9062 | 2291 | if (wpa_drv_send_action(wpa_s, wpa_s->assoc_freq, 0, wpa_s->bssid, |
7d878ca7 | 2292 | wpa_s->own_addr, wpa_s->bssid, |
f9da7505 | 2293 | req, req_len, 0) < 0) |
f049052b BG |
2294 | wpa_msg(wpa_s, MSG_INFO, "SME: Failed to send SA Query " |
2295 | "Request"); | |
7d878ca7 JM |
2296 | } |
2297 | ||
2298 | ||
2299 | static void sme_sa_query_timer(void *eloop_ctx, void *timeout_ctx) | |
2300 | { | |
2301 | struct wpa_supplicant *wpa_s = eloop_ctx; | |
2302 | unsigned int timeout, sec, usec; | |
2303 | u8 *trans_id, *nbuf; | |
2304 | ||
2305 | if (wpa_s->sme.sa_query_count > 0 && | |
2306 | sme_check_sa_query_timeout(wpa_s)) | |
2307 | return; | |
2308 | ||
067ffa26 JM |
2309 | nbuf = os_realloc_array(wpa_s->sme.sa_query_trans_id, |
2310 | wpa_s->sme.sa_query_count + 1, | |
2311 | WLAN_SA_QUERY_TR_ID_LEN); | |
f8608fab JM |
2312 | if (nbuf == NULL) { |
2313 | sme_stop_sa_query(wpa_s); | |
7d878ca7 | 2314 | return; |
f8608fab | 2315 | } |
7d878ca7 JM |
2316 | if (wpa_s->sme.sa_query_count == 0) { |
2317 | /* Starting a new SA Query procedure */ | |
46b8d4c0 | 2318 | os_get_reltime(&wpa_s->sme.sa_query_start); |
7d878ca7 JM |
2319 | } |
2320 | trans_id = nbuf + wpa_s->sme.sa_query_count * WLAN_SA_QUERY_TR_ID_LEN; | |
2321 | wpa_s->sme.sa_query_trans_id = nbuf; | |
2322 | wpa_s->sme.sa_query_count++; | |
2323 | ||
cb5ef952 JM |
2324 | if (os_get_random(trans_id, WLAN_SA_QUERY_TR_ID_LEN) < 0) { |
2325 | wpa_printf(MSG_DEBUG, "Could not generate SA Query ID"); | |
f8608fab | 2326 | sme_stop_sa_query(wpa_s); |
cb5ef952 JM |
2327 | return; |
2328 | } | |
7d878ca7 JM |
2329 | |
2330 | timeout = sa_query_retry_timeout; | |
2331 | sec = ((timeout / 1000) * 1024) / 1000; | |
2332 | usec = (timeout % 1000) * 1024; | |
2333 | eloop_register_timeout(sec, usec, sme_sa_query_timer, wpa_s, NULL); | |
2334 | ||
f049052b BG |
2335 | wpa_dbg(wpa_s, MSG_DEBUG, "SME: Association SA Query attempt %d", |
2336 | wpa_s->sme.sa_query_count); | |
7d878ca7 JM |
2337 | |
2338 | sme_send_sa_query_req(wpa_s, trans_id); | |
2339 | } | |
2340 | ||
2341 | ||
2342 | static void sme_start_sa_query(struct wpa_supplicant *wpa_s) | |
2343 | { | |
2344 | sme_sa_query_timer(wpa_s, NULL); | |
2345 | } | |
2346 | ||
2347 | ||
19df9b07 | 2348 | static void sme_stop_sa_query(struct wpa_supplicant *wpa_s) |
7d878ca7 JM |
2349 | { |
2350 | eloop_cancel_timeout(sme_sa_query_timer, wpa_s, NULL); | |
2351 | os_free(wpa_s->sme.sa_query_trans_id); | |
2352 | wpa_s->sme.sa_query_trans_id = NULL; | |
2353 | wpa_s->sme.sa_query_count = 0; | |
2354 | } | |
2355 | ||
2356 | ||
2357 | void sme_event_unprot_disconnect(struct wpa_supplicant *wpa_s, const u8 *sa, | |
2358 | const u8 *da, u16 reason_code) | |
2359 | { | |
2360 | struct wpa_ssid *ssid; | |
3302b7c2 | 2361 | struct os_reltime now; |
7d878ca7 | 2362 | |
7d878ca7 JM |
2363 | if (wpa_s->wpa_state != WPA_COMPLETED) |
2364 | return; | |
2365 | ssid = wpa_s->current_ssid; | |
3f56a2b7 | 2366 | if (wpas_get_ssid_pmf(wpa_s, ssid) == NO_MGMT_FRAME_PROTECTION) |
7d878ca7 JM |
2367 | return; |
2368 | if (os_memcmp(sa, wpa_s->bssid, ETH_ALEN) != 0) | |
2369 | return; | |
2370 | if (reason_code != WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA && | |
2371 | reason_code != WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA) | |
2372 | return; | |
2373 | if (wpa_s->sme.sa_query_count > 0) | |
2374 | return; | |
2375 | ||
3302b7c2 JM |
2376 | os_get_reltime(&now); |
2377 | if (wpa_s->sme.last_unprot_disconnect.sec && | |
2378 | !os_reltime_expired(&now, &wpa_s->sme.last_unprot_disconnect, 10)) | |
2379 | return; /* limit SA Query procedure frequency */ | |
2380 | wpa_s->sme.last_unprot_disconnect = now; | |
2381 | ||
f049052b BG |
2382 | wpa_dbg(wpa_s, MSG_DEBUG, "SME: Unprotected disconnect dropped - " |
2383 | "possible AP/STA state mismatch - trigger SA Query"); | |
7d878ca7 JM |
2384 | sme_start_sa_query(wpa_s); |
2385 | } | |
2386 | ||
2387 | ||
f91e68e9 MV |
2388 | void sme_event_ch_switch(struct wpa_supplicant *wpa_s) |
2389 | { | |
2390 | unsigned int usec; | |
2391 | u32 _rand; | |
2392 | ||
2393 | if (wpa_s->wpa_state != WPA_COMPLETED || | |
2394 | !wpa_sm_ocv_enabled(wpa_s->wpa)) | |
2395 | return; | |
2396 | ||
2397 | wpa_dbg(wpa_s, MSG_DEBUG, | |
2398 | "SME: Channel switch completed - trigger new SA Query to verify new operating channel"); | |
2399 | sme_stop_sa_query(wpa_s); | |
2400 | ||
2401 | if (os_get_random((u8 *) &_rand, sizeof(_rand)) < 0) | |
2402 | _rand = os_random(); | |
2403 | usec = _rand % (sa_query_ch_switch_max_delay + 1); | |
2404 | eloop_register_timeout(0, usec, sme_sa_query_timer, wpa_s, NULL); | |
2405 | } | |
2406 | ||
2407 | ||
f9da7505 MV |
2408 | static void sme_process_sa_query_request(struct wpa_supplicant *wpa_s, |
2409 | const u8 *sa, const u8 *data, | |
2410 | size_t len) | |
2411 | { | |
2412 | u8 resp[2 + WLAN_SA_QUERY_TR_ID_LEN + OCV_OCI_EXTENDED_LEN]; | |
2413 | u8 resp_len = 2 + WLAN_SA_QUERY_TR_ID_LEN; | |
2414 | ||
2415 | wpa_dbg(wpa_s, MSG_DEBUG, "SME: Sending SA Query Response to " | |
2416 | MACSTR, MAC2STR(wpa_s->bssid)); | |
2417 | ||
2418 | resp[0] = WLAN_ACTION_SA_QUERY; | |
2419 | resp[1] = WLAN_SA_QUERY_RESPONSE; | |
2420 | os_memcpy(resp + 2, data + 1, WLAN_SA_QUERY_TR_ID_LEN); | |
2421 | ||
2422 | #ifdef CONFIG_OCV | |
2423 | if (wpa_sm_ocv_enabled(wpa_s->wpa)) { | |
2424 | struct wpa_channel_info ci; | |
2425 | ||
2426 | if (wpa_drv_channel_info(wpa_s, &ci) != 0) { | |
2427 | wpa_printf(MSG_WARNING, | |
2428 | "Failed to get channel info for OCI element in SA Query Response frame"); | |
2429 | return; | |
2430 | } | |
2431 | ||
2432 | if (ocv_insert_extended_oci(&ci, resp + resp_len) < 0) | |
2433 | return; | |
2434 | ||
2435 | resp_len += OCV_OCI_EXTENDED_LEN; | |
2436 | } | |
2437 | #endif /* CONFIG_OCV */ | |
2438 | ||
2439 | if (wpa_drv_send_action(wpa_s, wpa_s->assoc_freq, 0, wpa_s->bssid, | |
2440 | wpa_s->own_addr, wpa_s->bssid, | |
2441 | resp, resp_len, 0) < 0) | |
2442 | wpa_msg(wpa_s, MSG_INFO, | |
2443 | "SME: Failed to send SA Query Response"); | |
2444 | } | |
2445 | ||
2446 | ||
2447 | static void sme_process_sa_query_response(struct wpa_supplicant *wpa_s, | |
2448 | const u8 *sa, const u8 *data, | |
2449 | size_t len) | |
7d878ca7 JM |
2450 | { |
2451 | int i; | |
2452 | ||
f9da7505 | 2453 | if (!wpa_s->sme.sa_query_trans_id) |
7d878ca7 | 2454 | return; |
f9da7505 | 2455 | |
f049052b BG |
2456 | wpa_dbg(wpa_s, MSG_DEBUG, "SME: Received SA Query response from " |
2457 | MACSTR " (trans_id %02x%02x)", MAC2STR(sa), data[1], data[2]); | |
7d878ca7 JM |
2458 | |
2459 | if (os_memcmp(sa, wpa_s->bssid, ETH_ALEN) != 0) | |
2460 | return; | |
2461 | ||
2462 | for (i = 0; i < wpa_s->sme.sa_query_count; i++) { | |
2463 | if (os_memcmp(wpa_s->sme.sa_query_trans_id + | |
2464 | i * WLAN_SA_QUERY_TR_ID_LEN, | |
2465 | data + 1, WLAN_SA_QUERY_TR_ID_LEN) == 0) | |
2466 | break; | |
2467 | } | |
2468 | ||
2469 | if (i >= wpa_s->sme.sa_query_count) { | |
f049052b BG |
2470 | wpa_dbg(wpa_s, MSG_DEBUG, "SME: No matching SA Query " |
2471 | "transaction identifier found"); | |
7d878ca7 JM |
2472 | return; |
2473 | } | |
2474 | ||
f049052b BG |
2475 | wpa_dbg(wpa_s, MSG_DEBUG, "SME: Reply to pending SA Query received " |
2476 | "from " MACSTR, MAC2STR(sa)); | |
7d878ca7 JM |
2477 | sme_stop_sa_query(wpa_s); |
2478 | } | |
2479 | ||
f9da7505 MV |
2480 | |
2481 | void sme_sa_query_rx(struct wpa_supplicant *wpa_s, const u8 *sa, | |
2482 | const u8 *data, size_t len) | |
2483 | { | |
2484 | if (len < 1 + WLAN_SA_QUERY_TR_ID_LEN) | |
2485 | return; | |
2486 | ||
2487 | wpa_dbg(wpa_s, MSG_DEBUG, "SME: Received SA Query frame from " | |
2488 | MACSTR " (trans_id %02x%02x)", MAC2STR(sa), data[1], data[2]); | |
2489 | ||
2490 | #ifdef CONFIG_OCV | |
2491 | if (wpa_sm_ocv_enabled(wpa_s->wpa)) { | |
2492 | struct ieee802_11_elems elems; | |
2493 | struct wpa_channel_info ci; | |
2494 | ||
2495 | if (ieee802_11_parse_elems(data + 1 + WLAN_SA_QUERY_TR_ID_LEN, | |
2496 | len - 1 - WLAN_SA_QUERY_TR_ID_LEN, | |
2497 | &elems, 1) == ParseFailed) { | |
2498 | wpa_printf(MSG_DEBUG, | |
2499 | "SA Query: Failed to parse elements"); | |
2500 | return; | |
2501 | } | |
2502 | ||
2503 | if (wpa_drv_channel_info(wpa_s, &ci) != 0) { | |
2504 | wpa_printf(MSG_WARNING, | |
2505 | "Failed to get channel info to validate received OCI in SA Query Action frame"); | |
2506 | return; | |
2507 | } | |
2508 | ||
2509 | if (ocv_verify_tx_params(elems.oci, elems.oci_len, &ci, | |
2510 | channel_width_to_int(ci.chanwidth), | |
2511 | ci.seg1_idx) != 0) { | |
2512 | wpa_printf(MSG_WARNING, "%s", ocv_errorstr); | |
2513 | return; | |
2514 | } | |
2515 | } | |
2516 | #endif /* CONFIG_OCV */ | |
2517 | ||
2518 | if (data[0] == WLAN_SA_QUERY_REQUEST) | |
2519 | sme_process_sa_query_request(wpa_s, sa, data, len); | |
2520 | else if (data[0] == WLAN_SA_QUERY_RESPONSE) | |
2521 | sme_process_sa_query_response(wpa_s, sa, data, len); | |
2522 | } | |
2523 | ||
7d878ca7 | 2524 | #endif /* CONFIG_IEEE80211W */ |