Make tr/// a little less mysterious

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@5992 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2007-04-18 03:24:38 +00:00
parent cc4962ac82
commit 1608a6f381

View File

@ -635,6 +635,10 @@ sub do_proto( $$$ )
{
my ($proto, $ports, $sports ) = @_;
sub port_count( $ ) {
$_[0] =~ tr/,:/,:/;
}
my $output = '';
$proto = '' if $proto eq '-';
@ -649,7 +653,7 @@ sub do_proto( $$$ )
if ( $ports =~ tr/,/,/ > 0 ) {
fatal_error "Port list requires Multiport support in your kernel/iptables: $ports" unless $capabilities{MULTIPORT};
fatal_error "Too many entries in port list: $ports" if $ports =~ tr/,:/,:/ > 14;
fatal_error "Too many entries in port list: $ports" if port_count( $ports ) > 14;
$output .= "-m multiport --dports $ports ";
} else {
@ -661,7 +665,7 @@ sub do_proto( $$$ )
if ( $sports =~ tr/,/,/ > 0 ) {
fatal_error "Port list requires Multiport support in your kernel/iptables: $sports" unless $capabilities{MULTIPORT};
fatal_error "Too many entries in port list: $sports" if $sports =~ tr/,:/,:/ > 14;
fatal_error "Too many entries in port list: $sports" if port_count( $sports ) > 14;
$output .= "-m multiport --sports $sports ";
} else {