Lines Matching refs:peer
30 struct ibss_rsn_peer *peer; in ibss_rsn_get_peer() local
32 for (peer = ibss_rsn->peers; peer; peer = peer->next) in ibss_rsn_get_peer()
33 if (os_memcmp(addr, peer->addr, ETH_ALEN) == 0) in ibss_rsn_get_peer()
35 return peer; in ibss_rsn_get_peer()
39 static void ibss_rsn_free(struct ibss_rsn_peer *peer) in ibss_rsn_free() argument
41 eloop_cancel_timeout(ibss_rsn_auth_timeout, peer, NULL); in ibss_rsn_free()
42 wpa_auth_sta_deinit(peer->auth); in ibss_rsn_free()
43 wpa_sm_deinit(peer->supp); in ibss_rsn_free()
44 os_free(peer); in ibss_rsn_free()
50 struct ibss_rsn_peer *peer = ctx; in supp_set_state() local
51 peer->supp_state = state; in supp_set_state()
57 struct ibss_rsn_peer *peer = ctx; in supp_get_state() local
58 return peer->supp_state; in supp_get_state()
65 struct ibss_rsn_peer *peer = ctx; in supp_ether_send() local
66 struct wpa_supplicant *wpa_s = peer->ibss_rsn->wpa_s; in supp_ether_send()
110 struct ibss_rsn_peer *peer = ctx; in supp_get_beacon_ie() local
114 return wpa_sm_set_ap_rsn_ie(peer->supp, in supp_get_beacon_ie()
123 static void ibss_check_rsn_completed(struct ibss_rsn_peer *peer) in ibss_check_rsn_completed() argument
125 struct wpa_supplicant *wpa_s = peer->ibss_rsn->wpa_s; in ibss_check_rsn_completed()
127 if ((peer->authentication_status & in ibss_check_rsn_completed()
131 if (peer->authentication_status & IBSS_RSN_REPORTED_PTK) in ibss_check_rsn_completed()
133 peer->authentication_status |= IBSS_RSN_REPORTED_PTK; in ibss_check_rsn_completed()
135 MAC2STR(peer->addr)); in ibss_check_rsn_completed()
144 struct ibss_rsn_peer *peer = ctx; in supp_set_key() local
153 peer->authentication_status |= IBSS_RSN_SET_PTK_SUPP; in supp_set_key()
154 ibss_check_rsn_completed(peer); in supp_set_key()
159 if (os_memcmp(peer->ibss_rsn->wpa_s->own_addr, peer->addr, in supp_set_key()
167 addr = peer->addr; in supp_set_key()
168 return wpa_drv_set_key(peer->ibss_rsn->wpa_s, alg, addr, key_idx, in supp_set_key()
175 struct ibss_rsn_peer *peer = ctx; in supp_get_network_ctx() local
176 return wpa_supplicant_get_ssid(peer->ibss_rsn->wpa_s); in supp_get_network_ctx()
202 static int ibss_rsn_supp_init(struct ibss_rsn_peer *peer, const u8 *own_addr, in ibss_rsn_supp_init() argument
209 ctx->ctx = peer; in ibss_rsn_supp_init()
210 ctx->msg_ctx = peer->ibss_rsn->wpa_s; in ibss_rsn_supp_init()
221 peer->supp = wpa_sm_init(ctx); in ibss_rsn_supp_init()
222 if (peer->supp == NULL) { in ibss_rsn_supp_init()
228 wpa_sm_set_own_addr(peer->supp, own_addr); in ibss_rsn_supp_init()
229 wpa_sm_set_param(peer->supp, WPA_PARAM_RSN_ENABLED, 1); in ibss_rsn_supp_init()
230 wpa_sm_set_param(peer->supp, WPA_PARAM_PROTO, WPA_PROTO_RSN); in ibss_rsn_supp_init()
231 wpa_sm_set_param(peer->supp, WPA_PARAM_PAIRWISE, WPA_CIPHER_CCMP); in ibss_rsn_supp_init()
232 wpa_sm_set_param(peer->supp, WPA_PARAM_GROUP, WPA_CIPHER_CCMP); in ibss_rsn_supp_init()
233 wpa_sm_set_param(peer->supp, WPA_PARAM_KEY_MGMT, WPA_KEY_MGMT_PSK); in ibss_rsn_supp_init()
234 wpa_sm_set_pmk(peer->supp, psk, PMK_LEN, NULL, NULL); in ibss_rsn_supp_init()
236 peer->supp_ie_len = sizeof(peer->supp_ie); in ibss_rsn_supp_init()
237 if (wpa_sm_set_assoc_wpa_ie_default(peer->supp, peer->supp_ie, in ibss_rsn_supp_init()
238 &peer->supp_ie_len) < 0) { in ibss_rsn_supp_init()
244 wpa_sm_notify_assoc(peer->supp, peer->addr); in ibss_rsn_supp_init()
317 struct ibss_rsn_peer *peer; in auth_set_key() local
318 peer = ibss_rsn_get_peer(ibss_rsn, addr); in auth_set_key()
319 if (peer) { in auth_set_key()
320 peer->authentication_status |= in auth_set_key()
322 ibss_check_rsn_completed(peer); in auth_set_key()
353 struct ibss_rsn_peer *peer; in auth_for_each_sta() local
357 for (peer = ibss_rsn->peers; peer; peer = peer->next) { in auth_for_each_sta()
358 if (peer->auth && cb(peer->auth, cb_ctx)) in auth_for_each_sta()
367 struct ibss_rsn_peer *peer, int authorized) in ibss_set_sta_authorized() argument
372 res = wpa_drv_sta_set_flags(ibss_rsn->wpa_s, peer->addr, in ibss_set_sta_authorized()
376 MAC2STR(peer->addr)); in ibss_set_sta_authorized()
378 res = wpa_drv_sta_set_flags(ibss_rsn->wpa_s, peer->addr, in ibss_set_sta_authorized()
381 MAC2STR(peer->addr)); in ibss_set_sta_authorized()
387 MAC2STR(peer->addr), errno); in ibss_set_sta_authorized()
396 struct ibss_rsn_peer *peer = ibss_rsn_get_peer(ibss_rsn, addr); in auth_set_eapol() local
398 if (peer == NULL) in auth_set_eapol()
403 ibss_set_sta_authorized(ibss_rsn, peer, value); in auth_set_eapol()
453 struct ibss_rsn_peer *peer) in ibss_rsn_auth_init() argument
455 peer->auth = wpa_auth_sta_init(ibss_rsn->auth_group, peer->addr, NULL); in ibss_rsn_auth_init()
456 if (peer->auth == NULL) { in ibss_rsn_auth_init()
462 if (wpa_validate_wpa_ie(ibss_rsn->auth_group, peer->auth, 0, in ibss_rsn_auth_init()
473 if (wpa_auth_sm_event(peer->auth, WPA_ASSOC)) in ibss_rsn_auth_init()
476 if (wpa_auth_sta_associated(ibss_rsn->auth_group, peer->auth)) in ibss_rsn_auth_init()
512 static int ibss_rsn_is_auth_started(struct ibss_rsn_peer * peer) in ibss_rsn_is_auth_started() argument
514 return peer->authentication_status & in ibss_rsn_is_auth_started()
522 struct ibss_rsn_peer *peer; in ibss_rsn_peer_init() local
526 peer = ibss_rsn_get_peer(ibss_rsn, addr); in ibss_rsn_peer_init()
527 if (peer) { in ibss_rsn_peer_init()
530 return peer; in ibss_rsn_peer_init()
536 peer = os_zalloc(sizeof(*peer)); in ibss_rsn_peer_init()
537 if (peer == NULL) { in ibss_rsn_peer_init()
542 peer->ibss_rsn = ibss_rsn; in ibss_rsn_peer_init()
543 os_memcpy(peer->addr, addr, ETH_ALEN); in ibss_rsn_peer_init()
544 peer->authentication_status = IBSS_RSN_AUTH_NOT_AUTHENTICATED; in ibss_rsn_peer_init()
546 if (ibss_rsn_supp_init(peer, ibss_rsn->wpa_s->own_addr, in ibss_rsn_peer_init()
548 ibss_rsn_free(peer); in ibss_rsn_peer_init()
552 peer->next = ibss_rsn->peers; in ibss_rsn_peer_init()
553 ibss_rsn->peers = peer; in ibss_rsn_peer_init()
555 return peer; in ibss_rsn_peer_init()
561 struct ibss_rsn_peer *peer = eloop_ctx; in ibss_rsn_auth_timeout() local
569 MACSTR " - start authenticator", MAC2STR(peer->addr)); in ibss_rsn_auth_timeout()
571 peer->authentication_status |= IBSS_RSN_AUTH_BY_US; in ibss_rsn_auth_timeout()
572 ibss_rsn_auth_init(peer->ibss_rsn, peer); in ibss_rsn_auth_timeout()
578 struct ibss_rsn_peer *peer; in ibss_rsn_start() local
585 peer = ibss_rsn_get_peer(ibss_rsn, addr); in ibss_rsn_start()
586 if (peer) in ibss_rsn_start()
589 peer = ibss_rsn_peer_init(ibss_rsn, addr); in ibss_rsn_start()
590 if (peer == NULL) in ibss_rsn_start()
600 peer->authentication_status |= IBSS_RSN_AUTH_BY_US; in ibss_rsn_start()
601 return ibss_rsn_auth_init(ibss_rsn, peer); in ibss_rsn_start()
603 os_get_reltime(&peer->own_auth_tx); in ibss_rsn_start()
604 eloop_register_timeout(1, 0, ibss_rsn_auth_timeout, peer, NULL); in ibss_rsn_start()
612 struct ibss_rsn_peer *peer, int reason) in ibss_rsn_peer_authenticated() argument
616 if (ibss_rsn == NULL || peer == NULL) in ibss_rsn_peer_authenticated()
619 already_started = ibss_rsn_is_auth_started(peer); in ibss_rsn_peer_authenticated()
620 peer->authentication_status |= reason; in ibss_rsn_peer_authenticated()
624 "started for peer " MACSTR, MAC2STR(peer->addr)); in ibss_rsn_peer_authenticated()
629 "for now-authenticated peer " MACSTR, MAC2STR(peer->addr)); in ibss_rsn_peer_authenticated()
631 return ibss_rsn_auth_init(ibss_rsn, peer); in ibss_rsn_peer_authenticated()
637 struct ibss_rsn_peer *peer, *prev; in ibss_rsn_stop() local
645 peer = ibss_rsn->peers; in ibss_rsn_stop()
646 while (peer) { in ibss_rsn_stop()
647 prev = peer; in ibss_rsn_stop()
648 peer = peer->next; in ibss_rsn_stop()
650 ibss_rsn->peers = peer; in ibss_rsn_stop()
657 for (prev = NULL, peer = ibss_rsn->peers; peer != NULL; in ibss_rsn_stop()
658 prev = peer, peer = peer->next) { in ibss_rsn_stop()
659 if (os_memcmp(peermac, peer->addr, ETH_ALEN) == 0) { in ibss_rsn_stop()
661 ibss_rsn->peers = peer->next; in ibss_rsn_stop()
663 prev->next = peer->next; in ibss_rsn_stop()
664 ibss_rsn_free(peer); in ibss_rsn_stop()
696 struct ibss_rsn_peer *peer, *prev; in ibss_rsn_deinit() local
701 peer = ibss_rsn->peers; in ibss_rsn_deinit()
702 while (peer) { in ibss_rsn_deinit()
703 prev = peer; in ibss_rsn_deinit()
704 peer = peer->next; in ibss_rsn_deinit()
759 struct ibss_rsn_peer *peer, in ibss_rsn_process_rx_eapol() argument
773 peer->authentication_status |= IBSS_RSN_AUTH_EAPOL_BY_PEER; in ibss_rsn_process_rx_eapol()
775 MACSTR, MAC2STR(peer->addr)); in ibss_rsn_process_rx_eapol()
776 wpa_sm_rx_eapol(peer->supp, peer->addr, tmp, len); in ibss_rsn_process_rx_eapol()
778 if (ibss_rsn_is_auth_started(peer) == 0) { in ibss_rsn_process_rx_eapol()
781 "authenticated", MAC2STR(peer->addr)); in ibss_rsn_process_rx_eapol()
787 "from "MACSTR, MAC2STR(peer->addr)); in ibss_rsn_process_rx_eapol()
788 wpa_receive(ibss_rsn->auth_group, peer->auth, tmp, len); in ibss_rsn_process_rx_eapol()
799 struct ibss_rsn_peer *peer; in ibss_rsn_rx_eapol() local
804 peer = ibss_rsn_get_peer(ibss_rsn, src_addr); in ibss_rsn_rx_eapol()
805 if (peer) in ibss_rsn_rx_eapol()
806 return ibss_rsn_process_rx_eapol(ibss_rsn, peer, buf, len); in ibss_rsn_rx_eapol()
813 peer = ibss_rsn_peer_init(ibss_rsn, src_addr); in ibss_rsn_rx_eapol()
814 if (peer == NULL) in ibss_rsn_rx_eapol()
820 ibss_rsn_peer_authenticated(ibss_rsn, peer, in ibss_rsn_rx_eapol()
839 struct ibss_rsn_peer *peer, in ibss_rsn_handle_auth_1_of_2() argument
845 if (peer && in ibss_rsn_handle_auth_1_of_2()
846 peer->authentication_status & (IBSS_RSN_SET_PTK_SUPP | in ibss_rsn_handle_auth_1_of_2()
857 if (peer && in ibss_rsn_handle_auth_1_of_2()
858 peer->authentication_status & IBSS_RSN_AUTH_EAPOL_BY_PEER) { in ibss_rsn_handle_auth_1_of_2()
859 if (peer->own_auth_tx.sec) { in ibss_rsn_handle_auth_1_of_2()
862 os_reltime_sub(&now, &peer->own_auth_tx, &diff); in ibss_rsn_handle_auth_1_of_2()
879 peer = NULL; in ibss_rsn_handle_auth_1_of_2()
882 if (!peer) { in ibss_rsn_handle_auth_1_of_2()
883 peer = ibss_rsn_peer_init(ibss_rsn, addr); in ibss_rsn_handle_auth_1_of_2()
884 if (!peer) in ibss_rsn_handle_auth_1_of_2()
895 ibss_rsn_peer_authenticated(ibss_rsn, peer, IBSS_RSN_AUTH_EAPOL_BY_US); in ibss_rsn_handle_auth_1_of_2()
903 struct ibss_rsn_peer *peer; in ibss_rsn_handle_auth() local
916 peer = ibss_rsn_get_peer(ibss_rsn, header->sa); in ibss_rsn_handle_auth()
920 ibss_rsn_handle_auth_1_of_2(ibss_rsn, peer, header->sa); in ibss_rsn_handle_auth()
925 if (!peer) { in ibss_rsn_handle_auth()
932 eloop_cancel_timeout(ibss_rsn_auth_timeout, peer, NULL); in ibss_rsn_handle_auth()
935 ibss_rsn_peer_authenticated(ibss_rsn, peer, in ibss_rsn_handle_auth()