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()
67 int encrypt = peer->authentication_status & IBSS_RSN_REPORTED_PTK; in supp_ether_send()
116 struct ibss_rsn_peer *peer = ctx; in supp_get_beacon_ie() local
120 wpa_sm_set_ap_rsnxe(peer->supp, NULL, 0); in supp_get_beacon_ie()
121 return wpa_sm_set_ap_rsn_ie(peer->supp, in supp_get_beacon_ie()
130 static void ibss_check_rsn_completed(struct ibss_rsn_peer *peer) in ibss_check_rsn_completed() argument
132 struct wpa_supplicant *wpa_s = peer->ibss_rsn->wpa_s; in ibss_check_rsn_completed()
134 if ((peer->authentication_status & in ibss_check_rsn_completed()
138 if (peer->authentication_status & IBSS_RSN_REPORTED_PTK) in ibss_check_rsn_completed()
140 peer->authentication_status |= IBSS_RSN_REPORTED_PTK; in ibss_check_rsn_completed()
142 MAC2STR(peer->addr)); in ibss_check_rsn_completed()
151 struct ibss_rsn_peer *peer = ctx; in supp_set_key() local
160 peer->authentication_status |= IBSS_RSN_SET_PTK_SUPP; in supp_set_key()
161 ibss_check_rsn_completed(peer); in supp_set_key()
166 if (os_memcmp(peer->ibss_rsn->wpa_s->own_addr, peer->addr, in supp_set_key()
174 addr = peer->addr; in supp_set_key()
175 return wpa_drv_set_key(peer->ibss_rsn->wpa_s, alg, addr, key_idx, in supp_set_key()
182 struct ibss_rsn_peer *peer = ctx; in supp_get_network_ctx() local
183 return wpa_supplicant_get_ssid(peer->ibss_rsn->wpa_s); in supp_get_network_ctx()
215 static int ibss_rsn_supp_init(struct ibss_rsn_peer *peer, const u8 *own_addr, in ibss_rsn_supp_init() argument
222 ctx->ctx = peer; in ibss_rsn_supp_init()
223 ctx->msg_ctx = peer->ibss_rsn->wpa_s; in ibss_rsn_supp_init()
235 peer->supp = wpa_sm_init(ctx); in ibss_rsn_supp_init()
236 if (peer->supp == NULL) { in ibss_rsn_supp_init()
242 wpa_sm_set_own_addr(peer->supp, own_addr); in ibss_rsn_supp_init()
243 wpa_sm_set_param(peer->supp, WPA_PARAM_RSN_ENABLED, 1); in ibss_rsn_supp_init()
244 wpa_sm_set_param(peer->supp, WPA_PARAM_PROTO, WPA_PROTO_RSN); in ibss_rsn_supp_init()
245 wpa_sm_set_param(peer->supp, WPA_PARAM_PAIRWISE, WPA_CIPHER_CCMP); in ibss_rsn_supp_init()
246 wpa_sm_set_param(peer->supp, WPA_PARAM_GROUP, WPA_CIPHER_CCMP); in ibss_rsn_supp_init()
247 wpa_sm_set_param(peer->supp, WPA_PARAM_KEY_MGMT, WPA_KEY_MGMT_PSK); in ibss_rsn_supp_init()
248 wpa_sm_set_pmk(peer->supp, psk, PMK_LEN, NULL, NULL); in ibss_rsn_supp_init()
250 peer->supp_ie_len = sizeof(peer->supp_ie); in ibss_rsn_supp_init()
251 if (wpa_sm_set_assoc_wpa_ie_default(peer->supp, peer->supp_ie, in ibss_rsn_supp_init()
252 &peer->supp_ie_len) < 0) { in ibss_rsn_supp_init()
258 wpa_sm_notify_assoc(peer->supp, peer->addr); in ibss_rsn_supp_init()
336 struct ibss_rsn_peer *peer; in auth_set_key() local
337 peer = ibss_rsn_get_peer(ibss_rsn, addr); in auth_set_key()
338 if (peer) { in auth_set_key()
339 peer->authentication_status |= in auth_set_key()
341 ibss_check_rsn_completed(peer); in auth_set_key()
372 struct ibss_rsn_peer *peer; in auth_for_each_sta() local
376 for (peer = ibss_rsn->peers; peer; peer = peer->next) { in auth_for_each_sta()
377 if (peer->auth && cb(peer->auth, cb_ctx)) in auth_for_each_sta()
386 struct ibss_rsn_peer *peer, int authorized) in ibss_set_sta_authorized() argument
391 res = wpa_drv_sta_set_flags(ibss_rsn->wpa_s, peer->addr, in ibss_set_sta_authorized()
395 MAC2STR(peer->addr)); in ibss_set_sta_authorized()
397 res = wpa_drv_sta_set_flags(ibss_rsn->wpa_s, peer->addr, in ibss_set_sta_authorized()
400 MAC2STR(peer->addr)); in ibss_set_sta_authorized()
406 MAC2STR(peer->addr), errno); in ibss_set_sta_authorized()
415 struct ibss_rsn_peer *peer = ibss_rsn_get_peer(ibss_rsn, addr); in auth_set_eapol() local
417 if (peer == NULL) in auth_set_eapol()
422 ibss_set_sta_authorized(ibss_rsn, peer, value); in auth_set_eapol()
472 struct ibss_rsn_peer *peer) in ibss_rsn_auth_init() argument
474 peer->auth = wpa_auth_sta_init(ibss_rsn->auth_group, peer->addr, NULL); in ibss_rsn_auth_init()
475 if (peer->auth == NULL) { in ibss_rsn_auth_init()
481 if (wpa_validate_wpa_ie(ibss_rsn->auth_group, peer->auth, 0, in ibss_rsn_auth_init()
492 if (wpa_auth_sm_event(peer->auth, WPA_ASSOC)) in ibss_rsn_auth_init()
495 if (wpa_auth_sta_associated(ibss_rsn->auth_group, peer->auth)) in ibss_rsn_auth_init()
527 static int ibss_rsn_is_auth_started(struct ibss_rsn_peer * peer) in ibss_rsn_is_auth_started() argument
529 return peer->authentication_status & in ibss_rsn_is_auth_started()
537 struct ibss_rsn_peer *peer; in ibss_rsn_peer_init() local
541 peer = ibss_rsn_get_peer(ibss_rsn, addr); in ibss_rsn_peer_init()
542 if (peer) { in ibss_rsn_peer_init()
545 return peer; in ibss_rsn_peer_init()
551 peer = os_zalloc(sizeof(*peer)); in ibss_rsn_peer_init()
552 if (peer == NULL) { in ibss_rsn_peer_init()
557 peer->ibss_rsn = ibss_rsn; in ibss_rsn_peer_init()
558 os_memcpy(peer->addr, addr, ETH_ALEN); in ibss_rsn_peer_init()
559 peer->authentication_status = IBSS_RSN_AUTH_NOT_AUTHENTICATED; in ibss_rsn_peer_init()
561 if (ibss_rsn_supp_init(peer, ibss_rsn->wpa_s->own_addr, in ibss_rsn_peer_init()
563 ibss_rsn_free(peer); in ibss_rsn_peer_init()
567 peer->next = ibss_rsn->peers; in ibss_rsn_peer_init()
568 ibss_rsn->peers = peer; in ibss_rsn_peer_init()
570 return peer; in ibss_rsn_peer_init()
576 struct ibss_rsn_peer *peer = eloop_ctx; in ibss_rsn_auth_timeout() local
584 MACSTR " - start authenticator", MAC2STR(peer->addr)); in ibss_rsn_auth_timeout()
586 peer->authentication_status |= IBSS_RSN_AUTH_BY_US; in ibss_rsn_auth_timeout()
587 ibss_rsn_auth_init(peer->ibss_rsn, peer); in ibss_rsn_auth_timeout()
593 struct ibss_rsn_peer *peer; in ibss_rsn_start() local
600 peer = ibss_rsn_get_peer(ibss_rsn, addr); in ibss_rsn_start()
601 if (peer) in ibss_rsn_start()
604 peer = ibss_rsn_peer_init(ibss_rsn, addr); in ibss_rsn_start()
605 if (peer == NULL) in ibss_rsn_start()
615 peer->authentication_status |= IBSS_RSN_AUTH_BY_US; in ibss_rsn_start()
616 return ibss_rsn_auth_init(ibss_rsn, peer); in ibss_rsn_start()
618 os_get_reltime(&peer->own_auth_tx); in ibss_rsn_start()
619 eloop_register_timeout(1, 0, ibss_rsn_auth_timeout, peer, NULL); in ibss_rsn_start()
627 struct ibss_rsn_peer *peer, int reason) in ibss_rsn_peer_authenticated() argument
631 if (ibss_rsn == NULL || peer == NULL) in ibss_rsn_peer_authenticated()
634 already_started = ibss_rsn_is_auth_started(peer); in ibss_rsn_peer_authenticated()
635 peer->authentication_status |= reason; in ibss_rsn_peer_authenticated()
639 "started for peer " MACSTR, MAC2STR(peer->addr)); in ibss_rsn_peer_authenticated()
644 "for now-authenticated peer " MACSTR, MAC2STR(peer->addr)); in ibss_rsn_peer_authenticated()
646 return ibss_rsn_auth_init(ibss_rsn, peer); in ibss_rsn_peer_authenticated()
652 struct ibss_rsn_peer *peer, *prev; in ibss_rsn_stop() local
660 peer = ibss_rsn->peers; in ibss_rsn_stop()
661 while (peer) { in ibss_rsn_stop()
662 prev = peer; in ibss_rsn_stop()
663 peer = peer->next; in ibss_rsn_stop()
665 ibss_rsn->peers = peer; in ibss_rsn_stop()
672 for (prev = NULL, peer = ibss_rsn->peers; peer != NULL; in ibss_rsn_stop()
673 prev = peer, peer = peer->next) { in ibss_rsn_stop()
674 if (os_memcmp(peermac, peer->addr, ETH_ALEN) == 0) { in ibss_rsn_stop()
676 ibss_rsn->peers = peer->next; in ibss_rsn_stop()
678 prev->next = peer->next; in ibss_rsn_stop()
679 ibss_rsn_free(peer); in ibss_rsn_stop()
711 struct ibss_rsn_peer *peer, *prev; in ibss_rsn_deinit() local
716 peer = ibss_rsn->peers; in ibss_rsn_deinit()
717 while (peer) { in ibss_rsn_deinit()
718 prev = peer; in ibss_rsn_deinit()
719 peer = peer->next; in ibss_rsn_deinit()
774 struct ibss_rsn_peer *peer, in ibss_rsn_process_rx_eapol() argument
788 peer->authentication_status |= IBSS_RSN_AUTH_EAPOL_BY_PEER; in ibss_rsn_process_rx_eapol()
790 MACSTR, MAC2STR(peer->addr)); in ibss_rsn_process_rx_eapol()
791 wpa_sm_rx_eapol(peer->supp, peer->addr, tmp, len); in ibss_rsn_process_rx_eapol()
793 if (ibss_rsn_is_auth_started(peer) == 0) { in ibss_rsn_process_rx_eapol()
796 "authenticated", MAC2STR(peer->addr)); in ibss_rsn_process_rx_eapol()
802 "from "MACSTR, MAC2STR(peer->addr)); in ibss_rsn_process_rx_eapol()
803 wpa_receive(ibss_rsn->auth_group, peer->auth, tmp, len); in ibss_rsn_process_rx_eapol()
814 struct ibss_rsn_peer *peer; in ibss_rsn_rx_eapol() local
819 peer = ibss_rsn_get_peer(ibss_rsn, src_addr); in ibss_rsn_rx_eapol()
820 if (peer) in ibss_rsn_rx_eapol()
821 return ibss_rsn_process_rx_eapol(ibss_rsn, peer, buf, len); in ibss_rsn_rx_eapol()
828 peer = ibss_rsn_peer_init(ibss_rsn, src_addr); in ibss_rsn_rx_eapol()
829 if (peer == NULL) in ibss_rsn_rx_eapol()
835 ibss_rsn_peer_authenticated(ibss_rsn, peer, in ibss_rsn_rx_eapol()
854 struct ibss_rsn_peer *peer, in ibss_rsn_handle_auth_1_of_2() argument
860 if (peer && in ibss_rsn_handle_auth_1_of_2()
861 peer->authentication_status & (IBSS_RSN_SET_PTK_SUPP | in ibss_rsn_handle_auth_1_of_2()
872 if (peer && in ibss_rsn_handle_auth_1_of_2()
873 peer->authentication_status & IBSS_RSN_AUTH_EAPOL_BY_PEER) { in ibss_rsn_handle_auth_1_of_2()
874 if (peer->own_auth_tx.sec) { in ibss_rsn_handle_auth_1_of_2()
877 os_reltime_sub(&now, &peer->own_auth_tx, &diff); in ibss_rsn_handle_auth_1_of_2()
894 peer = NULL; in ibss_rsn_handle_auth_1_of_2()
897 if (!peer) { in ibss_rsn_handle_auth_1_of_2()
898 peer = ibss_rsn_peer_init(ibss_rsn, addr); in ibss_rsn_handle_auth_1_of_2()
899 if (!peer) in ibss_rsn_handle_auth_1_of_2()
910 ibss_rsn_peer_authenticated(ibss_rsn, peer, IBSS_RSN_AUTH_EAPOL_BY_US); in ibss_rsn_handle_auth_1_of_2()
918 struct ibss_rsn_peer *peer; in ibss_rsn_handle_auth() local
931 peer = ibss_rsn_get_peer(ibss_rsn, header->sa); in ibss_rsn_handle_auth()
935 ibss_rsn_handle_auth_1_of_2(ibss_rsn, peer, header->sa); in ibss_rsn_handle_auth()
940 if (!peer) { in ibss_rsn_handle_auth()
947 eloop_cancel_timeout(ibss_rsn_auth_timeout, peer, NULL); in ibss_rsn_handle_auth()
950 ibss_rsn_peer_authenticated(ibss_rsn, peer, in ibss_rsn_handle_auth()