From patchwork Wed Jan 16 11:45:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: virtio-net: revert mac on reset From: "Michael S. Tsirkin" X-Patchwork-Id: 212493 Message-Id: <20130116114521.GA20630@redhat.com> To: qemu-devel@nongnu.org Cc: Stefan Hajnoczi , Anthony Liguori , Laszlo Ersek , Paolo Bonzini Date: Wed, 16 Jan 2013 13:45:21 +0200 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 Reviewed-by: Stefan Hajnoczi Reviewed-by: Laszlo Ersek --- hw/virtio-net.c | 1 + 1 file changed, 1 insertion(+) 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); }