static void wpas_clear_wps(struct wpa_supplicant *wpa_s) { int id; struct wpa_ssid *ssid, *remove_ssid = NULL, *prev_current; prev_current = wpa_s->current_ssid; eloop_cancel_timeout(wpas_wps_timeout, wpa_s, NULL); /* Remove any existing WPS network from configuration */ ssid = wpa_s->conf->ssid; while (ssid) { if (ssid->key_mgmt & WPA_KEY_MGMT_WPS) { if (ssid == wpa_s->current_ssid) { wpa_s->current_ssid = NULL; if (ssid != NULL) wpas_notify_network_changed(wpa_s); } id = ssid->id; remove_ssid = ssid; } else id = -1; ssid = ssid->next; if (id >= 0) { if (prev_current == remove_ssid) { wpa_sm_set_config(wpa_s->wpa, NULL); eapol_sm_notify_config(wpa_s->eapol, NULL, NULL); } wpas_notify_network_removed(wpa_s, remove_ssid); wpa_config_remove_network(wpa_s->conf, id); } } }
void wpa_supplicant_rsn_supp_set_config(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid) { struct rsn_supp_config conf; if (ssid) { os_memset(&conf, 0, sizeof(conf)); conf.network_ctx = ssid; conf.peerkey_enabled = ssid->peerkey; conf.allowed_pairwise_cipher = ssid->pairwise_cipher; #ifdef IEEE8021X_EAPOL conf.eap_workaround = ssid->eap_workaround; conf.eap_conf_ctx = &ssid->eap; #endif /* IEEE8021X_EAPOL */ conf.ssid = ssid->ssid; conf.ssid_len = ssid->ssid_len; conf.wpa_ptk_rekey = ssid->wpa_ptk_rekey; } wpa_sm_set_config(wpa_s->wpa, ssid ? &conf : NULL); }
void wpa_supplicant_rsn_supp_set_config(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid) { struct rsn_supp_config conf; if (ssid) { os_memset(&conf, 0, sizeof(conf)); conf.network_ctx = ssid; conf.allowed_pairwise_cipher = ssid->pairwise_cipher; #ifdef IEEE8021X_EAPOL conf.proactive_key_caching = ssid->proactive_key_caching < 0 ? wpa_s->conf->okc : ssid->proactive_key_caching; conf.eap_workaround = ssid->eap_workaround; conf.eap_conf_ctx = &ssid->eap; #endif /* IEEE8021X_EAPOL */ conf.ssid = ssid->ssid; conf.ssid_len = ssid->ssid_len; conf.wpa_ptk_rekey = ssid->wpa_ptk_rekey; #ifdef CONFIG_P2P if (ssid->p2p_group && wpa_s->current_bss && !wpa_s->p2p_disable_ip_addr_req) { struct wpabuf *p2p; p2p = wpa_bss_get_vendor_ie_multi(wpa_s->current_bss, P2P_IE_VENDOR_TYPE); if (p2p) { u8 group_capab; group_capab = p2p_get_group_capab(p2p); if (group_capab & P2P_GROUP_CAPAB_IP_ADDR_ALLOCATION) conf.p2p = 1; wpabuf_free(p2p); } } #endif /* CONFIG_P2P */ conf.wpa_rsc_relaxation = wpa_s->conf->wpa_rsc_relaxation; #ifdef CONFIG_FILS if (wpa_key_mgmt_fils(wpa_s->key_mgmt)) conf.fils_cache_id = wpa_bss_get_fils_cache_id(wpa_s->current_bss); #endif /* CONFIG_FILS */ } wpa_sm_set_config(wpa_s->wpa, ssid ? &conf : NULL); }
static int wpa_supplicant_select_config(struct wpa_supplicant *wpa_s) { struct wpa_ssid *ssid; if (wpa_s->conf->ap_scan == 1 && wpa_s->current_ssid) return 0; ssid = wpa_supplicant_get_ssid(wpa_s); if (ssid == NULL) { wpa_printf(MSG_INFO, "No network configuration found for the " "current AP"); return -1; } if (ssid->disabled) { wpa_printf(MSG_DEBUG, "Selected network is disabled"); return -1; } wpa_printf(MSG_DEBUG, "Network configuration found for the current " "AP"); if (ssid->key_mgmt & (WPA_KEY_MGMT_PSK | WPA_KEY_MGMT_IEEE8021X | WPA_KEY_MGMT_WPA_NONE)) { u8 wpa_ie[80]; size_t wpa_ie_len = sizeof(wpa_ie); wpa_supplicant_set_suites(wpa_s, NULL, ssid, wpa_ie, &wpa_ie_len); } else { wpa_supplicant_set_non_wpa_policy(wpa_s, ssid); } if (wpa_s->current_ssid && wpa_s->current_ssid != ssid) eapol_sm_invalidate_cached_session(wpa_s->eapol); wpa_s->current_ssid = ssid; wpa_sm_set_config(wpa_s->wpa, wpa_s->current_ssid); wpa_supplicant_initiate_eapol(wpa_s); return 0; }