eapol.c
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 FILE_LICENCE ( GPL2_OR_LATER );
00020
00021
00022
00023
00024
00025
00026
00027 #include <gpxe/netdevice.h>
00028 #include <gpxe/iobuf.h>
00029 #include <gpxe/if_ether.h>
00030 #include <gpxe/eapol.h>
00031 #include <errno.h>
00032 #include <byteswap.h>
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 static int eapol_rx ( struct io_buffer *iob, struct net_device *netdev,
00044 const void *ll_source )
00045 {
00046 struct eapol_frame *eapol = iob->data;
00047 struct eapol_handler *handler;
00048
00049 if ( iob_len ( iob ) < EAPOL_HDR_LEN ) {
00050 free_iob ( iob );
00051 return -EINVAL;
00052 }
00053
00054 for_each_table_entry ( handler, EAPOL_HANDLERS ) {
00055 if ( handler->type == eapol->type ) {
00056 iob_pull ( iob, EAPOL_HDR_LEN );
00057 return handler->rx ( iob, netdev, ll_source );
00058 }
00059 }
00060
00061 free_iob ( iob );
00062 return -( ENOTSUP | ( ( eapol->type & 0x1f ) << 8 ) );
00063 }
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074 static const char * eapol_ntoa ( const void *net_addr __unused )
00075 {
00076 return "<EAPOL>";
00077 }
00078
00079
00080 struct net_protocol eapol_protocol __net_protocol = {
00081 .name = "EAPOL",
00082 .rx = eapol_rx,
00083 .ntoa = eapol_ntoa,
00084 .net_proto = htons ( ETH_P_EAPOL ),
00085 };