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 <rmelch@hotmail.com>
This commit is contained in:
Robert Melchers 2021-10-06 13:31:07 +13:00 committed by Carles Cufí
parent f2859f9501
commit 59fcf8c031
1 changed files with 6 additions and 4 deletions

View File

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