summaryrefslogtreecommitdiffstats
path: root/hw
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2013-01-16 11:37:40 +0200
committerMichael S. Tsirkin <mst@redhat.com>2013-01-30 01:31:08 +0200
commit41dc8a67c7dcecdf7ae1cd25db3c46f2b42a221f (patch)
treeaf81e510943a4785b21508b1532a565240438cbd /hw
parent7586317bc0db3b993446b21eec914f5b66645ee4 (diff)
downloadhqemu-41dc8a67c7dcecdf7ae1cd25db3c46f2b42a221f.zip
hqemu-41dc8a67c7dcecdf7ae1cd25db3c46f2b42a221f.tar.gz
virtio-net: revert mac on reset
Once guest overrides virtio net primary mac, it retains the value set until qemu exit. This is inconsistent with standard nic behaviour. To fix, revert the mac to the original value on reset. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/virtio-net.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/hw/virtio-net.c b/hw/virtio-net.c
index 3bb01b1..4d80a25 100644
--- a/hw/virtio-net.c
+++ b/hw/virtio-net.c
@@ -199,6 +199,7 @@ static void virtio_net_reset(VirtIODevice *vdev)
n->mac_table.multi_overflow = 0;
n->mac_table.uni_overflow = 0;
memset(n->mac_table.macs, 0, MAC_TABLE_ENTRIES * ETH_ALEN);
+ memcpy(&n->mac[0], &n->nic->conf->macaddr, sizeof(n->mac));
memset(n->vlans, 0, MAX_VLAN >> 3);
}
OpenPOWER on IntegriCloud