Lines Matching defs:ibss_rsn
21 #include "ibss_rsn.h"
27 static struct ibss_rsn_peer * ibss_rsn_get_peer(struct ibss_rsn *ibss_rsn,
32 for (peer = ibss_rsn->peers; peer; peer = peer->next)
66 struct wpa_supplicant *wpa_s = peer->ibss_rsn->wpa_s;
125 struct wpa_supplicant *wpa_s = peer->ibss_rsn->wpa_s;
159 if (os_memcmp(peer->ibss_rsn->wpa_s->own_addr, peer->addr,
168 return wpa_drv_set_key(peer->ibss_rsn->wpa_s, alg, addr, key_idx,
176 return wpa_supplicant_get_ssid(peer->ibss_rsn->wpa_s);
210 ctx->msg_ctx = peer->ibss_rsn->wpa_s;
263 struct ibss_rsn *ibss_rsn = ctx;
268 return ibss_rsn->psk;
275 struct ibss_rsn *ibss_rsn = ctx;
276 struct wpa_supplicant *wpa_s = ibss_rsn->wpa_s;
293 struct ibss_rsn *ibss_rsn = ctx;
311 peer = ibss_rsn_get_peer(ibss_rsn, addr);
323 os_memcmp(ibss_rsn->wpa_s->own_addr, addr, ETH_ALEN) < 0) {
329 return wpa_drv_set_key(ibss_rsn->wpa_s, alg, addr, idx,
336 struct ibss_rsn *ibss_rsn = ctx;
337 wpa_drv_sta_deauth(ibss_rsn->wpa_s, addr, reason);
345 struct ibss_rsn *ibss_rsn = ctx;
350 for (peer = ibss_rsn->peers; peer; peer = peer->next) {
359 static void ibss_set_sta_authorized(struct ibss_rsn *ibss_rsn,
365 res = wpa_drv_sta_set_flags(ibss_rsn->wpa_s, peer->addr,
371 res = wpa_drv_sta_set_flags(ibss_rsn->wpa_s, peer->addr,
388 struct ibss_rsn *ibss_rsn = ctx;
389 struct ibss_rsn_peer *peer = ibss_rsn_get_peer(ibss_rsn, addr);
396 ibss_set_sta_authorized(ibss_rsn, peer, value);
406 static int ibss_rsn_auth_init_group(struct ibss_rsn *ibss_rsn,
424 cb.ctx = ibss_rsn;
433 ibss_rsn->auth_group = wpa_init(own_addr, &conf, &cb);
434 if (ibss_rsn->auth_group == NULL) {
439 wpa_init_keys(ibss_rsn->auth_group);
445 static int ibss_rsn_auth_init(struct ibss_rsn *ibss_rsn,
448 peer->auth = wpa_auth_sta_init(ibss_rsn->auth_group, peer->addr, NULL);
455 if (wpa_validate_wpa_ie(ibss_rsn->auth_group, peer->auth,
469 if (wpa_auth_sta_associated(ibss_rsn->auth_group, peer->auth))
476 static int ibss_rsn_send_auth(struct ibss_rsn *ibss_rsn, const u8 *da, int seq)
480 struct wpa_supplicant *wpa_s = ibss_rsn->wpa_s;
513 ibss_rsn_peer_init(struct ibss_rsn *ibss_rsn, const u8 *addr)
516 if (ibss_rsn == NULL)
519 peer = ibss_rsn_get_peer(ibss_rsn, addr);
535 peer->ibss_rsn = ibss_rsn;
539 if (ibss_rsn_supp_init(peer, ibss_rsn->wpa_s->own_addr,
540 ibss_rsn->psk) < 0) {
545 peer->next = ibss_rsn->peers;
546 ibss_rsn->peers = peer;
565 ibss_rsn_auth_init(peer->ibss_rsn, peer);
569 int ibss_rsn_start(struct ibss_rsn *ibss_rsn, const u8 *addr)
574 if (!ibss_rsn)
578 peer = ibss_rsn_get_peer(ibss_rsn, addr);
582 peer = ibss_rsn_peer_init(ibss_rsn, addr);
587 res = ibss_rsn_send_auth(ibss_rsn, addr, 1);
594 return ibss_rsn_auth_init(ibss_rsn, peer);
604 static int ibss_rsn_peer_authenticated(struct ibss_rsn *ibss_rsn,
609 if (ibss_rsn == NULL || peer == NULL)
624 return ibss_rsn_auth_init(ibss_rsn, peer);
628 void ibss_rsn_stop(struct ibss_rsn *ibss_rsn, const u8 *peermac)
632 if (ibss_rsn == NULL)
638 peer = ibss_rsn->peers;
643 ibss_rsn->peers = peer;
650 ibss_rsn->peers; peer != NULL;
654 ibss_rsn->peers = peer->next;
668 struct ibss_rsn * ibss_rsn_init(struct wpa_supplicant *wpa_s)
670 struct ibss_rsn *ibss_rsn;
672 ibss_rsn = os_zalloc(sizeof(*ibss_rsn));
673 if (ibss_rsn == NULL)
675 ibss_rsn->wpa_s = wpa_s;
677 if (ibss_rsn_auth_init_group(ibss_rsn, wpa_s->own_addr) < 0) {
678 ibss_rsn_deinit(ibss_rsn);
682 return ibss_rsn;
686 void ibss_rsn_deinit(struct ibss_rsn *ibss_rsn)
690 if (ibss_rsn == NULL)
693 peer = ibss_rsn->peers;
700 if (ibss_rsn->auth_group)
701 wpa_deinit(ibss_rsn->auth_group);
702 os_free(ibss_rsn);
750 static int ibss_rsn_process_rx_eapol(struct ibss_rsn *ibss_rsn,
781 wpa_receive(ibss_rsn->auth_group, peer->auth, tmp, len);
789 int ibss_rsn_rx_eapol(struct ibss_rsn *ibss_rsn, const u8 *src_addr,
794 if (ibss_rsn == NULL)
797 peer = ibss_rsn_get_peer(ibss_rsn, src_addr);
799 return ibss_rsn_process_rx_eapol(ibss_rsn, peer, buf, len);
806 peer = ibss_rsn_peer_init(ibss_rsn, src_addr);
813 ibss_rsn_peer_authenticated(ibss_rsn, peer,
816 return ibss_rsn_process_rx_eapol(ibss_rsn, ibss_rsn->peers,
823 void ibss_rsn_set_psk(struct ibss_rsn *ibss_rsn, const u8 *psk)
825 if (ibss_rsn == NULL)
827 os_memcpy(ibss_rsn->psk, psk, PMK_LEN);
831 static void ibss_rsn_handle_auth_1_of_2(struct ibss_rsn *ibss_rsn,
859 ibss_rsn_stop(ibss_rsn, addr);
864 peer = ibss_rsn_peer_init(ibss_rsn, addr);
874 ibss_rsn_send_auth(ibss_rsn, addr, 2);
876 ibss_rsn_peer_authenticated(ibss_rsn, peer, IBSS_RSN_AUTH_EAPOL_BY_US);
880 void ibss_rsn_handle_auth(struct ibss_rsn *ibss_rsn, const u8 *auth_frame,
890 if (ibss_rsn == NULL || len < auth_length)
897 peer = ibss_rsn_get_peer(ibss_rsn, header->sa);
901 ibss_rsn_handle_auth_1_of_2(ibss_rsn, peer, header->sa);
916 ibss_rsn_peer_authenticated(ibss_rsn, peer,