net: ethernet: Add Kconfig option to forward unrecognized EtherType frames

Add Kconfig option to the Ethernet L2 which allows to forward frames
with unknown EtherType further into the stack. This can be useful for
packet sockets, where further frame processing is application dependent.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
Robert Lubos 2022-05-17 09:33:17 +02:00 committed by Marti Bolivar
commit 0516d75d84
2 changed files with 13 additions and 0 deletions

View file

@ -108,4 +108,12 @@ config NET_ETHERNET_BRIDGE_DEFAULT
Say y if this is the case. If you only want to inspect Say y if this is the case. If you only want to inspect
existing bridge instances then say n. existing bridge instances then say n.
config NET_ETHERNET_FORWARD_UNRECOGNISED_ETHERTYPE
bool "Forward unrecognized EtherType frames further into net stack"
default y if NET_SOCKETS_PACKET
help
When enabled, the Ethernet L2 will forward even those frames for which
it does not recognize the EtherType in the header. By default, such
frames are dropped at the L2 processing.
endif # NET_L2_ETHERNET endif # NET_L2_ETHERNET

View file

@ -254,6 +254,11 @@ static enum net_verdict ethernet_recv(struct net_if *iface,
goto drop; goto drop;
#endif #endif
default: default:
if (IS_ENABLED(CONFIG_NET_ETHERNET_FORWARD_UNRECOGNISED_ETHERTYPE)) {
family = AF_UNSPEC;
break;
}
NET_DBG("Unknown hdr type 0x%04x iface %p", type, iface); NET_DBG("Unknown hdr type 0x%04x iface %p", type, iface);
goto drop; goto drop;
} }