]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
network: permit <forward mode='open'/> when a network has no IP address
authorLaine Stump <laine@redhat.com>
Mon, 2 Sep 2024 20:13:08 +0000 (16:13 -0400)
committerLaine Stump <laine@redhat.com>
Tue, 17 Sep 2024 14:55:14 +0000 (10:55 -0400)
The whole point of <forward mode='open'/> is to supress libvirt from
adding any firewall rules for a network, and someone might want to
create a network with no IP address (i.e. they don't want the guests
to have connectivity to the host via this interface) and no firewall
rules (they don't want any, or they want to add their own). So there's
no reason to fail when a network has <forward mode='open'/> and also
has no IP address.

Kind-of-Resolves: https://gitlab.com/libvirt/libvirt/-/issues/588
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
src/conf/network_conf.c

index 5cf419acf1d77a9a0bce3d36a0e3dab5e2ed82f0..320e1b089a4942b258565dbf15b16f3d477a5677 100644 (file)
@@ -1789,7 +1789,6 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt,
 
     case VIR_NETWORK_FORWARD_ROUTE:
     case VIR_NETWORK_FORWARD_NAT:
-    case VIR_NETWORK_FORWARD_OPEN:
         /* It's pointless to specify L3 forwarding without specifying
          * the network we're on.
          */
@@ -1806,8 +1805,10 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt,
                            def->name);
             return NULL;
         }
+        break;
 
-        if (def->forward.type == VIR_NETWORK_FORWARD_OPEN && def->forward.nifs) {
+    case VIR_NETWORK_FORWARD_OPEN:
+        if (def->forward.nifs) {
             /* an open network by definition can't place any restrictions
              * on what traffic is allowed or where it goes, so specifying
              * a forwarding device is nonsensical.