From: Michael S. Tsirkin Date: Wed, 16 Jan 2013 09:37:40 +0000 (+0200) Subject: virtio-net: revert mac on reset X-Git-Tag: v1.4.0-rc0~54^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=41dc8a67c7dcecdf7ae1cd25db3c46f2b42a221f;p=thirdparty%2Fqemu.git 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 --- diff --git a/hw/virtio-net.c b/hw/virtio-net.c index 3bb01b10374..4d80a257443 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); }