net: ethernet: Add EAPoL ether type support

Wi-Fi protocol uses EAPoL ether type frames for authentication, so, add
support for that ether type so that they are not dropped.

Though we have NET_ETHERNET_FORWARD_UNRECOGNISED_ETHERTYPE to allow
unknown frames to be passed up the stack, but this might cause
performance penalty.

Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
This commit is contained in:
Krishna T 2022-08-08 02:01:58 +05:30 committed by Carles Cufí
commit b754e63d1b
2 changed files with 4 additions and 0 deletions

View file

@ -66,6 +66,7 @@ struct net_eth_addr {
#define NET_ETH_PTYPE_LLDP 0x88cc #define NET_ETH_PTYPE_LLDP 0x88cc
#define NET_ETH_PTYPE_ALL 0x0003 /* from linux/if_ether.h */ #define NET_ETH_PTYPE_ALL 0x0003 /* from linux/if_ether.h */
#define NET_ETH_PTYPE_ECAT 0x88a4 #define NET_ETH_PTYPE_ECAT 0x88a4
#define NET_ETH_PTYPE_EAPOL 0x888e
#if !defined(ETH_P_ALL) #if !defined(ETH_P_ALL)
#define ETH_P_ALL NET_ETH_PTYPE_ALL #define ETH_P_ALL NET_ETH_PTYPE_ALL

View file

@ -240,6 +240,9 @@ static enum net_verdict ethernet_recv(struct net_if *iface,
net_pkt_set_family(pkt, AF_INET6); net_pkt_set_family(pkt, AF_INET6);
family = AF_INET6; family = AF_INET6;
break; break;
case NET_ETH_PTYPE_EAPOL:
family = AF_UNSPEC;
break;
#if defined(CONFIG_NET_L2_PTP) #if defined(CONFIG_NET_L2_PTP)
case NET_ETH_PTYPE_PTP: case NET_ETH_PTYPE_PTP:
family = AF_UNSPEC; family = AF_UNSPEC;