Skip to content

Commit e7df33e

Browse files
rmelchcfriedt
authored andcommitted
net: ethernet: ARP addresses being filled with mcast addresses
Fixes #38994, ARP messages were being sent to IPvXmcast MAC addresses rather than the expected source MAC address or the broadcast address. Signed-off-by: Robert Melchers <[email protected]>
1 parent 29b52a8 commit e7df33e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

subsys/net/l2/ethernet/ethernet.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -520,8 +520,9 @@ static struct net_buf *ethernet_fill_header(struct ethernet_context *ctx,
520520

521521
hdr_vlan = (struct net_eth_vlan_hdr *)(hdr_frag->data);
522522

523-
if (!ethernet_fill_in_dst_on_ipv4_mcast(pkt, &hdr_vlan->dst) &&
524-
!ethernet_fill_in_dst_on_ipv6_mcast(pkt, &hdr_vlan->dst)) {
523+
if (ptype == htons(NET_ETH_PTYPE_ARP) ||
524+
(!ethernet_fill_in_dst_on_ipv4_mcast(pkt, &hdr_vlan->dst) &&
525+
!ethernet_fill_in_dst_on_ipv6_mcast(pkt, &hdr_vlan->dst))) {
525526
memcpy(&hdr_vlan->dst, net_pkt_lladdr_dst(pkt)->addr,
526527
sizeof(struct net_eth_addr));
527528
}
@@ -541,8 +542,9 @@ static struct net_buf *ethernet_fill_header(struct ethernet_context *ctx,
541542
} else {
542543
hdr = (struct net_eth_hdr *)(hdr_frag->data);
543544

544-
if (!ethernet_fill_in_dst_on_ipv4_mcast(pkt, &hdr->dst) &&
545-
!ethernet_fill_in_dst_on_ipv6_mcast(pkt, &hdr->dst)) {
545+
if (ptype == htons(NET_ETH_PTYPE_ARP) ||
546+
(!ethernet_fill_in_dst_on_ipv4_mcast(pkt, &hdr->dst) &&
547+
!ethernet_fill_in_dst_on_ipv6_mcast(pkt, &hdr->dst))) {
546548
memcpy(&hdr->dst, net_pkt_lladdr_dst(pkt)->addr,
547549
sizeof(struct net_eth_addr));
548550
}

0 commit comments

Comments
 (0)