Bug 1196503

Summary: libvirt should output error when set a wrong ipv6 host id
Product: Red Hat Enterprise Linux 7 Reporter: Luyao Huang <lhuang>
Component: libvirtAssignee: Ján Tomko <jtomko>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1CC: dyuan, honzhang, jtomko, 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 06:17:40 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 2015-02-26 06:02:34 UTC
description of problem:
libvirt should output error when set a wrong ipv6 host id

Version-Release number of selected component (if applicable):
libvirt-1.2.8-16.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
 
1.prepare a network like this:

# virsh net-dumpxml ipv6
<network>
  <name>ipv6</name>
  <uuid>f8c22eeb-166a-4c5b-91a7-99c188b2c481</uuid>
  <forward mode='nat'/>
  <bridge name='virbr6' stp='on' delay='0'/>
  <mac address='52:54:00:7f:f0:47'/>
  <ip family='ipv6' address='2001:db8:ca2:2::1' prefix='64'>
    <dhcp>
      <range start='2001:db8:ca2:2:1::10' end='2001:db8:ca2:2:1::ff'/>
      <host id='0:4:7e:7d:f0:7d:a8:bc:c5:d2:13:32:11:ed:16:ea:84:f3' ip='2001:db8:ca2:2:3::4'/>
    </dhcp>
  </ip>
  <route family='ipv6' address='2001:db8:ca2:2::' prefix='65' gateway='2001:db8:ca2:2:1::10'/>
</network>

2. edit host id like this(change 'f' to 'z'):

<host id='0:4:7e:7d:f0:7d:a8:bc:c5:d2:13:32:11:ed:16:ea:84:z3' ip='2001:db8:ca2:2:3::4'/>

3.# virsh net-edit ipv6
Network ipv6 XML configuration edited.

4.check the libvirtd.log

2015-02-17 08:02:19.007+0000: 22613: error : virNetworkDHCPHostDefParseXML:731 : XML error: Invalid character 'z' in id '0:4:7e:7d:f0:7d:a8:bc:c5:d2:13:32:11:ed:16:ea:84:g3' of network 'ipv6'.

Actual results:
An error happened when parse the xml , but libvirt do not output it

Expected results:
libvirt should output error when set a wrong ipv6 host id, we already check this why not output the error and stop parse.


Additional info:

Comment 1 Luyao Huang 2015-02-26 07:58:45 UTC
upstream patch:
https://www.redhat.com/archives/libvir-list/2015-February/msg01091.html

Comment 2 Ján Tomko 2015-02-26 08:02:27 UTC
Now pushed as:
commit 719cd2182bf06196b26204a8cf88d28001b1d79b
Author:     Luyao Huang <lhuang>
AuthorDate: 2015-02-26 14:14:20 +0800
Commit:     Ján Tomko <jtomko>
CommitDate: 2015-02-26 08:52:43 +0100

    conf: error out on invalid host id
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1196503
    
    We already check whether the host id is valid or not, add a jump
    to forbid invalid host id.
    
    Signed-off-by: Luyao Huang <lhuang>
    Signed-off-by: Ján Tomko <jtomko>

git describe: v1.2.13-rc2-1-g719cd21

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

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

# virsh net-edit ipv6
error: XML error: Invalid character 'x' in id '0:4:7e:7d:f0:7d:a8:bc:c5:d2:13:32:11:ed:16:ea:84:aaxxx' of network 'ipv6'
Failed. Try again? [y,n,f,?]: 
error: XML error: Invalid character 'x' in id '0:4:7e:7d:f0:7d:a8:bc:c5:d2:13:32:11:ed:16:ea:84:aax66' of network 'ipv6'
Failed. Try again? [y,n,f,?]: 


# virsh net-define ipv6.xml
error: Failed to define network from ipv6.xml
error: XML error: Invalid character 'x' in id '0:4:7e:7d:f0:7d:a8:bc:c5:d2:13:32:11:ed:16:ea:84:aaxx3' of network 'ipv6'


# virsh net-define ipv6.xml
error: Failed to define network from ipv6.xml
error: XML error: Invalid character 'z' in id '0:4:7e:7d:f0:7d:a8:bc:c5:d2:13:32:11:ed:16:ea:84:z3' of network 'ipv6'

Comment 6 errata-xmlrpc 2015-11-19 06:17:40 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