Skip to content

Commit 4cd6654

Browse files
krish2718kartben
authored andcommitted
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 <Chaitanya.Tata@nordicsemi.no>
1 parent 70b6706 commit 4cd6654

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
@@ -32,6 +32,14 @@ config NET_L2_ETHERNET_MGMT
3232
Enable support net_mgmt Ethernet interface which can be used to
3333
configure at run-time Ethernet drivers and L2 settings.
3434

35+
36+
config NET_L2_ETHERNET_ACCEPT_MISMATCH_L3_L2_ADDR
37+
bool "Accept mismatched L3 and L2 addresses"
38+
help
39+
If enabled, then accept packets where the L3 and L2 addresses do not
40+
conform to RFC1122 section 3.3.6. This is useful in dealing with
41+
buggy devices that do not follow the RFC.
42+
3543
config NET_VLAN
3644
bool "Virtual LAN support"
3745
select NET_L2_VIRTUAL

subsys/net/l2/ethernet/ethernet.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,10 @@ static inline
178178
enum net_verdict ethernet_check_ipv4_bcast_addr(struct net_pkt *pkt,
179179
struct net_eth_hdr *hdr)
180180
{
181+
if (IS_ENABLED(CONFIG_NET_L2_ETHERNET_ACCEPT_MISMATCH_L3_L2_ADDR)) {
182+
return NET_OK;
183+
}
184+
181185
if (net_eth_is_addr_broadcast(&hdr->dst) &&
182186
!(net_ipv4_is_addr_mcast((struct in_addr *)NET_IPV4_HDR(pkt)->dst) ||
183187
net_ipv4_is_addr_bcast(net_pkt_iface(pkt),

0 commit comments

Comments
 (0)