From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53390) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VXD4s-0004j4-Oq for qemu-devel@nongnu.org; Fri, 18 Oct 2013 12:39:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VXD4m-000654-Ph for qemu-devel@nongnu.org; Fri, 18 Oct 2013 12:39:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:3217) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VXD4m-00064u-Hm for qemu-devel@nongnu.org; Fri, 18 Oct 2013 12:39:00 -0400 From: Stefan Hajnoczi Date: Fri, 18 Oct 2013 18:38:46 +0200 Message-Id: <1382114327-29926-3-git-send-email-stefanha@redhat.com> In-Reply-To: <1382114327-29926-1-git-send-email-stefanha@redhat.com> References: <1382114327-29926-1-git-send-email-stefanha@redhat.com> Subject: [Qemu-devel] [PULL v2 2/3] net/e1000: update network information when macaddr is changed in guest List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Amos Kong , Stefan Hajnoczi , Anthony Liguori From: Amos Kong If we change macaddr in guest by 'ifconfig eth0 hw ether 12:12:12:34:35:36', the mac register of e1000 is already updated, but we don't update network information in qemu. Therefor, the information in monitor is wrong. This patch updates nic info when the second part of macaddr is written. Signed-off-by: Amos Kong Signed-off-by: Stefan Hajnoczi --- hw/net/e1000.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hw/net/e1000.c b/hw/net/e1000.c index 9a1c46e..70a59fd 100644 --- a/hw/net/e1000.c +++ b/hw/net/e1000.c @@ -1106,7 +1106,15 @@ mac_read_clr8(E1000State *s, int index) static void mac_writereg(E1000State *s, int index, uint32_t val) { + uint32_t macaddr[2]; + s->mac_reg[index] = val; + + if (index == RA + 1) { + macaddr[0] = cpu_to_le32(s->mac_reg[RA]); + macaddr[1] = cpu_to_le32(s->mac_reg[RA + 1]); + qemu_format_nic_info_str(qemu_get_queue(s->nic), (uint8_t *)macaddr); + } } static void -- 1.8.3.1