events.c 30 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130
  1. /*
  2. * WPA Supplicant - Driver event processing
  3. * Copyright (c) 2003-2008, Jouni Malinen <j@w1.fi>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 as
  7. * published by the Free Software Foundation.
  8. *
  9. * Alternatively, this software may be distributed under the terms of BSD
  10. * license.
  11. *
  12. * See README and COPYING for more details.
  13. */
  14. #include "includes.h"
  15. #include "common.h"
  16. #include "eapol_supp/eapol_supp_sm.h"
  17. #include "wpa.h"
  18. #include "eloop.h"
  19. #include "drivers/driver.h"
  20. #include "config.h"
  21. #include "l2_packet/l2_packet.h"
  22. #include "wpa_supplicant_i.h"
  23. #include "pcsc_funcs.h"
  24. #include "preauth.h"
  25. #include "pmksa_cache.h"
  26. #include "wpa_ctrl.h"
  27. #include "eap_peer/eap.h"
  28. #include "ctrl_iface_dbus.h"
  29. #include "ieee802_11_defs.h"
  30. #include "blacklist.h"
  31. #include "wpas_glue.h"
  32. #include "wps_supplicant.h"
  33. #include "ibss_rsn.h"
  34. static int wpa_supplicant_select_config(struct wpa_supplicant *wpa_s)
  35. {
  36. struct wpa_ssid *ssid;
  37. if (wpa_s->conf->ap_scan == 1 && wpa_s->current_ssid)
  38. return 0;
  39. wpa_printf(MSG_DEBUG, "Select network based on association "
  40. "information");
  41. ssid = wpa_supplicant_get_ssid(wpa_s);
  42. if (ssid == NULL) {
  43. wpa_printf(MSG_INFO, "No network configuration found for the "
  44. "current AP");
  45. return -1;
  46. }
  47. if (ssid->disabled) {
  48. wpa_printf(MSG_DEBUG, "Selected network is disabled");
  49. return -1;
  50. }
  51. wpa_printf(MSG_DEBUG, "Network configuration found for the current "
  52. "AP");
  53. if (ssid->key_mgmt & (WPA_KEY_MGMT_PSK | WPA_KEY_MGMT_IEEE8021X |
  54. WPA_KEY_MGMT_WPA_NONE |
  55. WPA_KEY_MGMT_FT_PSK | WPA_KEY_MGMT_FT_IEEE8021X |
  56. WPA_KEY_MGMT_PSK_SHA256 |
  57. WPA_KEY_MGMT_IEEE8021X_SHA256)) {
  58. u8 wpa_ie[80];
  59. size_t wpa_ie_len = sizeof(wpa_ie);
  60. wpa_supplicant_set_suites(wpa_s, NULL, ssid,
  61. wpa_ie, &wpa_ie_len);
  62. } else {
  63. wpa_supplicant_set_non_wpa_policy(wpa_s, ssid);
  64. }
  65. if (wpa_s->current_ssid && wpa_s->current_ssid != ssid)
  66. eapol_sm_invalidate_cached_session(wpa_s->eapol);
  67. wpa_s->current_ssid = ssid;
  68. wpa_supplicant_rsn_supp_set_config(wpa_s, wpa_s->current_ssid);
  69. wpa_supplicant_initiate_eapol(wpa_s);
  70. return 0;
  71. }
  72. static void wpa_supplicant_stop_countermeasures(void *eloop_ctx,
  73. void *sock_ctx)
  74. {
  75. struct wpa_supplicant *wpa_s = eloop_ctx;
  76. if (wpa_s->countermeasures) {
  77. wpa_s->countermeasures = 0;
  78. wpa_drv_set_countermeasures(wpa_s, 0);
  79. wpa_msg(wpa_s, MSG_INFO, "WPA: TKIP countermeasures stopped");
  80. wpa_supplicant_req_scan(wpa_s, 0, 0);
  81. }
  82. }
  83. void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s)
  84. {
  85. wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED);
  86. os_memset(wpa_s->bssid, 0, ETH_ALEN);
  87. os_memset(wpa_s->pending_bssid, 0, ETH_ALEN);
  88. eapol_sm_notify_portEnabled(wpa_s->eapol, FALSE);
  89. eapol_sm_notify_portValid(wpa_s->eapol, FALSE);
  90. if (wpa_key_mgmt_wpa_psk(wpa_s->key_mgmt))
  91. eapol_sm_notify_eap_success(wpa_s->eapol, FALSE);
  92. wpa_s->ap_ies_from_associnfo = 0;
  93. }
  94. static void wpa_find_assoc_pmkid(struct wpa_supplicant *wpa_s)
  95. {
  96. struct wpa_ie_data ie;
  97. int pmksa_set = -1;
  98. size_t i;
  99. if (wpa_sm_parse_own_wpa_ie(wpa_s->wpa, &ie) < 0 ||
  100. ie.pmkid == NULL)
  101. return;
  102. for (i = 0; i < ie.num_pmkid; i++) {
  103. pmksa_set = pmksa_cache_set_current(wpa_s->wpa,
  104. ie.pmkid + i * PMKID_LEN,
  105. NULL, NULL, 0);
  106. if (pmksa_set == 0) {
  107. eapol_sm_notify_pmkid_attempt(wpa_s->eapol, 1);
  108. break;
  109. }
  110. }
  111. wpa_printf(MSG_DEBUG, "RSN: PMKID from assoc IE %sfound from PMKSA "
  112. "cache", pmksa_set == 0 ? "" : "not ");
  113. }
  114. static void wpa_supplicant_event_pmkid_candidate(struct wpa_supplicant *wpa_s,
  115. union wpa_event_data *data)
  116. {
  117. if (data == NULL) {
  118. wpa_printf(MSG_DEBUG, "RSN: No data in PMKID candidate event");
  119. return;
  120. }
  121. wpa_printf(MSG_DEBUG, "RSN: PMKID candidate event - bssid=" MACSTR
  122. " index=%d preauth=%d",
  123. MAC2STR(data->pmkid_candidate.bssid),
  124. data->pmkid_candidate.index,
  125. data->pmkid_candidate.preauth);
  126. pmksa_candidate_add(wpa_s->wpa, data->pmkid_candidate.bssid,
  127. data->pmkid_candidate.index,
  128. data->pmkid_candidate.preauth);
  129. }
  130. static int wpa_supplicant_dynamic_keys(struct wpa_supplicant *wpa_s)
  131. {
  132. if (wpa_s->key_mgmt == WPA_KEY_MGMT_NONE ||
  133. wpa_s->key_mgmt == WPA_KEY_MGMT_WPA_NONE)
  134. return 0;
  135. #ifdef IEEE8021X_EAPOL
  136. if (wpa_s->key_mgmt == WPA_KEY_MGMT_IEEE8021X_NO_WPA &&
  137. wpa_s->current_ssid &&
  138. !(wpa_s->current_ssid->eapol_flags &
  139. (EAPOL_FLAG_REQUIRE_KEY_UNICAST |
  140. EAPOL_FLAG_REQUIRE_KEY_BROADCAST))) {
  141. /* IEEE 802.1X, but not using dynamic WEP keys (i.e., either
  142. * plaintext or static WEP keys). */
  143. return 0;
  144. }
  145. #endif /* IEEE8021X_EAPOL */
  146. return 1;
  147. }
  148. /**
  149. * wpa_supplicant_scard_init - Initialize SIM/USIM access with PC/SC
  150. * @wpa_s: pointer to wpa_supplicant data
  151. * @ssid: Configuration data for the network
  152. * Returns: 0 on success, -1 on failure
  153. *
  154. * This function is called when starting authentication with a network that is
  155. * configured to use PC/SC for SIM/USIM access (EAP-SIM or EAP-AKA).
  156. */
  157. int wpa_supplicant_scard_init(struct wpa_supplicant *wpa_s,
  158. struct wpa_ssid *ssid)
  159. {
  160. #ifdef IEEE8021X_EAPOL
  161. int aka = 0, sim = 0, type;
  162. if (ssid->eap.pcsc == NULL || wpa_s->scard != NULL)
  163. return 0;
  164. if (ssid->eap.eap_methods == NULL) {
  165. sim = 1;
  166. aka = 1;
  167. } else {
  168. struct eap_method_type *eap = ssid->eap.eap_methods;
  169. while (eap->vendor != EAP_VENDOR_IETF ||
  170. eap->method != EAP_TYPE_NONE) {
  171. if (eap->vendor == EAP_VENDOR_IETF) {
  172. if (eap->method == EAP_TYPE_SIM)
  173. sim = 1;
  174. else if (eap->method == EAP_TYPE_AKA)
  175. aka = 1;
  176. }
  177. eap++;
  178. }
  179. }
  180. if (eap_peer_get_eap_method(EAP_VENDOR_IETF, EAP_TYPE_SIM) == NULL)
  181. sim = 0;
  182. if (eap_peer_get_eap_method(EAP_VENDOR_IETF, EAP_TYPE_AKA) == NULL)
  183. aka = 0;
  184. if (!sim && !aka) {
  185. wpa_printf(MSG_DEBUG, "Selected network is configured to use "
  186. "SIM, but neither EAP-SIM nor EAP-AKA are enabled");
  187. return 0;
  188. }
  189. wpa_printf(MSG_DEBUG, "Selected network is configured to use SIM "
  190. "(sim=%d aka=%d) - initialize PCSC", sim, aka);
  191. if (sim && aka)
  192. type = SCARD_TRY_BOTH;
  193. else if (aka)
  194. type = SCARD_USIM_ONLY;
  195. else
  196. type = SCARD_GSM_SIM_ONLY;
  197. wpa_s->scard = scard_init(type);
  198. if (wpa_s->scard == NULL) {
  199. wpa_printf(MSG_WARNING, "Failed to initialize SIM "
  200. "(pcsc-lite)");
  201. return -1;
  202. }
  203. wpa_sm_set_scard_ctx(wpa_s->wpa, wpa_s->scard);
  204. eapol_sm_register_scard_ctx(wpa_s->eapol, wpa_s->scard);
  205. #endif /* IEEE8021X_EAPOL */
  206. return 0;
  207. }
  208. #ifndef CONFIG_NO_SCAN_PROCESSING
  209. static int wpa_supplicant_match_privacy(struct wpa_scan_res *bss,
  210. struct wpa_ssid *ssid)
  211. {
  212. int i, privacy = 0;
  213. if (ssid->mixed_cell)
  214. return 1;
  215. for (i = 0; i < NUM_WEP_KEYS; i++) {
  216. if (ssid->wep_key_len[i]) {
  217. privacy = 1;
  218. break;
  219. }
  220. }
  221. #ifdef IEEE8021X_EAPOL
  222. if ((ssid->key_mgmt & WPA_KEY_MGMT_IEEE8021X_NO_WPA) &&
  223. ssid->eapol_flags & (EAPOL_FLAG_REQUIRE_KEY_UNICAST |
  224. EAPOL_FLAG_REQUIRE_KEY_BROADCAST))
  225. privacy = 1;
  226. #endif /* IEEE8021X_EAPOL */
  227. if (bss->caps & IEEE80211_CAP_PRIVACY)
  228. return privacy;
  229. return !privacy;
  230. }
  231. static int wpa_supplicant_ssid_bss_match(struct wpa_ssid *ssid,
  232. struct wpa_scan_res *bss)
  233. {
  234. struct wpa_ie_data ie;
  235. int proto_match = 0;
  236. const u8 *rsn_ie, *wpa_ie;
  237. int ret;
  238. ret = wpas_wps_ssid_bss_match(ssid, bss);
  239. if (ret >= 0)
  240. return ret;
  241. rsn_ie = wpa_scan_get_ie(bss, WLAN_EID_RSN);
  242. while ((ssid->proto & WPA_PROTO_RSN) && rsn_ie) {
  243. proto_match++;
  244. if (wpa_parse_wpa_ie(rsn_ie, 2 + rsn_ie[1], &ie)) {
  245. wpa_printf(MSG_DEBUG, " skip RSN IE - parse failed");
  246. break;
  247. }
  248. if (!(ie.proto & ssid->proto)) {
  249. wpa_printf(MSG_DEBUG, " skip RSN IE - proto "
  250. "mismatch");
  251. break;
  252. }
  253. if (!(ie.pairwise_cipher & ssid->pairwise_cipher)) {
  254. wpa_printf(MSG_DEBUG, " skip RSN IE - PTK cipher "
  255. "mismatch");
  256. break;
  257. }
  258. if (!(ie.group_cipher & ssid->group_cipher)) {
  259. wpa_printf(MSG_DEBUG, " skip RSN IE - GTK cipher "
  260. "mismatch");
  261. break;
  262. }
  263. if (!(ie.key_mgmt & ssid->key_mgmt)) {
  264. wpa_printf(MSG_DEBUG, " skip RSN IE - key mgmt "
  265. "mismatch");
  266. break;
  267. }
  268. #ifdef CONFIG_IEEE80211W
  269. if (!(ie.capabilities & WPA_CAPABILITY_MFPC) &&
  270. ssid->ieee80211w == IEEE80211W_REQUIRED) {
  271. wpa_printf(MSG_DEBUG, " skip RSN IE - no mgmt frame "
  272. "protection");
  273. break;
  274. }
  275. #endif /* CONFIG_IEEE80211W */
  276. wpa_printf(MSG_DEBUG, " selected based on RSN IE");
  277. return 1;
  278. }
  279. wpa_ie = wpa_scan_get_vendor_ie(bss, WPA_IE_VENDOR_TYPE);
  280. while ((ssid->proto & WPA_PROTO_WPA) && wpa_ie) {
  281. proto_match++;
  282. if (wpa_parse_wpa_ie(wpa_ie, 2 + wpa_ie[1], &ie)) {
  283. wpa_printf(MSG_DEBUG, " skip WPA IE - parse failed");
  284. break;
  285. }
  286. if (!(ie.proto & ssid->proto)) {
  287. wpa_printf(MSG_DEBUG, " skip WPA IE - proto "
  288. "mismatch");
  289. break;
  290. }
  291. if (!(ie.pairwise_cipher & ssid->pairwise_cipher)) {
  292. wpa_printf(MSG_DEBUG, " skip WPA IE - PTK cipher "
  293. "mismatch");
  294. break;
  295. }
  296. if (!(ie.group_cipher & ssid->group_cipher)) {
  297. wpa_printf(MSG_DEBUG, " skip WPA IE - GTK cipher "
  298. "mismatch");
  299. break;
  300. }
  301. if (!(ie.key_mgmt & ssid->key_mgmt)) {
  302. wpa_printf(MSG_DEBUG, " skip WPA IE - key mgmt "
  303. "mismatch");
  304. break;
  305. }
  306. wpa_printf(MSG_DEBUG, " selected based on WPA IE");
  307. return 1;
  308. }
  309. if (proto_match == 0)
  310. wpa_printf(MSG_DEBUG, " skip - no WPA/RSN proto match");
  311. return 0;
  312. }
  313. static struct wpa_scan_res *
  314. wpa_supplicant_select_bss_wpa(struct wpa_supplicant *wpa_s,
  315. struct wpa_ssid *group,
  316. struct wpa_ssid **selected_ssid)
  317. {
  318. struct wpa_ssid *ssid;
  319. struct wpa_scan_res *bss;
  320. size_t i;
  321. struct wpa_blacklist *e;
  322. const u8 *ie;
  323. wpa_printf(MSG_DEBUG, "Try to find WPA-enabled AP");
  324. for (i = 0; i < wpa_s->scan_res->num; i++) {
  325. const u8 *ssid_;
  326. u8 wpa_ie_len, rsn_ie_len, ssid_len;
  327. bss = wpa_s->scan_res->res[i];
  328. ie = wpa_scan_get_ie(bss, WLAN_EID_SSID);
  329. ssid_ = ie ? ie + 2 : (u8 *) "";
  330. ssid_len = ie ? ie[1] : 0;
  331. ie = wpa_scan_get_vendor_ie(bss, WPA_IE_VENDOR_TYPE);
  332. wpa_ie_len = ie ? ie[1] : 0;
  333. ie = wpa_scan_get_ie(bss, WLAN_EID_RSN);
  334. rsn_ie_len = ie ? ie[1] : 0;
  335. wpa_printf(MSG_DEBUG, "%d: " MACSTR " ssid='%s' "
  336. "wpa_ie_len=%u rsn_ie_len=%u caps=0x%x",
  337. (int) i, MAC2STR(bss->bssid),
  338. wpa_ssid_txt(ssid_, ssid_len),
  339. wpa_ie_len, rsn_ie_len, bss->caps);
  340. e = wpa_blacklist_get(wpa_s, bss->bssid);
  341. if (e && e->count > 1) {
  342. wpa_printf(MSG_DEBUG, " skip - blacklisted");
  343. continue;
  344. }
  345. if (wpa_ie_len == 0 && rsn_ie_len == 0) {
  346. wpa_printf(MSG_DEBUG, " skip - no WPA/RSN IE");
  347. continue;
  348. }
  349. for (ssid = group; ssid; ssid = ssid->pnext) {
  350. int check_ssid = 1;
  351. if (ssid->disabled) {
  352. wpa_printf(MSG_DEBUG, " skip - disabled");
  353. continue;
  354. }
  355. #ifdef CONFIG_WPS
  356. if (ssid->ssid_len == 0 &&
  357. wpas_wps_ssid_wildcard_ok(ssid, bss))
  358. check_ssid = 0;
  359. #endif /* CONFIG_WPS */
  360. if (check_ssid &&
  361. (ssid_len != ssid->ssid_len ||
  362. os_memcmp(ssid_, ssid->ssid, ssid_len) != 0)) {
  363. wpa_printf(MSG_DEBUG, " skip - "
  364. "SSID mismatch");
  365. continue;
  366. }
  367. if (ssid->bssid_set &&
  368. os_memcmp(bss->bssid, ssid->bssid, ETH_ALEN) != 0)
  369. {
  370. wpa_printf(MSG_DEBUG, " skip - "
  371. "BSSID mismatch");
  372. continue;
  373. }
  374. if (!wpa_supplicant_ssid_bss_match(ssid, bss))
  375. continue;
  376. wpa_printf(MSG_DEBUG, " selected WPA AP "
  377. MACSTR " ssid='%s'",
  378. MAC2STR(bss->bssid),
  379. wpa_ssid_txt(ssid_, ssid_len));
  380. *selected_ssid = ssid;
  381. return bss;
  382. }
  383. }
  384. return NULL;
  385. }
  386. static struct wpa_scan_res *
  387. wpa_supplicant_select_bss_non_wpa(struct wpa_supplicant *wpa_s,
  388. struct wpa_ssid *group,
  389. struct wpa_ssid **selected_ssid)
  390. {
  391. struct wpa_ssid *ssid;
  392. struct wpa_scan_res *bss;
  393. size_t i;
  394. struct wpa_blacklist *e;
  395. const u8 *ie;
  396. wpa_printf(MSG_DEBUG, "Try to find non-WPA AP");
  397. for (i = 0; i < wpa_s->scan_res->num; i++) {
  398. const u8 *ssid_;
  399. u8 wpa_ie_len, rsn_ie_len, ssid_len;
  400. bss = wpa_s->scan_res->res[i];
  401. ie = wpa_scan_get_ie(bss, WLAN_EID_SSID);
  402. ssid_ = ie ? ie + 2 : (u8 *) "";
  403. ssid_len = ie ? ie[1] : 0;
  404. ie = wpa_scan_get_vendor_ie(bss, WPA_IE_VENDOR_TYPE);
  405. wpa_ie_len = ie ? ie[1] : 0;
  406. ie = wpa_scan_get_ie(bss, WLAN_EID_RSN);
  407. rsn_ie_len = ie ? ie[1] : 0;
  408. wpa_printf(MSG_DEBUG, "%d: " MACSTR " ssid='%s' "
  409. "wpa_ie_len=%u rsn_ie_len=%u caps=0x%x",
  410. (int) i, MAC2STR(bss->bssid),
  411. wpa_ssid_txt(ssid_, ssid_len),
  412. wpa_ie_len, rsn_ie_len, bss->caps);
  413. e = wpa_blacklist_get(wpa_s, bss->bssid);
  414. if (e && e->count > 1) {
  415. wpa_printf(MSG_DEBUG, " skip - blacklisted");
  416. continue;
  417. }
  418. for (ssid = group; ssid; ssid = ssid->pnext) {
  419. int check_ssid = ssid->ssid_len != 0;
  420. if (ssid->disabled) {
  421. wpa_printf(MSG_DEBUG, " skip - disabled");
  422. continue;
  423. }
  424. #ifdef CONFIG_WPS
  425. if (ssid->key_mgmt & WPA_KEY_MGMT_WPS) {
  426. /* Only allow wildcard SSID match if an AP
  427. * advertises active WPS operation that matches
  428. * with our mode. */
  429. check_ssid = 1;
  430. if (ssid->ssid_len == 0 &&
  431. wpas_wps_ssid_wildcard_ok(ssid, bss))
  432. check_ssid = 0;
  433. }
  434. #endif /* CONFIG_WPS */
  435. if (check_ssid &&
  436. (ssid_len != ssid->ssid_len ||
  437. os_memcmp(ssid_, ssid->ssid, ssid_len) != 0)) {
  438. wpa_printf(MSG_DEBUG, " skip - "
  439. "SSID mismatch");
  440. continue;
  441. }
  442. if (ssid->bssid_set &&
  443. os_memcmp(bss->bssid, ssid->bssid, ETH_ALEN) != 0)
  444. {
  445. wpa_printf(MSG_DEBUG, " skip - "
  446. "BSSID mismatch");
  447. continue;
  448. }
  449. if (!(ssid->key_mgmt & WPA_KEY_MGMT_NONE) &&
  450. !(ssid->key_mgmt & WPA_KEY_MGMT_WPS) &&
  451. !(ssid->key_mgmt & WPA_KEY_MGMT_IEEE8021X_NO_WPA))
  452. {
  453. wpa_printf(MSG_DEBUG, " skip - "
  454. "non-WPA network not allowed");
  455. continue;
  456. }
  457. if ((ssid->key_mgmt &
  458. (WPA_KEY_MGMT_IEEE8021X | WPA_KEY_MGMT_PSK |
  459. WPA_KEY_MGMT_FT_IEEE8021X | WPA_KEY_MGMT_FT_PSK |
  460. WPA_KEY_MGMT_IEEE8021X_SHA256 |
  461. WPA_KEY_MGMT_PSK_SHA256)) &&
  462. (wpa_ie_len != 0 || rsn_ie_len != 0)) {
  463. wpa_printf(MSG_DEBUG, " skip - "
  464. "WPA network");
  465. continue;
  466. }
  467. if (!wpa_supplicant_match_privacy(bss, ssid)) {
  468. wpa_printf(MSG_DEBUG, " skip - "
  469. "privacy mismatch");
  470. continue;
  471. }
  472. if (bss->caps & IEEE80211_CAP_IBSS) {
  473. wpa_printf(MSG_DEBUG, " skip - "
  474. "IBSS (adhoc) network");
  475. continue;
  476. }
  477. wpa_printf(MSG_DEBUG, " selected non-WPA AP "
  478. MACSTR " ssid='%s'",
  479. MAC2STR(bss->bssid),
  480. wpa_ssid_txt(ssid_, ssid_len));
  481. *selected_ssid = ssid;
  482. return bss;
  483. }
  484. }
  485. return NULL;
  486. }
  487. static struct wpa_scan_res *
  488. wpa_supplicant_select_bss(struct wpa_supplicant *wpa_s, struct wpa_ssid *group,
  489. struct wpa_ssid **selected_ssid)
  490. {
  491. struct wpa_scan_res *selected;
  492. wpa_printf(MSG_DEBUG, "Selecting BSS from priority group %d",
  493. group->priority);
  494. /* First, try to find WPA-enabled AP */
  495. selected = wpa_supplicant_select_bss_wpa(wpa_s, group, selected_ssid);
  496. if (selected)
  497. return selected;
  498. /* If no WPA-enabled AP found, try to find non-WPA AP, if configuration
  499. * allows this. */
  500. return wpa_supplicant_select_bss_non_wpa(wpa_s, group, selected_ssid);
  501. }
  502. static void wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s)
  503. {
  504. int prio, timeout;
  505. struct wpa_scan_res *selected = NULL;
  506. struct wpa_ssid *ssid = NULL;
  507. if (wpa_supplicant_get_scan_results(wpa_s) < 0) {
  508. if (wpa_s->conf->ap_scan == 2)
  509. return;
  510. wpa_printf(MSG_DEBUG, "Failed to get scan results - try "
  511. "scanning again");
  512. timeout = 1;
  513. goto req_scan;
  514. }
  515. /*
  516. * Don't post the results if this was the initial cached
  517. * and there were no results.
  518. */
  519. if (wpa_s->scan_res_tried == 1 && wpa_s->conf->ap_scan == 1 &&
  520. wpa_s->scan_res->num == 0) {
  521. wpa_msg(wpa_s, MSG_DEBUG, "Cached scan results are "
  522. "empty - not posting");
  523. } else {
  524. wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_SCAN_RESULTS);
  525. wpa_supplicant_dbus_notify_scan_results(wpa_s);
  526. wpas_wps_notify_scan_results(wpa_s);
  527. }
  528. if ((wpa_s->conf->ap_scan == 2 && !wpas_wps_searching(wpa_s)) ||
  529. wpa_s->disconnected)
  530. return;
  531. while (selected == NULL) {
  532. for (prio = 0; prio < wpa_s->conf->num_prio; prio++) {
  533. selected = wpa_supplicant_select_bss(
  534. wpa_s, wpa_s->conf->pssid[prio], &ssid);
  535. if (selected)
  536. break;
  537. }
  538. if (selected == NULL && wpa_s->blacklist) {
  539. wpa_printf(MSG_DEBUG, "No APs found - clear blacklist "
  540. "and try again");
  541. wpa_blacklist_clear(wpa_s);
  542. } else if (selected == NULL) {
  543. break;
  544. }
  545. }
  546. if (selected) {
  547. if (wpas_wps_scan_pbc_overlap(wpa_s, selected, ssid)) {
  548. wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_OVERLAP
  549. "PBC session overlap");
  550. timeout = 10;
  551. goto req_scan;
  552. }
  553. /* Do not trigger new association unless the BSSID has changed
  554. * or if reassociation is requested. If we are in process of
  555. * associating with the selected BSSID, do not trigger new
  556. * attempt. */
  557. if (wpa_s->reassociate ||
  558. (os_memcmp(selected->bssid, wpa_s->bssid, ETH_ALEN) != 0 &&
  559. (wpa_s->wpa_state != WPA_ASSOCIATING ||
  560. os_memcmp(selected->bssid, wpa_s->pending_bssid,
  561. ETH_ALEN) != 0))) {
  562. if (wpa_supplicant_scard_init(wpa_s, ssid)) {
  563. wpa_supplicant_req_scan(wpa_s, 10, 0);
  564. return;
  565. }
  566. wpa_supplicant_associate(wpa_s, selected, ssid);
  567. } else {
  568. wpa_printf(MSG_DEBUG, "Already associated with the "
  569. "selected AP.");
  570. }
  571. rsn_preauth_scan_results(wpa_s->wpa, wpa_s->scan_res);
  572. } else {
  573. wpa_printf(MSG_DEBUG, "No suitable AP found.");
  574. timeout = 5;
  575. goto req_scan;
  576. }
  577. return;
  578. req_scan:
  579. if (wpa_s->scan_res_tried == 1 && wpa_s->conf->ap_scan == 1) {
  580. /*
  581. * Quick recovery if the initial scan results were not
  582. * complete when fetched before the first scan request.
  583. */
  584. wpa_s->scan_res_tried++;
  585. timeout = 0;
  586. }
  587. wpa_supplicant_req_scan(wpa_s, timeout, 0);
  588. }
  589. #endif /* CONFIG_NO_SCAN_PROCESSING */
  590. static void wpa_supplicant_event_associnfo(struct wpa_supplicant *wpa_s,
  591. union wpa_event_data *data)
  592. {
  593. int l, len, found = 0, wpa_found, rsn_found;
  594. u8 *p;
  595. wpa_printf(MSG_DEBUG, "Association info event");
  596. if (data->assoc_info.req_ies)
  597. wpa_hexdump(MSG_DEBUG, "req_ies", data->assoc_info.req_ies,
  598. data->assoc_info.req_ies_len);
  599. if (data->assoc_info.resp_ies)
  600. wpa_hexdump(MSG_DEBUG, "resp_ies", data->assoc_info.resp_ies,
  601. data->assoc_info.resp_ies_len);
  602. if (data->assoc_info.beacon_ies)
  603. wpa_hexdump(MSG_DEBUG, "beacon_ies",
  604. data->assoc_info.beacon_ies,
  605. data->assoc_info.beacon_ies_len);
  606. p = data->assoc_info.req_ies;
  607. l = data->assoc_info.req_ies_len;
  608. /* Go through the IEs and make a copy of the WPA/RSN IE, if present. */
  609. while (p && l >= 2) {
  610. len = p[1] + 2;
  611. if (len > l) {
  612. wpa_hexdump(MSG_DEBUG, "Truncated IE in assoc_info",
  613. p, l);
  614. break;
  615. }
  616. if ((p[0] == WLAN_EID_VENDOR_SPECIFIC && p[1] >= 6 &&
  617. (os_memcmp(&p[2], "\x00\x50\xF2\x01\x01\x00", 6) == 0)) ||
  618. (p[0] == WLAN_EID_RSN && p[1] >= 2)) {
  619. if (wpa_sm_set_assoc_wpa_ie(wpa_s->wpa, p, len))
  620. break;
  621. found = 1;
  622. wpa_find_assoc_pmkid(wpa_s);
  623. break;
  624. }
  625. l -= len;
  626. p += len;
  627. }
  628. if (!found && data->assoc_info.req_ies)
  629. wpa_sm_set_assoc_wpa_ie(wpa_s->wpa, NULL, 0);
  630. /* WPA/RSN IE from Beacon/ProbeResp */
  631. p = data->assoc_info.beacon_ies;
  632. l = data->assoc_info.beacon_ies_len;
  633. /* Go through the IEs and make a copy of the WPA/RSN IEs, if present.
  634. */
  635. wpa_found = rsn_found = 0;
  636. while (p && l >= 2) {
  637. len = p[1] + 2;
  638. if (len > l) {
  639. wpa_hexdump(MSG_DEBUG, "Truncated IE in beacon_ies",
  640. p, l);
  641. break;
  642. }
  643. if (!wpa_found &&
  644. p[0] == WLAN_EID_VENDOR_SPECIFIC && p[1] >= 6 &&
  645. os_memcmp(&p[2], "\x00\x50\xF2\x01\x01\x00", 6) == 0) {
  646. wpa_found = 1;
  647. wpa_sm_set_ap_wpa_ie(wpa_s->wpa, p, len);
  648. }
  649. if (!rsn_found &&
  650. p[0] == WLAN_EID_RSN && p[1] >= 2) {
  651. rsn_found = 1;
  652. wpa_sm_set_ap_rsn_ie(wpa_s->wpa, p, len);
  653. }
  654. l -= len;
  655. p += len;
  656. }
  657. if (!wpa_found && data->assoc_info.beacon_ies)
  658. wpa_sm_set_ap_wpa_ie(wpa_s->wpa, NULL, 0);
  659. if (!rsn_found && data->assoc_info.beacon_ies)
  660. wpa_sm_set_ap_rsn_ie(wpa_s->wpa, NULL, 0);
  661. if (wpa_found || rsn_found)
  662. wpa_s->ap_ies_from_associnfo = 1;
  663. }
  664. static void wpa_supplicant_event_assoc(struct wpa_supplicant *wpa_s,
  665. union wpa_event_data *data)
  666. {
  667. u8 bssid[ETH_ALEN];
  668. int ft_completed = wpa_ft_is_completed(wpa_s->wpa);
  669. if (data)
  670. wpa_supplicant_event_associnfo(wpa_s, data);
  671. wpa_supplicant_set_state(wpa_s, WPA_ASSOCIATED);
  672. if (wpa_s->use_client_mlme)
  673. os_memcpy(bssid, wpa_s->bssid, ETH_ALEN);
  674. if (wpa_s->use_client_mlme ||
  675. (wpa_drv_get_bssid(wpa_s, bssid) >= 0 &&
  676. os_memcmp(bssid, wpa_s->bssid, ETH_ALEN) != 0)) {
  677. wpa_msg(wpa_s, MSG_DEBUG, "Associated to a new BSS: BSSID="
  678. MACSTR, MAC2STR(bssid));
  679. os_memcpy(wpa_s->bssid, bssid, ETH_ALEN);
  680. os_memset(wpa_s->pending_bssid, 0, ETH_ALEN);
  681. if (wpa_supplicant_dynamic_keys(wpa_s) && !ft_completed) {
  682. wpa_clear_keys(wpa_s, bssid);
  683. }
  684. if (wpa_supplicant_select_config(wpa_s) < 0) {
  685. wpa_supplicant_disassociate(
  686. wpa_s, WLAN_REASON_DEAUTH_LEAVING);
  687. return;
  688. }
  689. }
  690. wpa_msg(wpa_s, MSG_INFO, "Associated with " MACSTR, MAC2STR(bssid));
  691. if (wpa_s->current_ssid) {
  692. /* When using scanning (ap_scan=1), SIM PC/SC interface can be
  693. * initialized before association, but for other modes,
  694. * initialize PC/SC here, if the current configuration needs
  695. * smartcard or SIM/USIM. */
  696. wpa_supplicant_scard_init(wpa_s, wpa_s->current_ssid);
  697. }
  698. wpa_sm_notify_assoc(wpa_s->wpa, bssid);
  699. l2_packet_notify_auth_start(wpa_s->l2);
  700. /*
  701. * Set portEnabled first to FALSE in order to get EAP state machine out
  702. * of the SUCCESS state and eapSuccess cleared. Without this, EAPOL PAE
  703. * state machine may transit to AUTHENTICATING state based on obsolete
  704. * eapSuccess and then trigger BE_AUTH to SUCCESS and PAE to
  705. * AUTHENTICATED without ever giving chance to EAP state machine to
  706. * reset the state.
  707. */
  708. if (!ft_completed) {
  709. eapol_sm_notify_portEnabled(wpa_s->eapol, FALSE);
  710. eapol_sm_notify_portValid(wpa_s->eapol, FALSE);
  711. }
  712. if (wpa_key_mgmt_wpa_psk(wpa_s->key_mgmt) || ft_completed)
  713. eapol_sm_notify_eap_success(wpa_s->eapol, FALSE);
  714. /* 802.1X::portControl = Auto */
  715. eapol_sm_notify_portEnabled(wpa_s->eapol, TRUE);
  716. wpa_s->eapol_received = 0;
  717. if (wpa_s->key_mgmt == WPA_KEY_MGMT_NONE ||
  718. wpa_s->key_mgmt == WPA_KEY_MGMT_WPA_NONE) {
  719. wpa_supplicant_cancel_auth_timeout(wpa_s);
  720. wpa_supplicant_set_state(wpa_s, WPA_COMPLETED);
  721. } else if (!ft_completed) {
  722. /* Timeout for receiving the first EAPOL packet */
  723. wpa_supplicant_req_auth_timeout(wpa_s, 10, 0);
  724. }
  725. wpa_supplicant_cancel_scan(wpa_s);
  726. if (wpa_s->driver_4way_handshake &&
  727. wpa_key_mgmt_wpa_psk(wpa_s->key_mgmt)) {
  728. /*
  729. * We are done; the driver will take care of RSN 4-way
  730. * handshake.
  731. */
  732. wpa_supplicant_cancel_auth_timeout(wpa_s);
  733. wpa_supplicant_set_state(wpa_s, WPA_COMPLETED);
  734. eapol_sm_notify_portValid(wpa_s->eapol, TRUE);
  735. eapol_sm_notify_eap_success(wpa_s->eapol, TRUE);
  736. }
  737. }
  738. static void wpa_supplicant_event_disassoc(struct wpa_supplicant *wpa_s)
  739. {
  740. const u8 *bssid;
  741. if (wpa_s->key_mgmt == WPA_KEY_MGMT_WPA_NONE) {
  742. /*
  743. * At least Host AP driver and a Prism3 card seemed to be
  744. * generating streams of disconnected events when configuring
  745. * IBSS for WPA-None. Ignore them for now.
  746. */
  747. wpa_printf(MSG_DEBUG, "Disconnect event - ignore in "
  748. "IBSS/WPA-None mode");
  749. return;
  750. }
  751. if (wpa_s->wpa_state == WPA_4WAY_HANDSHAKE &&
  752. wpa_key_mgmt_wpa_psk(wpa_s->key_mgmt)) {
  753. wpa_msg(wpa_s, MSG_INFO, "WPA: 4-Way Handshake failed - "
  754. "pre-shared key may be incorrect");
  755. }
  756. if (wpa_s->wpa_state >= WPA_ASSOCIATED)
  757. wpa_supplicant_req_scan(wpa_s, 0, 100000);
  758. bssid = wpa_s->bssid;
  759. if (is_zero_ether_addr(bssid))
  760. bssid = wpa_s->pending_bssid;
  761. wpa_blacklist_add(wpa_s, bssid);
  762. wpa_sm_notify_disassoc(wpa_s->wpa);
  763. wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_DISCONNECTED "- Disconnect event - "
  764. "remove keys");
  765. if (wpa_supplicant_dynamic_keys(wpa_s)) {
  766. wpa_s->keys_cleared = 0;
  767. wpa_clear_keys(wpa_s, wpa_s->bssid);
  768. }
  769. wpa_supplicant_mark_disassoc(wpa_s);
  770. }
  771. #ifdef CONFIG_DELAYED_MIC_ERROR_REPORT
  772. static void wpa_supplicant_delayed_mic_error_report(void *eloop_ctx,
  773. void *sock_ctx)
  774. {
  775. struct wpa_supplicant *wpa_s = eloop_ctx;
  776. if (!wpa_s->pending_mic_error_report)
  777. return;
  778. wpa_printf(MSG_DEBUG, "WPA: Sending pending MIC error report");
  779. wpa_sm_key_request(wpa_s->wpa, 1, wpa_s->pending_mic_error_pairwise);
  780. wpa_s->pending_mic_error_report = 0;
  781. }
  782. #endif /* CONFIG_DELAYED_MIC_ERROR_REPORT */
  783. static void
  784. wpa_supplicant_event_michael_mic_failure(struct wpa_supplicant *wpa_s,
  785. union wpa_event_data *data)
  786. {
  787. int pairwise;
  788. struct os_time t;
  789. wpa_msg(wpa_s, MSG_WARNING, "Michael MIC failure detected");
  790. pairwise = (data && data->michael_mic_failure.unicast);
  791. os_get_time(&t);
  792. if ((wpa_s->last_michael_mic_error &&
  793. t.sec - wpa_s->last_michael_mic_error <= 60) ||
  794. wpa_s->pending_mic_error_report) {
  795. if (wpa_s->pending_mic_error_report) {
  796. /*
  797. * Send the pending MIC error report immediately since
  798. * we are going to start countermeasures and AP better
  799. * do the same.
  800. */
  801. wpa_sm_key_request(wpa_s->wpa, 1,
  802. wpa_s->pending_mic_error_pairwise);
  803. }
  804. /* Send the new MIC error report immediately since we are going
  805. * to start countermeasures and AP better do the same.
  806. */
  807. wpa_sm_key_request(wpa_s->wpa, 1, pairwise);
  808. /* initialize countermeasures */
  809. wpa_s->countermeasures = 1;
  810. wpa_msg(wpa_s, MSG_WARNING, "TKIP countermeasures started");
  811. /*
  812. * Need to wait for completion of request frame. We do not get
  813. * any callback for the message completion, so just wait a
  814. * short while and hope for the best. */
  815. os_sleep(0, 10000);
  816. wpa_drv_set_countermeasures(wpa_s, 1);
  817. wpa_supplicant_deauthenticate(wpa_s,
  818. WLAN_REASON_MICHAEL_MIC_FAILURE);
  819. eloop_cancel_timeout(wpa_supplicant_stop_countermeasures,
  820. wpa_s, NULL);
  821. eloop_register_timeout(60, 0,
  822. wpa_supplicant_stop_countermeasures,
  823. wpa_s, NULL);
  824. /* TODO: mark the AP rejected for 60 second. STA is
  825. * allowed to associate with another AP.. */
  826. } else {
  827. #ifdef CONFIG_DELAYED_MIC_ERROR_REPORT
  828. if (wpa_s->mic_errors_seen) {
  829. /*
  830. * Reduce the effectiveness of Michael MIC error
  831. * reports as a means for attacking against TKIP if
  832. * more than one MIC failure is noticed with the same
  833. * PTK. We delay the transmission of the reports by a
  834. * random time between 0 and 60 seconds in order to
  835. * force the attacker wait 60 seconds before getting
  836. * the information on whether a frame resulted in a MIC
  837. * failure.
  838. */
  839. u8 rval[4];
  840. int sec;
  841. if (os_get_random(rval, sizeof(rval)) < 0)
  842. sec = os_random() % 60;
  843. else
  844. sec = WPA_GET_BE32(rval) % 60;
  845. wpa_printf(MSG_DEBUG, "WPA: Delay MIC error report %d "
  846. "seconds", sec);
  847. wpa_s->pending_mic_error_report = 1;
  848. wpa_s->pending_mic_error_pairwise = pairwise;
  849. eloop_cancel_timeout(
  850. wpa_supplicant_delayed_mic_error_report,
  851. wpa_s, NULL);
  852. eloop_register_timeout(
  853. sec, os_random() % 1000000,
  854. wpa_supplicant_delayed_mic_error_report,
  855. wpa_s, NULL);
  856. } else {
  857. wpa_sm_key_request(wpa_s->wpa, 1, pairwise);
  858. }
  859. #else /* CONFIG_DELAYED_MIC_ERROR_REPORT */
  860. wpa_sm_key_request(wpa_s->wpa, 1, pairwise);
  861. #endif /* CONFIG_DELAYED_MIC_ERROR_REPORT */
  862. }
  863. wpa_s->last_michael_mic_error = t.sec;
  864. wpa_s->mic_errors_seen++;
  865. }
  866. static void
  867. wpa_supplicant_event_interface_status(struct wpa_supplicant *wpa_s,
  868. union wpa_event_data *data)
  869. {
  870. if (os_strcmp(wpa_s->ifname, data->interface_status.ifname) != 0)
  871. return;
  872. switch (data->interface_status.ievent) {
  873. case EVENT_INTERFACE_ADDED:
  874. if (!wpa_s->interface_removed)
  875. break;
  876. wpa_s->interface_removed = 0;
  877. wpa_printf(MSG_DEBUG, "Configured interface was added.");
  878. if (wpa_supplicant_driver_init(wpa_s) < 0) {
  879. wpa_printf(MSG_INFO, "Failed to initialize the driver "
  880. "after interface was added.");
  881. }
  882. break;
  883. case EVENT_INTERFACE_REMOVED:
  884. wpa_printf(MSG_DEBUG, "Configured interface was removed.");
  885. wpa_s->interface_removed = 1;
  886. wpa_supplicant_mark_disassoc(wpa_s);
  887. l2_packet_deinit(wpa_s->l2);
  888. wpa_s->l2 = NULL;
  889. break;
  890. }
  891. }
  892. #ifdef CONFIG_PEERKEY
  893. static void
  894. wpa_supplicant_event_stkstart(struct wpa_supplicant *wpa_s,
  895. union wpa_event_data *data)
  896. {
  897. if (data == NULL)
  898. return;
  899. wpa_sm_stkstart(wpa_s->wpa, data->stkstart.peer);
  900. }
  901. #endif /* CONFIG_PEERKEY */
  902. #ifdef CONFIG_IEEE80211R
  903. static void
  904. wpa_supplicant_event_ft_response(struct wpa_supplicant *wpa_s,
  905. union wpa_event_data *data)
  906. {
  907. if (data == NULL)
  908. return;
  909. if (wpa_ft_process_response(wpa_s->wpa, data->ft_ies.ies,
  910. data->ft_ies.ies_len,
  911. data->ft_ies.ft_action,
  912. data->ft_ies.target_ap) < 0) {
  913. /* TODO: prevent MLME/driver from trying to associate? */
  914. }
  915. }
  916. #endif /* CONFIG_IEEE80211R */
  917. #ifdef CONFIG_IBSS_RSN
  918. static void wpa_supplicant_event_ibss_rsn_start(struct wpa_supplicant *wpa_s,
  919. union wpa_event_data *data)
  920. {
  921. if (data == NULL)
  922. return;
  923. ibss_rsn_start(wpa_s->ibss_rsn, data->ibss_rsn_start.peer);
  924. }
  925. #endif /* CONFIG_IBSS_RSN */
  926. void wpa_supplicant_event(void *ctx, wpa_event_type event,
  927. union wpa_event_data *data)
  928. {
  929. struct wpa_supplicant *wpa_s = ctx;
  930. switch (event) {
  931. case EVENT_ASSOC:
  932. wpa_supplicant_event_assoc(wpa_s, data);
  933. break;
  934. case EVENT_DISASSOC:
  935. wpa_supplicant_event_disassoc(wpa_s);
  936. break;
  937. case EVENT_MICHAEL_MIC_FAILURE:
  938. wpa_supplicant_event_michael_mic_failure(wpa_s, data);
  939. break;
  940. #ifndef CONFIG_NO_SCAN_PROCESSING
  941. case EVENT_SCAN_RESULTS:
  942. wpa_supplicant_event_scan_results(wpa_s);
  943. break;
  944. #endif /* CONFIG_NO_SCAN_PROCESSING */
  945. case EVENT_ASSOCINFO:
  946. wpa_supplicant_event_associnfo(wpa_s, data);
  947. break;
  948. case EVENT_INTERFACE_STATUS:
  949. wpa_supplicant_event_interface_status(wpa_s, data);
  950. break;
  951. case EVENT_PMKID_CANDIDATE:
  952. wpa_supplicant_event_pmkid_candidate(wpa_s, data);
  953. break;
  954. #ifdef CONFIG_PEERKEY
  955. case EVENT_STKSTART:
  956. wpa_supplicant_event_stkstart(wpa_s, data);
  957. break;
  958. #endif /* CONFIG_PEERKEY */
  959. #ifdef CONFIG_IEEE80211R
  960. case EVENT_FT_RESPONSE:
  961. wpa_supplicant_event_ft_response(wpa_s, data);
  962. break;
  963. #endif /* CONFIG_IEEE80211R */
  964. #ifdef CONFIG_IBSS_RSN
  965. case EVENT_IBSS_RSN_START:
  966. wpa_supplicant_event_ibss_rsn_start(wpa_s, data);
  967. break;
  968. #endif /* CONFIG_IBSS_RSN */
  969. default:
  970. wpa_printf(MSG_INFO, "Unknown event %d", event);
  971. break;
  972. }
  973. }