On 2/24/26 8:13 AM, Michal Prívozník wrote:
On 2/24/26 08:52, Laine Stump via Devel wrote:
From: Laine Stump <[email protected]>

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 <[email protected]>
---
  src/qemu/qemu_validate.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index a0ddf512f1..1c6662751b 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -1926,8 +1926,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;

This block of code starts with:

     for (i = 0; i < net->guestIP.nips; i++) {
         const virNetDevIPAddr *ip = net->guestIP.ips[i];

         if (net->type != VIR_DOMAIN_NET_TYPE_USER &&
             net->backend.type != VIR_DOMAIN_NET_BACKEND_PASST) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                            _("Invalid attempt to set network interface guest-side 
IP address info, not supported for this interface type/backend"));
             return -1;
         }

IOW this patch is a dead code, effectively.

Nope. The first condition says that if it's not BACKEND_PASST *AND* it's not type USER, then we fail validation. So we could still get here if net->type == VIR_DOMAIN_NET_TYPE_USER, but net->backend.type != VIR_DOMAIN_NET_BACKEND_PASST, in which case the validation inside this new if() clause is done.


Michal


Reply via email to