contrib/hostapd/hostapd/ieee802_1x.c
static void handle_eap(struct hostapd_data *hapd, struct sta_info *sta,
		       u8 *buf, size_t len)
{
	struct eap_hdr *eap;
	u16 eap_len;

	if (len < sizeof(*eap)) {
		printf("   too short EAP packet\n");
		return;
	}

	eap = (struct eap_hdr *) buf;

	eap_len = be_to_host16(eap->length);
	wpa_printf(MSG_DEBUG, "EAP: code=%d identifier=%d length=%d",
		   eap->code, eap->identifier, eap_len);
	if (eap_len < sizeof(*eap)) {
		wpa_printf(MSG_DEBUG, "   Invalid EAP length");
		return;
	} else if (eap_len > len) {
		wpa_printf(MSG_DEBUG, "   Too short frame to contain this EAP "
			   "packet");
		return;
	} else if (eap_len < len) {
		wpa_printf(MSG_DEBUG, "   Ignoring %lu extra bytes after EAP "
			   "packet", (unsigned long) len - eap_len);
	}

	switch (eap->code) {
	case EAP_CODE_REQUEST:
		wpa_printf(MSG_DEBUG, " (request)");
		return;
	case EAP_CODE_RESPONSE:
		wpa_printf(MSG_DEBUG, " (response)");
		handle_eap_response(hapd, sta, eap, eap_len);
		break;
	case EAP_CODE_SUCCESS:
		wpa_printf(MSG_DEBUG, " (success)");
		return;
	case EAP_CODE_FAILURE:
		wpa_printf(MSG_DEBUG, " (failure)");
		return;
	default:
		wpa_printf(MSG_DEBUG, " (unknown code)");
		return;
	}
}
/* Process incoming EAP packet from Supplicant */
Process incoming EAP packet from Supplicant
Process incoming EAP packet from Supplicant
static void handle_eap(struct hostapd_data *hapd, struct sta_info *sta,
		       u8 *buf, size_t len)
{
	struct eap_hdr *eap;
	u16 eap_len;
	if (len < sizeof(*eap)) {
		printf("   too short EAP packet\n");
		return;
	}
	eap = (struct eap_hdr *) buf;
	eap_len = be_to_host16(eap->length);
	wpa_printf(MSG_DEBUG, "EAP: code=%d identifier=%d length=%d",
		   eap->code, eap->identifier, eap_len);
	if (eap_len < sizeof(*eap)) {
		wpa_printf(MSG_DEBUG, "   Invalid EAP length");
		return;
	} else if (eap_len > len) {
		wpa_printf(MSG_DEBUG, "   Too short frame to contain this EAP "
			   "packet");
		return;
	} else if (eap_len < len) {
		wpa_printf(MSG_DEBUG, "   Ignoring %lu extra bytes after EAP "
			   "packet", (unsigned long) len - eap_len);
	}
	switch (eap->code) {
	case EAP_CODE_REQUEST:
		wpa_printf(MSG_DEBUG, " (request)");
		return;
	case EAP_CODE_RESPONSE:
		wpa_printf(MSG_DEBUG, " (response)");
		handle_eap_response(hapd, sta, eap, eap_len);
		break;
	case EAP_CODE_SUCCESS:
		wpa_printf(MSG_DEBUG, " (success)");
		return;
	case EAP_CODE_FAILURE:
		wpa_printf(MSG_DEBUG, " (failure)");
		return;
	default:
		wpa_printf(MSG_DEBUG, " (unknown code)");
		return;
	}
}
static void handle_eap ( struct hostapd_data * hapd , struct sta_info * sta , u8 * buf , size_t len ) { struct eap_hdr * eap ; u16 eap_len ; if ( len < sizeof ( * eap ) ) { printf ( " \n " ) ; return ; } eap = ( struct eap_hdr * ) buf ; eap_len = be_to_host16 ( eap -> length ) ; wpa_printf ( MSG_DEBUG , " " , eap -> code , eap -> identifier , eap_len ) ; if ( eap_len < sizeof ( * eap ) ) { wpa_printf ( MSG_DEBUG , " " ) ; return ; } else if ( eap_len > len ) { wpa_printf ( MSG_DEBUG , " " " " ) ; return ; } else if ( eap_len < len ) { wpa_printf ( MSG_DEBUG , " " " " , ( unsigned long ) len - eap_len ) ; } switch ( eap -> code ) { case EAP_CODE_REQUEST : wpa_printf ( MSG_DEBUG , " " ) ; return ; case EAP_CODE_RESPONSE : wpa_printf ( MSG_DEBUG , " " ) ; handle_eap_response ( hapd , sta , eap , eap_len ) ; break ; case EAP_CODE_SUCCESS : wpa_printf ( MSG_DEBUG , " " ) ; return ; case EAP_CODE_FAILURE : wpa_printf ( MSG_DEBUG , " " ) ; return ; default : wpa_printf ( MSG_DEBUG , " " ) ; return ; } }
Process incoming EAP packet from Supplicant
Process incoming EAP packet from Supplicant