]> git.proxmox.com Git - pve-firewall.git/commitdiff
avoid double spaces in ruleset_addrule
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 28 Mar 2018 08:53:30 +0000 (10:53 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 28 Mar 2018 09:35:06 +0000 (11:35 +0200)
ebtables doesn't have comment rules we could store the
digest in, so we need to match the ebtables-save output
instead.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Tested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/Firewall.pm

index 545216724614f3e21e73ef27c3d8eaa7474583f0..b8ade7c3c35a46bd22fb12f7288027fa5e3f25ad 100644 (file)
@@ -2065,7 +2065,9 @@ sub ruleset_addrule {
        my $logaction = get_log_rule_base($chain, $vmid, $logmsg, $log);
        push @{$ruleset->{$chain}}, "-A $chain $match $logaction";
    }
        my $logaction = get_log_rule_base($chain, $vmid, $logmsg, $log);
        push @{$ruleset->{$chain}}, "-A $chain $match $logaction";
    }
-   push @{$ruleset->{$chain}}, "-A $chain $match $action";
+   # for stable ebtables digests avoid double-spaces to match ebtables-save output
+   $match .= ' ' if length($match);
+   push @{$ruleset->{$chain}}, "-A $chain ${match}$action";
 }
 
 sub ruleset_insertrule {
 }
 
 sub ruleset_insertrule {