예제 #1
0
int ibss_rsn_rx_eapol(struct ibss_rsn *ibss_rsn, const u8 *src_addr,
		      const u8 *buf, size_t len)
{
	struct ibss_rsn_peer *peer;

	if (ibss_rsn == NULL)
		return -1;

	peer = ibss_rsn_get_peer(ibss_rsn, src_addr);
	if (peer)
		return ibss_rsn_process_rx_eapol(ibss_rsn, peer, buf, len);

	if (ibss_rsn_eapol_dst_supp(buf, len) > 0) {
		/*
		 * Create new IBSS peer based on an EAPOL message from the peer
		 * Authenticator.
		 */
		if (ibss_rsn_start(ibss_rsn, src_addr) < 0)
			return -1;
		return ibss_rsn_process_rx_eapol(ibss_rsn, ibss_rsn->peers,
						 buf, len);
	}

	return 0;
}
예제 #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) {
		wpa_printf(MSG_DEBUG, "RSN: IBSS RX EAPOL for Supplicant");
		wpa_sm_rx_eapol(peer->supp, peer->addr, tmp, len);
	} else {
		wpa_printf(MSG_DEBUG, "RSN: IBSS RX EAPOL for Authenticator");
		wpa_receive(ibss_rsn->auth_group, peer->auth, tmp, len);
	}
	os_free(tmp);

	return 1;
}
예제 #3
0
int ibss_rsn_rx_eapol(struct ibss_rsn *ibss_rsn, const u8 *src_addr,
		      const u8 *buf, size_t len)
{
	struct ibss_rsn_peer *peer;

	if (ibss_rsn == NULL)
		return -1;

	peer = ibss_rsn_get_peer(ibss_rsn, src_addr);
	if (peer)
		return ibss_rsn_process_rx_eapol(ibss_rsn, peer, buf, len);

	if (ibss_rsn_eapol_dst_supp(buf, len) > 0) {
		/*
		 * Create new IBSS peer based on an EAPOL message from the peer
		 * Authenticator.
		 */
		peer = ibss_rsn_peer_init(ibss_rsn, src_addr);
		if (peer == NULL)
			return -1;

		/* assume the peer is authenticated already */
		wpa_printf(MSG_DEBUG, "RSN: IBSS Not using IBSS Auth for peer "
			   MACSTR, MAC2STR(src_addr));
		ibss_rsn_peer_authenticated(ibss_rsn, peer,
					    IBSS_RSN_AUTH_EAPOL_BY_US);

		return ibss_rsn_process_rx_eapol(ibss_rsn, ibss_rsn->peers,
						 buf, len);
	}

	return 0;
}
예제 #4
0
파일: ibss_rsn.c 프로젝트: scyclzy/Hostapd
int ibss_rsn_rx_eapol(struct ibss_rsn *ibss_rsn, const u8 *src_addr,
                      const u8 *buf, size_t len)
{
    struct ibss_rsn_peer *peer;

    if (ibss_rsn == NULL)
        return -1;

    for (peer = ibss_rsn->peers; peer; peer = peer->next) {
        if (os_memcmp(src_addr, peer->addr, ETH_ALEN) == 0)
            return ibss_rsn_process_rx_eapol(ibss_rsn, peer,
                                             buf, len);
    }

    if (ibss_rsn_eapol_dst_supp(buf, len) > 0) {
        /*
         * Create new IBSS peer based on an EAPOL message from the peer
         * Authenticator.
         */
        if (ibss_rsn_start(ibss_rsn, src_addr) < 0)
            return -1;
        return ibss_rsn_process_rx_eapol(ibss_rsn, ibss_rsn->peers,
                                         buf, len);
    }

    return 0;
}
예제 #5
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;
}