my $line = shift;
return if $line =~ m/^#/;
return if $line =~ m/^\s*$/;
- if ($line =~ m/^(?:\S+)\s(PVEFW-\S+)\s(?:\S+).*/) {
+ if ($line =~ m/^:(\S+)\s\S+$/) {
+ # Make sure we know chains exist even if they're empty.
+ $chains->{$1} //= [];
+ } elsif ($line =~ m/^(?:\S+)\s(PVEFW-\S+)\s(?:\S+).*/) {
my $chain = $1;
$line =~ s/\s+$//;
push @{$chains->{$chain}}, $line;
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 {