]> xenbits.xensource.com Git - libvirt.git/commit
Fix parsing of bond interface XML
authorJim Fehlig <jfehlig@suse.com>
Thu, 21 Mar 2013 21:44:11 +0000 (15:44 -0600)
committerJim Fehlig <jfehlig@suse.com>
Fri, 22 Mar 2013 15:20:08 +0000 (09:20 -0600)
commit5ba077dcd0775d5fc5b8d3691c0a68b46e44ff9e
tree24e451121305b6ddcd74259f1f53469184569a19
parentb8fec67cb5309732b07742fcc988621d27313a35
Fix parsing of bond interface XML

Noticed that parsing bond interface XML containing the miimon element
fails

  <interface type="bond" name="bond0">
    ...
    <bond mode="active-backup">
      <miimon freq="100" carrier="netif"/>
      ...
    </bond>
  </interface>

This configuration does not contain the optional updelay and downdelay
attributes, but parsing will fail due to returning the result of
virXPathULong (a -1 when the attribute doesn't exist) from
virInterfaceDefParseBond after examining the updelay attribute.

While fixing this bug, cleanup the function to use virXPathInt instead
of virXPathULong, and store the result directly instead of using a tmp
variable.  Using virXPathInt actually fixes a potential silent
truncation bug noted by Eric Blake.

Also, there is no cleanup in the error label.  Remove the label,
returning failure where failure occurs and success if the end of the
function is reached.
src/conf/interface_conf.c