Skip to contentSkip to conversation

vdpa_sim_net: should not drop the multicast/broadcast packet

PATCH In review Cindy Lu 2 participants 2 messages Dec 14, 2022 virtio core

lore
Share & tools
lore

Cindy Lu

author
#0 lore raw

PATCH 1/1 vdpa_sim_net: should not drop the multicast/broadcast packet

In the receive_filter(), should not drop the packet with the broadcast/multicast address. Add the check for this

---
 drivers/vdpa/vdpa_sim/vdpa_sim_net.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/vdpa/vdpa_sim/vdpa_sim_net.c +3 -0
index c3cb225ea469..0f4739c31eea 100644
@@ -62,6 +62,9 @@ static bool receive_filter(struct vdpasim *vdpasim, size_t len)
 	if (len < ETH_ALEN + hdr_len)
 		return false;
 
+	if (is_broadcast_ether_addr(vdpasim->buffer + hdr_len) ||
+	    is_multicast_ether_addr(vdpasim->buffer + hdr_len))
+		return true;
 	if (!strncmp(vdpasim->buffer + hdr_len, vio_config->mac, ETH_ALEN))
 		return true;
 
Signature · 1 line
2.34.3
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Cindy Lu

In the receive_filter(), should not drop the packet with the broadcast/multicast address. Add the check for this

Thanks

Quoted 19 lines
---
 drivers/vdpa/vdpa_sim/vdpa_sim_net.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/vdpa/vdpa_sim/vdpa_sim_net.c +3 -1
index c3cb225ea469..0f4739c31eea 100644
@@ -62,6 +62,9 @@ static bool receive_filter(struct vdpasim *vdpasim, size_t len)
        if (len < ETH_ALEN + hdr_len)
                return false;
 
+       if (is_broadcast_ether_addr(vdpasim->buffer + hdr_len) ||
+           is_multicast_ether_addr(vdpasim->buffer + hdr_len))
+               return true;
        if (!strncmp(vdpasim->buffer + hdr_len, vio_config->mac, ETH_ALEN))
                return true;
 
--
Quoted 2 lines

2.34.3

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization