Bug 1071095

Summary: Libvirt report incorrect error message when parsing invalid value of CTRL_IP_LEARNING in nwfilter
Product: Red Hat Enterprise Linux 7 Reporter: Hu Jianwei <jiahu>
Component: libvirtAssignee: Laine Stump <laine>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: medium    
Version: 7.0CC: dyuan, honzhang, laine, mzhan, rbalakri, stefanb
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-1.2.7-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-05 07:30:51 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:
Embargoed:

Description Hu Jianwei 2014-02-28 05:22:01 UTC
Description of problem:
Libvirt report incorrect error message when parsing invalid value of CTRL_IP_LEARNING in nwfilter

Version-Release number of selected component (if applicable):
libvirt-1.1.1-25.el7.x86_64
qemu-kvm-rhev-1.5.3-50.el7.x86_64
kernel-3.10.0-97.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Set invalid value to CTRL_IP_LEARNING, Valid values are any, dhcp, or none.
[root@intel-e5530-8-2 ~]# virsh dumpxml r7 | grep interface -A8
    <interface type='network'>
      <mac address='52:54:00:7f:44:cb'/>
      <source network='default'/>
      <model type='rtl8139'/>
      <filterref filter='clean-traffic'>
        <parameter name='CTRL_IP_LEARNING' value='jiahu'/>                
      </filterref>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
...

2. Start the domain.
[root@intel-e5530-8-2 ~]# virsh start r7
error: Failed to start domain r7
error: internal error: Could not find value for variable 'IP'

Actual results:
As shown above, after checking the codes, lack of "goto err_exit;" after the "virReportError" sentence in virNWFilterInstantiate function in nwfilter/nwfilter_gentech_driver.c

 710             } else {
 711                 rc = -1;
 712                 virReportError(VIR_ERR_PARSE_FAILED,
 713                                _("filter '%s' "
 714                                  "learning value '%s' invalid."),
 715                                filter->name, learning);
 716             }
 717         } else

Expected results:
Rebuild libvirt with "goto err_exit;" line after src/nwfilter/nwfilter_gentech_driver.c:715, below message is expected results.

[root@intel-3323-24-1 src]# rpm -q libvirt
libvirt-1.1.1-25.el7_jiahu_testing.x86_64
[root@intel-3323-24-1 src]#
[root@intel-3323-24-1 src]# virsh dumpxml mig1| grep interface -A8
    <interface type='network'>
      <mac address='52:54:00:b7:e7:d8'/>
      <source network='default'/>
      <model type='rtl8139'/>
      <filterref filter='clean-traffic'>
        <parameter name='CTRL_IP_LEARNING' value='jiahu'/>
      </filterref>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
...

[root@intel-3323-24-1 src]# virsh start mig1
error: Failed to start domain mig1
error: failed to parse configuration file filter 'clean-traffic' learning value 'jiahu' invalid.

Comment 1 Stefan Berger 2014-03-12 14:40:45 UTC
A patch for this has been pushed to the upstream repo:

commit 41064facd48676bb311784f29619c1fbd0aed8c4
Author: Stefan Berger <stefanb.ibm.com>
Date:   Wed Mar 12 10:35:13 2014 -0400

    nwfilter: Add missing goto err_exit in error path

    https://bugzilla.redhat.com/show_bug.cgi?id=1071095

    Add a missing goto err_exit in the error path where an unsupported
    value is assigned to the CTRL_IP_LEARNING key.

    Signed-off-by: Stefan Berger <stefanb.ibm.com>

Comment 3 Hu Jianwei 2014-11-24 10:52:09 UTC
Verified the bug as below:

[root@ibm-x3850x5-06 ~]# rpm -q libvirt
libvirt-1.2.8-7.el7.x86_64

[root@ibm-x3850x5-06 ~]# virsh dumpxml r7 | grep /interface -B8
    <interface type='network'>
      <mac address='02:54:00:36:c6:d0'/>
      <source network='default'/>
      <model type='virtio'/>
      <filterref filter='clean-traffic'>
        <parameter name='CTRL_IP_LEARNING' value='jiahu'/>
      </filterref>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

[root@ibm-x3850x5-06 ~]# virsh start r7
error: Failed to start domain r7
error: failed to parse configuration file filter 'clean-traffic' learning value 'jiahu' invalid.

We can get expected results, changed to Verified.

Comment 5 errata-xmlrpc 2015-03-05 07:30:51 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2015-0323.html