Bug 767057

Summary: forward mode='bridge' macvtap xml with invalid section(bridge and ip section) can be defined and started
Product: Red Hat Enterprise Linux 7 Reporter: xhu
Component: libvirtAssignee: Laine Stump <laine>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: acathrow, ajia, cwei, dallan, laine, mshao, mzhan
Target Milestone: rc   
Target Release: 7.0   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-1.0.1-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-13 10:06:12 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description xhu 2011-12-13 05:01:51 UTC
Description of problem:
forward mode='bridge' macvtap xml with invalid section(bridge and ip section) can be defined and started

Version-Release number of selected component (if applicable):
libvirt-0.9.8-1.el6.x86_64
qemu-kvm-0.12.1.2-2.209.el6.x86_64
kernel-2.6.32-220.el6.x86_64

How reproducible:
everytimes

Steps to Reproduce:
1. prepare forward mode='bridge' macvtap xml with dhcp section
# cat macvtap-bridge-test.xml 
<network>
  <name>test</name>
  <forward dev='eth0' mode='bridge'>
    <interface dev='eth0'/>
    <interface dev='eth3'/>
  </forward>
  <bridge name='test'/>
  <ip address='192.168.200.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.200.2' end='192.168.200.254' />
    </dhcp>
  </ip>
</network>

2. define and start network test:
# virsh net-define macvtap-bridge-test.xml 
Network test defined from macvtap-bridge-test.xml

# virsh net-start test
Network test started

3. check test network xml:
<network>
  <name>test</name>
  <uuid>518e50e7-38dc-3441-3e4c-8f9fb536fb8f</uuid>
  <forward dev='eth0' mode='bridge'>
    <interface dev='eth0'/>
    <interface dev='eth3'/>
  </forward>
  <bridge name='test' />
  <ip address='192.168.200.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.200.2' end='192.168.200.254' />
    </dhcp>
  </ip>
</network>
  
Actual results:
forward mode='bridge' macvtap xml with invalid section(bridge and ip section) can be defined and started

Expected results:
when the above network xml is defined, invalid xml section error should raised.

Additional info:

Comment 4 Laine Stump 2012-12-05 19:18:25 UTC
Fix sent upstream:

https://www.redhat.com/archives/libvir-list/2012-December/msg00235.html

Comment 5 Laine Stump 2012-12-06 00:00:28 UTC
Pushed upstream. Will be in libvirt-1.0.1.

commit fd54f1de536ebd5f7566285b83029e6c73725d03
Author: Laine Stump <laine>
Date:   Wed Dec 5 14:10:24 2012 -0500

    network: prevent a few invalid configuration combinations
    
    This resolves: https://bugzilla.redhat.com/show_bug.cgi?id=767057
    
    It was possible to define a network with <forward mode='bridge'> that
    had both a bridge device and a forward device defined. These two are
    mutually exclusive by definition (if you are using a bridge device,
    then this is a host bridge, and if you have a forward dev defined,
    this is using macvtap). It was also possible to put <ip>, <dns>, and
    <domain> elements in this definition, although those aren't supported
    by the current driver (although it's conceivable that some other
    driver might support that).
    
    The items that are invalid by definition, are now checked in the XML
    parser (since they will definitely *always* be wrong), and the others
    are checked in networkValidate() in the network driver (since, as
    mentioned, it's possible that some other network driver, or even this
    one, could some day support setting those).

Comment 6 Huang Wenlong 2012-12-20 06:11:32 UTC
Verify this bug with:
libvirt-1.0.1-1.el7.x86_64


#cat net.xml
<network>
  <name>test</name>
  <forward dev='eth0' mode='bridge'>
    <interface dev='eth0'/>
    <interface dev='eth3'/>
  </forward>
  <bridge name='test'/>
  <ip address='192.168.200.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.200.2' end='192.168.200.254' />
    </dhcp>
  </ip>
</network>



#virsh net-define net.xml 
error: Failed to define network from net.xml
error: XML error: A network with forward mode='bridge' can specify a bridge name or a forward dev, but not both (network 'test')

Comment 7 Ludek Smid 2014-06-13 10:06:12 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.