Lines Matching refs:wpa_s
52 static int wpas_select_network_from_last_scan(struct wpa_supplicant *wpa_s,
57 static int wpas_temp_disabled(struct wpa_supplicant *wpa_s,
69 wpas_clear_temp_disabled(wpa_s, ssid, 0);
78 * @wpa_s: Pointer to wpa_supplicant data
86 static int wpas_reenabled_network_time(struct wpa_supplicant *wpa_s)
92 if (wpa_s->conf->auto_interworking && wpa_s->conf->interworking &&
93 wpa_s->conf->cred)
97 for (ssid = wpa_s->conf->ssid; ssid; ssid = ssid->next) {
101 disabled_for = wpas_temp_disabled(wpa_s, ssid);
116 struct wpa_supplicant *wpa_s = eloop_ctx;
118 if (wpa_s->disconnected || wpa_s->wpa_state != WPA_SCANNING)
121 wpa_dbg(wpa_s, MSG_DEBUG,
123 if (wpa_supplicant_fast_associate(wpa_s) != 1) {
124 wpa_supplicant_cancel_sched_scan(wpa_s);
125 wpa_supplicant_req_scan(wpa_s, 0, 0);
131 struct wpa_supplicant *wpa_s, const u8 *bssid)
134 struct wpa_ssid *ssid = wpa_s->current_ssid;
137 bss = wpa_bss_get(wpa_s, bssid, ssid->ssid, ssid->ssid_len);
139 bss = wpa_bss_get_bssid(wpa_s, bssid);
145 static void wpa_supplicant_update_current_bss(struct wpa_supplicant *wpa_s)
147 struct wpa_bss *bss = wpa_supplicant_get_new_bss(wpa_s, wpa_s->bssid);
150 wpa_supplicant_update_scan_results(wpa_s);
153 bss = wpa_supplicant_get_new_bss(wpa_s, wpa_s->bssid);
157 wpa_s->current_bss = bss;
161 static int wpa_supplicant_select_config(struct wpa_supplicant *wpa_s)
168 if (wpa_s->conf->ap_scan == 1 && wpa_s->current_ssid) {
169 wpa_supplicant_update_current_bss(wpa_s);
171 if (wpa_s->current_ssid->ssid_len == 0)
173 res = wpa_drv_get_ssid(wpa_s, drv_ssid);
175 wpa_msg(wpa_s, MSG_INFO,
181 if (drv_ssid_len == wpa_s->current_ssid->ssid_len &&
182 os_memcmp(drv_ssid, wpa_s->current_ssid->ssid,
186 wpa_msg(wpa_s, MSG_DEBUG,
192 wpa_dbg(wpa_s, MSG_DEBUG, "Select network based on association "
194 ssid = wpa_supplicant_get_ssid(wpa_s);
196 wpa_msg(wpa_s, MSG_INFO,
201 if (wpas_network_disabled(wpa_s, ssid)) {
202 wpa_dbg(wpa_s, MSG_DEBUG, "Selected network is disabled");
206 if (disallowed_bssid(wpa_s, wpa_s->bssid) ||
207 disallowed_ssid(wpa_s, ssid->ssid, ssid->ssid_len)) {
208 wpa_dbg(wpa_s, MSG_DEBUG, "Selected BSS is disallowed");
212 res = wpas_temp_disabled(wpa_s, ssid);
214 wpa_dbg(wpa_s, MSG_DEBUG, "Selected network is temporarily "
219 wpa_dbg(wpa_s, MSG_DEBUG, "Network configuration found for the "
224 if (wpa_supplicant_set_suites(wpa_s, NULL, ssid,
226 wpa_dbg(wpa_s, MSG_DEBUG, "Could not set WPA suites");
228 wpa_supplicant_set_non_wpa_policy(wpa_s, ssid);
231 if (wpa_s->current_ssid && wpa_s->current_ssid != ssid)
232 eapol_sm_invalidate_cached_session(wpa_s->eapol);
233 old_ssid = wpa_s->current_ssid;
234 wpa_s->current_ssid = ssid;
236 wpa_supplicant_update_current_bss(wpa_s);
238 wpa_supplicant_rsn_supp_set_config(wpa_s, wpa_s->current_ssid);
239 wpa_supplicant_initiate_eapol(wpa_s);
240 if (old_ssid != wpa_s->current_ssid)
241 wpas_notify_network_changed(wpa_s);
249 struct wpa_supplicant *wpa_s = eloop_ctx;
251 if (wpa_s->countermeasures) {
252 wpa_s->countermeasures = 0;
253 wpa_drv_set_countermeasures(wpa_s, 0);
254 wpa_msg(wpa_s, MSG_INFO, "WPA: TKIP countermeasures stopped");
263 wpa_supplicant_cancel_sched_scan(wpa_s);
264 wpa_supplicant_req_scan(wpa_s, 0, 0);
269 void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s)
273 wnm_bss_keep_alive_deinit(wpa_s);
276 ibss_rsn_deinit(wpa_s->ibss_rsn);
277 wpa_s->ibss_rsn = NULL;
281 wpa_supplicant_ap_deinit(wpa_s);
284 if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED)
287 wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED);
288 bssid_changed = !is_zero_ether_addr(wpa_s->bssid);
289 os_memset(wpa_s->bssid, 0, ETH_ALEN);
290 os_memset(wpa_s->pending_bssid, 0, ETH_ALEN);
291 sme_clear_on_disassoc(wpa_s);
292 wpa_s->current_bss = NULL;
293 wpa_s->assoc_freq = 0;
296 wpas_notify_bssid_changed(wpa_s);
298 eapol_sm_notify_portEnabled(wpa_s->eapol, FALSE);
299 eapol_sm_notify_portValid(wpa_s->eapol, FALSE);
300 if (wpa_key_mgmt_wpa_psk(wpa_s->key_mgmt))
301 eapol_sm_notify_eap_success(wpa_s->eapol, FALSE);
302 wpa_s->ap_ies_from_associnfo = 0;
303 wpa_s->current_ssid = NULL;
304 eapol_sm_notify_config(wpa_s->eapol, NULL, NULL);
305 wpa_s->key_mgmt = 0;
307 wpas_rrm_reset(wpa_s);
308 wpa_s->wnmsleep_used = 0;
312 static void wpa_find_assoc_pmkid(struct wpa_supplicant *wpa_s)
318 if (wpa_sm_parse_own_wpa_ie(wpa_s->wpa, &ie) < 0 ||
323 pmksa_set = pmksa_cache_set_current(wpa_s->wpa,
327 eapol_sm_notify_pmkid_attempt(wpa_s->eapol);
332 wpa_dbg(wpa_s, MSG_DEBUG, "RSN: PMKID from assoc IE %sfound from "
337 static void wpa_supplicant_event_pmkid_candidate(struct wpa_supplicant *wpa_s,
341 wpa_dbg(wpa_s, MSG_DEBUG, "RSN: No data in PMKID candidate "
345 wpa_dbg(wpa_s, MSG_DEBUG, "RSN: PMKID candidate event - bssid=" MACSTR
351 pmksa_candidate_add(wpa_s->wpa, data->pmkid_candidate.bssid,
357 static int wpa_supplicant_dynamic_keys(struct wpa_supplicant *wpa_s)
359 if (wpa_s->key_mgmt == WPA_KEY_MGMT_NONE ||
360 wpa_s->key_mgmt == WPA_KEY_MGMT_WPA_NONE)
364 if (wpa_s->key_mgmt == WPA_KEY_MGMT_IEEE8021X_NO_WPA &&
365 wpa_s->current_ssid &&
366 !(wpa_s->current_ssid->eapol_flags &
381 * @wpa_s: pointer to wpa_supplicant data
388 int wpa_supplicant_scard_init(struct wpa_supplicant *wpa_s,
396 wpa_s->scard != NULL || wpa_s->conf->external_sim)
425 wpa_dbg(wpa_s, MSG_DEBUG, "Selected network is configured to "
431 wpa_dbg(wpa_s, MSG_DEBUG, "Selected network is configured to use SIM "
434 wpa_s->scard = scard_init(wpa_s->conf->pcsc_reader);
435 if (wpa_s->scard == NULL) {
436 wpa_msg(wpa_s, MSG_WARNING, "Failed to initialize SIM "
440 wpa_sm_set_scard_ctx(wpa_s->wpa, wpa_s->scard);
441 eapol_sm_register_scard_ctx(wpa_s->eapol, wpa_s->scard);
499 static int wpa_supplicant_ssid_bss_match(struct wpa_supplicant *wpa_s,
509 ret = wpas_wps_ssid_bss_match(wpa_s, ssid, bss);
524 wpa_dbg(wpa_s, MSG_DEBUG, " skip RSN IE - parse "
532 wpa_dbg(wpa_s, MSG_DEBUG, " selected based on TSN "
538 wpa_dbg(wpa_s, MSG_DEBUG, " skip RSN IE - proto "
544 wpa_dbg(wpa_s, MSG_DEBUG, " skip RSN IE - PTK "
550 wpa_dbg(wpa_s, MSG_DEBUG, " skip RSN IE - GTK "
556 wpa_dbg(wpa_s, MSG_DEBUG, " skip RSN IE - key mgmt "
563 wpas_get_ssid_pmf(wpa_s, ssid) ==
565 wpa_dbg(wpa_s, MSG_DEBUG, " skip RSN IE - no mgmt "
571 wpas_get_ssid_pmf(wpa_s, ssid) ==
573 wpa_dbg(wpa_s, MSG_DEBUG,
580 wpas_get_ssid_pmf(wpa_s, ssid) !=
582 wpa_dbg(wpa_s, MSG_DEBUG,
588 wpa_dbg(wpa_s, MSG_DEBUG, " selected based on RSN IE");
597 wpa_dbg(wpa_s, MSG_DEBUG, " skip WPA IE - parse "
605 wpa_dbg(wpa_s, MSG_DEBUG, " selected based on TSN "
611 wpa_dbg(wpa_s, MSG_DEBUG, " skip WPA IE - proto "
617 wpa_dbg(wpa_s, MSG_DEBUG, " skip WPA IE - PTK "
623 wpa_dbg(wpa_s, MSG_DEBUG, " skip WPA IE - GTK "
629 wpa_dbg(wpa_s, MSG_DEBUG, " skip WPA IE - key mgmt "
634 wpa_dbg(wpa_s, MSG_DEBUG, " selected based on WPA IE");
640 wpa_dbg(wpa_s
646 wpa_dbg(wpa_s, MSG_DEBUG, " skip - no WPA/RSN proto match");
652 wpa_dbg(wpa_s, MSG_DEBUG, " allow in OSEN");
657 wpa_dbg(wpa_s, MSG_DEBUG, " allow in non-WPA/WPA2");
661 wpa_dbg(wpa_s, MSG_DEBUG, " reject due to mismatch with "
682 static int rate_match(struct wpa_supplicant *wpa_s, struct wpa_bss *bss)
692 modes = wpa_s->hw.modes;
702 for (i = 0; i < wpa_s->hw.num_modes; i++) {
739 wpa_dbg(wpa_s, MSG_DEBUG,
751 wpa_dbg(wpa_s, MSG_DEBUG,
773 wpa_dbg(wpa_s, MSG_DEBUG,
829 struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s,
853 wpa_dbg(wpa_s, MSG_DEBUG, "%d: " MACSTR " ssid='%s' "
863 e = wpa_blacklist_get(wpa_s, bss->bssid);
866 if (wpa_supplicant_enabled_networks(wpa_s) == 1) {
878 wpa_dbg(wpa_s, MSG_DEBUG, " skip - blacklisted "
885 wpa_dbg(wpa_s, MSG_DEBUG, " skip - SSID not known");
889 if (disallowed_bssid(wpa_s, bss->bssid)) {
890 wpa_dbg(wpa_s, MSG_DEBUG, " skip - BSSID disallowed");
894 if (disallowed_ssid(wpa_s, bss->ssid, bss->ssid_len)) {
895 wpa_dbg(wpa_s, MSG_DEBUG, " skip - SSID disallowed");
905 if (wpas_network_disabled(wpa_s, ssid)) {
906 wpa_dbg(wpa_s, MSG_DEBUG, " skip - disabled");
910 res = wpas_temp_disabled(wpa_s, ssid);
912 wpa_dbg(wpa_s, MSG_DEBUG, " skip - disabled "
919 wpa_dbg(wpa_s, MSG_DEBUG, " skip - blacklisted "
925 wpas_wps_ssid_wildcard_ok(wpa_s, ssid, bss))
934 wpas_wps_ssid_wildcard_ok(wpa_s, ssid, bss))
946 wpa_dbg(wpa_s, MSG_DEBUG, " skip - SSID mismatch");
952 wpa_dbg(wpa_s, MSG_DEBUG, " skip - BSSID mismatch");
960 wpa_dbg(wpa_s, MSG_DEBUG,
969 wpa_dbg(wpa_s, MSG_DEBUG,
974 if (!wpa_supplicant_ssid_bss_match(wpa_s, ssid, bss))
981 wpa_dbg(wpa_s, MSG_DEBUG, " skip - non-WPA network "
988 wpa_dbg(wpa_s, MSG_DEBUG, " skip - ignore WPA/WPA2 AP for WEP network block");
993 wpa_dbg(wpa_s, MSG_DEBUG, " skip - non-OSEN network "
999 wpa_dbg(wpa_s, MSG_DEBUG, " skip - privacy "
1005 wpa_dbg(wpa_s, MSG_DEBUG, " skip - neither ESS nor PBSS network");
1010 wpa_dbg(wpa_s, MSG_DEBUG, " skip - PBSS mismatch (ssid %d bss %d)",
1016 wpa_dbg(wpa_s, MSG_DEBUG, " skip - frequency not "
1021 if (!rate_match(wpa_s, bss)) {
1022 wpa_dbg(wpa_s, MSG_DEBUG, " skip - rate sets do "
1031 wpa_dbg(wpa_s, MSG_DEBUG, " skip - no P2P IE seen");
1041 wpa_dbg(wpa_s, MSG_DEBUG, " skip - no P2P element");
1047 wpa_dbg(wpa_s, MSG_DEBUG, " skip - could not fetch P2P element");
1054 wpa_dbg(wpa_s, MSG_DEBUG, " skip - no matching GO P2P Device Address in P2P element");
1068 if (os_reltime_before(&bss->last_update, &wpa_s->scan_min_time))
1072 os_reltime_sub(&wpa_s->scan_min_time,
1074 wpa_dbg(wpa_s, MSG_DEBUG,
1084 wpa_dbg(wpa_s, MSG_DEBUG,
1090 if (wpa_is_bss_tmp_disallowed(wpa_s, bss->bssid)) {
1091 wpa_dbg(wpa_s, MSG_DEBUG,
1107 wpa_supplicant_select_bss(struct wpa_supplicant *wpa_s,
1115 wpa_dbg(wpa_s, MSG_DEBUG, "Try to find BSS matching pre-selected network id=%d",
1118 wpa_dbg(wpa_s, MSG_DEBUG, "Selecting BSS from priority group %d",
1121 for (i = 0; i < wpa_s->last_scan_res_used; i++) {
1122 struct wpa_bss *bss = wpa_s->last_scan_res[i];
1123 *selected_ssid = wpa_scan_res_match(wpa_s, i, bss, group,
1127 wpa_dbg(wpa_s, MSG_DEBUG, " selected BSS " MACSTR
1138 struct wpa_bss * wpa_supplicant_pick_network(struct wpa_supplicant *wpa_s,
1146 if (wpa_s->last_scan_res == NULL ||
1147 wpa_s->last_scan_res_used == 0)
1150 if (wpa_s->next_ssid) {
1152 for (ssid = wpa_s->conf->ssid; ssid; ssid = ssid->next) {
1153 if (ssid == wpa_s->next_ssid)
1157 wpa_s->next_ssid = NULL;
1161 for (prio = 0; prio < wpa_s->conf->num_prio; prio++) {
1163 wpa_s->conf->pssid[prio]->priority) {
1165 wpa_s, next_ssid, selected_ssid, 1);
1170 wpa_s, wpa_s->conf->pssid[prio],
1176 if (selected == NULL && wpa_s->blacklist &&
1177 !wpa_s->countermeasures) {
1178 wpa_dbg(wpa_s, MSG_DEBUG, "No APs found - clear "
1180 wpa_blacklist_clear(wpa_s);
1181 wpa_s->blacklist_cleared++;
1191 wpa_dbg(wpa_s, MSG_DEBUG,
1194 wpas_notify_network_request(wpa_s, ssid,
1202 wpas_send_ctrl_req(wpa_s, ssid, field_name, txt);
1211 static void wpa_supplicant_req_new_scan(struct wpa_supplicant *wpa_s,
1214 if (!wpa_supplicant_enabled_networks(wpa_s)) {
1220 wpa_dbg(wpa_s, MSG_DEBUG, "Short-circuit new scan request "
1222 wpa_supplicant_set_state(wpa_s, WPA_INACTIVE);
1226 wpa_s->scan_for_connection = 1;
1227 wpa_supplicant_req_scan(wpa_s, timeout_sec, timeout_usec);
1231 int wpa_supplicant_connect(struct wpa_supplicant *wpa_s,
1235 if (wpas_wps_scan_pbc_overlap(wpa_s, selected, ssid)) {
1236 wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_OVERLAP
1238 wpas_notify_wps_event_pbc_overlap(wpa_s);
1240 if (wpa_s->p2p_group_interface == P2P_GROUP_INTERFACE_CLIENT ||
1241 wpa_s->p2p_in_provisioning) {
1243 wpa_s, NULL);
1249 wpas_wps_pbc_overlap(wpa_s);
1250 wpas_wps_cancel(wpa_s);
1255 wpa_msg(wpa_s, MSG_DEBUG,
1259 wpa_s->reassociate, MAC2STR(selected->bssid),
1260 MAC2STR(wpa_s->bssid), MAC2STR(wpa_s->pending_bssid),
1261 wpa_supplicant_state_txt(wpa_s->wpa_state),
1262 ssid, wpa_s->current_ssid);
1269 if (wpa_s->reassociate ||
1270 (os_memcmp(selected->bssid, wpa_s->bssid, ETH_ALEN) != 0 &&
1271 ((wpa_s->wpa_state != WPA_ASSOCIATING &&
1272 wpa_s->wpa_state != WPA_AUTHENTICATING) ||
1273 wpa_s->pending_bssid) &&
1274 os_memcmp(selected->bssid, wpa_s->pending_bssid, ETH_ALEN) !=
1276 (is_zero_ether_addr(wpa_s->pending_bssid) &&
1277 ssid != wpa_s->current_ssid)))) {
1278 if (wpa_supplicant_scard_init(wpa_s, ssid)) {
1279 wpa_supplicant_req_new_scan(wpa_s, 10, 0);
1282 wpa_msg(wpa_s, MSG_DEBUG, "Request association with " MACSTR,
1284 wpa_supplicant_associate(wpa_s, selected, ssid);
1286 wpa_dbg(wpa_s, MSG_DEBUG, "Already associated or trying to "
1295 wpa_supplicant_pick_new_network(struct wpa_supplicant *wpa_s)
1300 for (prio = 0; prio < wpa_s->conf->num_prio; prio++) {
1301 for (ssid = wpa_s->conf->pssid[prio]; ssid; ssid = ssid->pnext)
1303 if (wpas_network_disabled(wpa_s, ssid))
1318 struct wpa_supplicant *wpa_s)
1322 if (rsn_preauth_scan_results(wpa_s->wpa) < 0)
1325 dl_list_for_each(bss, &wpa_s->bss, struct wpa_bss, list) {
1336 rsn_preauth_scan_result(wpa_s->wpa, bss->bssid, ssid, rsn);
1342 static int wpa_supplicant_need_to_roam(struct wpa_supplicant *wpa_s,
1352 if (wpa_s->reassociate)
1354 if (wpa_s->wpa_state < WPA_ASSOCIATED)
1356 if (wpa_s->current_ssid == NULL)
1358 if (wpa_s->current_ssid != ssid)
1361 if (wpas_driver_bss_selection(wpa_s))
1364 if (wpa_s->current_ssid->ssid)
1365 current_bss = wpa_bss_get(wpa_s, wpa_s->bssid,
1366 wpa_s->current_ssid->ssid,
1367 wpa_s->current_ssid->ssid_len);
1369 current_bss = wpa_bss_get_bssid(wpa_s, wpa_s->bssid);
1381 wpa_dbg(wpa_s, MSG_DEBUG, "Considering within-ESS reassociation");
1382 wpa_dbg(wpa_s, MSG_DEBUG, "Current BSS: " MACSTR
1386 wpa_dbg(wpa_s, MSG_DEBUG, "Selected BSS: " MACSTR
1391 if (wpa_s->current_ssid->bssid_set &&
1392 os_memcmp(selected->bssid, wpa_s->current_ssid->bssid, ETH_ALEN) ==
1394 wpa_dbg(wpa_s, MSG_DEBUG, "Allow reassociation - selected BSS "
1400 wpa_dbg(wpa_s, MSG_DEBUG,
1409 wpa_dbg(wpa_s, MSG_DEBUG, "Skip roam - Current BSS has better "
1435 wpa_dbg(wpa_s, MSG_DEBUG, "Skip roam - too small difference "
1449 static int _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
1461 if (wpa_s->ap_iface)
1465 wpa_supplicant_notify_scanning(wpa_s, 0);
1467 scan_res = wpa_supplicant_get_scan_results(wpa_s,
1471 if (wpa_s->conf->ap_scan == 2 || ap ||
1472 wpa_s->scan_res_handler == scan_only_handler)
1478 wpa_dbg(wpa_s, MSG_DEBUG, "Failed to get scan results - try "
1480 wpa_supplicant_req_new_scan(wpa_s, 1, 0);
1501 if (own_request && wpa_s->scan_res_handler &&
1503 void (*scan_res_handler)(struct wpa_supplicant *wpa_s,
1506 scan_res_handler = wpa_s->scan_res_handler;
1507 wpa_s->scan_res_handler = NULL;
1508 scan_res_handler(wpa_s, scan_res);
1514 wpa_dbg(wpa_s, MSG_DEBUG, "Ignore scan results in AP mode");
1516 if (wpa_s->ap_iface->scan_cb)
1517 wpa_s->ap_iface->scan_cb(wpa_s->ap_iface);
1522 wpa_dbg(wpa_s, MSG_DEBUG, "New scan results available (own=%u ext=%u)",
1523 wpa_s->own_scan_running,
1525 if (wpa_s->last_scan_req == MANUAL_SCAN_REQ &&
1526 wpa_s->manual_scan_use_id && wpa_s->own_scan_running &&
1528 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_SCAN_RESULTS "id=%u",
1529 wpa_s->manual_scan_id);
1530 wpa_s->manual_scan_use_id = 0;
1532 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_SCAN_RESULTS);
1534 wpas_notify_scan_results(wpa_s);
1536 wpas_notify_scan_done(wpa_s, 1);
1539 wpa_dbg(wpa_s, MSG_DEBUG, "Do not use results from externally requested scan operation for network selection");
1544 if (wnm_scan_process(wpa_s, 1) > 0)
1547 if (sme_proc_obss_scan(wpa_s) > 0)
1550 if ((wpa_s->conf->ap_scan == 2 && !wpas_wps_searching(wpa_s)))
1553 if (autoscan_notify_scan(wpa_s, scan_res))
1556 if (wpa_s->disconnected) {
1557 wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED);
1561 if (!wpas_driver_bss_selection(wpa_s) &&
1562 bgscan_notify_scan(wpa_s, scan_res) == 1)
1565 wpas_wps_update_ap_info(wpa_s, scan_res);
1567 if (wpa_s->wpa_state >= WPA_AUTHENTICATING &&
1568 wpa_s->wpa_state < WPA_COMPLETED)
1573 if (own_request && wpa_s->scan_work) {
1574 struct wpa_radio_work *work = wpa_s->scan_work;
1575 wpa_s->scan_work = NULL;
1579 return wpas_select_network_from_last_scan(wpa_s, 1, own_request);
1583 if (own_request && wpa_s->scan_work) {
1584 struct wpa_radio_work *work = wpa_s->scan_work;
1585 wpa_s->scan_work = NULL;
1592 static int wpas_select_network_from_last_scan(struct wpa_supplicant *wpa_s,
1597 int time_to_reenable = wpas_reenabled_network_time(wpa_s);
1600 wpa_dbg(wpa_s, MSG_DEBUG,
1603 eloop_cancel_timeout(wpas_network_reenabled, wpa_s, NULL);
1605 wpas_network_reenabled, wpa_s, NULL);
1609 if (wpa_s->p2p_mgmt)
1612 selected = wpa_supplicant_pick_network(wpa_s, &ssid);
1616 skip = !wpa_supplicant_need_to_roam(wpa_s, selected, ssid);
1619 wpa_supplicant_rsn_preauth_scan_results(wpa_s);
1623 if (ssid != wpa_s->current_ssid &&
1624 wpa_s->wpa_state >= WPA_AUTHENTICATING) {
1625 wpa_s->own_disconnect_req = 1;
1627 wpa_s, WLAN_REASON_DEAUTH_LEAVING);
1630 if (wpa_supplicant_connect(wpa_s, selected, ssid) < 0) {
1631 wpa_dbg(wpa_s, MSG_DEBUG, "Connect failed");
1635 wpa_supplicant_rsn_preauth_scan_results(wpa_s);
1643 if (wpa_s->ifmsh) {
1644 wpa_msg(wpa_s, MSG_INFO,
1649 wpa_dbg(wpa_s, MSG_DEBUG, "No suitable network found");
1650 ssid = wpa_supplicant_pick_new_network(wpa_s);
1652 wpa_dbg(wpa_s, MSG_DEBUG, "Setup a new network");
1653 wpa_supplicant_associate(wpa_s, NULL, ssid);
1655 wpa_supplicant_rsn_preauth_scan_results(wpa_s);
1662 int timeout_sec = wpa_s->scan_interval;
1667 res = wpas_p2p_scan_no_go_seen(wpa_s);
1673 if (wpa_s->p2p_in_provisioning ||
1674 wpa_s->show_group_started ||
1675 wpa_s->p2p_in_invitation) {
1683 wpa_supplicant_req_new_scan(wpa_s, timeout_sec,
1689 if (wpa_s->conf->auto_interworking &&
1690 wpa_s->conf->interworking &&
1691 wpa_s->conf->cred) {
1692 wpa_dbg(wpa_s, MSG_DEBUG, "Interworking: "
1695 wpa_s->network_select = 1;
1696 wpa_s->auto_network_select = 1;
1697 interworking_start_fetch_anqp(wpa_s);
1702 if (wpa_s->after_wps > 0 || wpas_wps_searching(wpa_s)) {
1703 wpa_dbg(wpa_s, MSG_DEBUG, "Use shorter wait during WPS processing");
1706 wpa_supplicant_req_new_scan(wpa_s, timeout_sec,
1711 if (wpa_supplicant_req_sched_scan(wpa_s))
1712 wpa_supplicant_req_new_scan(wpa_s, timeout_sec,
1715 wpa_msg_ctrl(wpa_s, MSG_INFO,
1723 static int wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
1729 res = _wpa_supplicant_event_scan_results(wpa_s, data, 1);
1733 * wpa_s after this.
1752 dl_list_for_each(ifs, &wpa_s->radio->ifaces, struct wpa_supplicant,
1754 if (ifs != wpa_s) {
1767 int wpa_supplicant_fast_associate(struct wpa_supplicant *wpa_s)
1774 if (wpa_s->last_scan_res_used == 0)
1778 if (os_reltime_expired(&now, &wpa_s->last_scan, 5)) {
1783 return wpas_select_network_from_last_scan(wpa_s, 0, 1);
1791 struct wpa_supplicant *wpa_s = eloop_ctx;
1793 if (wpa_s->wpa_state < WPA_ASSOCIATED)
1796 if (!wpa_s->no_keep_alive) {
1798 MAC2STR(wpa_s->bssid));
1802 if (wpa_s->l2)
1803 l2_packet_send(wpa_s->l2, wpa_s->bssid, 0x0800,
1808 if (wpa_s->sme.bss_max_idle_period) {
1810 msec = wpa_s->sme.bss_max_idle_period * 1024; /* times 1000 */
1814 wnm_bss_keep_alive, wpa_s, NULL);
1820 static void wnm_process_assoc_resp(struct wpa_supplicant *wpa_s,
1834 wpa_s->sme.bss_max_idle_period =
1837 "TU)%s", wpa_s->sme.bss_max_idle_period,
1840 if (wpa_s->sme.bss_max_idle_period == 0)
1841 wpa_s->sme.bss_max_idle_period = 1;
1842 if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME) {
1843 eloop_cancel_timeout(wnm_bss_keep_alive, wpa_s, NULL);
1845 msec = wpa_s->sme.bss_max_idle_period * 1024;
1849 wnm_bss_keep_alive, wpa_s,
1859 void wnm_bss_keep_alive_deinit(struct wpa_supplicant *wpa_s)
1862 eloop_cancel_timeout(wnm_bss_keep_alive, wpa_s, NULL);
1869 static int wpas_qos_map_set(struct wpa_supplicant *wpa_s, const u8 *qos_map,
1875 res = wpa_drv_set_qos_map(wpa_s, qos_map, len);
1884 wpa_s,
1896 wpas_qos_map_set(wpa_s, elems.qos_map_set,
1905 static int wpas_fst_update_mbie(struct wpa_supplicant *wpa_s,
1910 if (!ie || !ie_len || !wpa_s->fst)
1938 wpabuf_free(wpa_s->received_mb_ies);
1939 wpa_s->received_mb_ies = mb_ies_by_info(&mb_ies);
1948 static int wpa_supplicant_event_associnfo(struct wpa_supplicant *wpa_s,
1957 wpa_dbg(wpa_s, MSG_DEBUG, "Association info event");
1965 wpa_tdls_assoc_resp_ies(wpa_s->wpa, data->assoc_info.resp_ies,
1969 wnm_process_assoc_resp(wpa_s, data->assoc_info.resp_ies,
1973 interworking_process_assoc_resp(wpa_s, data->assoc_info.resp_ies,
1982 wpa_dbg(wpa_s, MSG_DEBUG, "freq=%u MHz",
2001 if (wpa_sm_set_assoc_wpa_ie(wpa_s->wpa, p, len))
2004 wpa_find_assoc_pmkid(wpa_s);
2011 wpa_sm_set_assoc_wpa_ie(wpa_s->wpa, NULL, 0);
2015 if (wpa_s->sme.auth_alg == WPA_AUTH_ALG_FT) {
2016 if (wpa_drv_get_bssid(wpa_s, bssid) < 0 ||
2017 wpa_ft_validate_reassoc_resp(wpa_s->wpa,
2021 wpa_dbg(wpa_s, MSG_DEBUG, "FT: Validation of "
2024 wpa_s, WLAN_REASON_INVALID_IE);
2033 if (p && wpa_s->current_ssid &&
2034 wpa_s->current_ssid->key_mgmt == WPA_KEY_MGMT_WPS) {
2038 wpa_msg(wpa_s, MSG_INFO, "WPS-STRICT: AP did not "
2046 wpa_s, WLAN_REASON_INVALID_IE);
2063 wpa_s->sme.ft_used = 1;
2064 os_memcpy(wpa_s->sme.mobility_domain, p + 2,
2074 if (!(wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME) &&
2075 wpa_ft_is_completed(wpa_s->wpa)) {
2076 if (wpa_drv_get_bssid(wpa_s, bssid) < 0 ||
2077 wpa_ft_validate_reassoc_resp(wpa_s->wpa,
2081 wpa_dbg(wpa_s, MSG_DEBUG, "FT: Validation of "
2084 wpa_s, WLAN_REASON_INVALID_IE);
2087 wpa_dbg(wpa_s, MSG_DEBUG, "FT: Reassociation Response done");
2090 wpa_sm_set_ft_params(wpa_s->wpa, data->assoc_info.resp_ies,
2112 wpa_sm_set_ap_wpa_ie(wpa_s->wpa, p, len);
2118 wpa_sm_set_ap_rsn_ie(wpa_s->wpa, p, len);
2126 wpa_sm_set_ap_wpa_ie(wpa_s->wpa, NULL, 0);
2128 wpa_sm_set_ap_rsn_ie(wpa_s->wpa, NULL, 0);
2130 wpa_s->ap_ies_from_associnfo = 1;
2132 if (wpa_s->assoc_freq && data->assoc_info.freq &&
2133 wpa_s->assoc_freq != data->assoc_info.freq) {
2136 wpa_s->assoc_freq, data->assoc_info.freq);
2137 wpa_supplicant_update_scan_results(wpa_s);
2140 wpa_s->assoc_freq = data->assoc_info.freq;
2146 static int wpa_supplicant_assoc_update_ie(struct wpa_supplicant *wpa_s)
2150 if (!wpa_s->current_bss || !wpa_s->current_ssid)
2153 if (!wpa_key_mgmt_wpa_any(wpa_s->current_ssid->key_mgmt))
2156 bss_wpa = wpa_bss_get_vendor_ie(wpa_s->current_bss,
2158 bss_rsn = wpa_bss_get_ie(wpa_s->current_bss, WLAN_EID_RSN);
2160 if (wpa_sm_set_ap_wpa_ie(wpa_s->wpa, bss_wpa,
2162 wpa_sm_set_ap_rsn_ie(wpa_s->wpa, bss_rsn,
2170 static void wpas_fst_update_mb_assoc(struct wpa_supplicant *wpa_s,
2175 struct wpa_bss *bss = wpa_s->current_bss;
2178 wpabuf_free(wpa_s->received_mb_ies);
2179 wpa_s->received_mb_ies = NULL;
2182 !wpas_fst_update_mbie(wpa_s, ai->resp_ies, ai->resp_ies_len)) {
2189 !wpas_fst_update_mbie(wpa_s, ai->beacon_ies, ai->beacon_ies_len)) {
2201 if (!wpas_fst_update_mbie(wpa_s, ieprb, bss->ie_len))
2203 else if (!wpas_fst_update_mbie(wpa_s, iebcn, bss->beacon_ie_len))
2209 static void wpa_supplicant_event_assoc(struct wpa_supplicant *wpa_s,
2217 if (wpa_s->ap_iface) {
2220 hostapd_notif_assoc(wpa_s->ap_iface->bss[0],
2229 eloop_cancel_timeout(wpas_network_reenabled, wpa_s, NULL);
2231 ft_completed = wpa_ft_is_completed(wpa_s->wpa);
2232 if (data && wpa_supplicant_event_associnfo(wpa_s, data) < 0)
2235 if (wpa_drv_get_bssid(wpa_s, bssid) < 0) {
2236 wpa_dbg(wpa_s, MSG_ERROR, "Failed to get BSSID");
2238 wpa_s, WLAN_REASON_DEAUTH_LEAVING);
2242 wpa_supplicant_set_state(wpa_s, WPA_ASSOCIATED);
2243 if (os_memcmp(bssid, wpa_s->bssid, ETH_ALEN) != 0) {
2244 wpa_dbg(wpa_s, MSG_DEBUG, "Associated to a new BSS: BSSID="
2248 os_memcpy(wpa_s->bssid, bssid, ETH_ALEN);
2249 os_memset(wpa_s->pending_bssid, 0, ETH_ALEN);
2250 wpas_notify_bssid_changed(wpa_s);
2252 if (wpa_supplicant_dynamic_keys(wpa_s) && !ft_completed) {
2253 wpa_clear_keys(wpa_s, bssid);
2255 if (wpa_supplicant_select_config(wpa_s) < 0) {
2257 wpa_s, WLAN_REASON_DEAUTH_LEAVING);
2263 if (wpa_s->conf->ap_scan == 1) {
2265 if (wpa_s->conf->ap_scan == 1 &&
2266 wpa_s->drv_flags & WPA_DRIVER_FLAGS_BSS_SELECTION) {
2268 if (wpa_supplicant_assoc_update_ie(wpa_s) < 0 && new_bss)
2269 wpa_msg(wpa_s, MSG_WARNING,
2273 wpas_fst_update_mb_assoc(wpa_s, data);
2276 os_memcpy(wpa_s->sme.prev_bssid, bssid, ETH_ALEN);
2277 wpa_s->sme.prev_bssid_set = 1;
2278 wpa_s->sme.last_unprot_disconnect.sec = 0;
2281 wpa_msg(wpa_s, MSG_INFO, "Associated with " MACSTR, MAC2STR(bssid));
2282 if (wpa_s->current_ssid) {
2287 wpa_supplicant_scard_init(wpa_s, wpa_s->current_ssid);
2289 wpa_sm_notify_assoc(wpa_s->wpa, bssid);
2290 if (wpa_s->l2)
2291 l2_packet_notify_auth_start(wpa_s->l2);
2302 eapol_sm_notify_portEnabled(wpa_s->eapol, FALSE);
2303 eapol_sm_notify_portValid(wpa_s->eapol, FALSE);
2305 if (wpa_key_mgmt_wpa_psk(wpa_s->key_mgmt) || ft_completed)
2306 eapol_sm_notify_eap_success(wpa_s->eapol, FALSE);
2308 eapol_sm_notify_portEnabled(wpa_s->eapol, TRUE);
2309 wpa_s->eapol_received = 0;
2310 if (wpa_s->key_mgmt == WPA_KEY_MGMT_NONE ||
2311 wpa_s->key_mgmt == WPA_KEY_MGMT_WPA_NONE ||
2312 (wpa_s->current_ssid &&
2313 wpa_s->current_ssid->mode == IEEE80211_MODE_IBSS)) {
2314 if (wpa_s->current_ssid &&
2315 wpa_s->key_mgmt == WPA_KEY_MGMT_WPA_NONE &&
2316 (wpa_s->drv_flags &
2322 wpa_supplicant_set_wpa_none_key(wpa_s,
2323 wpa_s->current_ssid);
2325 wpa_supplicant_cancel_auth_timeout(wpa_s);
2326 wpa_supplicant_set_state(wpa_s, WPA_COMPLETED);
2329 wpa_supplicant_req_auth_timeout(wpa_s, 10, 0);
2331 wpa_supplicant_cancel_scan(wpa_s);
2333 if ((wpa_s->drv_flags & WPA_DRIVER_FLAGS_4WAY_HANDSHAKE) &&
2334 wpa_key_mgmt_wpa_psk(wpa_s->key_mgmt)) {
2339 wpa_supplicant_cancel_auth_timeout(wpa_s);
2340 wpa_supplicant_set_state(wpa_s, WPA_COMPLETED);
2341 eapol_sm_notify_portValid(wpa_s->eapol, TRUE);
2342 eapol_sm_notify_eap_success(wpa_s->eapol, TRUE);
2343 } else if ((wpa_s->drv_flags & WPA_DRIVER_FLAGS_4WAY_HANDSHAKE) &&
2344 wpa_key_mgmt_wpa_ieee8021x(wpa_s->key_mgmt)) {
2350 eapol_sm_notify_portValid(wpa_s->eapol, TRUE);
2356 wpa_supplicant_cancel_auth_timeout(wpa_s);
2357 wpa_supplicant_set_state(wpa_s, WPA_COMPLETED);
2358 eapol_sm_notify_portValid(wpa_s->eapol, TRUE);
2359 eapol_sm_notify_eap_success(wpa_s->eapol, TRUE);
2362 wpa_s->last_eapol_matches_bssid = 0;
2364 if (wpa_s->pending_eapol_rx) {
2367 os_reltime_sub(&now, &wpa_s->pending_eapol_rx_time, &age);
2369 os_memcmp(wpa_s->pending_eapol_rx_src, bssid, ETH_ALEN) ==
2371 wpa_dbg(wpa_s, MSG_DEBUG, "Process pending EAPOL "
2375 wpa_s, wpa_s->pending_eapol_rx_src,
2376 wpabuf_head(wpa_s->pending_eapol_rx),
2377 wpabuf_len(wpa_s->pending_eapol_rx));
2379 wpabuf_free(wpa_s->pending_eapol_rx);
2380 wpa_s->pending_eapol_rx = NULL;
2383 if ((wpa_s->key_mgmt == WPA_KEY_MGMT_NONE ||
2384 wpa_s->key_mgmt == WPA_KEY_MGMT_IEEE8021X_NO_WPA) &&
2385 wpa_s->current_ssid &&
2386 (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC_DONE)) {
2388 wpa_set_wep_keys(wpa_s, wpa_s->current_ssid);
2392 if (wpa_s->current_ssid &&
2393 wpa_s->current_ssid->mode == WPAS_MODE_IBSS &&
2394 wpa_s->key_mgmt != WPA_KEY_MGMT_NONE &&
2395 wpa_s->key_mgmt != WPA_KEY_MGMT_WPA_NONE &&
2396 wpa_s->ibss_rsn == NULL) {
2397 wpa_s->ibss_rsn = ibss_rsn_init(wpa_s);
2398 if (!wpa_s->ibss_rsn) {
2399 wpa_msg(wpa_s, MSG_INFO, "Failed to init IBSS RSN");
2401 wpa_s, WLAN_REASON_DEAUTH_LEAVING);
2405 ibss_rsn_set_psk(wpa_s->ibss_rsn, wpa_s->current_ssid->psk);
2409 wpas_wps_notify_assoc(wpa_s, bssid);
2412 wmm_ac_notify_assoc(wpa_s, data->assoc_info.resp_ies,
2416 if (wpa_s->reassoc_same_bss)
2417 wmm_ac_restore_tspecs(wpa_s);
2430 static void wpa_supplicant_event_disassoc(struct wpa_supplicant *wpa_s,
2436 if (wpa_s->key_mgmt == WPA_KEY_MGMT_WPA_NONE) {
2445 bssid = wpa_s->bssid;
2447 bssid = wpa_s->pending_bssid;
2450 wpa_s->wpa_state >= WPA_AUTHENTICATING) {
2451 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_DISCONNECTED "bssid=" MACSTR
2459 static int could_be_psk_mismatch(struct wpa_supplicant *wpa_s, u16 reason_code,
2462 if (wpa_s
2463 !wpa_key_mgmt_wpa_psk(wpa_s->key_mgmt))
2481 static void wpa_supplicant_event_disassoc_finish(struct wpa_supplicant *wpa_s,
2492 authenticating = wpa_s->wpa_state == WPA_AUTHENTICATING;
2493 os_memcpy(prev_pending_bssid, wpa_s->pending_bssid, ETH_ALEN);
2495 if (wpa_s->key_mgmt == WPA_KEY_MGMT_WPA_NONE) {
2501 wpa_dbg(wpa_s, MSG_DEBUG, "Disconnect event - ignore in "
2506 if (could_be_psk_mismatch(wpa_s, reason_code, locally_generated)) {
2507 wpa_msg(wpa_s, MSG_INFO, "WPA: 4-Way Handshake failed - "
2509 if (wpas_p2p_4way_hs_failed(wpa_s) > 0)
2511 wpas_auth_failed(wpa_s, "WRONG_KEY");
2513 if (!wpa_s->disconnected &&
2514 (!wpa_s->auto_reconnect_disabled ||
2515 wpa_s->key_mgmt == WPA_KEY_MGMT_WPS ||
2516 wpas_wps_searching(wpa_s) ||
2517 wpas_wps_reenable_networks_pending(wpa_s))) {
2518 wpa_dbg(wpa_s, MSG_DEBUG, "Auto connect enabled: try to "
2520 wpa_s->key_mgmt == WPA_KEY_MGMT_WPS,
2521 wpas_wps_searching(wpa_s),
2522 wpa_s->wpa_state);
2523 if (wpa_s->wpa_state == WPA_COMPLETED &&
2524 wpa_s->current_ssid &&
2525 wpa_s->current_ssid->mode == WPAS_MODE_INFRA &&
2534 fast_reconnect = wpa_s->current_bss;
2535 fast_reconnect_ssid = wpa_s->current_ssid;
2536 } else if (wpa_s->wpa_state >= WPA_ASSOCIATING)
2537 wpa_supplicant_req_scan(wpa_s, 0, 100000);
2539 wpa_dbg(wpa_s, MSG_DEBUG, "Do not request new "
2542 wpa_dbg(wpa_s, MSG_DEBUG, "Auto connect disabled: do not "
2544 wpa_s->reassociate = 0;
2545 wpa_s->disconnected = 1;
2546 if (!wpa_s->pno)
2547 wpa_supplicant_cancel_sched_scan(wpa_s);
2549 bssid = wpa_s->bssid;
2551 bssid = wpa_s->pending_bssid;
2552 if (wpa_s->wpa_state >= WPA_AUTHENTICATING)
2553 wpas_connection_failed(wpa_s, bssid);
2554 wpa_sm_notify_disassoc(wpa_s->wpa);
2556 wpa_s->disconnect_reason = -reason_code;
2558 wpa_s->disconnect_reason = reason_code;
2559 wpas_notify_disconnect_reason(wpa_s);
2560 if (wpa_supplicant_dynamic_keys(wpa_s)) {
2561 wpa_dbg(wpa_s, MSG_DEBUG, "Disconnect event - remove keys");
2562 wpa_clear_keys(wpa_s, wpa_s->bssid);
2564 last_ssid = wpa_s->current_ssid;
2565 wpa_supplicant_mark_disassoc(wpa_s);
2567 if (authenticating && (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME)) {
2568 sme_disassoc_while_authenticating(wpa_s, prev_pending_bssid);
2569 wpa_s->current_ssid = last_ssid;
2573 !wpas_network_disabled(wpa_s, fast_reconnect_ssid) &&
2574 !disallowed_bssid(wpa_s, fast_reconnect->bssid) &&
2575 !disallowed_ssid(wpa_s, fast_reconnect->ssid,
2577 !wpas_temp_disabled(wpa_s, fast_reconnect_ssid) &&
2578 !wpa_is_bss_tmp_disallowed(wpa_s, fast_reconnect->bssid)) {
2580 wpa_dbg(wpa_s, MSG_DEBUG, "Try to reconnect to the same BSS");
2581 if (wpa_supplicant_connect(wpa_s, fast_reconnect,
2584 wpa_supplicant_req_scan(wpa_s, 0, 100000);
2594 wpa_supplicant_req_scan(wpa_s, 0, 100000);
2602 struct wpa_supplicant *wpa_s = eloop_ctx;
2604 if (!wpa_s->pending_mic_error_report)
2607 wpa_dbg(wpa_s, MSG_DEBUG, "WPA: Sending pending MIC error report");
2608 wpa_sm_key_request(wpa_s->wpa, 1, wpa_s->pending_mic_error_pairwise);
2609 wpa_s->pending_mic_error_report = 0;
2615 wpa_supplicant_event_michael_mic_failure(struct wpa_supplicant *wpa_s,
2621 wpa_msg(wpa_s, MSG_WARNING, "Michael MIC failure detected");
2624 if ((wpa_s->last_michael_mic_error.sec &&
2625 !os_reltime_expired(&t, &wpa_s->last_michael_mic_error, 60)) ||
2626 wpa_s->pending_mic_error_report) {
2627 if (wpa_s->pending_mic_error_report) {
2633 wpa_sm_key_request(wpa_s->wpa, 1,
2634 wpa_s->pending_mic_error_pairwise);
2640 wpa_sm_key_request(wpa_s->wpa, 1, pairwise);
2643 wpa_s->countermeasures = 1;
2645 wpa_blacklist_add(wpa_s, wpa_s->bssid);
2647 wpa_msg(wpa_s, MSG_WARNING, "TKIP countermeasures started");
2655 wpa_drv_set_countermeasures(wpa_s, 1);
2656 wpa_supplicant_deauthenticate(wpa_s,
2659 wpa_s, NULL);
2662 wpa_s, NULL);
2667 if (wpa_s->mic_errors_seen) {
2685 wpa_dbg(wpa_s, MSG_DEBUG, "WPA: Delay MIC error "
2687 wpa_s->pending_mic_error_report = 1;
2688 wpa_s->pending_mic_error_pairwise = pairwise;
2691 wpa_s, NULL);
2695 wpa_s, NULL);
2697 wpa_sm_key_request(wpa_s->wpa, 1, pairwise);
2700 wpa_sm_key_request(wpa_s->wpa, 1, pairwise);
2703 wpa_s->last_michael_mic_error = t;
2704 wpa_s->mic_errors_seen++;
2711 struct wpa_supplicant *wpa_s;
2713 for (wpa_s = head; wpa_s != NULL; wpa_s = wpa_s->next)
2714 if (!wpa_s->interface_removed)
2722 wpa_supplicant_event_interface_status(struct wpa_supplicant *wpa_s,
2725 if (os_strcmp(wpa_s->ifname, data->interface_status.ifname) != 0)
2730 if (!wpa_s->interface_removed)
2732 wpa_s->interface_removed = 0;
2733 wpa_dbg(wpa_s, MSG_DEBUG, "Configured interface was added");
2734 if (wpa_supplicant_driver_init(wpa_s) < 0) {
2735 wpa_msg(wpa_s, MSG_INFO, "Failed to initialize the "
2740 if (!wpa_s->global->p2p &&
2741 !wpa_s->global->p2p_disabled &&
2742 !wpa_s->conf->p2p_disabled &&
2743 (wpa_s->drv_flags &
2746 wpa_s, wpa_s->global->params.conf_p2p_dev) < 0) {
2755 wpa_dbg(wpa_s, MSG_DEBUG, "Configured interface was removed");
2756 wpa_s->interface_removed = 1;
2757 wpa_supplicant_mark_disassoc(wpa_s);
2758 wpa_supplicant_set_state(wpa_s, WPA_INTERFACE_DISABLED);
2759 l2_packet_deinit(wpa_s->l2);
2760 wpa_s->l2 = NULL;
2763 if (wpa_s->global->p2p &&
2764 wpa_s->global->p2p_init_wpa_s->parent == wpa_s &&
2765 (wpa_s->drv_flags &
2767 wpa_dbg(wpa_s, MSG_DEBUG,
2770 wpa_s->global, wpa_s->global->p2p_init_wpa_s,
2772 wpa_s->global->p2p_init_wpa_s = NULL;
2777 if (wpa_s->matched) {
2778 wpa_supplicant_remove_iface(wpa_s->global, wpa_s, 0);
2785 if (!any_interfaces(wpa_s->global->ifaces))
2795 wpa_supplicant_event_stkstart(struct wpa_supplicant *wpa_s,
2800 wpa_sm_stkstart(wpa_s->wpa, data->stkstart.peer);
2806 static void wpa_supplicant_event_tdls(struct wpa_supplicant *wpa_s,
2813 wpa_tdls_remove(wpa_s->wpa, data->tdls.peer);
2814 if (wpa_tdls_is_external_setup(wpa_s->wpa))
2815 wpa_tdls_start(wpa_s->wpa, data->tdls.peer);
2817 wpa_drv_tdls_oper(wpa_s, TDLS_SETUP, data->tdls.peer);
2820 if (wpa_tdls_is_external_setup(wpa_s->wpa))
2821 wpa_tdls_teardown_link(wpa_s->wpa, data->tdls.peer,
2824 wpa_drv_tdls_oper(wpa_s, TDLS_TEARDOWN,
2828 wpa_tdls_send_discovery_request(wpa_s->wpa,
2837 static void wpa_supplicant_event_wnm(struct wpa_supplicant *wpa_s,
2847 ieee802_11_send_wnmsleep_req(wpa_s, data->wnm.sleep_action,
2857 wpa_supplicant_event_ft_response(struct wpa_supplicant *wpa_s,
2863 if (wpa_ft_process_response(wpa_s->wpa, data->ft_ies.ies,
2876 static void wpa_supplicant_event_ibss_rsn_start(struct wpa_supplicant *wpa_s,
2880 if (wpa_s->wpa_state < WPA_ASSOCIATED)
2884 ssid = wpa_s->current_ssid;
2890 ibss_rsn_start(wpa_s->ibss_rsn, data->ibss_rsn_start.peer);
2894 static void wpa_supplicant_event_ibss_auth(struct wpa_supplicant *wpa_s,
2897 struct wpa_ssid *ssid = wpa_s->current_ssid;
2906 ibss_rsn_handle_auth(wpa_s->ibss_rsn, data->rx_mgmt.frame,
2913 static void ft_rx_action(struct wpa_supplicant *wpa_s, const u8 *data,
2920 if (!(wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME))
2929 wpa_dbg(wpa_s, MSG_DEBUG, "FT: Received FT Action Response: STA "
2933 if (os_memcmp(sta_addr, wpa_s->own_addr, ETH_ALEN) != 0) {
2934 wpa_dbg(wpa_s, MSG_DEBUG, "FT: Foreign STA Address " MACSTR
2940 wpa_dbg(wpa_s, MSG_DEBUG, "FT: FT Action Response indicates "
2946 if (wpa_ft_process_response(wpa_s->wpa, data + 1 + 2 * ETH_ALEN + 2,
2954 bss = wpa_bss_get_bssid(wpa_s, target_ap_addr);
2956 wpa_s->sme.freq = bss->freq;
2957 wpa_s->sme.auth_alg = WPA_AUTH_ALG_FT;
2958 sme_associate(wpa_s, WPAS_MODE_INFRA, target_ap_addr,
2966 static void wpa_supplicant_event_unprot_deauth(struct wpa_supplicant *wpa_s,
2974 sme_event_unprot_disconnect(wpa_s, e->sa, e->da, e->reason_code);
2979 static void wpa_supplicant_event_unprot_disassoc(struct wpa_supplicant *wpa_s,
2987 sme_event_unprot_disconnect(wpa_s, e->sa, e->da, e->reason_code);
2992 static void wpas_event_disconnect(struct wpa_supplicant *wpa_s, const u8 *addr,
2997 if (wpa_s->ap_iface && addr) {
2998 hostapd_notif_disassoc(wpa_s->ap_iface->bss[0], addr);
3002 if (wpa_s->ap_iface) {
3003 wpa_dbg(wpa_s, MSG_DEBUG, "Ignore deauth event in AP mode");
3009 wpa_s->own_disconnect_req = 0;
3011 wpa_supplicant_event_disassoc(wpa_s, reason_code, locally_generated);
3014 ((wpa_key_mgmt_wpa_ieee8021x(wpa_s->key_mgmt) ||
3015 (wpa_s->key_mgmt & WPA_KEY_MGMT_IEEE8021X_NO_WPA)) &&
3016 wpa_s->eapol))) &&
3017 !wpa_s->eap_expected_failure))
3018 wpas_auth_failed(wpa_s, "AUTH_FAILED");
3022 if (wpas_p2p_deauth_notif(wpa_s, addr, reason_code, ie, ie_len,
3033 wpa_supplicant_event_disassoc_finish(wpa_s, reason_code,
3038 static void wpas_event_disassoc(struct wpa_supplicant *wpa_s,
3047 wpa_dbg(wpa_s, MSG_DEBUG, "Disassociation notification");
3055 wpa_dbg(wpa_s, MSG_DEBUG, " * reason %u%s", reason_code,
3058 wpa_dbg(wpa_s, MSG_DEBUG, " * address " MACSTR,
3065 if (wpa_s->ap_iface && info && info->addr) {
3066 hostapd_notif_disassoc(wpa_s->ap_iface->bss[0], info->addr);
3070 if (wpa_s->ap_iface) {
3071 wpa_dbg(wpa_s, MSG_DEBUG, "Ignore disassoc event in AP mode");
3079 wpa_s, info->addr, reason_code, info->ie, info->ie_len,
3084 if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME)
3085 sme_event_disassoc(wpa_s, info);
3087 wpas_event_disconnect(wpa_s, addr, reason_code, locally_generated,
3092 static void wpas_event_deauth(struct wpa_supplicant *wpa_s,
3101 wpa_dbg(wpa_s, MSG_DEBUG, "Deauthentication notification");
3109 wpa_dbg(wpa_s, MSG_DEBUG, " * reason %u%s",
3113 wpa_dbg(wpa_s, MSG_DEBUG, " * address " MACSTR,
3120 wpa_reset_ft_completed(wpa_s->wpa);
3122 wpas_event_disconnect(wpa_s, addr, reason_code,
3164 struct wpa_supplicant *wpa_s, struct channel_list_changed *info)
3168 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_REGDOM_CHANGE "init=%s type=%s%s%s",
3173 if (wpa_s->drv_priv == NULL)
3176 dl_list_for_each(ifs, &wpa_s->radio->ifaces, struct wpa_supplicant,
3186 if (wpa_s->sched_scanning) {
3187 wpa_dbg(wpa_s, MSG_DEBUG,
3189 wpa_supplicant_cancel_sched_scan(wpa_s);
3190 wpa_supplicant_req_scan(wpa_s, 0, 0);
3193 wpas_p2p_update_channel_list(wpa_s, WPAS_P2P_CHANNEL_UPDATE_DRIVER);
3197 static void wpas_event_rx_mgmt_action(struct wpa_supplicant *wpa_s,
3214 wpa_dbg(wpa_s, MSG_DEBUG, "Received Action frame: SA=" MACSTR
3219 wmm_ac_rx_action(wpa_s, mgmt->da, mgmt->sa, payload, plen);
3225 ft_rx_action(wpa_s, payload, plen);
3233 sme_sa_query_rx(wpa_s, mgmt->sa, payload, plen);
3241 ieee802_11_rx_wnm_action(wpa_s, mgmt, len);
3249 gas_query_rx(wpa_s->gas, mgmt->da, mgmt->sa, mgmt->bssid,
3258 wpa_dbg(wpa_s, MSG_DEBUG,
3270 wpa_dbg(wpa_s, MSG_DEBUG, "Interworking: Received QoS Map Configure frame from "
3272 if (os_memcmp(mgmt->sa, wpa_s->bssid, ETH_ALEN) == 0 &&
3275 wpas_qos_map_set(wpa_s, pos + 2, pos[1]);
3282 wpas_rrm_process_neighbor_rep(wpa_s, payload + 1, plen - 1);
3288 wpas_rrm_handle_link_measurement_request(wpa_s, mgmt->sa,
3295 if (mgmt->u.action.category == WLAN_ACTION_FST && wpa_s->fst) {
3296 fst_rx_action(wpa_s->fst, mgmt, len);
3301 wpas_p2p_rx_action(wpa_s, mgmt->da, mgmt->sa, mgmt->bssid,
3303 if (wpa_s->ifmsh)
3304 mesh_mpm_action_rx(wpa_s, mgmt, len);
3308 static void wpa_supplicant_notify_avoid_freq(struct wpa_supplicant *wpa_s,
3318 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_AVOID_FREQ "ranges=%s",
3322 if (freq_range_list_parse(&wpa_s->global->p2p_go_avoid_freq, str)) {
3323 wpa_dbg(wpa_s, MSG_ERROR, "%s: Failed to parse freq range",
3326 wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Update channel list based on frequency avoid event");
3332 wpas_p2p_update_channel_list(wpa_s,
3341 static void wpa_supplicant_event_assoc_auth(struct wpa_supplicant *wpa_s,
3344 wpa_dbg(wpa_s, MSG_DEBUG,
3346 wpa_s->wpa_state);
3347 if (wpa_s->wpa_state == WPA_ASSOCIATED) {
3348 wpa_supplicant_cancel_auth_timeout(wpa_s);
3349 wpa_supplicant_set_state(wpa_s, WPA_COMPLETED);
3350 eapol_sm_notify_portValid(wpa_s->eapol, TRUE);
3351 eapol_sm_notify_eap_success(wpa_s->eapol, TRUE);
3353 wpa_sm_set_rx_replay_ctr(wpa_s->wpa, data->assoc_info.key_replay_ctr);
3354 wpa_sm_set_ptk_kck_kek(wpa_s->wpa, data->assoc_info.ptk_kck,
3364 struct wpa_supplicant *wpa_s = ctx;
3367 if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED &&
3372 wpa_dbg(wpa_s, MSG_DEBUG,
3392 wpa_dbg(wpa_s, level, "Event %s (%d) received",
3400 if (!wpas_fst_update_mbie(wpa_s, data->auth.ies,
3405 sme_event_auth(wpa_s, data);
3408 wpa_supplicant_event_assoc(wpa_s, data);
3410 wpa_supplicant_event_assoc_auth(wpa_s, data);
3412 wpa_msg(wpa_s, MSG_INFO,
3418 wpas_event_disassoc(wpa_s,
3422 wpas_event_deauth(wpa_s,
3426 wpa_supplicant_event_michael_mic_failure(wpa_s, data);
3430 if (wpa_s->own_scan_requested ||
3434 os_get_reltime(&wpa_s->scan_start_time);
3435 os_reltime_sub(&wpa_s->scan_start_time,
3436 &wpa_s->scan_trigger_time, &diff);
3437 wpa_dbg(wpa_s, MSG_DEBUG, "Own scan request started a scan in %ld.%06ld seconds",
3439 wpa_s->own_scan_requested = 0;
3440 wpa_s->own_scan_running = 1;
3441 if (wpa_s->last_scan_req == MANUAL_SCAN_REQ &&
3442 wpa_s->manual_scan_use_id) {
3443 wpa_msg_ctrl(wpa_s, MSG_INFO,
3445 wpa_s->manual_scan_id);
3447 wpa_msg_ctrl(wpa_s, MSG_INFO,
3451 wpa_dbg(wpa_s, MSG_DEBUG, "External program started a scan");
3452 wpa_s->radio->external_scan_running = 1;
3453 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_SCAN_STARTED);
3457 if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED) {
3458 wpa_s->scan_res_handler = NULL;
3459 wpa_s->own_scan_running = 0;
3460 wpa_s->radio->external_scan_running = 0;
3461 wpa_s->last_scan_req = NORMAL_SCAN_REQ;
3466 os_reltime_initialized(&wpa_s->scan_start_time)) {
3469 os_reltime_sub(&now, &wpa_s->scan_start_time, &diff);
3470 wpa_s->scan_start_time.sec = 0;
3471 wpa_s->scan_start_time.usec = 0;
3472 wpa_dbg(wpa_s, MSG_DEBUG, "Scan completed in %ld.%06ld seconds",
3475 if (wpa_supplicant_event_scan_results(wpa_s, data))
3478 wpa_s->own_scan_running = 0;
3480 wpa_s->radio->external_scan_running = 0;
3481 radio_work_check_next(wpa_s);
3485 wpa_supplicant_event_associnfo(wpa_s, data);
3488 wpa_supplicant_event_interface_status(wpa_s, data);
3491 wpa_supplicant_event_pmkid_candidate(wpa_s, data);
3495 wpa_supplicant_event_stkstart(wpa_s, data);
3500 wpa_supplicant_event_tdls(wpa_s, data);
3505 wpa_supplicant_event_wnm(wpa_s, data);
3510 wpa_supplicant_event_ft_response(wpa_s, data);
3515 wpa_supplicant_event_ibss_rsn_start(wpa_s, data);
3520 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_ASSOC_REJECT
3525 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_ASSOC_REJECT
3528 wpa_s->assoc_status_code = data->assoc_reject.status_code;
3529 wpas_notify_assoc_status_code(wpa_s);
3530 if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME)
3531 sme_event_assoc_reject(wpa_s, data);
3535 bssid = wpa_s->pending_bssid;
3536 wpas_connection_failed(wpa_s, bssid);
3537 wpa_supplicant_mark_disassoc(wpa_s);
3542 if (wpa_s->current_ssid &&
3543 wpa_s->current_ssid->mode == WPAS_MODE_MESH) {
3544 wpa_dbg(wpa_s, MSG_DEBUG,
3548 if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME)
3549 sme_event_auth_timed_out(wpa_s, data);
3553 if (wpa_s->current_ssid &&
3554 wpa_s->current_ssid->mode == WPAS_MODE_MESH) {
3555 wpa_dbg(wpa_s, MSG_DEBUG,
3559 if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME)
3560 sme_event_assoc_timed_out(wpa_s, data);
3563 wpa_dbg(wpa_s, MSG_DEBUG, "EVENT_TX_STATUS dst=" MACSTR
3568 if (wpa_s->ap_iface == NULL) {
3573 wpa_s, data->tx_status.dst,
3584 wpa_dbg(wpa_s, MSG_DEBUG, "EVENT_TX_STATUS pending_dst="
3585 MACSTR, MAC2STR(wpa_s->parent->pending_action_dst));
3592 os_memcmp(wpa_s->parent->pending_action_dst,
3595 wpa_s->parent, data->tx_status.dst,
3607 ap_mgmt_tx_cb(wpa_s, data->tx_status.data,
3613 ap_tx_status(wpa_s, data->tx_status.dst,
3623 ap_eapol_tx_status(wpa_s, data->eapol_tx_status.dst,
3629 ap_client_poll_ok(wpa_s, data->client_poll.addr);
3632 if (wpa_s->ap_iface == NULL)
3634 ap_rx_from_unknown_sta(wpa_s, data->rx_from_unknown.addr,
3638 if (!data || !wpa_s->current_ssid)
3641 wpa_s->assoc_freq = data->ch_switch.freq;
3642 wpa_s->current_ssid->frequency = data->ch_switch.freq;
3644 if (wpa_s->current_ssid->mode == WPAS_MODE_AP ||
3645 wpa_s->current_ssid->mode == WPAS_MODE_P2P_GO ||
3646 wpa_s->current_ssid->mode ==
3648 wpas_ap_ch_switch(wpa_s, data->ch_switch.freq,
3656 wpas_p2p_update_channel_list(wpa_s, WPAS_P2P_CHANNEL_UPDATE_CS);
3661 wpas_event_dfs_radar_detected(wpa_s, &data->dfs_event);
3665 wpas_event_dfs_cac_started(wpa_s, &data->dfs_event);
3669 wpas_event_dfs_cac_finished(wpa_s, &data->dfs_event);
3673 wpas_event_dfs_cac_aborted(wpa_s, &data->dfs_event);
3677 wpas_event_dfs_cac_nop_finished(wpa_s,
3687 if (wpa_s->ext_mgmt_frame_handling) {
3694 wpa_msg(wpa_s, MSG_INFO, "MGMT-RX freq=%d datarate=%u ssi_signal=%d %s",
3709 if (wpa_s->ap_iface == NULL) {
3722 wpa_s, src, mgmt->da,
3730 if (wpa_s->current_ssid &&
3731 wpa_s->current_ssid->mode == WPAS_MODE_IBSS &&
3734 wpa_supplicant_event_ibss_auth(wpa_s, data);
3741 wpa_s, data->rx_mgmt.frame,
3748 if (wpa_s->ifmsh) {
3749 mesh_mpm_mgmt_rx(wpa_s, &data->rx_mgmt);
3753 wpa_dbg(wpa_s, MSG_DEBUG, "AP: ignore received "
3767 wpas_notify_preq(wpa_s, mgmt->sa, mgmt->da,
3772 ap_mgmt_rx(wpa_s, &data->rx_mgmt);
3781 if (wpa_s->ap_iface) {
3782 hostapd_probe_req_rx(wpa_s->ap_iface->bss[0],
3792 wpas_p2p_probe_req_rx(wpa_s, data->rx_probe_req.sa,
3803 wpa_s, data->remain_on_channel.freq,
3807 wpa_s, data->remain_on_channel.freq,
3813 wpa_s, data->remain_on_channel.freq);
3816 wpa_s, data->remain_on_channel.freq);
3819 wpa_supplicant_rx_eapol(wpa_s, data->eapol_rx.src,
3824 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_SIGNAL_CHANGE
3830 wpa_bss_update_level(wpa_s->current_bss,
3833 wpa_s, data->signal_change.above_threshold,
3839 wpa_dbg(wpa_s, MSG_DEBUG, "Interface was enabled");
3840 if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED) {
3841 wpa_supplicant_update_mac_addr(wpa_s);
3842 if (wpa_s->p2p_mgmt) {
3843 wpa_supplicant_set_state(wpa_s,
3849 if (!wpa_s->ap_iface) {
3850 wpa_supplicant_set_state(wpa_s,
3852 wpa_s->scan_req = NORMAL_SCAN_REQ;
3853 wpa_supplicant_req_scan(wpa_s, 0, 0);
3855 wpa_supplicant_set_state(wpa_s,
3858 wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED);
3859 wpa_supplicant_req_scan(wpa_s, 0, 0);
3864 wpa_dbg(wpa_s, MSG_DEBUG, "Interface was disabled");
3866 if (wpa_s->p2p_group_interface == P2P_GROUP_INTERFACE_GO ||
3867 (wpa_s->current_ssid && wpa_s->current_ssid->p2p_group &&
3868 wpa_s->current_ssid->mode == WPAS_MODE_P2P_GO)) {
3873 wpa_supplicant_set_state(wpa_s, WPA_INTERFACE_DISABLED);
3879 if (wpa_s->current_ssid &&
3880 wpa_s->current_ssid->p2p_group)
3881 wpas_p2p_interface_unavailable(wpa_s);
3883 wpas_p2p_disconnect(wpa_s);
3885 * wpa_s instance may have been freed, so must not use
3890 if (wpa_s->p2p_scan_work && wpa_s->global->p2p &&
3891 p2p_in_progress(wpa_s->global->p2p) > 1) {
3895 p2p_stop_find(wpa_s->global->p2p);
3899 if (wpa_s->wpa_state >= WPA_AUTHENTICATING) {
3905 wpa_s, WLAN_REASON_DEAUTH_LEAVING, 1);
3907 wpa_supplicant_mark_disassoc(wpa_s);
3908 radio_remove_works(wpa_s, NULL, 0);
3910 wpa_supplicant_set_state(wpa_s, WPA_INTERFACE_DISABLED);
3914 wpa_s, &data->channel_list_changed);
3917 wpas_p2p_interface_unavailable(wpa_s);
3920 wpa_dbg(wpa_s, MSG_DEBUG, "Best channel event received "
3924 wpa_s->best_24_freq = data->best_chan.freq_24;
3925 wpa_s->best_5_freq = data->best_chan.freq_5;
3926 wpa_s->best_overall_freq = data->best_chan.freq_overall;
3927 wpas_p2p_update_best_channels(wpa_s, data->best_chan.freq_24,
3932 wpa_supplicant_event_unprot_deauth(wpa_s,
3936 wpa_supplicant_event_unprot_disassoc(wpa_s,
3941 if (wpa_s->ap_iface && data)
3942 hostapd_event_sta_low_ack(wpa_s->ap_iface->bss[0],
3947 wpa_tdls_disable_unreachable_link(wpa_s->wpa,
3953 ibss_rsn_stop(wpa_s->ibss_rsn, data->ibss_peer_lost.peer);
3958 wpa_s->bssid, ETH_ALEN))
3960 if (!wpa_s->wpa)
3962 wpa_sm_update_replay_ctr(wpa_s->wpa,
3966 wpa_s->sched_scanning = 0;
3967 resched = wpa_s->scanning && wpas_scan_scheduled(wpa_s);
3968 wpa_supplicant_notify_scanning(wpa_s, 0);
3970 if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED)
3977 if (wpa_s->sched_scan_timed_out) {
3978 wpa_supplicant_req_sched_scan(wpa_s);
3979 } else if (wpa_s->pno_sched_pending) {
3980 wpa_s->pno_sched_pending = 0;
3981 wpas_start_pno(wpa_s);
3983 wpa_supplicant_req_scan(wpa_s, 0, 0);
3989 wpas_wps_start_pbc(wpa_s, NULL, 0);
3993 wpa_supplicant_notify_avoid_freq(wpa_s, data);
3997 if (!wpa_s->ap_iface || !data)
4000 wpa_s->ap_iface->bss[0],
4007 if (!wpa_s->ifmsh || !data)
4009 wpa_mesh_notify_peer(wpa_s, data->mesh_peer.peer,
4016 if (!wpa_s->ap_iface)
4018 hostapd_event_get_survey(wpa_s->ap_iface,
4024 if (!wpa_s->ap_iface)
4026 hostapd_acs_channel_selected(wpa_s->ap_iface->bss[0],
4031 wpa_msg(wpa_s, MSG_INFO, "Unknown event %d", event);
4040 struct wpa_supplicant *wpa_s;
4045 wpa_s = wpa_supplicant_get_iface(ctx, data->interface_status.ifname);
4046 if (wpa_s && wpa_s->driver->get_ifindex) {
4049 ifindex = wpa_s->driver->get_ifindex(wpa_s->drv_priv);
4051 wpa_dbg(wpa_s, MSG_DEBUG,
4065 wpa_s = wpa_supplicant_add_iface(ctx, wpa_i, NULL);
4067 if (wpa_s)
4068 wpa_s->matched = 1;
4072 if (wpa_s)
4073 wpa_supplicant_event(wpa_s, event, data);