Bug 1026689

Summary: virtio-net: macaddr is reset but network info of monitor isn't updated
Product: Red Hat Enterprise Linux 7 Reporter: Amos Kong <akong>
Component: qemu-kvmAssignee: Amos Kong <akong>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: acathrow, ailan, flang, hhuang, juzhang, michen, qiguo, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
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 09:25:58 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Amos Kong 2013-11-05 09:03:44 UTC
Description of problem:

This patch should be backported:

commit 702d66a813dd84afd7c3d1ad8cbdcc8e3449bcd9
Author: Michael S. Tsirkin <mst>
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>

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 15:56:08 UTC
Fix included in qemu-kvm-1.5.3-17.el7

Comment 3 langfang 2013-11-25 03:34:47 UTC
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 09:25:58 UTC
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.