]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: only limit IPv4 prefix for slirp
authorLaine Stump <laine@redhat.com>
Wed, 11 Feb 2026 23:31:42 +0000 (18:31 -0500)
committerLaine Stump <laine@redhat.com>
Mon, 9 Mar 2026 05:14:47 +0000 (01:14 -0400)
The slirp backend is limited in what the netmask/prefix of a
user-specified IP address can be, but passt doesn't have these
artificial limitations - any valid prefix is okay with passt, so we
shouldn't reject them

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_validate.c

index dc66b3bc3b7abe887b1f37868ceae7b437d45cc6..5c664d549b7bd3c8273ef281a7f5196b36fed109 100644 (file)
@@ -1946,8 +1946,9 @@ qemuValidateDomainDeviceDefNetwork(const virDomainNetDef *net,
             }
             hasV4Addr = true;
 
-            if (ip->prefix > 0 &&
-                (ip->prefix < 4 || ip->prefix > 27)) {
+            if (net->backend.type != VIR_DOMAIN_NET_BACKEND_PASST &&
+                (ip->prefix > 0 &&
+                 (ip->prefix < 4 || ip->prefix > 27))) {
                 virReportError(VIR_ERR_XML_ERROR, "%s",
                                _("invalid prefix, must be in range of 4-27"));
                 return -1;