From patchwork Wed Jan 16 11:45:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 212493 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 123702C0093 for ; Wed, 16 Jan 2013 22:41:46 +1100 (EST) Received: from localhost ([::1]:59751 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TvRNH-0007cs-Jx for incoming@patchwork.ozlabs.org; Wed, 16 Jan 2013 06:41:43 -0500 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 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r0GBfNJB017034 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 16 Jan 2013 06:41:23 -0500 Received: from redhat.com (vpn1-4-197.ams2.redhat.com [10.36.4.197]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id r0GBfLCj006123; Wed, 16 Jan 2013 06:41:22 -0500 Date: Wed, 16 Jan 2013 13:45:21 +0200 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Message-ID: <20130116114521.GA20630@redhat.com> MIME-Version: 1.0 Content-Disposition: inline X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Stefan Hajnoczi , Anthony Liguori , Laszlo Ersek , Paolo Bonzini Subject: [Qemu-devel] [PATCH] virtio-net: revert mac on reset X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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); }