From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:52556) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TvRN4-0007cj-Vu for qemu-devel@nongnu.org; Wed, 16 Jan 2013 06:41:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TvRN0-0007LF-BK for qemu-devel@nongnu.org; Wed, 16 Jan 2013 06:41:30 -0500 Received: from mx1.redhat.com ([209.132.183.28]:21308) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TvRN0-0007L8-3a for qemu-devel@nongnu.org; Wed, 16 Jan 2013 06:41:26 -0500 Date: Wed, 16 Jan 2013 13:45:21 +0200 From: "Michael S. Tsirkin" Message-ID: <20130116114521.GA20630@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] [PATCH] virtio-net: revert mac on reset List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Stefan Hajnoczi , Anthony Liguori , Laszlo Ersek , Paolo Bonzini 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 --- 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); } -- MST