diff mbox

virtio-net: broken RX filtering logic fixed

Message ID 1379862553-26307-1-git-send-email-dmitry@daynix.com
State New
Headers show

Commit Message

Dmitry Fleytman Sept. 22, 2013, 3:09 p.m. UTC
From: Dmitry Fleytman <dfleytma@redhat.com>

Upon processing of VIRTIO_NET_CTRL_MAC_TABLE_SET command
multicast list overwrites unicast list in mac_table.
This leads to broken logic for both unicast and multicast RX filtering.

Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
---
 hw/net/virtio-net.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Stefan Hajnoczi Sept. 23, 2013, 1:05 p.m. UTC | #1
On Sun, Sep 22, 2013 at 06:09:13PM +0300, Dmitry Fleytman wrote:
> From: Dmitry Fleytman <dfleytma@redhat.com>
> 
> Upon processing of VIRTIO_NET_CTRL_MAC_TABLE_SET command
> multicast list overwrites unicast list in mac_table.
> This leads to broken logic for both unicast and multicast RX filtering.
> 
> Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
> ---
>  hw/net/virtio-net.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Thanks, applied to my net-next tree:
https://github.com/stefanha/qemu/commits/net-next

Stefan
diff mbox

Patch

diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index dd41008..e822ab1 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -656,7 +656,8 @@  static int virtio_net_handle_mac(VirtIONet *n, uint8_t cmd,
     }
 
     if (n->mac_table.in_use + mac_data.entries <= MAC_TABLE_ENTRIES) {
-        s = iov_to_buf(iov, iov_cnt, 0, n->mac_table.macs,
+        s = iov_to_buf(iov, iov_cnt, 0,
+                       &n->mac_table.macs[n->mac_table.in_use * ETH_ALEN],
                        mac_data.entries * ETH_ALEN);
         if (s != mac_data.entries * ETH_ALEN) {
             goto error;