iPXE
Functions | Variables
eapol.c File Reference

Extensible Authentication Protocol over LAN (EAPoL) More...

#include <assert.h>
#include <errno.h>
#include <byteswap.h>
#include <ipxe/iobuf.h>
#include <ipxe/if_ether.h>
#include <ipxe/if_arp.h>
#include <ipxe/netdevice.h>
#include <ipxe/vlan.h>
#include <ipxe/retry.h>
#include <ipxe/eap.h>
#include <ipxe/eapol.h>

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 
static int eapol_rx (struct io_buffer *iobuf, struct net_device *netdev, const void *ll_dest __unused, const void *ll_source, unsigned int flags __unused)
 Process EAPoL packet. More...
 
static int eapol_eap_rx (struct eapol_supplicant *supplicant, struct io_buffer *iobuf, const void *ll_source __unused)
 Process EAPoL-encapsulated EAP packet. More...
 
static int eapol_tx (struct eapol_supplicant *supplicant, unsigned int type, const void *data, size_t len)
 Transmit EAPoL packet. More...
 
static int eapol_eap_tx (struct eap_supplicant *eap, const void *data, size_t len)
 Transmit EAPoL-encapsulated EAP packet. More...
 
static void eapol_expired (struct retry_timer *timer, int fail __unused)
 (Re)transmit EAPoL-Start packet More...
 
static int eapol_probe (struct net_device *netdev, void *priv)
 Create EAPoL supplicant. More...
 
static void eapol_notify (struct net_device *netdev, void *priv)
 Handle EAPoL supplicant state change. More...
 

Variables

struct net_driver eapol_driver __net_driver
 EAPoL driver. More...
 
static const uint8_t eapol_mac [ETH_ALEN]
 EAPoL destination MAC address. More...
 
struct net_protocol eapol_protocol __net_protocol
 EAPoL protocol. More...
 
struct eapol_handler eapol_eap __eapol_handler
 EAPoL handler for EAP packets. More...
 

Detailed Description

Extensible Authentication Protocol over LAN (EAPoL)

Definition in file eapol.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ eapol_rx()

static int eapol_rx ( struct io_buffer iobuf,
struct net_device netdev,
const void *ll_dest  __unused,
const void *  ll_source,
unsigned int flags  __unused 
)
static

Process EAPoL packet.

Parameters
iobufI/O buffer
netdevNetwork device
ll_destLink-layer destination address
ll_sourceLink-layer source address
flagsPacket flags
Return values
rcReturn status code

Definition at line 61 of file eapol.c.

63  {
64  struct eapol_supplicant *supplicant;
65  struct eapol_header *eapol;
66  struct eapol_handler *handler;
67  size_t remaining;
68  size_t len;
69  int rc;
70 
71  /* Find matching supplicant */
72  supplicant = netdev_priv ( netdev, &eapol_driver );
73 
74  /* Ignore non-EAPoL devices */
75  if ( ! supplicant->eap.netdev ) {
76  DBGC ( netdev, "EAPOL %s is not an EAPoL device\n",
77  netdev->name );
78  DBGC_HDA ( netdev, 0, iobuf->data, iob_len ( iobuf ) );
79  rc = -ENOTTY;
80  goto drop;
81  }
82 
83  /* Sanity checks */
84  if ( iob_len ( iobuf ) < sizeof ( *eapol ) ) {
85  DBGC ( netdev, "EAPOL %s underlength header:\n",
86  netdev->name );
87  DBGC_HDA ( netdev, 0, iobuf->data, iob_len ( iobuf ) );
88  rc = -EINVAL;
89  goto drop;
90  }
91  eapol = iobuf->data;
92  remaining = ( iob_len ( iobuf ) - sizeof ( *eapol ) );
93  len = ntohs ( eapol->len );
94  if ( len > remaining ) {
95  DBGC ( netdev, "EAPOL %s v%d type %d len %zd underlength "
96  "payload:\n", netdev->name, eapol->version,
97  eapol->type, len );
98  DBGC_HDA ( netdev, 0, iobuf->data, iob_len ( iobuf ) );
99  rc = -EINVAL;
100  goto drop;
101  }
102 
103  /* Strip any trailing padding */
104  iob_unput ( iobuf, ( len - remaining ) );
105 
106  /* Handle according to type */
107  for_each_table_entry ( handler, EAPOL_HANDLERS ) {
108  if ( handler->type == eapol->type ) {
109  return handler->rx ( supplicant, iob_disown ( iobuf ),
110  ll_source );
111  }
112  }
113  rc = -ENOTSUP;
114  DBGC ( netdev, "EAPOL %s v%d type %d unsupported\n",
115  netdev->name, eapol->version, eapol->type );
116  DBGC_HDA ( netdev, 0, iobuf->data, iob_len ( iobuf ) );
117 
118  drop:
119  free_iob ( iobuf );
120  return rc;
121 }
uint16_t len
Payload length.
Definition: eapol.h:24
#define EINVAL
Invalid argument.
Definition: errno.h:428
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
Definition: iobuf.c:146
#define DBGC(...)
Definition: compiler.h:505
#define ntohs(value)
Definition: byteswap.h:136
#define EAPOL_HANDLERS
EAPoL handler table.
Definition: eapol.h:74
#define ENOTSUP
Operation not supported.
Definition: errno.h:589
#define iob_disown(iobuf)
Disown an I/O buffer.
Definition: iobuf.h:212
EAPoL header.
Definition: eapol.h:18
void * netdev_priv(struct net_device *netdev, struct net_driver *driver)
Get network device driver private data.
Definition: netdevice.c:152
#define DBGC_HDA(...)
Definition: compiler.h:506
struct eap_supplicant eap
EAP supplicant.
Definition: eapol.h:42
static struct net_device * netdev
Definition: gdbudp.c:52
An EAPoL handler.
Definition: eapol.h:56
#define iob_unput(iobuf, len)
Definition: iobuf.h:135
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
Definition: iobuf.h:155
#define for_each_table_entry(pointer, table)
Iterate through all entries within a linker table.
Definition: tables.h:385
int(* rx)(struct eapol_supplicant *supplicant, struct io_buffer *iobuf, const void *ll_source)
Process received packet.
Definition: eapol.h:69
uint8_t type
Type.
Definition: eapol.h:22
char name[NETDEV_NAME_LEN]
Name of this network device.
Definition: netdevice.h:362
uint32_t len
Length.
Definition: ena.h:14
#define ENOTTY
Inappropriate I/O control operation.
Definition: errno.h:594
void * data
Start of data.
Definition: iobuf.h:48
uint8_t version
Version.
Definition: eapol.h:20
struct net_device * netdev
Network device.
Definition: eap.h:140
An EAPoL supplicant.
Definition: eapol.h:40
uint8_t type
Type.
Definition: eapol.h:58

References io_buffer::data, DBGC, DBGC_HDA, eapol_supplicant::eap, EAPOL_HANDLERS, EINVAL, ENOTSUP, ENOTTY, for_each_table_entry, free_iob(), iob_disown, iob_len(), iob_unput, len, eapol_header::len, net_device::name, netdev, eap_supplicant::netdev, netdev_priv(), ntohs, rc, eapol_handler::rx, eapol_header::type, eapol_handler::type, and eapol_header::version.

◆ eapol_eap_rx()

static int eapol_eap_rx ( struct eapol_supplicant supplicant,
struct io_buffer iobuf,
const void *ll_source  __unused 
)
static

Process EAPoL-encapsulated EAP packet.

Parameters
supplicantEAPoL supplicant
ll_sourceLink-layer source address
Return values
rcReturn status code

Definition at line 137 of file eapol.c.

139  {
140  struct net_device *netdev = supplicant->eap.netdev;
141  struct eapol_header *eapol;
142  int rc;
143 
144  /* Sanity check */
145  assert ( iob_len ( iobuf ) >= sizeof ( *eapol ) );
146 
147  /* Strip EAPoL header */
148  eapol = iob_pull ( iobuf, sizeof ( *eapol ) );
149 
150  /* Process EAP packet */
151  if ( ( rc = eap_rx ( &supplicant->eap, iobuf->data,
152  iob_len ( iobuf ) ) ) != 0 ) {
153  DBGC ( netdev, "EAPOL %s v%d EAP failed: %s\n",
154  netdev->name, eapol->version, strerror ( rc ) );
155  goto drop;
156  }
157 
158  /* Update EAPoL-Start transmission timer */
159  if ( supplicant->eap.flags & EAP_FL_PASSIVE ) {
160  /* Stop sending EAPoL-Start */
161  if ( timer_running ( &supplicant->timer ) ) {
162  DBGC ( netdev, "EAPOL %s becoming passive\n",
163  netdev->name );
164  }
165  stop_timer ( &supplicant->timer );
166  } else if ( supplicant->eap.flags & EAP_FL_ONGOING ) {
167  /* Delay EAPoL-Start until after next expected packet */
168  DBGC ( netdev, "EAPOL %s deferring Start\n", netdev->name );
169  start_timer_fixed ( &supplicant->timer, EAP_WAIT_TIMEOUT );
170  supplicant->count = 0;
171  }
172 
173  drop:
174  free_iob ( iobuf );
175  return rc;
176 }
#define iob_pull(iobuf, len)
Definition: iobuf.h:102
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
Definition: iobuf.c:146
#define DBGC(...)
Definition: compiler.h:505
int eap_rx(struct eap_supplicant *supplicant, const void *data, size_t len)
Handle EAP packet.
Definition: eap.c:263
EAPoL header.
Definition: eapol.h:18
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
struct eap_supplicant eap
EAP supplicant.
Definition: eapol.h:42
static struct net_device * netdev
Definition: gdbudp.c:52
#define EAP_FL_PASSIVE
EAP supplicant is passive.
Definition: eap.h:174
#define EAP_FL_ONGOING
EAP authentication is in progress.
Definition: eap.h:164
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
Definition: iobuf.h:155
A network device.
Definition: netdevice.h:352
void start_timer_fixed(struct retry_timer *timer, unsigned long timeout)
Start timer with a specified timeout.
Definition: retry.c:64
void stop_timer(struct retry_timer *timer)
Stop timer.
Definition: retry.c:117
char name[NETDEV_NAME_LEN]
Name of this network device.
Definition: netdevice.h:362
struct retry_timer timer
EAPoL-Start retransmission timer.
Definition: eapol.h:44
void * data
Start of data.
Definition: iobuf.h:48
uint8_t version
Version.
Definition: eapol.h:20
#define EAP_WAIT_TIMEOUT
EAP protocol wait timeout.
Definition: eap.h:135
unsigned int count
EAPoL-Start transmission count.
Definition: eapol.h:46
struct net_device * netdev
Network device.
Definition: eap.h:140
uint16_t flags
Flags.
Definition: eap.h:142

References assert(), eapol_supplicant::count, io_buffer::data, DBGC, eapol_supplicant::eap, EAP_FL_ONGOING, EAP_FL_PASSIVE, eap_rx(), EAP_WAIT_TIMEOUT, eap_supplicant::flags, free_iob(), iob_len(), iob_pull, net_device::name, netdev, eap_supplicant::netdev, rc, start_timer_fixed(), stop_timer(), strerror(), eapol_supplicant::timer, and eapol_header::version.

◆ eapol_tx()

static int eapol_tx ( struct eapol_supplicant supplicant,
unsigned int  type,
const void *  data,
size_t  len 
)
static

Transmit EAPoL packet.

Parameters
supplicantEAPoL supplicant
typePacket type
dataPacket body
lenLength of packet body
Return values
rcReturn status code

Definition at line 193 of file eapol.c.

194  {
195  struct net_device *netdev = supplicant->eap.netdev;
196  struct io_buffer *iobuf;
197  struct eapol_header *eapol;
198  int rc;
199 
200  /* Allocate I/O buffer */
201  iobuf = alloc_iob ( MAX_LL_HEADER_LEN + sizeof ( *eapol ) + len );
202  if ( ! iobuf )
203  return -ENOMEM;
204  iob_reserve ( iobuf, MAX_LL_HEADER_LEN );
205 
206  /* Construct EAPoL header */
207  eapol = iob_put ( iobuf, sizeof ( *eapol ) );
208  eapol->version = EAPOL_VERSION_2001;
209  eapol->type = type;
210  eapol->len = htons ( len );
211 
212  /* Append packet body */
213  memcpy ( iob_put ( iobuf, len ), data, len );
214 
215  /* Transmit packet */
216  if ( ( rc = net_tx ( iob_disown ( iobuf ), netdev, &eapol_protocol,
217  &eapol_mac, netdev->ll_addr ) ) != 0 ) {
218  DBGC ( netdev, "EAPOL %s could not transmit type %d: %s\n",
219  netdev->name, type, strerror ( rc ) );
220  DBGC_HDA ( netdev, 0, data, len );
221  return rc;
222  }
223 
224  return 0;
225 }
uint16_t len
Payload length.
Definition: eapol.h:24
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define iob_put(iobuf, len)
Definition: iobuf.h:120
#define DBGC(...)
Definition: compiler.h:505
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
Definition: iobuf.c:129
static const uint8_t eapol_mac[ETH_ALEN]
EAPoL destination MAC address.
Definition: eapol.c:47
#define ENOMEM
Not enough space.
Definition: errno.h:534
#define iob_disown(iobuf)
Disown an I/O buffer.
Definition: iobuf.h:212
void * memcpy(void *dest, const void *src, size_t len) __nonnull
EAPoL header.
Definition: eapol.h:18
#define DBGC_HDA(...)
Definition: compiler.h:506
struct eap_supplicant eap
EAP supplicant.
Definition: eapol.h:42
static struct net_device * netdev
Definition: gdbudp.c:52
#define MAX_LL_HEADER_LEN
Maximum length of a link-layer header.
Definition: netdevice.h:45
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
#define EAPOL_VERSION_2001
802.1X-2001
Definition: eapol.h:28
A network device.
Definition: netdevice.h:352
uint8_t type
Type.
Definition: eapol.h:22
#define iob_reserve(iobuf, len)
Definition: iobuf.h:67
char name[NETDEV_NAME_LEN]
Name of this network device.
Definition: netdevice.h:362
int net_tx(struct io_buffer *iobuf, struct net_device *netdev, struct net_protocol *net_protocol, const void *ll_dest, const void *ll_source)
Transmit network-layer packet.
Definition: netdevice.c:1073
uint32_t len
Length.
Definition: ena.h:14
uint32_t type
Operating system type.
Definition: ena.h:12
uint8_t version
Version.
Definition: eapol.h:20
uint8_t data[48]
Additional event data.
Definition: ena.h:22
struct net_device * netdev
Network device.
Definition: eap.h:140
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
Definition: netdevice.h:387
#define htons(value)
Definition: byteswap.h:135
A persistent I/O buffer.
Definition: iobuf.h:33

References alloc_iob(), data, DBGC, DBGC_HDA, eapol_supplicant::eap, eapol_mac, EAPOL_VERSION_2001, ENOMEM, htons, iob_disown, iob_put, iob_reserve, len, eapol_header::len, net_device::ll_addr, MAX_LL_HEADER_LEN, memcpy(), net_device::name, net_tx(), netdev, eap_supplicant::netdev, rc, strerror(), type, eapol_header::type, and eapol_header::version.

Referenced by eapol_eap_tx(), and eapol_expired().

◆ eapol_eap_tx()

static int eapol_eap_tx ( struct eap_supplicant eap,
const void *  data,
size_t  len 
)
static

Transmit EAPoL-encapsulated EAP packet.

Parameters
supplicantEAPoL supplicant
ll_sourceLink-layer source address
Return values
rcReturn status code

Definition at line 234 of file eapol.c.

235  {
236  struct eapol_supplicant *supplicant =
237  container_of ( eap, struct eapol_supplicant, eap );
238 
239  /* Transmit encapsulated packet */
240  return eapol_tx ( supplicant, EAPOL_TYPE_EAP, data, len );
241 }
#define container_of(ptr, type, field)
Get containing structure.
Definition: stddef.h:35
struct eap_supplicant eap
EAP supplicant.
Definition: eapol.h:42
#define EAPOL_TYPE_EAP
EAPoL-encapsulated EAP packets.
Definition: eapol.h:31
uint32_t len
Length.
Definition: ena.h:14
uint8_t data[48]
Additional event data.
Definition: ena.h:22
An EAPoL supplicant.
Definition: eapol.h:40
static int eapol_tx(struct eapol_supplicant *supplicant, unsigned int type, const void *data, size_t len)
Transmit EAPoL packet.
Definition: eapol.c:193

References container_of, data, eapol_supplicant::eap, eapol_tx(), EAPOL_TYPE_EAP, and len.

Referenced by eapol_probe().

◆ eapol_expired()

static void eapol_expired ( struct retry_timer timer,
int fail  __unused 
)
static

(Re)transmit EAPoL-Start packet

Parameters
timerEAPoL-Start timer
expiredFailure indicator

Definition at line 249 of file eapol.c.

249  {
250  struct eapol_supplicant *supplicant =
252  struct net_device *netdev = supplicant->eap.netdev;
253 
254  /* Stop transmitting after maximum number of attempts */
255  if ( supplicant->count++ >= EAPOL_START_COUNT ) {
256  DBGC ( netdev, "EAPOL %s giving up\n", netdev->name );
257  return;
258  }
259 
260  /* Schedule next transmission */
262 
263  /* Transmit EAPoL-Start, ignoring errors */
264  DBGC2 ( netdev, "EAPOL %s transmitting Start\n", netdev->name );
265  eapol_tx ( supplicant, EAPOL_TYPE_START, NULL, 0 );
266 }
#define EAPOL_START_INTERVAL
Delay between EAPoL-Start packets.
Definition: eapol.h:50
#define DBGC(...)
Definition: compiler.h:505
A timer.
Definition: timer.h:28
#define container_of(ptr, type, field)
Get containing structure.
Definition: stddef.h:35
struct eap_supplicant eap
EAP supplicant.
Definition: eapol.h:42
static struct net_device * netdev
Definition: gdbudp.c:52
A network device.
Definition: netdevice.h:352
#define EAPOL_TYPE_START
EAPoL start.
Definition: eapol.h:34
void start_timer_fixed(struct retry_timer *timer, unsigned long timeout)
Start timer with a specified timeout.
Definition: retry.c:64
char name[NETDEV_NAME_LEN]
Name of this network device.
Definition: netdevice.h:362
#define DBGC2(...)
Definition: compiler.h:522
unsigned int count
EAPoL-Start transmission count.
Definition: eapol.h:46
struct net_device * netdev
Network device.
Definition: eap.h:140
An EAPoL supplicant.
Definition: eapol.h:40
#define EAPOL_START_COUNT
Maximum number of EAPoL-Start packets to transmit.
Definition: eapol.h:53
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321
static int eapol_tx(struct eapol_supplicant *supplicant, unsigned int type, const void *data, size_t len)
Transmit EAPoL packet.
Definition: eapol.c:193

References container_of, eapol_supplicant::count, DBGC, DBGC2, eapol_supplicant::eap, EAPOL_START_COUNT, EAPOL_START_INTERVAL, eapol_tx(), EAPOL_TYPE_START, net_device::name, netdev, eap_supplicant::netdev, NULL, and start_timer_fixed().

Referenced by eapol_probe().

◆ eapol_probe()

static int eapol_probe ( struct net_device netdev,
void *  priv 
)
static

Create EAPoL supplicant.

Parameters
netdevNetwork device
privPrivate data
Return values
rcReturn status code

Definition at line 275 of file eapol.c.

275  {
276  struct eapol_supplicant *supplicant = priv;
278 
279  /* Ignore non-EAPoL devices */
280  if ( ll_protocol->ll_proto != htons ( ARPHRD_ETHER ) )
281  return 0;
282  if ( vlan_tag ( netdev ) )
283  return 0;
284 
285  /* Initialise structure */
286  supplicant->eap.netdev = netdev;
287  supplicant->eap.tx = eapol_eap_tx;
288  timer_init ( &supplicant->timer, eapol_expired, &netdev->refcnt );
289 
290  return 0;
291 }
static int eapol_eap_tx(struct eap_supplicant *eap, const void *data, size_t len)
Transmit EAPoL-encapsulated EAP packet.
Definition: eapol.c:234
static void eapol_expired(struct retry_timer *timer, int fail __unused)
(Re)transmit EAPoL-Start packet
Definition: eapol.c:249
A link-layer protocol.
Definition: netdevice.h:114
struct eap_supplicant eap
EAP supplicant.
Definition: eapol.h:42
static struct net_device * netdev
Definition: gdbudp.c:52
struct refcnt refcnt
Reference counter.
Definition: netdevice.h:354
uint16_t ll_proto
Link-layer protocol.
Definition: netdevice.h:194
int(* tx)(struct eap_supplicant *supplicant, const void *data, size_t len)
Transmit EAP response.
Definition: eap.h:155
static struct tlan_private * priv
Definition: tlan.c:224
struct retry_timer timer
EAPoL-Start retransmission timer.
Definition: eapol.h:44
struct net_device * netdev
Network device.
Definition: eap.h:140
An EAPoL supplicant.
Definition: eapol.h:40
static unsigned int vlan_tag(struct net_device *netdev)
Get the VLAN tag.
Definition: vlan.h:73
#define ARPHRD_ETHER
Ethernet 10Mbps.
Definition: if_arp.h:16
#define htons(value)
Definition: byteswap.h:135
struct ll_protocol * ll_protocol
Link-layer protocol.
Definition: netdevice.h:372

References ARPHRD_ETHER, eapol_supplicant::eap, eapol_eap_tx(), eapol_expired(), htons, ll_protocol::ll_proto, net_device::ll_protocol, netdev, eap_supplicant::netdev, priv, net_device::refcnt, eapol_supplicant::timer, eap_supplicant::tx, and vlan_tag().

◆ eapol_notify()

static void eapol_notify ( struct net_device netdev,
void *  priv 
)
static

Handle EAPoL supplicant state change.

Parameters
netdevNetwork device
privPrivate data

Definition at line 299 of file eapol.c.

299  {
300  struct eapol_supplicant *supplicant = priv;
301 
302  /* Ignore non-EAPoL devices */
303  if ( ! supplicant->eap.netdev )
304  return;
305 
306  /* Terminate and reset EAP when link goes down */
307  if ( ! ( netdev_is_open ( netdev ) && netdev_link_ok ( netdev ) ) ) {
308  if ( timer_running ( &supplicant->timer ) ) {
309  DBGC ( netdev, "EAPOL %s shutting down\n",
310  netdev->name );
311  }
312  supplicant->eap.flags = 0;
313  stop_timer ( &supplicant->timer );
314  return;
315  }
316 
317  /* Do nothing if EAP is already in progress */
318  if ( timer_running ( &supplicant->timer ) )
319  return;
320 
321  /* Do nothing if EAP has already finished transmitting */
322  if ( supplicant->eap.flags & EAP_FL_PASSIVE )
323  return;
324 
325  /* Otherwise, start sending EAPoL-Start */
326  start_timer_nodelay ( &supplicant->timer );
327  supplicant->count = 0;
328  DBGC ( netdev, "EAPOL %s starting up\n", netdev->name );
329 }
static void start_timer_nodelay(struct retry_timer *timer)
Start timer with no delay.
Definition: retry.h:99
#define DBGC(...)
Definition: compiler.h:505
static int netdev_is_open(struct net_device *netdev)
Check whether or not network device is open.
Definition: netdevice.h:658
static int netdev_link_ok(struct net_device *netdev)
Check link state of network device.
Definition: netdevice.h:636
struct eap_supplicant eap
EAP supplicant.
Definition: eapol.h:42
static struct net_device * netdev
Definition: gdbudp.c:52
#define EAP_FL_PASSIVE
EAP supplicant is passive.
Definition: eap.h:174
void stop_timer(struct retry_timer *timer)
Stop timer.
Definition: retry.c:117
char name[NETDEV_NAME_LEN]
Name of this network device.
Definition: netdevice.h:362
static struct tlan_private * priv
Definition: tlan.c:224
struct retry_timer timer
EAPoL-Start retransmission timer.
Definition: eapol.h:44
unsigned int count
EAPoL-Start transmission count.
Definition: eapol.h:46
struct net_device * netdev
Network device.
Definition: eap.h:140
An EAPoL supplicant.
Definition: eapol.h:40
uint16_t flags
Flags.
Definition: eap.h:142

References eapol_supplicant::count, DBGC, eapol_supplicant::eap, EAP_FL_PASSIVE, eap_supplicant::flags, net_device::name, netdev, eap_supplicant::netdev, netdev_is_open(), netdev_link_ok(), priv, start_timer_nodelay(), stop_timer(), and eapol_supplicant::timer.

Variable Documentation

◆ __net_driver

struct net_driver eapol_driver __net_driver
Initial value:
= {
.name = "EAPoL",
.priv_len = sizeof ( struct eapol_supplicant ),
.probe = eapol_probe,
.notify = eapol_notify,
}
static void eapol_notify(struct net_device *netdev, void *priv)
Handle EAPoL supplicant state change.
Definition: eapol.c:299
static int eapol_probe(struct net_device *netdev, void *priv)
Create EAPoL supplicant.
Definition: eapol.c:275
An EAPoL supplicant.
Definition: eapol.h:40

EAPoL driver.

Definition at line 44 of file eapol.c.

◆ eapol_mac

const uint8_t eapol_mac[ETH_ALEN]
static
Initial value:
= {
0x01, 0x80, 0xc2, 0x00, 0x00, 0x03
}

EAPoL destination MAC address.

Definition at line 47 of file eapol.c.

Referenced by eapol_tx().

◆ __net_protocol

struct net_protocol eapol_protocol __net_protocol
Initial value:
= {
.name = "EAPOL",
.net_proto = htons ( ETH_P_EAPOL ),
.rx = eapol_rx,
}
static int eapol_rx(struct io_buffer *iobuf, struct net_device *netdev, const void *ll_dest __unused, const void *ll_source, unsigned int flags __unused)
Process EAPoL packet.
Definition: eapol.c:61
#define ETH_P_EAPOL
Definition: if_ether.h:24
#define htons(value)
Definition: byteswap.h:135

EAPoL protocol.

AoE protocol.

Definition at line 124 of file eapol.c.

◆ __eapol_handler

struct eapol_handler eapol_eap __eapol_handler
Initial value:
= {
.type = EAPOL_TYPE_EAP,
.rx = eapol_eap_rx,
}
static int eapol_eap_rx(struct eapol_supplicant *supplicant, struct io_buffer *iobuf, const void *ll_source __unused)
Process EAPoL-encapsulated EAP packet.
Definition: eapol.c:137
#define EAPOL_TYPE_EAP
EAPoL-encapsulated EAP packets.
Definition: eapol.h:31

EAPoL handler for EAP packets.

Definition at line 179 of file eapol.c.