]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Check for down limit of SLIRP prefix too
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 6 Feb 2018 09:21:56 +0000 (10:21 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 14 Feb 2018 12:43:47 +0000 (13:43 +0100)
https://bugzilla.redhat.com/show_bug.cgi?id=1515533

We're already checking if IPv4 prefix isn't too long. But we are
not checking if it isn't too short. QEMU supports prefixes longer
than 4 (including). I haven't find anything similar related to
IPv6 in qemu sources.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
src/qemu/qemu_domain.c

index b60bb465a13186b7821c3c3384867c13cc0de08c..2bc0259eaef8e0cc0a1fca8230fe156041812e68 100644 (file)
@@ -3873,9 +3873,9 @@ qemuDomainDeviceDefValidateNetwork(const virDomainNetDef *net)
                 }
                 hasIPv4 = true;
 
-                if (ip->prefix > 27) {
+                if (ip->prefix < 4 || ip->prefix > 27) {
                     virReportError(VIR_ERR_XML_ERROR, "%s",
-                                   _("prefix too long"));
+                                   _("invalid prefix, must be in range of 4-27"));
                     return -1;
                 }
             }