Lines Matching defs:sm
35 * @sm: Pointer to WPA state machine data from wpa_sm_init()
37 void pmksa_candidate_free(struct wpa_sm *sm)
41 if (sm == NULL)
44 dl_list_for_each_safe(entry, n, &sm->pmksa_candidates,
65 struct wpa_sm *sm = ctx;
70 if (sm->preauth_eapol == NULL ||
71 is_zero_ether_addr(sm->preauth_bssid) ||
72 !ether_addr_equal(sm->preauth_bssid, src_addr)) {
79 eapol_sm_rx_eapol(sm->preauth_eapol, src_addr, buf, len,
88 struct wpa_sm *sm = ctx;
106 sm->pmk_len = pmk_len;
107 pmksa_cache_add(sm->pmksa, pmk, pmk_len, NULL,
109 sm->preauth_bssid, sm->own_addr,
110 sm->network_ctx,
113 wpa_msg(sm->ctx->msg_ctx, MSG_INFO,
120 wpa_msg(sm->ctx->msg_ctx, MSG_INFO, "RSN: pre-authentication with "
121 MACSTR " %s", MAC2STR(sm->preauth_bssid),
125 rsn_preauth_deinit(sm);
126 rsn_preauth_candidate_process(sm);
132 struct wpa_sm *sm = eloop_ctx;
134 wpa_msg(sm->ctx->msg_ctx, MSG_INFO, "RSN: pre-authentication with "
135 MACSTR " timed out", MAC2STR(sm->preauth_bssid));
136 rsn_preauth_deinit(sm);
137 rsn_preauth_candidate_process(sm);
144 struct wpa_sm *sm = ctx;
152 if (sm->l2_preauth == NULL)
155 msg = wpa_sm_alloc_eapol(sm, type, buf, len, &msglen, NULL);
160 res = l2_packet_send(sm->l2_preauth, sm->preauth_bssid,
169 * @sm: Pointer to WPA state machine data from wpa_sm_init()
181 int rsn_preauth_init(struct wpa_sm *sm, const u8 *dst,
188 if (sm->preauth_eapol)
191 wpa_msg(sm->ctx->msg_ctx, MSG_DEBUG,
194 sm->l2_preauth = l2_packet_init(sm->ifname, sm->own_addr,
196 rsn_preauth_receive, sm, 0);
197 if (sm->l2_preauth == NULL) {
203 if (sm->bridge_ifname) {
204 sm->l2_preauth_br = l2_packet_init(sm->bridge_ifname,
205 sm->own_addr,
207 rsn_preauth_receive, sm, 0);
208 if (sm->l2_preauth_br == NULL) {
223 ctx->ctx = sm->ctx->ctx;
224 ctx->msg_ctx = sm->ctx->ctx;
227 ctx->cb_ctx = sm;
228 ctx->scard_ctx = sm->scard_ctx;
230 ctx->eapol_send_ctx = sm;
231 ctx->set_config_blob = sm->ctx->set_config_blob;
232 ctx->get_config_blob = sm->ctx->get_config_blob;
234 sm->preauth_eapol = eapol_sm_init(ctx);
235 if (sm->preauth_eapol == NULL) {
245 eapol_conf.fast_reauth = sm->fast_reauth;
246 eapol_conf.workaround = sm->eap_workaround;
247 eapol_sm_notify_config(sm->preauth_eapol, eap_conf, &eapol_conf);
254 eapol_sm_configure(sm->preauth_eapol, -1, -1, 5, 6);
255 os_memcpy(sm->preauth_bssid, dst, ETH_ALEN);
257 eapol_sm_notify_portValid(sm->preauth_eapol, true);
259 eapol_sm_notify_portEnabled(sm->preauth_eapol, true);
261 eloop_register_timeout(sm->dot11RSNAConfigSATimeout, 0,
262 rsn_preauth_timeout, sm, NULL);
267 if (sm->l2_preauth_br) {
268 l2_packet_deinit(sm->l2_preauth_br);
269 sm->l2_preauth_br = NULL;
271 l2_packet_deinit(sm->l2_preauth);
272 sm->l2_preauth = NULL;
279 * @sm: Pointer to WPA state machine data from wpa_sm_init()
284 void rsn_preauth_deinit(struct wpa_sm *sm)
286 if (sm == NULL || !sm->preauth_eapol)
289 eloop_cancel_timeout(rsn_preauth_timeout, sm, NULL);
290 eapol_sm_deinit(sm->preauth_eapol);
291 sm->preauth_eapol = NULL;
292 os_memset(sm->preauth_bssid, 0, ETH_ALEN);
294 l2_packet_deinit(sm->l2_preauth);
295 sm->l2_preauth = NULL;
296 if (sm->l2_preauth_br) {
297 l2_packet_deinit(sm->l2_preauth_br);
298 sm->l2_preauth_br = NULL;
305 * @sm: Pointer to WPA state machine data from wpa_sm_init()
311 void rsn_preauth_candidate_process(struct wpa_sm *sm)
315 if (dl_list_empty(&sm->pmksa_candidates))
320 wpa_msg(sm->ctx->msg_ctx, MSG_DEBUG, "RSN: processing PMKSA candidate "
322 if (sm->preauth_eapol ||
323 sm->proto != WPA_PROTO_RSN ||
324 wpa_sm_get_state(sm) != WPA_COMPLETED ||
325 !rsn_preauth_key_mgmt(sm->key_mgmt)) {
326 wpa_msg(sm->ctx->msg_ctx, MSG_DEBUG, "RSN: not in suitable "
331 dl_list_for_each_safe(candidate, n, &sm->pmksa_candidates,
334 p = pmksa_cache_get(sm->pmksa, candidate->bssid, sm->own_addr,
336 if (!ether_addr_equal(sm->bssid, candidate->bssid) &&
338 wpa_msg(sm->ctx->msg_ctx, MSG_DEBUG, "RSN: PMKSA "
343 rsn_preauth_init(sm, candidate->bssid,
344 sm->eap_conf_ctx);
348 wpa_msg(sm->ctx->msg_ctx, MSG_DEBUG, "RSN: PMKSA candidate "
354 wpa_sm_add_pmkid(sm, NULL, candidate->bssid, p->pmkid,
362 wpa_msg(sm->ctx->msg_ctx, MSG_DEBUG, "RSN: no more pending PMKSA "
369 * @sm: Pointer to WPA state machine data from wpa_sm_init()
378 void pmksa_candidate_add(struct wpa_sm *sm, const u8 *bssid,
383 if (sm->network_ctx && sm->proactive_key_caching)
384 pmksa_cache_get_opportunistic(sm->pmksa, sm->network_ctx,
396 dl_list_for_each(pos, &sm->pmksa_candidates,
418 dl_list_for_each(pos, &sm->pmksa_candidates,
439 dl_list_add_tail(&sm->pmksa_candidates, &cand->list);
441 wpa_msg(sm->ctx->msg_ctx, MSG_DEBUG, "RSN: added PMKSA cache "
443 rsn_preauth_candidate_process(sm);
451 * @sm: Pointer to WPA state machine data from wpa_sm_init()
458 int rsn_preauth_scan_results(struct wpa_sm *sm)
460 if (sm->ssid_len == 0)
467 pmksa_candidate_free(sm);
475 * @sm: Pointer to WPA state machine data from wpa_sm_init()
480 void rsn_preauth_scan_result(struct wpa_sm *sm, const u8 *bssid,
486 if (ssid[1] != sm->ssid_len ||
487 os_memcmp(ssid + 2, sm->ssid, sm->ssid_len) != 0)
490 if (ether_addr_equal(bssid, sm->bssid))
496 pmksa = pmksa_cache_get(sm->pmksa, bssid, sm->own_addr, NULL, NULL, 0);
505 pmksa_candidate_add(sm, bssid, PMKID_CANDIDATE_PRIO_SCAN,
513 * @sm: Pointer to WPA state machine data from wpa_sm_init()
523 int rsn_preauth_get_status(struct wpa_sm *sm, char *buf, size_t buflen,
529 if (sm->preauth_eapol) {
535 res = eapol_sm_get_status(sm->preauth_eapol,
548 * @sm: Pointer to WPA state machine data from wpa_sm_init()
550 int rsn_preauth_in_progress(struct wpa_sm *sm)
552 return sm->preauth_eapol != NULL;