From nobody Wed Nov 27 18:51:39 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1544202060716741.9013825338116; Fri, 7 Dec 2018 09:01:00 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 097573B714; Fri, 7 Dec 2018 17:00:58 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 33B3E4DA7B; Fri, 7 Dec 2018 17:00:56 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 18905181A968; Fri, 7 Dec 2018 17:00:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wB7H0sQw009136 for ; Fri, 7 Dec 2018 12:00:54 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7ED095D971; Fri, 7 Dec 2018 17:00:54 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-37.ams2.redhat.com [10.36.112.37]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3CA4D5D9C6; Fri, 7 Dec 2018 17:00:53 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Fri, 7 Dec 2018 17:00:48 +0000 Message-Id: <20181207170048.18181-3-berrange@redhat.com> In-Reply-To: <20181207170048.18181-1-berrange@redhat.com> References: <20181207170048.18181-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/2] util: move firewall rules into per network chains X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Fri, 07 Dec 2018 17:00:59 +0000 (UTC) The previous commit created chains for each virtual network. This commit adjusts the code so that rules are now put in these new chains. With two networks running, the filter table thus looks like -N LIBVIRT_FWI -N LIBVIRT_FWI_virbr0 -N LIBVIRT_FWI_virbr1 -N LIBVIRT_FWO -N LIBVIRT_FWO_virbr0 -N LIBVIRT_FWO_virbr1 -N LIBVIRT_FWX -N LIBVIRT_FWX_virbr0 -N LIBVIRT_FWX_virbr1 -N LIBVIRT_INP -N LIBVIRT_INP_virbr0 -N LIBVIRT_INP_virbr1 -N LIBVIRT_OUT -N LIBVIRT_OUT_virbr0 -N LIBVIRT_OUT_virbr1 -A INPUT -j LIBVIRT_INP -A FORWARD -j LIBVIRT_FWX -A FORWARD -j LIBVIRT_FWI -A FORWARD -j LIBVIRT_FWO -A OUTPUT -j LIBVIRT_OUT -A LIBVIRT_FWI -o virbr1 -j LIBVIRT_FWI_virbr1 -A LIBVIRT_FWI -o virbr0 -j LIBVIRT_FWI_virbr0 -A LIBVIRT_FWI_virbr0 -d 192.168.0.0/24 -o virbr0 -m conntrack --ctstate = RELATED,ESTABLISHED -j ACCEPT -A LIBVIRT_FWI_virbr0 -o virbr0 -j REJECT --reject-with icmp-port-unreach= able -A LIBVIRT_FWI_virbr1 -d 192.168.1.0/24 -o virbr1 -m conntrack --ctstate = RELATED,ESTABLISHED -j ACCEPT -A LIBVIRT_FWI_virbr1 -o virbr1 -j REJECT --reject-with icmp-port-unreach= able -A LIBVIRT_FWO -i virbr1 -j LIBVIRT_FWO_virbr1 -A LIBVIRT_FWO -i virbr0 -j LIBVIRT_FWO_virbr0 -A LIBVIRT_FWO_virbr0 -s 192.168.0.0/24 -i virbr0 -j ACCEPT -A LIBVIRT_FWO_virbr0 -i virbr0 -j REJECT --reject-with icmp-port-unreach= able -A LIBVIRT_FWO_virbr1 -s 192.168.1.0/24 -i virbr1 -j ACCEPT -A LIBVIRT_FWO_virbr1 -i virbr1 -j REJECT --reject-with icmp-port-unreach= able -A LIBVIRT_FWX -j LIBVIRT_FWX_virbr1 -A LIBVIRT_FWX -j LIBVIRT_FWX_virbr0 -A LIBVIRT_FWX_virbr0 -i virbr0 -o virbr0 -j ACCEPT -A LIBVIRT_FWX_virbr1 -i virbr1 -o virbr1 -j ACCEPT -A LIBVIRT_INP -i virbr1 -j LIBVIRT_INP_virbr1 -A LIBVIRT_INP -i virbr0 -j LIBVIRT_INP_virbr0 -A LIBVIRT_INP_virbr0 -i virbr0 -p udp -m udp --dport 53 -j ACCEPT -A LIBVIRT_INP_virbr0 -i virbr0 -p tcp -m tcp --dport 53 -j ACCEPT -A LIBVIRT_INP_virbr0 -i virbr0 -p udp -m udp --dport 67 -j ACCEPT -A LIBVIRT_INP_virbr0 -i virbr0 -p tcp -m tcp --dport 67 -j ACCEPT -A LIBVIRT_INP_virbr1 -i virbr1 -p udp -m udp --dport 53 -j ACCEPT -A LIBVIRT_INP_virbr1 -i virbr1 -p tcp -m tcp --dport 53 -j ACCEPT -A LIBVIRT_INP_virbr1 -i virbr1 -p udp -m udp --dport 67 -j ACCEPT -A LIBVIRT_INP_virbr1 -i virbr1 -p tcp -m tcp --dport 67 -j ACCEPT -A LIBVIRT_OUT -o virbr1 -j LIBVIRT_OUT_virbr1 -A LIBVIRT_OUT -o virbr0 -j LIBVIRT_OUT_virbr0 -A LIBVIRT_OUT_virbr0 -o virbr0 -p udp -m udp --dport 68 -j ACCEPT -A LIBVIRT_OUT_virbr1 -o virbr1 -p udp -m udp --dport 68 -j ACCEPT while the nat table has -N LIBVIRT_PRT -N LIBVIRT_PRT_virbr0 -N LIBVIRT_PRT_virbr1 -A POSTROUTING -j LIBVIRT_PRT -A LIBVIRT_PRT -j LIBVIRT_PRT_virbr1 -A LIBVIRT_PRT -j LIBVIRT_PRT_virbr0 -A LIBVIRT_PRT_virbr0 -s 192.168.0.0/24 -d 224.0.0.0/24 -j RETURN -A LIBVIRT_PRT_virbr0 -s 192.168.0.0/24 -d 255.255.255.255/32 -j RETURN -A LIBVIRT_PRT_virbr0 -s 192.168.0.0/24 ! -d 192.168.0.0/24 -p tcp -j MAS= QUERADE --to-ports 1024-65535 -A LIBVIRT_PRT_virbr0 -s 192.168.0.0/24 ! -d 192.168.0.0/24 -p udp -j MAS= QUERADE --to-ports 1024-65535 -A LIBVIRT_PRT_virbr0 -s 192.168.0.0/24 ! -d 192.168.0.0/24 -j MASQUERADE -A LIBVIRT_PRT_virbr1 -s 192.168.1.0/24 -d 224.0.0.0/24 -j RETURN -A LIBVIRT_PRT_virbr1 -s 192.168.1.0/24 -d 255.255.255.255/32 -j RETURN -A LIBVIRT_PRT_virbr1 -s 192.168.1.0/24 ! -d 192.168.1.0/24 -p tcp -j MAS= QUERADE --to-ports 1024-65535 -A LIBVIRT_PRT_virbr1 -s 192.168.1.0/24 ! -d 192.168.1.0/24 -p udp -j MAS= QUERADE --to-ports 1024-65535 -A LIBVIRT_PRT_virbr1 -s 192.168.1.0/24 ! -d 192.168.1.0/24 -j MASQUERADE and the mangle table has -N LIBVIRT_PRT -N LIBVIRT_PRT_virbr0 -N LIBVIRT_PRT_virbr1 -A POSTROUTING -j LIBVIRT_PRT -A LIBVIRT_PRT -j LIBVIRT_PRT_virbr1 -A LIBVIRT_PRT -j LIBVIRT_PRT_virbr0 -A LIBVIRT_PRT_virbr0 -o virbr0 -p udp -m udp --dport 68 -j CHECKSUM --ch= ecksum-fill -A LIBVIRT_PRT_virbr1 -o virbr1 -p udp -m udp --dport 68 -j CHECKSUM --ch= ecksum-fill Signed-off-by: Daniel P. Berrang=C3=A9 --- src/libvirt_private.syms | 1 - src/network/bridge_driver_linux.c | 25 +++- src/util/viriptables.c | 124 ++++++++++++------ src/util/viriptables.h | 6 +- .../nat-default-linux.args | 32 ++--- .../nat-ipv6-linux.args | 48 +++---- .../nat-many-ips-linux.args | 60 ++++----- .../nat-no-dhcp-linux.args | 46 +++---- .../nat-tftp-linux.args | 34 ++--- .../route-default-linux.args | 22 ++-- 10 files changed, 230 insertions(+), 168 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 8f7f166aef..c5b480cb87 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2071,7 +2071,6 @@ iptablesRemoveOutputFixUdpChecksum; iptablesRemoveTcpInput; iptablesRemoveUdpInput; iptablesRemoveUdpOutput; -iptablesSetDeletePrivate; iptablesSetupLocalChains; iptablesSetupPrivateChains; iptablesTeardownLocalChains; diff --git a/src/network/bridge_driver_linux.c b/src/network/bridge_driver_= linux.c index 4777e9efc4..220834d323 100644 --- a/src/network/bridge_driver_linux.c +++ b/src/network/bridge_driver_linux.c @@ -36,6 +36,8 @@ VIR_LOG_INIT("network.bridge_driver_linux"); =20 #define PROC_NET_ROUTE "/proc/net/route" =20 +static bool deleteLegacyRules; + int networkPreReloadFirewallRules(bool startup) { int ret =3D iptablesSetupPrivateChains(); @@ -55,16 +57,16 @@ int networkPreReloadFirewallRules(bool startup) * rules will be present. Thus we can safely just tell it * to always delete from the builin chain */ - if (startup && ret =3D=3D 1) { - iptablesSetDeletePrivate(false); - } + if (startup && ret =3D=3D 1) + deleteLegacyRules =3D true; + return 0; } =20 =20 void networkPostReloadFirewallRules(bool startup ATTRIBUTE_UNUSED) { - iptablesSetDeletePrivate(true); + deleteLegacyRules =3D false; } =20 =20 @@ -261,6 +263,7 @@ networkAddMasqueradingFirewallRules(virFirewallPtr fw, =20 /* First the generic masquerade rule for other protocols */ if (iptablesAddForwardMasquerade(fw, + def->bridge, &ipdef->address, prefix, forwardIf, @@ -271,6 +274,7 @@ networkAddMasqueradingFirewallRules(virFirewallPtr fw, =20 /* UDP with a source port restriction */ if (iptablesAddForwardMasquerade(fw, + def->bridge, &ipdef->address, prefix, forwardIf, @@ -281,6 +285,7 @@ networkAddMasqueradingFirewallRules(virFirewallPtr fw, =20 /* TCP with a source port restriction */ if (iptablesAddForwardMasquerade(fw, + def->bridge, &ipdef->address, prefix, forwardIf, @@ -291,6 +296,7 @@ networkAddMasqueradingFirewallRules(virFirewallPtr fw, =20 /* exempt local network broadcast address as destination */ if (iptablesAddDontMasquerade(fw, + def->bridge, &ipdef->address, prefix, forwardIf, @@ -299,6 +305,7 @@ networkAddMasqueradingFirewallRules(virFirewallPtr fw, =20 /* exempt local multicast range as destination */ if (iptablesAddDontMasquerade(fw, + def->bridge, &ipdef->address, prefix, forwardIf, @@ -320,6 +327,7 @@ networkRemoveMasqueradingFirewallRules(virFirewallPtr f= w, return 0; =20 if (iptablesRemoveDontMasquerade(fw, + def->bridge, &ipdef->address, prefix, forwardIf, @@ -327,6 +335,7 @@ networkRemoveMasqueradingFirewallRules(virFirewallPtr f= w, return -1; =20 if (iptablesRemoveDontMasquerade(fw, + def->bridge, &ipdef->address, prefix, forwardIf, @@ -334,6 +343,7 @@ networkRemoveMasqueradingFirewallRules(virFirewallPtr f= w, return -1; =20 if (iptablesRemoveForwardMasquerade(fw, + def->bridge, &ipdef->address, prefix, forwardIf, @@ -343,6 +353,7 @@ networkRemoveMasqueradingFirewallRules(virFirewallPtr f= w, return -1; =20 if (iptablesRemoveForwardMasquerade(fw, + def->bridge, &ipdef->address, prefix, forwardIf, @@ -352,6 +363,7 @@ networkRemoveMasqueradingFirewallRules(virFirewallPtr f= w, return -1; =20 if (iptablesRemoveForwardMasquerade(fw, + def->bridge, &ipdef->address, prefix, forwardIf, @@ -717,7 +729,10 @@ void networkRemoveFirewallRules(virNetworkDefPtr def) virNetworkIPDefPtr ipdef; virFirewallPtr fw =3D NULL; =20 - iptablesTeardownLocalChains(def->bridge); + if (!deleteLegacyRules) { + iptablesTeardownLocalChains(def->bridge); + goto cleanup; + } =20 fw =3D virFirewallNew(); =20 diff --git a/src/util/viriptables.c b/src/util/viriptables.c index 53d0568a84..f7072fd140 100644 --- a/src/util/viriptables.c +++ b/src/util/viriptables.c @@ -46,13 +46,13 @@ VIR_LOG_INIT("util.iptables"); =20 #define VIR_FROM_THIS VIR_FROM_NONE =20 +#define CHAIN_NAME_MAX 32 /* Linux XT_TABLE_MAXNAMELEN - includes the NUL= */ + enum { ADD =3D 0, REMOVE }; =20 -static int deletePrivate =3D true; - typedef struct { const char *parent; const char *child; @@ -268,13 +268,6 @@ iptablesTeardownLocalChains(const char *iface) } =20 =20 -void -iptablesSetDeletePrivate(bool pvt) -{ - deletePrivate =3D pvt; -} - - static void iptablesInput(virFirewallPtr fw, virFirewallLayer layer, @@ -285,6 +278,10 @@ iptablesInput(virFirewallPtr fw, int tcp) { char portstr[32]; + char chainName[CHAIN_NAME_MAX]; + + snprintf(chainName, sizeof(chainName), "LIBVIRT_INP_%s", iface); + chainName[sizeof(chainName) - 1] =3D '\0'; =20 snprintf(portstr, sizeof(portstr), "%d", port); portstr[sizeof(portstr) - 1] =3D '\0'; @@ -292,7 +289,7 @@ iptablesInput(virFirewallPtr fw, virFirewallAddRule(fw, layer, "--table", "filter", action =3D=3D ADD ? "--insert" : "--delete", - pvt ? "LIBVIRT_INP" : "INPUT", + pvt ? chainName : "INPUT", "--in-interface", iface, "--protocol", tcp ? "tcp" : "udp", "--destination-port", portstr, @@ -310,6 +307,10 @@ iptablesOutput(virFirewallPtr fw, int tcp) { char portstr[32]; + char chainName[CHAIN_NAME_MAX]; + + snprintf(chainName, sizeof(chainName), "LIBVIRT_OUT_%s", iface); + chainName[sizeof(chainName) - 1] =3D '\0'; =20 snprintf(portstr, sizeof(portstr), "%d", port); portstr[sizeof(portstr) - 1] =3D '\0'; @@ -317,7 +318,7 @@ iptablesOutput(virFirewallPtr fw, virFirewallAddRule(fw, layer, "--table", "filter", action =3D=3D ADD ? "--insert" : "--delete", - pvt ? "LIBVIRT_OUT" : "OUTPUT", + pvt ? chainName : "OUTPUT", "--out-interface", iface, "--protocol", tcp ? "tcp" : "udp", "--destination-port", portstr, @@ -358,7 +359,7 @@ iptablesRemoveTcpInput(virFirewallPtr fw, const char *iface, int port) { - iptablesInput(fw, layer, deletePrivate, iface, port, REMOVE, 1); + iptablesInput(fw, layer, false, iface, port, REMOVE, 1); } =20 /** @@ -394,7 +395,7 @@ iptablesRemoveUdpInput(virFirewallPtr fw, const char *iface, int port) { - iptablesInput(fw, layer, deletePrivate, iface, port, REMOVE, 0); + iptablesInput(fw, layer, false, iface, port, REMOVE, 0); } =20 /** @@ -430,7 +431,7 @@ iptablesRemoveUdpOutput(virFirewallPtr fw, const char *iface, int port) { - iptablesOutput(fw, layer, deletePrivate, iface, port, REMOVE, 0); + iptablesOutput(fw, layer, false, iface, port, REMOVE, 0); } =20 =20 @@ -480,6 +481,10 @@ iptablesForwardAllowOut(virFirewallPtr fw, VIR_AUTOFREE(char *) networkstr =3D NULL; virFirewallLayer layer =3D VIR_SOCKET_ADDR_FAMILY(netaddr) =3D=3D AF_I= NET ? VIR_FIREWALL_LAYER_IPV4 : VIR_FIREWALL_LAYER_IPV6; + char chainName[CHAIN_NAME_MAX]; + + snprintf(chainName, sizeof(chainName), "LIBVIRT_FWO_%s", iface); + chainName[sizeof(chainName) - 1] =3D '\0'; =20 if (!(networkstr =3D iptablesFormatNetwork(netaddr, prefix))) return -1; @@ -488,7 +493,7 @@ iptablesForwardAllowOut(virFirewallPtr fw, virFirewallAddRule(fw, layer, "--table", "filter", action =3D=3D ADD ? "--insert" : "--delete", - pvt ? "LIBVIRT_FWO" : "FORWARD", + pvt ? chainName : "FORWARD", "--source", networkstr, "--in-interface", iface, "--out-interface", physdev, @@ -498,7 +503,7 @@ iptablesForwardAllowOut(virFirewallPtr fw, virFirewallAddRule(fw, layer, "--table", "filter", action =3D=3D ADD ? "--insert" : "--delete", - pvt ? "LIBVIRT_FWO" : "FORWARD", + pvt ? chainName : "FORWARD", "--source", networkstr, "--in-interface", iface, "--jump", "ACCEPT", @@ -550,7 +555,7 @@ iptablesRemoveForwardAllowOut(virFirewallPtr fw, const char *iface, const char *physdev) { - return iptablesForwardAllowOut(fw, deletePrivate, netaddr, prefix, ifa= ce, physdev, REMOVE); + return iptablesForwardAllowOut(fw, false, netaddr, prefix, iface, phys= dev, REMOVE); } =20 =20 @@ -569,6 +574,10 @@ iptablesForwardAllowRelatedIn(virFirewallPtr fw, virFirewallLayer layer =3D VIR_SOCKET_ADDR_FAMILY(netaddr) =3D=3D AF_I= NET ? VIR_FIREWALL_LAYER_IPV4 : VIR_FIREWALL_LAYER_IPV6; VIR_AUTOFREE(char *) networkstr =3D NULL; + char chainName[CHAIN_NAME_MAX]; + + snprintf(chainName, sizeof(chainName), "LIBVIRT_FWI_%s", iface); + chainName[sizeof(chainName) - 1] =3D '\0'; =20 if (!(networkstr =3D iptablesFormatNetwork(netaddr, prefix))) return -1; @@ -577,7 +586,7 @@ iptablesForwardAllowRelatedIn(virFirewallPtr fw, virFirewallAddRule(fw, layer, "--table", "filter", action =3D=3D ADD ? "--insert" : "--delete", - pvt ? "LIBVIRT_FWI" : "FORWARD", + pvt ? chainName : "FORWARD", "--destination", networkstr, "--in-interface", physdev, "--out-interface", iface, @@ -589,7 +598,7 @@ iptablesForwardAllowRelatedIn(virFirewallPtr fw, virFirewallAddRule(fw, layer, "--table", "filter", action =3D=3D ADD ? "--insert" : "--delete", - pvt ? "LIBVIRT_FWI" : "FORWARD", + pvt ? chainName : "FORWARD", "--destination", networkstr, "--out-interface", iface, "--match", "conntrack", @@ -643,7 +652,7 @@ iptablesRemoveForwardAllowRelatedIn(virFirewallPtr fw, const char *iface, const char *physdev) { - return iptablesForwardAllowRelatedIn(fw, deletePrivate, netaddr, prefi= x, iface, physdev, REMOVE); + return iptablesForwardAllowRelatedIn(fw, false, netaddr, prefix, iface= , physdev, REMOVE); } =20 /* Allow all traffic destined to the bridge, with a valid network address @@ -660,6 +669,10 @@ iptablesForwardAllowIn(virFirewallPtr fw, virFirewallLayer layer =3D VIR_SOCKET_ADDR_FAMILY(netaddr) =3D=3D AF_I= NET ? VIR_FIREWALL_LAYER_IPV4 : VIR_FIREWALL_LAYER_IPV6; VIR_AUTOFREE(char *) networkstr =3D NULL; + char chainName[CHAIN_NAME_MAX]; + + snprintf(chainName, sizeof(chainName), "LIBVIRT_FWI_%s", iface); + chainName[sizeof(chainName) - 1] =3D '\0'; =20 if (!(networkstr =3D iptablesFormatNetwork(netaddr, prefix))) return -1; @@ -668,7 +681,7 @@ iptablesForwardAllowIn(virFirewallPtr fw, virFirewallAddRule(fw, layer, "--table", "filter", action =3D=3D ADD ? "--insert" : "--delete", - pvt ? "LIBVIRT_FWI" : "FORWARD", + pvt ? chainName : "FORWARD", "--destination", networkstr, "--in-interface", physdev, "--out-interface", iface, @@ -678,7 +691,7 @@ iptablesForwardAllowIn(virFirewallPtr fw, virFirewallAddRule(fw, layer, "--table", "filter", action =3D=3D ADD ? "--insert" : "--delete", - pvt ? "LIBVIRT_FWI" : "FORWARD", + pvt ? chainName : "FORWARD", "--destination", networkstr, "--out-interface", iface, "--jump", "ACCEPT", @@ -729,7 +742,7 @@ iptablesRemoveForwardAllowIn(virFirewallPtr fw, const char *iface, const char *physdev) { - return iptablesForwardAllowIn(fw, deletePrivate, netaddr, prefix, ifac= e, physdev, REMOVE); + return iptablesForwardAllowIn(fw, false, netaddr, prefix, iface, physd= ev, REMOVE); } =20 static void @@ -739,10 +752,15 @@ iptablesForwardAllowCross(virFirewallPtr fw, const char *iface, int action) { + char chainName[CHAIN_NAME_MAX]; + + snprintf(chainName, sizeof(chainName), "LIBVIRT_FWX_%s", iface); + chainName[sizeof(chainName) - 1] =3D '\0'; + virFirewallAddRule(fw, layer, "--table", "filter", action =3D=3D ADD ? "--insert" : "--delete", - pvt ? "LIBVIRT_FWX" : "FORWARD", + pvt ? chainName : "FORWARD", "--in-interface", iface, "--out-interface", iface, "--jump", "ACCEPT", @@ -784,7 +802,7 @@ iptablesRemoveForwardAllowCross(virFirewallPtr fw, virFirewallLayer layer, const char *iface) { - iptablesForwardAllowCross(fw, layer, deletePrivate, iface, REMOVE); + iptablesForwardAllowCross(fw, layer, false, iface, REMOVE); } =20 static void @@ -794,10 +812,15 @@ iptablesForwardRejectOut(virFirewallPtr fw, const char *iface, int action) { + char chainName[CHAIN_NAME_MAX]; + + snprintf(chainName, sizeof(chainName), "LIBVIRT_FWO_%s", iface); + chainName[sizeof(chainName) - 1] =3D '\0'; + virFirewallAddRule(fw, layer, "--table", "filter", action =3D=3D ADD ? "--insert" : "--delete", - pvt ? "LIBVIRT_FWO" : "FORWARD", + pvt ? chainName : "FORWARD", "--in-interface", iface, "--jump", "REJECT", NULL); @@ -836,7 +859,7 @@ iptablesRemoveForwardRejectOut(virFirewallPtr fw, virFirewallLayer layer, const char *iface) { - iptablesForwardRejectOut(fw, layer, deletePrivate, iface, REMOVE); + iptablesForwardRejectOut(fw, layer, false, iface, REMOVE); } =20 =20 @@ -847,10 +870,15 @@ iptablesForwardRejectIn(virFirewallPtr fw, const char *iface, int action) { + char chainName[CHAIN_NAME_MAX]; + + snprintf(chainName, sizeof(chainName), "LIBVIRT_FWI_%s", iface); + chainName[sizeof(chainName) - 1] =3D '\0'; + virFirewallAddRule(fw, layer, "--table", "filter", action =3D=3D ADD ? "--insert" : "--delete", - pvt ? "LIBVIRT_FWI" : "FORWARD", + pvt ? chainName : "FORWARD", "--out-interface", iface, "--jump", "REJECT", NULL); @@ -889,7 +917,7 @@ iptablesRemoveForwardRejectIn(virFirewallPtr fw, virFirewallLayer layer, const char *iface) { - iptablesForwardRejectIn(fw, layer, deletePrivate, iface, REMOVE); + iptablesForwardRejectIn(fw, layer, false, iface, REMOVE); } =20 =20 @@ -899,6 +927,7 @@ iptablesRemoveForwardRejectIn(virFirewallPtr fw, static int iptablesForwardMasquerade(virFirewallPtr fw, bool pvt, + const char *iface, virSocketAddr *netaddr, unsigned int prefix, const char *physdev, @@ -913,6 +942,10 @@ iptablesForwardMasquerade(virFirewallPtr fw, VIR_AUTOFREE(char *) portRangeStr =3D NULL; VIR_AUTOFREE(char *) natRangeStr =3D NULL; virFirewallRulePtr rule; + char chainName[CHAIN_NAME_MAX]; + + snprintf(chainName, sizeof(chainName), "LIBVIRT_PRT_%s", iface); + chainName[sizeof(chainName) - 1] =3D '\0'; =20 if (!(networkstr =3D iptablesFormatNetwork(netaddr, prefix))) return -1; @@ -938,7 +971,7 @@ iptablesForwardMasquerade(virFirewallPtr fw, rule =3D virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4, "--table", "nat", action =3D=3D ADD ? "--insert" : "--dele= te", - pvt ? "LIBVIRT_PRT" : "POSTROUTING", + pvt ? chainName : "POSTROUTING", "--source", networkstr, "-p", protocol, "!", "--destination", networkstr, @@ -947,7 +980,7 @@ iptablesForwardMasquerade(virFirewallPtr fw, rule =3D virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4, "--table", "nat", action =3D=3D ADD ? "--insert" : "--dele= te", - pvt ? "LIBVIRT_PRT" : "POSTROUTING", + pvt ? chainName : "POSTROUTING", "--source", networkstr, "!", "--destination", networkstr, NULL); @@ -1018,6 +1051,7 @@ iptablesForwardMasquerade(virFirewallPtr fw, */ int iptablesAddForwardMasquerade(virFirewallPtr fw, + const char *iface, virSocketAddr *netaddr, unsigned int prefix, const char *physdev, @@ -1025,7 +1059,7 @@ iptablesAddForwardMasquerade(virFirewallPtr fw, virPortRangePtr port, const char *protocol) { - return iptablesForwardMasquerade(fw, true, netaddr, prefix, + return iptablesForwardMasquerade(fw, true, iface, netaddr, prefix, physdev, addr, port, protocol, ADD); } =20 @@ -1044,6 +1078,7 @@ iptablesAddForwardMasquerade(virFirewallPtr fw, */ int iptablesRemoveForwardMasquerade(virFirewallPtr fw, + const char *iface, virSocketAddr *netaddr, unsigned int prefix, const char *physdev, @@ -1051,7 +1086,7 @@ iptablesRemoveForwardMasquerade(virFirewallPtr fw, virPortRangePtr port, const char *protocol) { - return iptablesForwardMasquerade(fw, deletePrivate, netaddr, prefix, + return iptablesForwardMasquerade(fw, false, iface, netaddr, prefix, physdev, addr, port, protocol, REMOVE= ); } =20 @@ -1062,6 +1097,7 @@ iptablesRemoveForwardMasquerade(virFirewallPtr fw, static int iptablesForwardDontMasquerade(virFirewallPtr fw, bool pvt, + const char *iface, virSocketAddr *netaddr, unsigned int prefix, const char *physdev, @@ -1069,6 +1105,10 @@ iptablesForwardDontMasquerade(virFirewallPtr fw, int action) { VIR_AUTOFREE(char *) networkstr =3D NULL; + char chainName[CHAIN_NAME_MAX]; + + snprintf(chainName, sizeof(chainName), "LIBVIRT_PRT_%s", iface); + chainName[sizeof(chainName) - 1] =3D '\0'; =20 if (!(networkstr =3D iptablesFormatNetwork(netaddr, prefix))) return -1; @@ -1085,7 +1125,7 @@ iptablesForwardDontMasquerade(virFirewallPtr fw, virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4, "--table", "nat", action =3D=3D ADD ? "--insert" : "--delete", - pvt ? "LIBVIRT_PRT" : "POSTROUTING", + pvt ? chainName : "POSTROUTING", "--out-interface", physdev, "--source", networkstr, "--destination", destaddr, @@ -1095,7 +1135,7 @@ iptablesForwardDontMasquerade(virFirewallPtr fw, virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4, "--table", "nat", action =3D=3D ADD ? "--insert" : "--delete", - pvt ? "LIBVIRT_PRT" : "POSTROUTING", + pvt ? chainName : "POSTROUTING", "--source", networkstr, "--destination", destaddr, "--jump", "RETURN", @@ -1120,12 +1160,13 @@ iptablesForwardDontMasquerade(virFirewallPtr fw, */ int iptablesAddDontMasquerade(virFirewallPtr fw, + const char *iface, virSocketAddr *netaddr, unsigned int prefix, const char *physdev, const char *destaddr) { - return iptablesForwardDontMasquerade(fw, true, netaddr, prefix, + return iptablesForwardDontMasquerade(fw, true, iface, netaddr, prefix, physdev, destaddr, ADD); } =20 @@ -1145,12 +1186,13 @@ iptablesAddDontMasquerade(virFirewallPtr fw, */ int iptablesRemoveDontMasquerade(virFirewallPtr fw, + const char *iface, virSocketAddr *netaddr, unsigned int prefix, const char *physdev, const char *destaddr) { - return iptablesForwardDontMasquerade(fw, deletePrivate, netaddr, prefi= x, + return iptablesForwardDontMasquerade(fw, false, iface, netaddr, prefix, physdev, destaddr, REMOVE); } =20 @@ -1163,6 +1205,10 @@ iptablesOutputFixUdpChecksum(virFirewallPtr fw, int action) { char portstr[32]; + char chainName[CHAIN_NAME_MAX]; + + snprintf(chainName, sizeof(chainName), "LIBVIRT_PRT_%s", iface); + chainName[sizeof(chainName) - 1] =3D '\0'; =20 snprintf(portstr, sizeof(portstr), "%d", port); portstr[sizeof(portstr) - 1] =3D '\0'; @@ -1170,7 +1216,7 @@ iptablesOutputFixUdpChecksum(virFirewallPtr fw, virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4, "--table", "mangle", action =3D=3D ADD ? "--insert" : "--delete", - pvt ? "LIBVIRT_PRT" : "POSTROUTING", + pvt ? chainName : "POSTROUTING", "--out-interface", iface, "--protocol", "udp", "--destination-port", portstr, @@ -1211,5 +1257,5 @@ iptablesRemoveOutputFixUdpChecksum(virFirewallPtr fw, const char *iface, int port) { - iptablesOutputFixUdpChecksum(fw, deletePrivate, iface, port, REMOVE); + iptablesOutputFixUdpChecksum(fw, false, iface, port, REMOVE); } diff --git a/src/util/viriptables.h b/src/util/viriptables.h index 8eb884aa9f..0b4e41f692 100644 --- a/src/util/viriptables.h +++ b/src/util/viriptables.h @@ -31,8 +31,6 @@ int iptablesSetupPrivateChains (void); int iptablesSetupLocalChains (const char *iface); int iptablesTeardownLocalChains (const char *iface); =20 -void iptablesSetDeletePrivate (bool pvt); - void iptablesAddTcpInput (virFirewallPtr fw, virFirewallLayer layer, const char *iface, @@ -120,6 +118,7 @@ void iptablesRemoveForwardRejectIn (virFi= rewallPtr fw, const char *iface); =20 int iptablesAddForwardMasquerade (virFirewallPtr fw, + const char *iface, virSocketAddr *netaddr, unsigned int prefix, const char *physdev, @@ -128,6 +127,7 @@ int iptablesAddForwardMasquerade (virFi= rewallPtr fw, const char *protocol) ATTRIBUTE_RETURN_CHECK; int iptablesRemoveForwardMasquerade (virFirewallPtr fw, + const char *iface, virSocketAddr *netaddr, unsigned int prefix, const char *physdev, @@ -136,12 +136,14 @@ int iptablesRemoveForwardMasquerade (vir= FirewallPtr fw, const char *protocol) ATTRIBUTE_RETURN_CHECK; int iptablesAddDontMasquerade (virFirewallPtr fw, + const char *iface, virSocketAddr *netaddr, unsigned int prefix, const char *physdev, const char *destaddr) ATTRIBUTE_RETURN_CHECK; int iptablesRemoveDontMasquerade (virFirewallPtr fw, + const char *iface, virSocketAddr *netaddr, unsigned int prefix, const char *physdev, diff --git a/tests/networkxml2firewalldata/nat-default-linux.args b/tests/n= etworkxml2firewalldata/nat-default-linux.args index 8efc415bee..3f6fb06549 100644 --- a/tests/networkxml2firewalldata/nat-default-linux.args +++ b/tests/networkxml2firewalldata/nat-default-linux.args @@ -98,64 +98,64 @@ ip6tables \ --jump LIBVIRT_PRT_virbr0 iptables \ --table filter \ ---insert LIBVIRT_INP \ +--insert LIBVIRT_INP_virbr0 \ --in-interface virbr0 \ --protocol tcp \ --destination-port 67 \ --jump ACCEPT iptables \ --table filter \ ---insert LIBVIRT_INP \ +--insert LIBVIRT_INP_virbr0 \ --in-interface virbr0 \ --protocol udp \ --destination-port 67 \ --jump ACCEPT iptables \ --table filter \ ---insert LIBVIRT_OUT \ +--insert LIBVIRT_OUT_virbr0 \ --out-interface virbr0 \ --protocol udp \ --destination-port 68 \ --jump ACCEPT iptables \ --table filter \ ---insert LIBVIRT_INP \ +--insert LIBVIRT_INP_virbr0 \ --in-interface virbr0 \ --protocol tcp \ --destination-port 53 \ --jump ACCEPT iptables \ --table filter \ ---insert LIBVIRT_INP \ +--insert LIBVIRT_INP_virbr0 \ --in-interface virbr0 \ --protocol udp \ --destination-port 53 \ --jump ACCEPT iptables \ --table filter \ ---insert LIBVIRT_FWO \ +--insert LIBVIRT_FWO_virbr0 \ --in-interface virbr0 \ --jump REJECT iptables \ --table filter \ ---insert LIBVIRT_FWI \ +--insert LIBVIRT_FWI_virbr0 \ --out-interface virbr0 \ --jump REJECT iptables \ --table filter \ ---insert LIBVIRT_FWX \ +--insert LIBVIRT_FWX_virbr0 \ --in-interface virbr0 \ --out-interface virbr0 \ --jump ACCEPT iptables \ --table filter \ ---insert LIBVIRT_FWO \ +--insert LIBVIRT_FWO_virbr0 \ --source 192.168.122.0/24 \ --in-interface virbr0 \ --jump ACCEPT iptables \ --table filter \ ---insert LIBVIRT_FWI \ +--insert LIBVIRT_FWI_virbr0 \ --destination 192.168.122.0/24 \ --out-interface virbr0 \ --match conntrack \ @@ -163,13 +163,13 @@ iptables \ --jump ACCEPT iptables \ --table nat \ ---insert LIBVIRT_PRT \ +--insert LIBVIRT_PRT_virbr0 \ --source 192.168.122.0/24 '!' \ --destination 192.168.122.0/24 \ --jump MASQUERADE iptables \ --table nat \ ---insert LIBVIRT_PRT \ +--insert LIBVIRT_PRT_virbr0 \ --source 192.168.122.0/24 \ -p udp '!' \ --destination 192.168.122.0/24 \ @@ -177,7 +177,7 @@ iptables \ --to-ports 1024-65535 iptables \ --table nat \ ---insert LIBVIRT_PRT \ +--insert LIBVIRT_PRT_virbr0 \ --source 192.168.122.0/24 \ -p tcp '!' \ --destination 192.168.122.0/24 \ @@ -185,19 +185,19 @@ iptables \ --to-ports 1024-65535 iptables \ --table nat \ ---insert LIBVIRT_PRT \ +--insert LIBVIRT_PRT_virbr0 \ --source 192.168.122.0/24 \ --destination 255.255.255.255/32 \ --jump RETURN iptables \ --table nat \ ---insert LIBVIRT_PRT \ +--insert LIBVIRT_PRT_virbr0 \ --source 192.168.122.0/24 \ --destination 224.0.0.0/24 \ --jump RETURN iptables \ --table mangle \ ---insert LIBVIRT_PRT \ +--insert LIBVIRT_PRT_virbr0 \ --out-interface virbr0 \ --protocol udp \ --destination-port 68 \ diff --git a/tests/networkxml2firewalldata/nat-ipv6-linux.args b/tests/netw= orkxml2firewalldata/nat-ipv6-linux.args index a72efecc49..7d4db3ac99 100644 --- a/tests/networkxml2firewalldata/nat-ipv6-linux.args +++ b/tests/networkxml2firewalldata/nat-ipv6-linux.args @@ -98,101 +98,101 @@ ip6tables \ --jump LIBVIRT_PRT_virbr0 iptables \ --table filter \ ---insert LIBVIRT_INP \ +--insert LIBVIRT_INP_virbr0 \ --in-interface virbr0 \ --protocol tcp \ --destination-port 67 \ --jump ACCEPT iptables \ --table filter \ ---insert LIBVIRT_INP \ +--insert LIBVIRT_INP_virbr0 \ --in-interface virbr0 \ --protocol udp \ --destination-port 67 \ --jump ACCEPT iptables \ --table filter \ ---insert LIBVIRT_OUT \ +--insert LIBVIRT_OUT_virbr0 \ --out-interface virbr0 \ --protocol udp \ --destination-port 68 \ --jump ACCEPT iptables \ --table filter \ ---insert LIBVIRT_INP \ +--insert LIBVIRT_INP_virbr0 \ --in-interface virbr0 \ --protocol tcp \ --destination-port 53 \ --jump ACCEPT iptables \ --table filter \ ---insert LIBVIRT_INP \ +--insert LIBVIRT_INP_virbr0 \ --in-interface virbr0 \ --protocol udp \ --destination-port 53 \ --jump ACCEPT iptables \ --table filter \ ---insert LIBVIRT_FWO \ +--insert LIBVIRT_FWO_virbr0 \ --in-interface virbr0 \ --jump REJECT iptables \ --table filter \ ---insert LIBVIRT_FWI \ +--insert LIBVIRT_FWI_virbr0 \ --out-interface virbr0 \ --jump REJECT iptables \ --table filter \ ---insert LIBVIRT_FWX \ +--insert LIBVIRT_FWX_virbr0 \ --in-interface virbr0 \ --out-interface virbr0 \ --jump ACCEPT ip6tables \ --table filter \ ---insert LIBVIRT_FWO \ +--insert LIBVIRT_FWO_virbr0 \ --in-interface virbr0 \ --jump REJECT ip6tables \ --table filter \ ---insert LIBVIRT_FWI \ +--insert LIBVIRT_FWI_virbr0 \ --out-interface virbr0 \ --jump REJECT ip6tables \ --table filter \ ---insert LIBVIRT_FWX \ +--insert LIBVIRT_FWX_virbr0 \ --in-interface virbr0 \ --out-interface virbr0 \ --jump ACCEPT ip6tables \ --table filter \ ---insert LIBVIRT_INP \ +--insert LIBVIRT_INP_virbr0 \ --in-interface virbr0 \ --protocol tcp \ --destination-port 53 \ --jump ACCEPT ip6tables \ --table filter \ ---insert LIBVIRT_INP \ +--insert LIBVIRT_INP_virbr0 \ --in-interface virbr0 \ --protocol udp \ --destination-port 53 \ --jump ACCEPT ip6tables \ --table filter \ ---insert LIBVIRT_INP \ +--insert LIBVIRT_INP_virbr0 \ --in-interface virbr0 \ --protocol udp \ --destination-port 547 \ --jump ACCEPT iptables \ --table filter \ ---insert LIBVIRT_FWO \ +--insert LIBVIRT_FWO_virbr0 \ --source 192.168.122.0/24 \ --in-interface virbr0 \ --jump ACCEPT iptables \ --table filter \ ---insert LIBVIRT_FWI \ +--insert LIBVIRT_FWI_virbr0 \ --destination 192.168.122.0/24 \ --out-interface virbr0 \ --match conntrack \ @@ -200,13 +200,13 @@ iptables \ --jump ACCEPT iptables \ --table nat \ ---insert LIBVIRT_PRT \ +--insert LIBVIRT_PRT_virbr0 \ --source 192.168.122.0/24 '!' \ --destination 192.168.122.0/24 \ --jump MASQUERADE iptables \ --table nat \ ---insert LIBVIRT_PRT \ +--insert LIBVIRT_PRT_virbr0 \ --source 192.168.122.0/24 \ -p udp '!' \ --destination 192.168.122.0/24 \ @@ -214,7 +214,7 @@ iptables \ --to-ports 1024-65535 iptables \ --table nat \ ---insert LIBVIRT_PRT \ +--insert LIBVIRT_PRT_virbr0 \ --source 192.168.122.0/24 \ -p tcp '!' \ --destination 192.168.122.0/24 \ @@ -222,31 +222,31 @@ iptables \ --to-ports 1024-65535 iptables \ --table nat \ ---insert LIBVIRT_PRT \ +--insert LIBVIRT_PRT_virbr0 \ --source 192.168.122.0/24 \ --destination 255.255.255.255/32 \ --jump RETURN iptables \ --table nat \ ---insert LIBVIRT_PRT \ +--insert LIBVIRT_PRT_virbr0 \ --source 192.168.122.0/24 \ --destination 224.0.0.0/24 \ --jump RETURN ip6tables \ --table filter \ ---insert LIBVIRT_FWO \ +--insert LIBVIRT_FWO_virbr0 \ --source 2001:db8:ca2:2::/64 \ --in-interface virbr0 \ --jump ACCEPT ip6tables \ --table filter \ ---insert LIBVIRT_FWI \ +--insert LIBVIRT_FWI_virbr0 \ --destination 2001:db8:ca2:2::/64 \ --out-interface virbr0 \ --jump ACCEPT iptables \ --table mangle \ ---insert LIBVIRT_PRT \ +--insert LIBVIRT_PRT_virbr0 \ --out-interface virbr0 \ --protocol udp \ --destination-port 68 \ diff --git a/tests/networkxml2firewalldata/nat-many-ips-linux.args b/tests/= networkxml2firewalldata/nat-many-ips-linux.args index 5094d6793b..421b57c0bb 100644 --- a/tests/networkxml2firewalldata/nat-many-ips-linux.args +++ b/tests/networkxml2firewalldata/nat-many-ips-linux.args @@ -98,64 +98,64 @@ ip6tables \ --jump LIBVIRT_PRT_virbr0 iptables \ --table filter \ ---insert LIBVIRT_INP \ +--insert LIBVIRT_INP_virbr0 \ --in-interface virbr0 \ --protocol tcp \ --destination-port 67 \ --jump ACCEPT iptables \ --table filter \ ---insert LIBVIRT_INP \ +--insert LIBVIRT_INP_virbr0 \ --in-interface virbr0 \ --protocol udp \ --destination-port 67 \ --jump ACCEPT iptables \ --table filter \ ---insert LIBVIRT_OUT \ +--insert LIBVIRT_OUT_virbr0 \ --out-interface virbr0 \ --protocol udp \ --destination-port 68 \ --jump ACCEPT iptables \ --table filter \ ---insert LIBVIRT_INP \ +--insert LIBVIRT_INP_virbr0 \ --in-interface virbr0 \ --protocol tcp \ --destination-port 53 \ --jump ACCEPT iptables \ --table filter \ ---insert LIBVIRT_INP \ +--insert LIBVIRT_INP_virbr0 \ --in-interface virbr0 \ --protocol udp \ --destination-port 53 \ --jump ACCEPT iptables \ --table filter \ ---insert LIBVIRT_FWO \ +--insert LIBVIRT_FWO_virbr0 \ --in-interface virbr0 \ --jump REJECT iptables \ --table filter \ ---insert LIBVIRT_FWI \ +--insert LIBVIRT_FWI_virbr0 \ --out-interface virbr0 \ --jump REJECT iptables \ --table filter \ ---insert LIBVIRT_FWX \ +--insert LIBVIRT_FWX_virbr0 \ --in-interface virbr0 \ --out-interface virbr0 \ --jump ACCEPT iptables \ --table filter \ ---insert LIBVIRT_FWO \ +--insert LIBVIRT_FWO_virbr0 \ --source 192.168.122.0/24 \ --in-interface virbr0 \ --jump ACCEPT iptables \ --table filter \ ---insert LIBVIRT_FWI \ +--insert LIBVIRT_FWI_virbr0 \ --destination 192.168.122.0/24 \ --out-interface virbr0 \ --match conntrack \ @@ -163,13 +163,13 @@ iptables \ --jump ACCEPT iptables \ --table nat \ ---insert LIBVIRT_PRT \ +--insert LIBVIRT_PRT_virbr0 \ --source 192.168.122.0/24 '!' \ --destination 192.168.122.0/24 \ --jump MASQUERADE iptables \ --table nat \ ---insert LIBVIRT_PRT \ +--insert LIBVIRT_PRT_virbr0 \ --source 192.168.122.0/24 \ -p udp '!' \ --destination 192.168.122.0/24 \ @@ -177,7 +177,7 @@ iptables \ --to-ports 1024-65535 iptables \ --table nat \ ---insert LIBVIRT_PRT \ +--insert LIBVIRT_PRT_virbr0 \ --source 192.168.122.0/24 \ -p tcp '!' \ --destination 192.168.122.0/24 \ @@ -185,25 +185,25 @@ iptables \ --to-ports 1024-65535 iptables \ --table nat \ ---insert LIBVIRT_PRT \ +--insert LIBVIRT_PRT_virbr0 \ --source 192.168.122.0/24 \ --destination 255.255.255.255/32 \ --jump RETURN iptables \ --table nat \ ---insert LIBVIRT_PRT \ +--insert LIBVIRT_PRT_virbr0 \ --source 192.168.122.0/24 \ --destination 224.0.0.0/24 \ --jump RETURN iptables \ --table filter \ ---insert LIBVIRT_FWO \ +--insert LIBVIRT_FWO_virbr0 \ --source 192.168.128.0/24 \ --in-interface virbr0 \ --jump ACCEPT iptables \ --table filter \ ---insert LIBVIRT_FWI \ +--insert LIBVIRT_FWI_virbr0 \ --destination 192.168.128.0/24 \ --out-interface virbr0 \ --match conntrack \ @@ -211,13 +211,13 @@ iptables \ --jump ACCEPT iptables \ --table nat \ ---insert LIBVIRT_PRT \ +--insert LIBVIRT_PRT_virbr0 \ --source 192.168.128.0/24 '!' \ --destination 192.168.128.0/24 \ --jump MASQUERADE iptables \ --table nat \ ---insert LIBVIRT_PRT \ +--insert LIBVIRT_PRT_virbr0 \ --source 192.168.128.0/24 \ -p udp '!' \ --destination 192.168.128.0/24 \ @@ -225,7 +225,7 @@ iptables \ --to-ports 1024-65535 iptables \ --table nat \ ---insert LIBVIRT_PRT \ +--insert LIBVIRT_PRT_virbr0 \ --source 192.168.128.0/24 \ -p tcp '!' \ --destination 192.168.128.0/24 \ @@ -233,25 +233,25 @@ iptables \ --to-ports 1024-65535 iptables \ --table nat \ ---insert LIBVIRT_PRT \ +--insert LIBVIRT_PRT_virbr0 \ --source 192.168.128.0/24 \ --destination 255.255.255.255/32 \ --jump RETURN iptables \ --table nat \ ---insert LIBVIRT_PRT \ +--insert LIBVIRT_PRT_virbr0 \ --source 192.168.128.0/24 \ --destination 224.0.0.0/24 \ --jump RETURN iptables \ --table filter \ ---insert LIBVIRT_FWO \ +--insert LIBVIRT_FWO_virbr0 \ --source 192.168.150.0/24 \ --in-interface virbr0 \ --jump ACCEPT iptables \ --table filter \ ---insert LIBVIRT_FWI \ +--insert LIBVIRT_FWI_virbr0 \ --destination 192.168.150.0/24 \ --out-interface virbr0 \ --match conntrack \ @@ -259,13 +259,13 @@ iptables \ --jump ACCEPT iptables \ --table nat \ ---insert LIBVIRT_PRT \ +--insert LIBVIRT_PRT_virbr0 \ --source 192.168.150.0/24 '!' \ --destination 192.168.150.0/24 \ --jump MASQUERADE iptables \ --table nat \ ---insert LIBVIRT_PRT \ +--insert LIBVIRT_PRT_virbr0 \ --source 192.168.150.0/24 \ -p udp '!' \ --destination 192.168.150.0/24 \ @@ -273,7 +273,7 @@ iptables \ --to-ports 1024-65535 iptables \ --table nat \ ---insert LIBVIRT_PRT \ +--insert LIBVIRT_PRT_virbr0 \ --source 192.168.150.0/24 \ -p tcp '!' \ --destination 192.168.150.0/24 \ @@ -281,19 +281,19 @@ iptables \ --to-ports 1024-65535 iptables \ --table nat \ ---insert LIBVIRT_PRT \ +--insert LIBVIRT_PRT_virbr0 \ --source 192.168.150.0/24 \ --destination 255.255.255.255/32 \ --jump RETURN iptables \ --table nat \ ---insert LIBVIRT_PRT \ +--insert LIBVIRT_PRT_virbr0 \ --source 192.168.150.0/24 \ --destination 224.0.0.0/24 \ --jump RETURN iptables \ --table mangle \ ---insert LIBVIRT_PRT \ +--insert LIBVIRT_PRT_virbr0 \ --out-interface virbr0 \ --protocol udp \ --destination-port 68 \ diff --git a/tests/networkxml2firewalldata/nat-no-dhcp-linux.args b/tests/n= etworkxml2firewalldata/nat-no-dhcp-linux.args index 3b870a0a02..90e62405d3 100644 --- a/tests/networkxml2firewalldata/nat-no-dhcp-linux.args +++ b/tests/networkxml2firewalldata/nat-no-dhcp-linux.args @@ -98,101 +98,101 @@ ip6tables \ --jump LIBVIRT_PRT_virbr0 iptables \ --table filter \ ---insert LIBVIRT_INP \ +--insert LIBVIRT_INP_virbr0 \ --in-interface virbr0 \ --protocol tcp \ --destination-port 67 \ --jump ACCEPT iptables \ --table filter \ ---insert LIBVIRT_INP \ +--insert LIBVIRT_INP_virbr0 \ --in-interface virbr0 \ --protocol udp \ --destination-port 67 \ --jump ACCEPT iptables \ --table filter \ ---insert LIBVIRT_OUT \ +--insert LIBVIRT_OUT_virbr0 \ --out-interface virbr0 \ --protocol udp \ --destination-port 68 \ --jump ACCEPT iptables \ --table filter \ ---insert LIBVIRT_INP \ +--insert LIBVIRT_INP_virbr0 \ --in-interface virbr0 \ --protocol tcp \ --destination-port 53 \ --jump ACCEPT iptables \ --table filter \ ---insert LIBVIRT_INP \ +--insert LIBVIRT_INP_virbr0 \ --in-interface virbr0 \ --protocol udp \ --destination-port 53 \ --jump ACCEPT iptables \ --table filter \ ---insert LIBVIRT_FWO \ +--insert LIBVIRT_FWO_virbr0 \ --in-interface virbr0 \ --jump REJECT iptables \ --table filter \ ---insert LIBVIRT_FWI \ +--insert LIBVIRT_FWI_virbr0 \ --out-interface virbr0 \ --jump REJECT iptables \ --table filter \ ---insert LIBVIRT_FWX \ +--insert LIBVIRT_FWX_virbr0 \ --in-interface virbr0 \ --out-interface virbr0 \ --jump ACCEPT ip6tables \ --table filter \ ---insert LIBVIRT_FWO \ +--insert LIBVIRT_FWO_virbr0 \ --in-interface virbr0 \ --jump REJECT ip6tables \ --table filter \ ---insert LIBVIRT_FWI \ +--insert LIBVIRT_FWI_virbr0 \ --out-interface virbr0 \ --jump REJECT ip6tables \ --table filter \ ---insert LIBVIRT_FWX \ +--insert LIBVIRT_FWX_virbr0 \ --in-interface virbr0 \ --out-interface virbr0 \ --jump ACCEPT ip6tables \ --table filter \ ---insert LIBVIRT_INP \ +--insert LIBVIRT_INP_virbr0 \ --in-interface virbr0 \ --protocol tcp \ --destination-port 53 \ --jump ACCEPT ip6tables \ --table filter \ ---insert LIBVIRT_INP \ +--insert LIBVIRT_INP_virbr0 \ --in-interface virbr0 \ --protocol udp \ --destination-port 53 \ --jump ACCEPT ip6tables \ --table filter \ ---insert LIBVIRT_INP \ +--insert LIBVIRT_INP_virbr0 \ --in-interface virbr0 \ --protocol udp \ --destination-port 547 \ --jump ACCEPT iptables \ --table filter \ ---insert LIBVIRT_FWO \ +--insert LIBVIRT_FWO_virbr0 \ --source 192.168.122.0/24 \ --in-interface virbr0 \ --jump ACCEPT iptables \ --table filter \ ---insert LIBVIRT_FWI \ +--insert LIBVIRT_FWI_virbr0 \ --destination 192.168.122.0/24 \ --out-interface virbr0 \ --match conntrack \ @@ -200,13 +200,13 @@ iptables \ --jump ACCEPT iptables \ --table nat \ ---insert LIBVIRT_PRT \ +--insert LIBVIRT_PRT_virbr0 \ --source 192.168.122.0/24 '!' \ --destination 192.168.122.0/24 \ --jump MASQUERADE iptables \ --table nat \ ---insert LIBVIRT_PRT \ +--insert LIBVIRT_PRT_virbr0 \ --source 192.168.122.0/24 \ -p udp '!' \ --destination 192.168.122.0/24 \ @@ -214,7 +214,7 @@ iptables \ --to-ports 1024-65535 iptables \ --table nat \ ---insert LIBVIRT_PRT \ +--insert LIBVIRT_PRT_virbr0 \ --source 192.168.122.0/24 \ -p tcp '!' \ --destination 192.168.122.0/24 \ @@ -222,25 +222,25 @@ iptables \ --to-ports 1024-65535 iptables \ --table nat \ ---insert LIBVIRT_PRT \ +--insert LIBVIRT_PRT_virbr0 \ --source 192.168.122.0/24 \ --destination 255.255.255.255/32 \ --jump RETURN iptables \ --table nat \ ---insert LIBVIRT_PRT \ +--insert LIBVIRT_PRT_virbr0 \ --source 192.168.122.0/24 \ --destination 224.0.0.0/24 \ --jump RETURN ip6tables \ --table filter \ ---insert LIBVIRT_FWO \ +--insert LIBVIRT_FWO_virbr0 \ --source 2001:db8:ca2:2::/64 \ --in-interface virbr0 \ --jump ACCEPT ip6tables \ --table filter \ ---insert LIBVIRT_FWI \ +--insert LIBVIRT_FWI_virbr0 \ --destination 2001:db8:ca2:2::/64 \ --out-interface virbr0 \ --jump ACCEPT diff --git a/tests/networkxml2firewalldata/nat-tftp-linux.args b/tests/netw= orkxml2firewalldata/nat-tftp-linux.args index f002f0add9..b83720e6b5 100644 --- a/tests/networkxml2firewalldata/nat-tftp-linux.args +++ b/tests/networkxml2firewalldata/nat-tftp-linux.args @@ -98,71 +98,71 @@ ip6tables \ --jump LIBVIRT_PRT_virbr0 iptables \ --table filter \ ---insert LIBVIRT_INP \ +--insert LIBVIRT_INP_virbr0 \ --in-interface virbr0 \ --protocol tcp \ --destination-port 67 \ --jump ACCEPT iptables \ --table filter \ ---insert LIBVIRT_INP \ +--insert LIBVIRT_INP_virbr0 \ --in-interface virbr0 \ --protocol udp \ --destination-port 67 \ --jump ACCEPT iptables \ --table filter \ ---insert LIBVIRT_OUT \ +--insert LIBVIRT_OUT_virbr0 \ --out-interface virbr0 \ --protocol udp \ --destination-port 68 \ --jump ACCEPT iptables \ --table filter \ ---insert LIBVIRT_INP \ +--insert LIBVIRT_INP_virbr0 \ --in-interface virbr0 \ --protocol tcp \ --destination-port 53 \ --jump ACCEPT iptables \ --table filter \ ---insert LIBVIRT_INP \ +--insert LIBVIRT_INP_virbr0 \ --in-interface virbr0 \ --protocol udp \ --destination-port 53 \ --jump ACCEPT iptables \ --table filter \ ---insert LIBVIRT_INP \ +--insert LIBVIRT_INP_virbr0 \ --in-interface virbr0 \ --protocol udp \ --destination-port 69 \ --jump ACCEPT iptables \ --table filter \ ---insert LIBVIRT_FWO \ +--insert LIBVIRT_FWO_virbr0 \ --in-interface virbr0 \ --jump REJECT iptables \ --table filter \ ---insert LIBVIRT_FWI \ +--insert LIBVIRT_FWI_virbr0 \ --out-interface virbr0 \ --jump REJECT iptables \ --table filter \ ---insert LIBVIRT_FWX \ +--insert LIBVIRT_FWX_virbr0 \ --in-interface virbr0 \ --out-interface virbr0 \ --jump ACCEPT iptables \ --table filter \ ---insert LIBVIRT_FWO \ +--insert LIBVIRT_FWO_virbr0 \ --source 192.168.122.0/24 \ --in-interface virbr0 \ --jump ACCEPT iptables \ --table filter \ ---insert LIBVIRT_FWI \ +--insert LIBVIRT_FWI_virbr0 \ --destination 192.168.122.0/24 \ --out-interface virbr0 \ --match conntrack \ @@ -170,13 +170,13 @@ iptables \ --jump ACCEPT iptables \ --table nat \ ---insert LIBVIRT_PRT \ +--insert LIBVIRT_PRT_virbr0 \ --source 192.168.122.0/24 '!' \ --destination 192.168.122.0/24 \ --jump MASQUERADE iptables \ --table nat \ ---insert LIBVIRT_PRT \ +--insert LIBVIRT_PRT_virbr0 \ --source 192.168.122.0/24 \ -p udp '!' \ --destination 192.168.122.0/24 \ @@ -184,7 +184,7 @@ iptables \ --to-ports 1024-65535 iptables \ --table nat \ ---insert LIBVIRT_PRT \ +--insert LIBVIRT_PRT_virbr0 \ --source 192.168.122.0/24 \ -p tcp '!' \ --destination 192.168.122.0/24 \ @@ -192,19 +192,19 @@ iptables \ --to-ports 1024-65535 iptables \ --table nat \ ---insert LIBVIRT_PRT \ +--insert LIBVIRT_PRT_virbr0 \ --source 192.168.122.0/24 \ --destination 255.255.255.255/32 \ --jump RETURN iptables \ --table nat \ ---insert LIBVIRT_PRT \ +--insert LIBVIRT_PRT_virbr0 \ --source 192.168.122.0/24 \ --destination 224.0.0.0/24 \ --jump RETURN iptables \ --table mangle \ ---insert LIBVIRT_PRT \ +--insert LIBVIRT_PRT_virbr0 \ --out-interface virbr0 \ --protocol udp \ --destination-port 68 \ diff --git a/tests/networkxml2firewalldata/route-default-linux.args b/tests= /networkxml2firewalldata/route-default-linux.args index 783e803dff..deb639a2b9 100644 --- a/tests/networkxml2firewalldata/route-default-linux.args +++ b/tests/networkxml2firewalldata/route-default-linux.args @@ -98,70 +98,70 @@ ip6tables \ --jump LIBVIRT_PRT_virbr0 iptables \ --table filter \ ---insert LIBVIRT_INP \ +--insert LIBVIRT_INP_virbr0 \ --in-interface virbr0 \ --protocol tcp \ --destination-port 67 \ --jump ACCEPT iptables \ --table filter \ ---insert LIBVIRT_INP \ +--insert LIBVIRT_INP_virbr0 \ --in-interface virbr0 \ --protocol udp \ --destination-port 67 \ --jump ACCEPT iptables \ --table filter \ ---insert LIBVIRT_OUT \ +--insert LIBVIRT_OUT_virbr0 \ --out-interface virbr0 \ --protocol udp \ --destination-port 68 \ --jump ACCEPT iptables \ --table filter \ ---insert LIBVIRT_INP \ +--insert LIBVIRT_INP_virbr0 \ --in-interface virbr0 \ --protocol tcp \ --destination-port 53 \ --jump ACCEPT iptables \ --table filter \ ---insert LIBVIRT_INP \ +--insert LIBVIRT_INP_virbr0 \ --in-interface virbr0 \ --protocol udp \ --destination-port 53 \ --jump ACCEPT iptables \ --table filter \ ---insert LIBVIRT_FWO \ +--insert LIBVIRT_FWO_virbr0 \ --in-interface virbr0 \ --jump REJECT iptables \ --table filter \ ---insert LIBVIRT_FWI \ +--insert LIBVIRT_FWI_virbr0 \ --out-interface virbr0 \ --jump REJECT iptables \ --table filter \ ---insert LIBVIRT_FWX \ +--insert LIBVIRT_FWX_virbr0 \ --in-interface virbr0 \ --out-interface virbr0 \ --jump ACCEPT iptables \ --table filter \ ---insert LIBVIRT_FWO \ +--insert LIBVIRT_FWO_virbr0 \ --source 192.168.122.0/24 \ --in-interface virbr0 \ --jump ACCEPT iptables \ --table filter \ ---insert LIBVIRT_FWI \ +--insert LIBVIRT_FWI_virbr0 \ --destination 192.168.122.0/24 \ --out-interface virbr0 \ --jump ACCEPT iptables \ --table mangle \ ---insert LIBVIRT_PRT \ +--insert LIBVIRT_PRT_virbr0 \ --out-interface virbr0 \ --protocol udp \ --destination-port 68 \ --=20 2.19.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list