Skip to content

Commit

Permalink
net/e1000: update network information when macaddr is changed in guest
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
  • Loading branch information
amoskong authored and stefanhaRH committed Oct 18, 2013
1 parent 655d3b6 commit 7c36507
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions hw/net/e1000.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7c36507

Please sign in to comment.