2 * Copyright (c) 2009 Joshua Oreman <oremanj@rwcr.net>.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 * Definitions for EAPOL (Extensible Authentication Protocol over
25 * LANs) frames. Definitions for the packets usually encapsulated in
29 #include <gpxe/tables.h>
32 FILE_LICENCE ( GPL2_OR_LATER );
36 * @defgroup eapol_type EAPOL archetype identifiers
39 #define EAPOL_TYPE_EAP 0 /**< EAP authentication handshake packet */
40 #define EAPOL_TYPE_START 1 /**< Request by Peer to begin (no data) */
41 #define EAPOL_TYPE_LOGOFF 2 /**< Request by Peer to terminate (no data) */
42 #define EAPOL_TYPE_KEY 3 /**< EAPOL-Key packet */
45 /** Expected EAPOL version field value
47 * Version 2 is often seen and has no format differences from version 1;
48 * however, many older APs will completely drop version-2 packets, so
49 * we advertise ourselves as version 1.
51 #define EAPOL_THIS_VERSION 1
53 /** Length of an EAPOL frame header */
54 #define EAPOL_HDR_LEN 4
58 * This may encapsulate an eap_pkt, an eapol_key_pkt, or a Start or
59 * Logoff request with no data attached. It is transmitted directly in
60 * an Ethernet frame, with no IP packet header.
64 /** EAPOL version identifier, always 1 */
67 /** EAPOL archetype identifier indicating format of payload */
70 /** Length of payload, in network byte order */
73 /** Payload, if @a type is EAP or EAPOL-Key */
75 } __attribute__ (( packed ));
78 /** An EAPOL frame type handler
80 * Normally there will be at most two of these, one for EAP and one
81 * for EAPOL-Key frames. The EAPOL interface code handles Start and
86 /** EAPOL archetype identifier for payload this handler will handle */
89 /** Receive EAPOL-encapsulated packet of specified type
91 * @v iob I/O buffer containing packet payload
92 * @v netdev Network device from which packet was received
93 * @v ll_source Source link-layer address from which packet was received
94 * @ret rc Return status code
96 * The I/O buffer will have the EAPOL header pulled off it, so
97 * @c iob->data points to the first byte of the payload.
99 * This function takes ownership of the I/O buffer passed to it.
101 int ( * rx ) ( struct io_buffer *iob, struct net_device *netdev,
102 const void *ll_source );
105 #define EAPOL_HANDLERS __table ( struct eapol_handler, "eapol_handlers" )
106 #define __eapol_handler __table_entry ( EAPOL_HANDLERS, 01 )
109 extern struct net_protocol eapol_protocol __net_protocol;
112 #endif /* _GPXE_EAPOL_H */