$source = "${zoneref}:$rule->{source}";
}
} else {
- $source = "any:$rule->{source}";
+ $source = "all:$rule->{source}";
}
return sprintf($rule_format, $action, $source, $dest, $rule->{proto} || '-',
my $dest;
if (!$rule->{dest}) {
- $dest = 'any';
+ $dest = 'all';
} else {
- $dest = "any:$rule->{dest}";
+ $dest = "all:$rule->{dest}";
}
return sprintf($rule_format, $action, "$zid:$tap", $dest,
foreach my $rule (@$inrules) {
foreach my $netid (keys %{$netinfo->{$vmid}}) {
my $net = $netinfo->{$vmid}->{$netid};
- next if !($rule->{iface} eq 'any' || $rule->{iface} eq $netid);
+ next if $rule->{iface} && $rule->{iface} ne $netid;
$out .= &$generate_input_rule($zoneinfo, $rule, $net, $netid);
}
}
foreach my $rule (@$outrules) {
foreach my $netid (keys %{$netinfo->{$vmid}}) {
my $net = $netinfo->{$vmid}->{$netid};
- next if !($rule->{iface} eq 'any' || $rule->{iface} eq $netid);
+ next if $rule->{iface} && $rule->{iface} ne $netid;
$out .= &$generate_output_rule($zoneinfo, $rule, $net, $netid);
}
}
my ($action, $iface, $source, $dest, $proto, $dport, $sport) =
split(/\s+/, $line);
- if (!($action && $iface && $source && $dest)) {
+ if (!$action) {
warn "skip incomplete line\n";
next;
}
next;
}
- $iface = undef if $iface eq '-';
+ $iface = undef if $iface && $iface eq '-';
if ($iface && $iface !~ m/^(net0|net1|net2|net3|net4|net5)$/) {
warn "unknown interface '$iface'\n";
next;
}
- $proto = undef if $proto eq '-';
+ $proto = undef if $proto && $proto eq '-';
if ($proto && $proto !~ m/^(icmp|tcp|udp)$/) {
warn "unknown protokol '$proto'\n";
next;
}
- $source = undef if $source eq '-';
+ $source = undef if $source && $source eq '-';
# if ($source !~ m/^(XYZ)$/) {
# warn "unknown source '$source'\n";
# next;
# }
- $dest = undef if $dest eq '-';
+ $dest = undef if $dest && $dest eq '-';
# if ($dest !~ m/^XYZ)$/) {
# warn "unknown destination '$dest'\n";
# next;