Esempio n. 1
0
static int ibss_rsn_peer_authenticated(struct ibss_rsn *ibss_rsn,
				       struct ibss_rsn_peer *peer, int reason)
{
	int already_started;

	if (ibss_rsn == NULL || peer == NULL)
		return -1;

	already_started = ibss_rsn_is_auth_started(peer);
	peer->authentication_status |= reason;

	if (already_started) {
		wpa_printf(MSG_DEBUG, "RSN: IBSS Authenticator already "
			   "started for peer " MACSTR, MAC2STR(peer->addr));
		return 0;
	}

	wpa_printf(MSG_DEBUG, "RSN: Starting IBSS Authenticator "
		   "for now-authenticated peer " MACSTR, MAC2STR(peer->addr));

	return ibss_rsn_auth_init(ibss_rsn, peer);
}
Esempio n. 2
0
static int ibss_rsn_process_rx_eapol(struct ibss_rsn *ibss_rsn,
				     struct ibss_rsn_peer *peer,
				     const u8 *buf, size_t len)
{
	int supp;
	u8 *tmp;

	supp = ibss_rsn_eapol_dst_supp(buf, len);
	if (supp < 0)
		return -1;

	tmp = os_malloc(len);
	if (tmp == NULL)
		return -1;
	os_memcpy(tmp, buf, len);
	if (supp) {
		peer->authentication_status |= IBSS_RSN_AUTH_EAPOL_BY_PEER;
		wpa_printf(MSG_DEBUG, "RSN: IBSS RX EAPOL for Supplicant from "
			   MACSTR, MAC2STR(peer->addr));
		wpa_sm_rx_eapol(peer->supp, peer->addr, tmp, len);
	} else {
		if (ibss_rsn_is_auth_started(peer) == 0) {
			wpa_printf(MSG_DEBUG, "RSN: IBSS EAPOL for "
				   "Authenticator dropped as " MACSTR " is not "
				   "authenticated", MAC2STR(peer->addr));
			os_free(tmp);
			return -1;
		}

		wpa_printf(MSG_DEBUG, "RSN: IBSS RX EAPOL for Authenticator "
			   "from "MACSTR, MAC2STR(peer->addr));
		wpa_receive(ibss_rsn->auth_group, peer->auth, tmp, len);
	}
	os_free(tmp);

	return 1;
}