aboutsummaryrefslogtreecommitdiff
path: root/hw/net/e1000.c
diff options
context:
space:
mode:
authorAmos Kong <akong@redhat.com>2013-10-17 15:02:49 +0800
committerStefan Hajnoczi <stefanha@redhat.com>2013-10-18 13:28:09 +0200
commit7c36507c2b8776266f50c5e2739bd18279953b93 (patch)
tree48f380f3d9b808af48b89e37e735832339b8163e /hw/net/e1000.c
parent655d3b63b036b70714adbdae685055f1bda0f8f1 (diff)
net/e1000: update network information when macaddr is changed in guest
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 <akong@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'hw/net/e1000.c')
-rw-r--r--hw/net/e1000.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/hw/net/e1000.c b/hw/net/e1000.c
index 9a1c46e8ca..70a59fde7f 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