qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] virtio-net: revert mac on reset
@ 2013-01-16 11:45 Michael S. Tsirkin
  2013-01-16 13:29 ` Stefan Hajnoczi
  2013-01-16 13:44 ` Laszlo Ersek
  0 siblings, 2 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2013-01-16 11:45 UTC (permalink / raw)
  To: qemu-devel; +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 <mst@redhat.com>
---
 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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] virtio-net: revert mac on reset
  2013-01-16 11:45 [Qemu-devel] [PATCH] virtio-net: revert mac on reset Michael S. Tsirkin
@ 2013-01-16 13:29 ` Stefan Hajnoczi
  2013-01-16 13:44 ` Laszlo Ersek
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2013-01-16 13:29 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Paolo Bonzini, Anthony Liguori, Laszlo Ersek, qemu-devel

On Wed, Jan 16, 2013 at 01:45:21PM +0200, Michael S. Tsirkin wrote:
> 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 <mst@redhat.com>
> ---
>  hw/virtio-net.c | 1 +
>  1 file changed, 1 insertion(+)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] virtio-net: revert mac on reset
  2013-01-16 11:45 [Qemu-devel] [PATCH] virtio-net: revert mac on reset Michael S. Tsirkin
  2013-01-16 13:29 ` Stefan Hajnoczi
@ 2013-01-16 13:44 ` Laszlo Ersek
  1 sibling, 0 replies; 3+ messages in thread
From: Laszlo Ersek @ 2013-01-16 13:44 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Stefan Hajnoczi, Anthony Liguori, qemu-devel, Paolo Bonzini

On 01/16/13 12:45, Michael S. Tsirkin wrote:
> 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 <mst@redhat.com>
> ---
>  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);
>  }
>  

Reviewed-by: Laszlo Ersek <lersek@redhat.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-01-16 13:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-16 11:45 [Qemu-devel] [PATCH] virtio-net: revert mac on reset Michael S. Tsirkin
2013-01-16 13:29 ` Stefan Hajnoczi
2013-01-16 13:44 ` Laszlo Ersek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).