Skip to content

Commit 0ac9290

Browse files
krish2718rlubos
authored andcommitted
[nrf fromtree] net: l2: Add a config option to allow mismatched L3/L2 address packets
The RFC1122 section 3.3.6 says we SHOULD drop the packets if L2 address is brodcast but L3 address is unicast, but we had seen some Wi-Fi access points in the field not conforming to that, and DHCP offer is dropped due to this and causes Wi-Fi connectivity issues. As the RFC saus it's SHOULD and not a MUST, add a config option to allow such packets, disabled by default. Signed-off-by: Chaitanya Tata <[email protected]> (cherry picked from commit 4cd6654)
1 parent 4040aa0 commit 0ac9290

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

subsys/net/l2/ethernet/Kconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ config NET_L2_ETHERNET_MGMT
2424
Enable support net_mgmt Ethernet interface which can be used to
2525
configure at run-time Ethernet drivers and L2 settings.
2626

27+
28+
config NET_L2_ETHERNET_ACCEPT_MISMATCH_L3_L2_ADDR
29+
bool "Accept mismatched L3 and L2 addresses"
30+
help
31+
If enabled, then accept packets where the L3 and L2 addresses do not
32+
conform to RFC1122 section 3.3.6. This is useful in dealing with
33+
buggy devices that do not follow the RFC.
34+
2735
config NET_VLAN
2836
bool "Virtual lan support"
2937
help

subsys/net/l2/ethernet/ethernet.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,10 @@ static inline
173173
enum net_verdict ethernet_check_ipv4_bcast_addr(struct net_pkt *pkt,
174174
struct net_eth_hdr *hdr)
175175
{
176+
if (IS_ENABLED(CONFIG_NET_L2_ETHERNET_ACCEPT_MISMATCH_L3_L2_ADDR)) {
177+
return NET_OK;
178+
}
179+
176180
if (net_eth_is_addr_broadcast(&hdr->dst) &&
177181
!(net_ipv4_is_addr_mcast((struct in_addr *)NET_IPV4_HDR(pkt)->dst) ||
178182
net_ipv4_is_addr_bcast(net_pkt_iface(pkt),

0 commit comments

Comments
 (0)