Bug 1125764

Summary: libvirt should check stp delay time
Product: Red Hat Enterprise Linux 7 Reporter: Luyao Huang <lhuang>
Component: libvirtAssignee: Erik Skultety <eskultet>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: dyuan, honzhang, jsuchane, lhuang, mzhan, rbalakri
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-1.2.13-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 05:46:34 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 Luyao Huang 2014-08-01 03:07:30 UTC
description of problem:
libvirt should check stp delay time.When you set a large number or a negative number to it,it will start success and can use dumpxml see it.

Version-Release number of selected component (if applicable):
libvirt-1.1.1-29.el7_0.1.x86_64


How reproducible:
100%

Steps to Reproduce:
1.prepare xml like this
# cat net.xml
<network>
  <name>net4</name>
  <uuid>d918f9ff-f9b2-4ab7-ae01-f1042cd303a6</uuid>
  <forward mode='nat'/>
  <bridge name='virbr13' stp='on' delay='-10000000000' />
  <mac address='52:54:00:c7:ce7'/>
  <ip address='192.168.13.13' netmask='255.255.255.0'>
  </ip>
</network>

2.define it and start
# virsh net-define net.xml
Network net4 defined from net.xml

3.# virsh net-dumpxml net4
<network>
  <name>net4</name>
  <uuid>d918f9ff-f9b2-4ab7-ae01-f1042cd303a6</uuid>
  <forward mode='nat'>
    <nat>
      <port start='1024' end='65535'/>
    </nat>
  </forward>
  <bridge name='virbr13' stp='on' delay='-10000000000' />
  <mac address='52:54:00:c7:ce7'/>
  <ip address='192.168.13.13' netmask='255.255.255.0'>
  </ip>
</network>

4.# brctl showstp virbr13
virbr13
 bridge id                8000.525400c7ced7
 designated root        8000.525400c7ced7
 root port                   0                        path cost                   0
 max age                  20.00                        bridge max age                  20.00
 hello time                   2.00                        bridge hello time           2.00
 *forward delay                  30.00*                        bridge forward delay          30.00
 ageing time                 300.00
 hello timer                   0.93                        tcn timer                   0.00
 topology change timer           0.00                        gc timer                 236.12
 flags                        




Actual results:
Edit success with no error output, network can start normal.And dumpxml cannot
offer a right forward delay time.

Expected results:
libvirt should check stp delay time,and don't

Comment 3 Erik Skultety 2014-09-16 08:17:27 UTC
Fixed upstream:

commit 3aa0524104fd27f091483a0380fec81b3eb3a477
Author: Erik Skultety <eskultet>
Date:   Mon Sep 15 10:42:15 2014 +0200

    network: check for invalid forward delay time
    
    When spanning tree protocol is allowed in bridge settings, forward delay
    value is set as well (default is 0 if omitted). Until now, there was no
    check for delay value validity. Delay makes sense only as a positive
    numerical value.
    
    Note: However, even if you provide positive  numerical value, brctl
    utility only uses values from range <2,30>, so the number provided can
    be modified (kernel most likely) to fall within this range.

v1.2.8-139-g3aa0524

Comment 5 hongming 2015-04-10 07:24:41 UTC
Verify it as follows. The result is expected. Move its status to VERIFIED.

# rpm -q libvirt 
libvirt-1.2.14-1.el7.x86_64

# cat net.xml
<network>
  <name>testnet</name>
  <forward mode='nat'/>
  <bridge name='virbr13' stp='on' delay='-10000' />
  <mac address='52:54:00:c7:ce7'/>
  <ip address='192.168.13.13' netmask='255.255.255.0'>
  </ip>
</network>

# virsh net-define net.xml
error: Failed to define network from net.xml
error: XML error: Invalid delay value in network 'testnet'

# vim net.xml

# cat net.xml
<network>
  <name>testnet</name>
  <forward mode='nat'/>
  <bridge name='virbr13' stp='on' delay='aaa' />
  <mac address='52:54:00:c7:ce7'/>
  <ip address='192.168.13.13' netmask='255.255.255.0'>
  </ip>
</network>


# virsh net-define net.xml
error: Failed to define network from net.xml
error: XML error: Invalid delay value in network 'testnet'


# virsh net-edit default <===  change the delay value to illegal values
error: XML error: Invalid delay value in network 'default'
Failed. Try again? [y,n,f,?]:

Comment 7 errata-xmlrpc 2015-11-19 05:46:34 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/RHBA-2015-2202.html