sme.c 29 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024
  1. /*
  2. * wpa_supplicant - SME
  3. * Copyright (c) 2009-2010, Jouni Malinen <j@w1.fi>
  4. *
  5. * This software may be distributed under the terms of the BSD license.
  6. * See README for more details.
  7. */
  8. #include "includes.h"
  9. #include "common.h"
  10. #include "utils/eloop.h"
  11. #include "common/ieee802_11_defs.h"
  12. #include "common/ieee802_11_common.h"
  13. #include "eapol_supp/eapol_supp_sm.h"
  14. #include "common/wpa_common.h"
  15. #include "rsn_supp/wpa.h"
  16. #include "rsn_supp/pmksa_cache.h"
  17. #include "config.h"
  18. #include "wpa_supplicant_i.h"
  19. #include "driver_i.h"
  20. #include "wpas_glue.h"
  21. #include "wps_supplicant.h"
  22. #include "p2p_supplicant.h"
  23. #include "notify.h"
  24. #include "bss.h"
  25. #include "scan.h"
  26. #include "sme.h"
  27. #define SME_AUTH_TIMEOUT 5
  28. #define SME_ASSOC_TIMEOUT 5
  29. static void sme_auth_timer(void *eloop_ctx, void *timeout_ctx);
  30. static void sme_assoc_timer(void *eloop_ctx, void *timeout_ctx);
  31. static void sme_obss_scan_timeout(void *eloop_ctx, void *timeout_ctx);
  32. #ifdef CONFIG_IEEE80211W
  33. static void sme_stop_sa_query(struct wpa_supplicant *wpa_s);
  34. #endif /* CONFIG_IEEE80211W */
  35. void sme_authenticate(struct wpa_supplicant *wpa_s,
  36. struct wpa_bss *bss, struct wpa_ssid *ssid)
  37. {
  38. struct wpa_driver_auth_params params;
  39. struct wpa_ssid *old_ssid;
  40. #ifdef CONFIG_IEEE80211R
  41. const u8 *ie;
  42. #endif /* CONFIG_IEEE80211R */
  43. #ifdef CONFIG_IEEE80211R
  44. const u8 *md = NULL;
  45. #endif /* CONFIG_IEEE80211R */
  46. int i, bssid_changed;
  47. if (bss == NULL) {
  48. wpa_msg(wpa_s, MSG_ERROR, "SME: No scan result available for "
  49. "the network");
  50. return;
  51. }
  52. wpa_s->current_bss = bss;
  53. os_memset(&params, 0, sizeof(params));
  54. wpa_s->reassociate = 0;
  55. params.freq = bss->freq;
  56. params.bssid = bss->bssid;
  57. params.ssid = bss->ssid;
  58. params.ssid_len = bss->ssid_len;
  59. params.p2p = ssid->p2p_group;
  60. if (wpa_s->sme.ssid_len != params.ssid_len ||
  61. os_memcmp(wpa_s->sme.ssid, params.ssid, params.ssid_len) != 0)
  62. wpa_s->sme.prev_bssid_set = 0;
  63. wpa_s->sme.freq = params.freq;
  64. os_memcpy(wpa_s->sme.ssid, params.ssid, params.ssid_len);
  65. wpa_s->sme.ssid_len = params.ssid_len;
  66. params.auth_alg = WPA_AUTH_ALG_OPEN;
  67. #ifdef IEEE8021X_EAPOL
  68. if (ssid->key_mgmt & WPA_KEY_MGMT_IEEE8021X_NO_WPA) {
  69. if (ssid->leap) {
  70. if (ssid->non_leap == 0)
  71. params.auth_alg = WPA_AUTH_ALG_LEAP;
  72. else
  73. params.auth_alg |= WPA_AUTH_ALG_LEAP;
  74. }
  75. }
  76. #endif /* IEEE8021X_EAPOL */
  77. wpa_dbg(wpa_s, MSG_DEBUG, "Automatic auth_alg selection: 0x%x",
  78. params.auth_alg);
  79. if (ssid->auth_alg) {
  80. params.auth_alg = ssid->auth_alg;
  81. wpa_dbg(wpa_s, MSG_DEBUG, "Overriding auth_alg selection: "
  82. "0x%x", params.auth_alg);
  83. }
  84. for (i = 0; i < NUM_WEP_KEYS; i++) {
  85. if (ssid->wep_key_len[i])
  86. params.wep_key[i] = ssid->wep_key[i];
  87. params.wep_key_len[i] = ssid->wep_key_len[i];
  88. }
  89. params.wep_tx_keyidx = ssid->wep_tx_keyidx;
  90. bssid_changed = !is_zero_ether_addr(wpa_s->bssid);
  91. os_memset(wpa_s->bssid, 0, ETH_ALEN);
  92. os_memcpy(wpa_s->pending_bssid, bss->bssid, ETH_ALEN);
  93. if (bssid_changed)
  94. wpas_notify_bssid_changed(wpa_s);
  95. if ((wpa_bss_get_vendor_ie(bss, WPA_IE_VENDOR_TYPE) ||
  96. wpa_bss_get_ie(bss, WLAN_EID_RSN)) &&
  97. wpa_key_mgmt_wpa(ssid->key_mgmt)) {
  98. int try_opportunistic;
  99. try_opportunistic = ssid->proactive_key_caching &&
  100. (ssid->proto & WPA_PROTO_RSN);
  101. if (pmksa_cache_set_current(wpa_s->wpa, NULL, bss->bssid,
  102. wpa_s->current_ssid,
  103. try_opportunistic) == 0)
  104. eapol_sm_notify_pmkid_attempt(wpa_s->eapol, 1);
  105. wpa_s->sme.assoc_req_ie_len = sizeof(wpa_s->sme.assoc_req_ie);
  106. if (wpa_supplicant_set_suites(wpa_s, bss, ssid,
  107. wpa_s->sme.assoc_req_ie,
  108. &wpa_s->sme.assoc_req_ie_len)) {
  109. wpa_msg(wpa_s, MSG_WARNING, "SME: Failed to set WPA "
  110. "key management and encryption suites");
  111. return;
  112. }
  113. } else if (wpa_key_mgmt_wpa_any(ssid->key_mgmt)) {
  114. wpa_s->sme.assoc_req_ie_len = sizeof(wpa_s->sme.assoc_req_ie);
  115. if (wpa_supplicant_set_suites(wpa_s, NULL, ssid,
  116. wpa_s->sme.assoc_req_ie,
  117. &wpa_s->sme.assoc_req_ie_len)) {
  118. wpa_msg(wpa_s, MSG_WARNING, "SME: Failed to set WPA "
  119. "key management and encryption suites (no "
  120. "scan results)");
  121. return;
  122. }
  123. #ifdef CONFIG_WPS
  124. } else if (ssid->key_mgmt & WPA_KEY_MGMT_WPS) {
  125. struct wpabuf *wps_ie;
  126. wps_ie = wps_build_assoc_req_ie(wpas_wps_get_req_type(ssid));
  127. if (wps_ie && wpabuf_len(wps_ie) <=
  128. sizeof(wpa_s->sme.assoc_req_ie)) {
  129. wpa_s->sme.assoc_req_ie_len = wpabuf_len(wps_ie);
  130. os_memcpy(wpa_s->sme.assoc_req_ie, wpabuf_head(wps_ie),
  131. wpa_s->sme.assoc_req_ie_len);
  132. } else
  133. wpa_s->sme.assoc_req_ie_len = 0;
  134. wpabuf_free(wps_ie);
  135. wpa_supplicant_set_non_wpa_policy(wpa_s, ssid);
  136. #endif /* CONFIG_WPS */
  137. } else {
  138. wpa_supplicant_set_non_wpa_policy(wpa_s, ssid);
  139. wpa_s->sme.assoc_req_ie_len = 0;
  140. }
  141. #ifdef CONFIG_IEEE80211R
  142. ie = wpa_bss_get_ie(bss, WLAN_EID_MOBILITY_DOMAIN);
  143. if (ie && ie[1] >= MOBILITY_DOMAIN_ID_LEN)
  144. md = ie + 2;
  145. wpa_sm_set_ft_params(wpa_s->wpa, ie, ie ? 2 + ie[1] : 0);
  146. if (md) {
  147. /* Prepare for the next transition */
  148. wpa_ft_prepare_auth_request(wpa_s->wpa, ie);
  149. }
  150. if (md && wpa_key_mgmt_ft(ssid->key_mgmt)) {
  151. if (wpa_s->sme.assoc_req_ie_len + 5 <
  152. sizeof(wpa_s->sme.assoc_req_ie)) {
  153. struct rsn_mdie *mdie;
  154. u8 *pos = wpa_s->sme.assoc_req_ie +
  155. wpa_s->sme.assoc_req_ie_len;
  156. *pos++ = WLAN_EID_MOBILITY_DOMAIN;
  157. *pos++ = sizeof(*mdie);
  158. mdie = (struct rsn_mdie *) pos;
  159. os_memcpy(mdie->mobility_domain, md,
  160. MOBILITY_DOMAIN_ID_LEN);
  161. mdie->ft_capab = md[MOBILITY_DOMAIN_ID_LEN];
  162. wpa_s->sme.assoc_req_ie_len += 5;
  163. }
  164. if (wpa_s->sme.ft_used &&
  165. os_memcmp(md, wpa_s->sme.mobility_domain, 2) == 0 &&
  166. wpa_sm_has_ptk(wpa_s->wpa)) {
  167. wpa_dbg(wpa_s, MSG_DEBUG, "SME: Trying to use FT "
  168. "over-the-air");
  169. params.auth_alg = WPA_AUTH_ALG_FT;
  170. params.ie = wpa_s->sme.ft_ies;
  171. params.ie_len = wpa_s->sme.ft_ies_len;
  172. }
  173. }
  174. #endif /* CONFIG_IEEE80211R */
  175. #ifdef CONFIG_IEEE80211W
  176. wpa_s->sme.mfp = ssid->ieee80211w;
  177. if (ssid->ieee80211w != NO_MGMT_FRAME_PROTECTION) {
  178. const u8 *rsn = wpa_bss_get_ie(bss, WLAN_EID_RSN);
  179. struct wpa_ie_data _ie;
  180. if (rsn && wpa_parse_wpa_ie(rsn, 2 + rsn[1], &_ie) == 0 &&
  181. _ie.capabilities &
  182. (WPA_CAPABILITY_MFPC | WPA_CAPABILITY_MFPR)) {
  183. wpa_dbg(wpa_s, MSG_DEBUG, "SME: Selected AP supports "
  184. "MFP: require MFP");
  185. wpa_s->sme.mfp = MGMT_FRAME_PROTECTION_REQUIRED;
  186. }
  187. }
  188. #endif /* CONFIG_IEEE80211W */
  189. #ifdef CONFIG_P2P
  190. if (wpa_s->global->p2p) {
  191. u8 *pos;
  192. size_t len;
  193. int res;
  194. pos = wpa_s->sme.assoc_req_ie + wpa_s->sme.assoc_req_ie_len;
  195. len = sizeof(wpa_s->sme.assoc_req_ie) -
  196. wpa_s->sme.assoc_req_ie_len;
  197. res = wpas_p2p_assoc_req_ie(wpa_s, bss, pos, len,
  198. ssid->p2p_group);
  199. if (res >= 0)
  200. wpa_s->sme.assoc_req_ie_len += res;
  201. }
  202. #endif /* CONFIG_P2P */
  203. #ifdef CONFIG_INTERWORKING
  204. if (wpa_s->conf->interworking) {
  205. u8 *pos = wpa_s->sme.assoc_req_ie;
  206. if (wpa_s->sme.assoc_req_ie_len > 0 && pos[0] == WLAN_EID_RSN)
  207. pos += 2 + pos[1];
  208. os_memmove(pos + 6, pos,
  209. wpa_s->sme.assoc_req_ie_len -
  210. (pos - wpa_s->sme.assoc_req_ie));
  211. wpa_s->sme.assoc_req_ie_len += 6;
  212. *pos++ = WLAN_EID_EXT_CAPAB;
  213. *pos++ = 4;
  214. *pos++ = 0x00;
  215. *pos++ = 0x00;
  216. *pos++ = 0x00;
  217. *pos++ = 0x80; /* Bit 31 - Interworking */
  218. }
  219. #endif /* CONFIG_INTERWORKING */
  220. wpa_supplicant_cancel_sched_scan(wpa_s);
  221. wpa_supplicant_cancel_scan(wpa_s);
  222. wpa_msg(wpa_s, MSG_INFO, "SME: Trying to authenticate with " MACSTR
  223. " (SSID='%s' freq=%d MHz)", MAC2STR(params.bssid),
  224. wpa_ssid_txt(params.ssid, params.ssid_len), params.freq);
  225. wpa_clear_keys(wpa_s, bss->bssid);
  226. wpa_supplicant_set_state(wpa_s, WPA_AUTHENTICATING);
  227. old_ssid = wpa_s->current_ssid;
  228. wpa_s->current_ssid = ssid;
  229. wpa_supplicant_rsn_supp_set_config(wpa_s, wpa_s->current_ssid);
  230. wpa_supplicant_initiate_eapol(wpa_s);
  231. if (old_ssid != wpa_s->current_ssid)
  232. wpas_notify_network_changed(wpa_s);
  233. wpa_s->sme.auth_alg = params.auth_alg;
  234. if (wpa_drv_authenticate(wpa_s, &params) < 0) {
  235. wpa_msg(wpa_s, MSG_INFO, "SME: Authentication request to the "
  236. "driver failed");
  237. wpas_connection_failed(wpa_s, bss->bssid);
  238. wpa_supplicant_mark_disassoc(wpa_s);
  239. return;
  240. }
  241. eloop_register_timeout(SME_AUTH_TIMEOUT, 0, sme_auth_timer, wpa_s,
  242. NULL);
  243. /*
  244. * Association will be started based on the authentication event from
  245. * the driver.
  246. */
  247. }
  248. void sme_event_auth(struct wpa_supplicant *wpa_s, union wpa_event_data *data)
  249. {
  250. struct wpa_ssid *ssid = wpa_s->current_ssid;
  251. if (ssid == NULL) {
  252. wpa_dbg(wpa_s, MSG_DEBUG, "SME: Ignore authentication event "
  253. "when network is not selected");
  254. return;
  255. }
  256. if (wpa_s->wpa_state != WPA_AUTHENTICATING) {
  257. wpa_dbg(wpa_s, MSG_DEBUG, "SME: Ignore authentication event "
  258. "when not in authenticating state");
  259. return;
  260. }
  261. if (os_memcmp(wpa_s->pending_bssid, data->auth.peer, ETH_ALEN) != 0) {
  262. wpa_dbg(wpa_s, MSG_DEBUG, "SME: Ignore authentication with "
  263. "unexpected peer " MACSTR,
  264. MAC2STR(data->auth.peer));
  265. return;
  266. }
  267. wpa_dbg(wpa_s, MSG_DEBUG, "SME: Authentication response: peer=" MACSTR
  268. " auth_type=%d status_code=%d",
  269. MAC2STR(data->auth.peer), data->auth.auth_type,
  270. data->auth.status_code);
  271. wpa_hexdump(MSG_MSGDUMP, "SME: Authentication response IEs",
  272. data->auth.ies, data->auth.ies_len);
  273. eloop_cancel_timeout(sme_auth_timer, wpa_s, NULL);
  274. if (data->auth.status_code != WLAN_STATUS_SUCCESS) {
  275. wpa_dbg(wpa_s, MSG_DEBUG, "SME: Authentication failed (status "
  276. "code %d)", data->auth.status_code);
  277. if (data->auth.status_code !=
  278. WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG ||
  279. wpa_s->sme.auth_alg == data->auth.auth_type ||
  280. wpa_s->current_ssid->auth_alg == WPA_AUTH_ALG_LEAP) {
  281. wpas_connection_failed(wpa_s, wpa_s->pending_bssid);
  282. return;
  283. }
  284. switch (data->auth.auth_type) {
  285. case WLAN_AUTH_OPEN:
  286. wpa_s->current_ssid->auth_alg = WPA_AUTH_ALG_SHARED;
  287. wpa_dbg(wpa_s, MSG_DEBUG, "SME: Trying SHARED auth");
  288. wpa_supplicant_associate(wpa_s, wpa_s->current_bss,
  289. wpa_s->current_ssid);
  290. return;
  291. case WLAN_AUTH_SHARED_KEY:
  292. wpa_s->current_ssid->auth_alg = WPA_AUTH_ALG_LEAP;
  293. wpa_dbg(wpa_s, MSG_DEBUG, "SME: Trying LEAP auth");
  294. wpa_supplicant_associate(wpa_s, wpa_s->current_bss,
  295. wpa_s->current_ssid);
  296. return;
  297. default:
  298. return;
  299. }
  300. }
  301. #ifdef CONFIG_IEEE80211R
  302. if (data->auth.auth_type == WLAN_AUTH_FT) {
  303. union wpa_event_data edata;
  304. os_memset(&edata, 0, sizeof(edata));
  305. edata.ft_ies.ies = data->auth.ies;
  306. edata.ft_ies.ies_len = data->auth.ies_len;
  307. os_memcpy(edata.ft_ies.target_ap, data->auth.peer, ETH_ALEN);
  308. wpa_supplicant_event(wpa_s, EVENT_FT_RESPONSE, &edata);
  309. }
  310. #endif /* CONFIG_IEEE80211R */
  311. sme_associate(wpa_s, ssid->mode, data->auth.peer,
  312. data->auth.auth_type);
  313. }
  314. void sme_associate(struct wpa_supplicant *wpa_s, enum wpas_mode mode,
  315. const u8 *bssid, u16 auth_type)
  316. {
  317. struct wpa_driver_associate_params params;
  318. struct ieee802_11_elems elems;
  319. #ifdef CONFIG_HT_OVERRIDES
  320. struct ieee80211_ht_capabilities htcaps;
  321. struct ieee80211_ht_capabilities htcaps_mask;
  322. #endif /* CONFIG_HT_OVERRIDES */
  323. os_memset(&params, 0, sizeof(params));
  324. params.bssid = bssid;
  325. params.ssid = wpa_s->sme.ssid;
  326. params.ssid_len = wpa_s->sme.ssid_len;
  327. params.freq = wpa_s->sme.freq;
  328. params.bg_scan_period = wpa_s->current_ssid ?
  329. wpa_s->current_ssid->bg_scan_period : -1;
  330. params.wpa_ie = wpa_s->sme.assoc_req_ie_len ?
  331. wpa_s->sme.assoc_req_ie : NULL;
  332. params.wpa_ie_len = wpa_s->sme.assoc_req_ie_len;
  333. params.pairwise_suite = cipher_suite2driver(wpa_s->pairwise_cipher);
  334. params.group_suite = cipher_suite2driver(wpa_s->group_cipher);
  335. #ifdef CONFIG_HT_OVERRIDES
  336. os_memset(&htcaps, 0, sizeof(htcaps));
  337. os_memset(&htcaps_mask, 0, sizeof(htcaps_mask));
  338. params.htcaps = (u8 *) &htcaps;
  339. params.htcaps_mask = (u8 *) &htcaps_mask;
  340. wpa_supplicant_apply_ht_overrides(wpa_s, wpa_s->current_ssid, &params);
  341. #endif /* CONFIG_HT_OVERRIDES */
  342. #ifdef CONFIG_IEEE80211R
  343. if (auth_type == WLAN_AUTH_FT && wpa_s->sme.ft_ies) {
  344. params.wpa_ie = wpa_s->sme.ft_ies;
  345. params.wpa_ie_len = wpa_s->sme.ft_ies_len;
  346. }
  347. #endif /* CONFIG_IEEE80211R */
  348. params.mode = mode;
  349. params.mgmt_frame_protection = wpa_s->sme.mfp;
  350. if (wpa_s->sme.prev_bssid_set)
  351. params.prev_bssid = wpa_s->sme.prev_bssid;
  352. wpa_msg(wpa_s, MSG_INFO, "Trying to associate with " MACSTR
  353. " (SSID='%s' freq=%d MHz)", MAC2STR(params.bssid),
  354. params.ssid ? wpa_ssid_txt(params.ssid, params.ssid_len) : "",
  355. params.freq);
  356. wpa_supplicant_set_state(wpa_s, WPA_ASSOCIATING);
  357. if (params.wpa_ie == NULL ||
  358. ieee802_11_parse_elems(params.wpa_ie, params.wpa_ie_len, &elems, 0)
  359. < 0) {
  360. wpa_dbg(wpa_s, MSG_DEBUG, "SME: Could not parse own IEs?!");
  361. os_memset(&elems, 0, sizeof(elems));
  362. }
  363. if (elems.rsn_ie) {
  364. params.wpa_proto = WPA_PROTO_RSN;
  365. wpa_sm_set_assoc_wpa_ie(wpa_s->wpa, elems.rsn_ie - 2,
  366. elems.rsn_ie_len + 2);
  367. } else if (elems.wpa_ie) {
  368. params.wpa_proto = WPA_PROTO_WPA;
  369. wpa_sm_set_assoc_wpa_ie(wpa_s->wpa, elems.wpa_ie - 2,
  370. elems.wpa_ie_len + 2);
  371. } else
  372. wpa_sm_set_assoc_wpa_ie(wpa_s->wpa, NULL, 0);
  373. if (wpa_s->current_ssid && wpa_s->current_ssid->p2p_group)
  374. params.p2p = 1;
  375. if (wpa_s->parent->set_sta_uapsd)
  376. params.uapsd = wpa_s->parent->sta_uapsd;
  377. else
  378. params.uapsd = -1;
  379. if (wpa_drv_associate(wpa_s, &params) < 0) {
  380. wpa_msg(wpa_s, MSG_INFO, "SME: Association request to the "
  381. "driver failed");
  382. wpas_connection_failed(wpa_s, wpa_s->pending_bssid);
  383. os_memset(wpa_s->pending_bssid, 0, ETH_ALEN);
  384. return;
  385. }
  386. eloop_register_timeout(SME_ASSOC_TIMEOUT, 0, sme_assoc_timer, wpa_s,
  387. NULL);
  388. }
  389. int sme_update_ft_ies(struct wpa_supplicant *wpa_s, const u8 *md,
  390. const u8 *ies, size_t ies_len)
  391. {
  392. if (md == NULL || ies == NULL) {
  393. wpa_dbg(wpa_s, MSG_DEBUG, "SME: Remove mobility domain");
  394. os_free(wpa_s->sme.ft_ies);
  395. wpa_s->sme.ft_ies = NULL;
  396. wpa_s->sme.ft_ies_len = 0;
  397. wpa_s->sme.ft_used = 0;
  398. return 0;
  399. }
  400. os_memcpy(wpa_s->sme.mobility_domain, md, MOBILITY_DOMAIN_ID_LEN);
  401. wpa_hexdump(MSG_DEBUG, "SME: FT IEs", ies, ies_len);
  402. os_free(wpa_s->sme.ft_ies);
  403. wpa_s->sme.ft_ies = os_malloc(ies_len);
  404. if (wpa_s->sme.ft_ies == NULL)
  405. return -1;
  406. os_memcpy(wpa_s->sme.ft_ies, ies, ies_len);
  407. wpa_s->sme.ft_ies_len = ies_len;
  408. return 0;
  409. }
  410. static void sme_deauth(struct wpa_supplicant *wpa_s)
  411. {
  412. int bssid_changed;
  413. bssid_changed = !is_zero_ether_addr(wpa_s->bssid);
  414. if (wpa_drv_deauthenticate(wpa_s, wpa_s->pending_bssid,
  415. WLAN_REASON_DEAUTH_LEAVING) < 0) {
  416. wpa_msg(wpa_s, MSG_INFO, "SME: Deauth request to the driver "
  417. "failed");
  418. }
  419. wpa_s->sme.prev_bssid_set = 0;
  420. wpas_connection_failed(wpa_s, wpa_s->pending_bssid);
  421. wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED);
  422. os_memset(wpa_s->bssid, 0, ETH_ALEN);
  423. os_memset(wpa_s->pending_bssid, 0, ETH_ALEN);
  424. if (bssid_changed)
  425. wpas_notify_bssid_changed(wpa_s);
  426. }
  427. void sme_event_assoc_reject(struct wpa_supplicant *wpa_s,
  428. union wpa_event_data *data)
  429. {
  430. wpa_dbg(wpa_s, MSG_DEBUG, "SME: Association with " MACSTR " failed: "
  431. "status code %d", MAC2STR(wpa_s->pending_bssid),
  432. data->assoc_reject.status_code);
  433. eloop_cancel_timeout(sme_assoc_timer, wpa_s, NULL);
  434. /*
  435. * For now, unconditionally terminate the previous authentication. In
  436. * theory, this should not be needed, but mac80211 gets quite confused
  437. * if the authentication is left pending.. Some roaming cases might
  438. * benefit from using the previous authentication, so this could be
  439. * optimized in the future.
  440. */
  441. sme_deauth(wpa_s);
  442. }
  443. void sme_event_auth_timed_out(struct wpa_supplicant *wpa_s,
  444. union wpa_event_data *data)
  445. {
  446. wpa_dbg(wpa_s, MSG_DEBUG, "SME: Authentication timed out");
  447. wpas_connection_failed(wpa_s, wpa_s->pending_bssid);
  448. wpa_supplicant_mark_disassoc(wpa_s);
  449. }
  450. void sme_event_assoc_timed_out(struct wpa_supplicant *wpa_s,
  451. union wpa_event_data *data)
  452. {
  453. wpa_dbg(wpa_s, MSG_DEBUG, "SME: Association timed out");
  454. wpas_connection_failed(wpa_s, wpa_s->pending_bssid);
  455. wpa_supplicant_mark_disassoc(wpa_s);
  456. }
  457. void sme_event_disassoc(struct wpa_supplicant *wpa_s,
  458. union wpa_event_data *data)
  459. {
  460. wpa_dbg(wpa_s, MSG_DEBUG, "SME: Disassociation event received");
  461. if (wpa_s->sme.prev_bssid_set) {
  462. /*
  463. * cfg80211/mac80211 can get into somewhat confused state if
  464. * the AP only disassociates us and leaves us in authenticated
  465. * state. For now, force the state to be cleared to avoid
  466. * confusing errors if we try to associate with the AP again.
  467. */
  468. wpa_dbg(wpa_s, MSG_DEBUG, "SME: Deauthenticate to clear "
  469. "driver state");
  470. wpa_drv_deauthenticate(wpa_s, wpa_s->sme.prev_bssid,
  471. WLAN_REASON_DEAUTH_LEAVING);
  472. }
  473. }
  474. static void sme_auth_timer(void *eloop_ctx, void *timeout_ctx)
  475. {
  476. struct wpa_supplicant *wpa_s = eloop_ctx;
  477. if (wpa_s->wpa_state == WPA_AUTHENTICATING) {
  478. wpa_msg(wpa_s, MSG_DEBUG, "SME: Authentication timeout");
  479. sme_deauth(wpa_s);
  480. }
  481. }
  482. static void sme_assoc_timer(void *eloop_ctx, void *timeout_ctx)
  483. {
  484. struct wpa_supplicant *wpa_s = eloop_ctx;
  485. if (wpa_s->wpa_state == WPA_ASSOCIATING) {
  486. wpa_msg(wpa_s, MSG_DEBUG, "SME: Association timeout");
  487. sme_deauth(wpa_s);
  488. }
  489. }
  490. void sme_state_changed(struct wpa_supplicant *wpa_s)
  491. {
  492. /* Make sure timers are cleaned up appropriately. */
  493. if (wpa_s->wpa_state != WPA_ASSOCIATING)
  494. eloop_cancel_timeout(sme_assoc_timer, wpa_s, NULL);
  495. if (wpa_s->wpa_state != WPA_AUTHENTICATING)
  496. eloop_cancel_timeout(sme_auth_timer, wpa_s, NULL);
  497. }
  498. void sme_disassoc_while_authenticating(struct wpa_supplicant *wpa_s,
  499. const u8 *prev_pending_bssid)
  500. {
  501. /*
  502. * mac80211-workaround to force deauth on failed auth cmd,
  503. * requires us to remain in authenticating state to allow the
  504. * second authentication attempt to be continued properly.
  505. */
  506. wpa_dbg(wpa_s, MSG_DEBUG, "SME: Allow pending authentication "
  507. "to proceed after disconnection event");
  508. wpa_supplicant_set_state(wpa_s, WPA_AUTHENTICATING);
  509. os_memcpy(wpa_s->pending_bssid, prev_pending_bssid, ETH_ALEN);
  510. /*
  511. * Re-arm authentication timer in case auth fails for whatever reason.
  512. */
  513. eloop_cancel_timeout(sme_auth_timer, wpa_s, NULL);
  514. eloop_register_timeout(SME_AUTH_TIMEOUT, 0, sme_auth_timer, wpa_s,
  515. NULL);
  516. }
  517. void sme_deinit(struct wpa_supplicant *wpa_s)
  518. {
  519. os_free(wpa_s->sme.ft_ies);
  520. wpa_s->sme.ft_ies = NULL;
  521. wpa_s->sme.ft_ies_len = 0;
  522. #ifdef CONFIG_IEEE80211W
  523. sme_stop_sa_query(wpa_s);
  524. #endif /* CONFIG_IEEE80211W */
  525. eloop_cancel_timeout(sme_assoc_timer, wpa_s, NULL);
  526. eloop_cancel_timeout(sme_auth_timer, wpa_s, NULL);
  527. eloop_cancel_timeout(sme_obss_scan_timeout, wpa_s, NULL);
  528. }
  529. static void sme_send_2040_bss_coex(struct wpa_supplicant *wpa_s,
  530. const u8 *chan_list, u8 num_channels,
  531. u8 num_intol)
  532. {
  533. struct ieee80211_2040_bss_coex_ie *bc_ie;
  534. struct ieee80211_2040_intol_chan_report *ic_report;
  535. struct wpabuf *buf;
  536. wpa_printf(MSG_DEBUG, "SME: Send 20/40 BSS Coexistence to " MACSTR,
  537. MAC2STR(wpa_s->bssid));
  538. buf = wpabuf_alloc(2 + /* action.category + action_code */
  539. sizeof(struct ieee80211_2040_bss_coex_ie) +
  540. sizeof(struct ieee80211_2040_intol_chan_report) +
  541. num_channels);
  542. if (buf == NULL)
  543. return;
  544. wpabuf_put_u8(buf, WLAN_ACTION_PUBLIC);
  545. wpabuf_put_u8(buf, WLAN_PA_20_40_BSS_COEX);
  546. bc_ie = wpabuf_put(buf, sizeof(*bc_ie));
  547. bc_ie->element_id = WLAN_EID_20_40_BSS_COEXISTENCE;
  548. bc_ie->length = 1;
  549. if (num_intol)
  550. bc_ie->coex_param |= WLAN_20_40_BSS_COEX_20MHZ_WIDTH_REQ;
  551. if (num_channels > 0) {
  552. ic_report = wpabuf_put(buf, sizeof(*ic_report));
  553. ic_report->element_id = WLAN_EID_20_40_BSS_INTOLERANT;
  554. ic_report->length = num_channels + 1;
  555. ic_report->op_class = 0;
  556. os_memcpy(wpabuf_put(buf, num_channels), chan_list,
  557. num_channels);
  558. }
  559. if (wpa_drv_send_action(wpa_s, wpa_s->assoc_freq, 0, wpa_s->bssid,
  560. wpa_s->own_addr, wpa_s->bssid,
  561. wpabuf_head(buf), wpabuf_len(buf), 0) < 0) {
  562. wpa_msg(wpa_s, MSG_INFO,
  563. "SME: Failed to send 20/40 BSS Coexistence frame");
  564. }
  565. wpabuf_free(buf);
  566. }
  567. /**
  568. * enum wpas_band - Frequency band
  569. * @WPAS_BAND_2GHZ: 2.4 GHz ISM band
  570. * @WPAS_BAND_5GHZ: around 5 GHz band (4.9 - 5.7 GHz)
  571. */
  572. enum wpas_band {
  573. WPAS_BAND_2GHZ,
  574. WPAS_BAND_5GHZ,
  575. WPAS_BAND_INVALID
  576. };
  577. /**
  578. * freq_to_channel - Convert frequency into channel info
  579. * @channel: Buffer for returning channel number
  580. * Returns: Band (2 or 5 GHz)
  581. */
  582. static enum wpas_band freq_to_channel(int freq, u8 *channel)
  583. {
  584. enum wpas_band band = (freq <= 2484) ? WPAS_BAND_2GHZ : WPAS_BAND_5GHZ;
  585. u8 chan = 0;
  586. if (freq >= 2412 && freq <= 2472)
  587. chan = (freq - 2407) / 5;
  588. else if (freq == 2484)
  589. chan = 14;
  590. else if (freq >= 5180 && freq <= 5805)
  591. chan = (freq - 5000) / 5;
  592. *channel = chan;
  593. return band;
  594. }
  595. int sme_proc_obss_scan(struct wpa_supplicant *wpa_s)
  596. {
  597. struct wpa_bss *bss;
  598. const u8 *ie;
  599. u16 ht_cap;
  600. u8 chan_list[P2P_MAX_CHANNELS], channel;
  601. u8 num_channels = 0, num_intol = 0, i;
  602. if (!wpa_s->sme.sched_obss_scan)
  603. return 0;
  604. wpa_s->sme.sched_obss_scan = 0;
  605. if (!wpa_s->current_bss || wpa_s->wpa_state != WPA_COMPLETED)
  606. return 1;
  607. /*
  608. * Check whether AP uses regulatory triplet or channel triplet in
  609. * country info. Right now the operating class of the BSS channel
  610. * width trigger event is "unknown" (IEEE Std 802.11-2012 10.15.12),
  611. * based on the assumption that operating class triplet is not used in
  612. * beacon frame. If the First Channel Number/Operating Extension
  613. * Identifier octet has a positive integer value of 201 or greater,
  614. * then its operating class triplet.
  615. *
  616. * TODO: If Supported Operating Classes element is present in beacon
  617. * frame, have to lookup operating class in Annex E and fill them in
  618. * 2040 coex frame.
  619. */
  620. ie = wpa_bss_get_ie(wpa_s->current_bss, WLAN_EID_COUNTRY);
  621. if (ie && (ie[1] >= 6) && (ie[5] >= 201))
  622. return 1;
  623. os_memset(chan_list, 0, sizeof(chan_list));
  624. dl_list_for_each(bss, &wpa_s->bss, struct wpa_bss, list) {
  625. /* Skip other band bss */
  626. if (freq_to_channel(bss->freq, &channel) != WPAS_BAND_2GHZ)
  627. continue;
  628. ie = wpa_bss_get_ie(bss, WLAN_EID_HT_CAP);
  629. ht_cap = (ie && (ie[1] == 26)) ? WPA_GET_LE16(ie + 2) : 0;
  630. if (!ht_cap || (ht_cap & HT_CAP_INFO_40MHZ_INTOLERANT)) {
  631. /* Check whether the channel is already considered */
  632. for (i = 0; i < num_channels; i++) {
  633. if (channel == chan_list[i])
  634. break;
  635. }
  636. if (i != num_channels)
  637. continue;
  638. if (ht_cap & HT_CAP_INFO_40MHZ_INTOLERANT)
  639. num_intol++;
  640. chan_list[num_channels++] = channel;
  641. }
  642. }
  643. sme_send_2040_bss_coex(wpa_s, chan_list, num_channels, num_intol);
  644. return 1;
  645. }
  646. static struct hostapd_hw_modes * get_mode(struct hostapd_hw_modes *modes,
  647. u16 num_modes,
  648. enum hostapd_hw_mode mode)
  649. {
  650. u16 i;
  651. for (i = 0; i < num_modes; i++) {
  652. if (modes[i].mode == mode)
  653. return &modes[i];
  654. }
  655. return NULL;
  656. }
  657. static void wpa_setband_scan_freqs_list(struct wpa_supplicant *wpa_s,
  658. enum hostapd_hw_mode band,
  659. struct wpa_driver_scan_params *params)
  660. {
  661. /* Include only supported channels for the specified band */
  662. struct hostapd_hw_modes *mode;
  663. int count, i;
  664. mode = get_mode(wpa_s->hw.modes, wpa_s->hw.num_modes, band);
  665. if (mode == NULL) {
  666. /* No channels supported in this band - use empty list */
  667. params->freqs = os_zalloc(sizeof(int));
  668. return;
  669. }
  670. params->freqs = os_zalloc((mode->num_channels + 1) * sizeof(int));
  671. if (params->freqs == NULL)
  672. return;
  673. for (count = 0, i = 0; i < mode->num_channels; i++) {
  674. if (mode->channels[i].flag & HOSTAPD_CHAN_DISABLED)
  675. continue;
  676. params->freqs[count++] = mode->channels[i].freq;
  677. }
  678. }
  679. static void sme_obss_scan_timeout(void *eloop_ctx, void *timeout_ctx)
  680. {
  681. struct wpa_supplicant *wpa_s = eloop_ctx;
  682. struct wpa_driver_scan_params params;
  683. if (!wpa_s->current_bss) {
  684. wpa_printf(MSG_DEBUG, "SME OBSS: Ignore scan request");
  685. return;
  686. }
  687. os_memset(&params, 0, sizeof(params));
  688. wpa_setband_scan_freqs_list(wpa_s, HOSTAPD_MODE_IEEE80211G, &params);
  689. wpa_printf(MSG_DEBUG, "SME OBSS: Request an OBSS scan");
  690. if (wpa_supplicant_trigger_scan(wpa_s, &params))
  691. wpa_printf(MSG_DEBUG, "SME OBSS: Failed to trigger scan");
  692. else
  693. wpa_s->sme.sched_obss_scan = 1;
  694. os_free(params.freqs);
  695. eloop_register_timeout(wpa_s->sme.obss_scan_int, 0,
  696. sme_obss_scan_timeout, wpa_s, NULL);
  697. }
  698. void sme_sched_obss_scan(struct wpa_supplicant *wpa_s, int enable)
  699. {
  700. const u8 *ie;
  701. struct wpa_bss *bss = wpa_s->current_bss;
  702. struct wpa_ssid *ssid = wpa_s->current_ssid;
  703. eloop_cancel_timeout(sme_obss_scan_timeout, wpa_s, NULL);
  704. wpa_s->sme.sched_obss_scan = 0;
  705. if (!enable)
  706. return;
  707. if (!(wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME) || ssid == NULL ||
  708. ssid->mode != IEEE80211_MODE_INFRA)
  709. return; /* Not using station SME in wpa_supplicant */
  710. if (!wpa_s->hw.modes ||
  711. !(wpa_s->hw.modes->ht_capab & HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET))
  712. return; /* Driver does not support HT40 */
  713. if (bss == NULL || bss->freq < 2400 || bss->freq > 2500)
  714. return; /* Not associated on 2.4 GHz band */
  715. /* Check whether AP supports HT40 */
  716. ie = wpa_bss_get_ie(wpa_s->current_bss, WLAN_EID_HT_CAP);
  717. if (!ie || ie[1] < 2 ||
  718. !(WPA_GET_LE16(ie + 2) & HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET))
  719. return; /* AP does not support HT40 */
  720. ie = wpa_bss_get_ie(wpa_s->current_bss,
  721. WLAN_EID_OVERLAPPING_BSS_SCAN_PARAMS);
  722. if (!ie || ie[1] < 14)
  723. return; /* AP does not request OBSS scans */
  724. wpa_s->sme.obss_scan_int = WPA_GET_LE16(ie + 6);
  725. if (wpa_s->sme.obss_scan_int < 10) {
  726. wpa_printf(MSG_DEBUG, "SME: Invalid OBSS Scan Interval %u "
  727. "replaced with the minimum 10 sec",
  728. wpa_s->sme.obss_scan_int);
  729. wpa_s->sme.obss_scan_int = 10;
  730. }
  731. wpa_printf(MSG_DEBUG, "SME: OBSS Scan Interval %u sec",
  732. wpa_s->sme.obss_scan_int);
  733. eloop_register_timeout(wpa_s->sme.obss_scan_int, 0,
  734. sme_obss_scan_timeout, wpa_s, NULL);
  735. }
  736. #ifdef CONFIG_IEEE80211W
  737. static const unsigned int sa_query_max_timeout = 1000;
  738. static const unsigned int sa_query_retry_timeout = 201;
  739. static int sme_check_sa_query_timeout(struct wpa_supplicant *wpa_s)
  740. {
  741. u32 tu;
  742. struct os_time now, passed;
  743. os_get_time(&now);
  744. os_time_sub(&now, &wpa_s->sme.sa_query_start, &passed);
  745. tu = (passed.sec * 1000000 + passed.usec) / 1024;
  746. if (sa_query_max_timeout < tu) {
  747. wpa_dbg(wpa_s, MSG_DEBUG, "SME: SA Query timed out");
  748. sme_stop_sa_query(wpa_s);
  749. wpa_supplicant_deauthenticate(
  750. wpa_s, WLAN_REASON_PREV_AUTH_NOT_VALID);
  751. return 1;
  752. }
  753. return 0;
  754. }
  755. static void sme_send_sa_query_req(struct wpa_supplicant *wpa_s,
  756. const u8 *trans_id)
  757. {
  758. u8 req[2 + WLAN_SA_QUERY_TR_ID_LEN];
  759. wpa_dbg(wpa_s, MSG_DEBUG, "SME: Sending SA Query Request to "
  760. MACSTR, MAC2STR(wpa_s->bssid));
  761. wpa_hexdump(MSG_DEBUG, "SME: SA Query Transaction ID",
  762. trans_id, WLAN_SA_QUERY_TR_ID_LEN);
  763. req[0] = WLAN_ACTION_SA_QUERY;
  764. req[1] = WLAN_SA_QUERY_REQUEST;
  765. os_memcpy(req + 2, trans_id, WLAN_SA_QUERY_TR_ID_LEN);
  766. if (wpa_drv_send_action(wpa_s, wpa_s->assoc_freq, 0, wpa_s->bssid,
  767. wpa_s->own_addr, wpa_s->bssid,
  768. req, sizeof(req), 0) < 0)
  769. wpa_msg(wpa_s, MSG_INFO, "SME: Failed to send SA Query "
  770. "Request");
  771. }
  772. static void sme_sa_query_timer(void *eloop_ctx, void *timeout_ctx)
  773. {
  774. struct wpa_supplicant *wpa_s = eloop_ctx;
  775. unsigned int timeout, sec, usec;
  776. u8 *trans_id, *nbuf;
  777. if (wpa_s->sme.sa_query_count > 0 &&
  778. sme_check_sa_query_timeout(wpa_s))
  779. return;
  780. nbuf = os_realloc(wpa_s->sme.sa_query_trans_id,
  781. (wpa_s->sme.sa_query_count + 1) *
  782. WLAN_SA_QUERY_TR_ID_LEN);
  783. if (nbuf == NULL)
  784. return;
  785. if (wpa_s->sme.sa_query_count == 0) {
  786. /* Starting a new SA Query procedure */
  787. os_get_time(&wpa_s->sme.sa_query_start);
  788. }
  789. trans_id = nbuf + wpa_s->sme.sa_query_count * WLAN_SA_QUERY_TR_ID_LEN;
  790. wpa_s->sme.sa_query_trans_id = nbuf;
  791. wpa_s->sme.sa_query_count++;
  792. os_get_random(trans_id, WLAN_SA_QUERY_TR_ID_LEN);
  793. timeout = sa_query_retry_timeout;
  794. sec = ((timeout / 1000) * 1024) / 1000;
  795. usec = (timeout % 1000) * 1024;
  796. eloop_register_timeout(sec, usec, sme_sa_query_timer, wpa_s, NULL);
  797. wpa_dbg(wpa_s, MSG_DEBUG, "SME: Association SA Query attempt %d",
  798. wpa_s->sme.sa_query_count);
  799. sme_send_sa_query_req(wpa_s, trans_id);
  800. }
  801. static void sme_start_sa_query(struct wpa_supplicant *wpa_s)
  802. {
  803. sme_sa_query_timer(wpa_s, NULL);
  804. }
  805. static void sme_stop_sa_query(struct wpa_supplicant *wpa_s)
  806. {
  807. eloop_cancel_timeout(sme_sa_query_timer, wpa_s, NULL);
  808. os_free(wpa_s->sme.sa_query_trans_id);
  809. wpa_s->sme.sa_query_trans_id = NULL;
  810. wpa_s->sme.sa_query_count = 0;
  811. }
  812. void sme_event_unprot_disconnect(struct wpa_supplicant *wpa_s, const u8 *sa,
  813. const u8 *da, u16 reason_code)
  814. {
  815. struct wpa_ssid *ssid;
  816. if (!(wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME))
  817. return;
  818. if (wpa_s->wpa_state != WPA_COMPLETED)
  819. return;
  820. ssid = wpa_s->current_ssid;
  821. if (ssid == NULL || ssid->ieee80211w == 0)
  822. return;
  823. if (os_memcmp(sa, wpa_s->bssid, ETH_ALEN) != 0)
  824. return;
  825. if (reason_code != WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA &&
  826. reason_code != WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA)
  827. return;
  828. if (wpa_s->sme.sa_query_count > 0)
  829. return;
  830. wpa_dbg(wpa_s, MSG_DEBUG, "SME: Unprotected disconnect dropped - "
  831. "possible AP/STA state mismatch - trigger SA Query");
  832. sme_start_sa_query(wpa_s);
  833. }
  834. void sme_sa_query_rx(struct wpa_supplicant *wpa_s, const u8 *sa,
  835. const u8 *data, size_t len)
  836. {
  837. int i;
  838. if (wpa_s->sme.sa_query_trans_id == NULL ||
  839. len < 1 + WLAN_SA_QUERY_TR_ID_LEN ||
  840. data[0] != WLAN_SA_QUERY_RESPONSE)
  841. return;
  842. wpa_dbg(wpa_s, MSG_DEBUG, "SME: Received SA Query response from "
  843. MACSTR " (trans_id %02x%02x)", MAC2STR(sa), data[1], data[2]);
  844. if (os_memcmp(sa, wpa_s->bssid, ETH_ALEN) != 0)
  845. return;
  846. for (i = 0; i < wpa_s->sme.sa_query_count; i++) {
  847. if (os_memcmp(wpa_s->sme.sa_query_trans_id +
  848. i * WLAN_SA_QUERY_TR_ID_LEN,
  849. data + 1, WLAN_SA_QUERY_TR_ID_LEN) == 0)
  850. break;
  851. }
  852. if (i >= wpa_s->sme.sa_query_count) {
  853. wpa_dbg(wpa_s, MSG_DEBUG, "SME: No matching SA Query "
  854. "transaction identifier found");
  855. return;
  856. }
  857. wpa_dbg(wpa_s, MSG_DEBUG, "SME: Reply to pending SA Query received "
  858. "from " MACSTR, MAC2STR(sa));
  859. sme_stop_sa_query(wpa_s);
  860. }
  861. #endif /* CONFIG_IEEE80211W */