]> git.ipfire.org Git - thirdparty/libvirt.git/commit
network: verify proper address family in updates to <host> and <range>
authorLaine Stump <laine@laine.org>
Mon, 19 Jan 2015 22:04:01 +0000 (17:04 -0500)
committerLaine Stump <laine@laine.org>
Mon, 10 Aug 2015 06:38:41 +0000 (02:38 -0400)
commit6a21bc119e37bafcbe5cfd13e57080d651296b43
treecf1f96e2cf76efb871a1b7457652a282d333d049
parent7d69387cd6c49710d76d06f20f0cf9ef5a28aa55
network: verify proper address family in updates to <host> and <range>

By specifying parentIndex in a call to virNetworkUpdate(), it was
possible to direct libvirt to add a dhcp range or static host of a
non-matching address family to the <dhcp> element of an <ip>. For
example, given:

 <ip address='192.168.122.1' netmask='255.255.255.0'/>
 <ip family='ipv6' address='2001:db6:ca3:45::1' prefix='64'/>

you could provide a static host entry with an IPv4 address, and
specify that it be added to the 2nd <ip> element (index 1):

  virsh net-update default add ip-dhcp-host --parent-index 1 \
  '<host mac="52:54:00:00:00:01" ip="192.168.122.45"/>'

This would be happily added with no error (and no concern of any
possible future consequences).

This patch checks that any dhcp range or host element being added to a
network ip's <dhcp> subelement has addresses of the same family as the
ip element they are being added to.

This resolves:

  https://bugzilla.redhat.com/show_bug.cgi?id=1184736
src/conf/network_conf.c