Skip to contentSkip to conversation

virtio-net: Correctly store multicast filter entries

PATCH In review Vlad Yasevich 1 participant 2 messages Nov 8, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 virtio-net: Correctly store multicast filter entries

Commit 921ac5d0f3a0df869db5ce4edf752f51d8b1596a
virtio-net: remove layout assumptions for ctrl vq
introduced a regression where the multicast address filter entries are written to the beginning of the mac table array, thus overwriting any unicast addresses that may have been programmed in the filter.
The multicast addresses should be written after all the unicast addresses.

---
 hw/net/virtio-net.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/net/virtio-net.c +2 -1
index 22dbd05..94e8b68 100644
@@ -657,7 +657,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;
Signature · 1 line
1.8.4.2
#1 lore raw
Quoted 10 lines · Vlad Yasevich

Commit 921ac5d0f3a0df869db5ce4edf752f51d8b1596a
virtio-net: remove layout assumptions for ctrl vq
introduced a regression where the multicast address filter entries are written to the beginning of the mac table array, thus overwriting any unicast addresses that may have been programmed in the filter.
The multicast addresses should be written after all the unicast addresses.

Please ignore. Just saw pull pull request with similar patch.

-vlad

Quoted 19 lines
---
  hw/net/virtio-net.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
hw/net/virtio-net.c +2 -1
index 22dbd05..94e8b68 100644
@@ -657,7 +657,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;