Bug 1026689 - virtio-net: macaddr is reset but network info of monitor isn't updated
virtio-net: macaddr is reset but network info of monitor isn't updated
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm (Show other bugs)
7.0
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: Amos Kong
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-11-05 04:03 EST by Amos Kong
Modified: 2015-05-24 20:07 EDT (History)
8 users (show)

See Also:
Fixed In Version: qemu-kvm-1.5.3-17.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-06-13 05:25:58 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Amos Kong 2013-11-05 04:03:44 EST
Description of problem:

This patch should be backported:

commit 702d66a813dd84afd7c3d1ad8cbdcc8e3449bcd9
Author: Michael S. Tsirkin <mst@redhat.com>
Date:   Tue Sep 17 11:45:36 2013 +0300

    virtio-net: fix up HMP NIC info string on reset
    
    When mac is updated on reset, info string has stale data.
    Fix it up.
    
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index dd41008..22dbd05 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -314,6 +314,7 @@ static void virtio_net_reset(VirtIODevice *vdev)
     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));
+    qemu_format_nic_info_str(qemu_get_queue(n->nic), n->mac);
     memset(n->vlans, 0, MAX_VLAN >> 3);
 }

How reproducible:
100%

Steps to Reproduce:
1. boot guest with virtio nic
2. change mac address in guest by 
   ifconfig eth0 hw ether 12:12:12:01:01:01:01
3. reboot guest
4. checking macaddr info in monitor repeatedly
   # info network

Actual results:
the macaddr of virtio nic in monitor isn't reset

Expected results:
the mac info is updated during the reset
Comment 1 Miroslav Rezanina 2013-11-07 10:56:08 EST
Fix included in qemu-kvm-1.5.3-17.el7
Comment 3 langfang 2013-11-24 22:34:47 EST
Reproduce this bug as follow version:
Host:
# uname -r
3.10.0-52.el7.x86_64
# rpm -q qemu-kvm
qemu-kvm-1.5.3-16.el7.x86_64

Guest :3.10.0-48.el7.x86_64


Steps:
1. Boot guest with virtio nic
...-netdev tap,id=hostnet0,vhost=on,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:60:3f:29,bus=pci.0,addr=0x4 ...

2. Change mac address in guest by 
   #ifconfig eth0 hw ether 12:12:12:01:01:09
3. Reboot guest
4. checking macaddr info in monitor repeatedly
   # info network

Results: the macaddr of virtio nic in monitor isn't reset
(qemu) info network 
net0: index=0,type=nic,model=virtio-net-pci,macaddr=12:12:12:01:01:09
 \ hostnet0: index=0,type=tap,ifname=tap0,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown

Verify this bug as follow version:
Host:

# uname -r
3.10.0-52.el7.x86_64
# rpm -q qemu-kvm
qemu-kvm-1.5.3-19.el7.x86_64

Guest:3.10.0-48.el7.x86_64

Steps as same as reproduce

Results:
After step4,macaddr change to original one

(qemu) info network
net0: index=0,type=nic,model=virtio-net-pci,macaddr=52:54:00:60:3f:29
 \ hostnet0: index=0,type=tap,ifname=tap0,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown


Addtional info :Tried about 3 times ,not hit any problem


According to above test ,this bug has fixed.
Comment 5 Ludek Smid 2014-06-13 05:25:58 EDT
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.

Note You need to log in before you can comment on or make changes to this bug.