From: Michal Privoznik Date: Tue, 6 Feb 2018 09:21:56 +0000 (+0100) Subject: qemu: Check for down limit of SLIRP prefix too X-Git-Tag: v4.1.0-rc1~109 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b62b8090b2ad4524a5bf9d40d0d1c17a9d57f5a0;p=thirdparty%2Flibvirt.git qemu: Check for down limit of SLIRP prefix too 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 Reviewed-by: John Ferlan --- diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index b60bb465a1..2bc0259eae 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -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; } }