From: Mira Limbeck Date: Tue, 6 Aug 2019 08:25:14 +0000 (+0200) Subject: only add VM chains if VM firewall is enabled X-Git-Url: https://git.proxmox.com/?p=pve-firewall.git;a=commitdiff_plain;h=033a15b372734fcfb390c3b747f67bfa4643dabd only add VM chains if VM firewall is enabled Before if a NIC had the firewall enabled and the MAC filter was active, a rule was added to the tap device even if the VM firewall was not enabled. This led to nested machines not being able to reach outside. Testcase: Host <-> VM <-> CT all on the same bridge. Host and CT could not reach each other because of the MAC filter. Now we check if the VM firewall is enabled and only add the MAC and IP filters then. Signed-off-by: Mira Limbeck --- diff --git a/src/PVE/Firewall.pm b/src/PVE/Firewall.pm index 36dced6..1319bfb 100644 --- a/src/PVE/Firewall.pm +++ b/src/PVE/Firewall.pm @@ -2363,10 +2363,10 @@ sub generate_tap_rules_direction { my $ipfilter_ipset = compute_ipset_chain_name($vmid, $ipfilter_name, $ipversion) if $options->{ipfilter} || $vmfw_conf->{ipset}->{$ipfilter_name}; - # create chain with mac and ip filter - ruleset_create_vm_chain($ruleset, $tapchain, $ipversion, $options, $macaddr, $ipfilter_ipset, $direction); - if ($options->{enable}) { + # create chain with mac and ip filter + ruleset_create_vm_chain($ruleset, $tapchain, $ipversion, $options, $macaddr, $ipfilter_ipset, $direction); + ruleset_generate_vm_rules($ruleset, $rules, $cluster_conf, $vmfw_conf, $tapchain, $netid, $direction, $options, $ipversion, $vmid); ruleset_generate_vm_ipsrules($ruleset, $options, $direction, $iface);