mirror of
https://gitlab.com/shorewall/code.git
synced 2025-06-25 12:13:29 +02:00
Emit more uniform error messages
git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@6572 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
parent
3d7336cb79
commit
4b456a3d34
@ -372,18 +372,18 @@ sub process_actions1() {
|
|||||||
|
|
||||||
if ( $targets{$action} ) {
|
if ( $targets{$action} ) {
|
||||||
next if $targets{$action} & ACTION;
|
next if $targets{$action} & ACTION;
|
||||||
fatal_error "Invalid Action Name: $action";
|
fatal_error "Invalid Action Name ($action)";
|
||||||
}
|
}
|
||||||
|
|
||||||
$targets{$action} = ACTION;
|
$targets{$action} = ACTION;
|
||||||
|
|
||||||
fatal_error "Invalid Action Name: $action" unless "\L$action" =~ /^[a-z]\w*$/;
|
fatal_error "Invalid Action Name ($action)" unless "\L$action" =~ /^[a-z]\w*$/;
|
||||||
|
|
||||||
new_action $action;
|
new_action $action;
|
||||||
|
|
||||||
my $actionfile = find_file "action.$action";
|
my $actionfile = find_file "action.$action";
|
||||||
|
|
||||||
fatal_error "Missing Action File: $actionfile" unless -f $actionfile;
|
fatal_error "Missing Action File ($actionfile)" unless -f $actionfile;
|
||||||
|
|
||||||
progress_message2 " Pre-processing $actionfile...";
|
progress_message2 " Pre-processing $actionfile...";
|
||||||
|
|
||||||
@ -516,7 +516,7 @@ sub process_action3( $$$$$ ) {
|
|||||||
my $actionfile = find_file "action.$action";
|
my $actionfile = find_file "action.$action";
|
||||||
my $standard = ( $actionfile =~ /^$globals{SHAREDIR}/ );
|
my $standard = ( $actionfile =~ /^$globals{SHAREDIR}/ );
|
||||||
|
|
||||||
fatal_error "Missing Action File: $actionfile" unless -f $actionfile;
|
fatal_error "Missing Action File ($actionfile)" unless -f $actionfile;
|
||||||
|
|
||||||
progress_message2 "Processing $actionfile for chain $chainref->{name}...";
|
progress_message2 "Processing $actionfile for chain $chainref->{name}...";
|
||||||
|
|
||||||
|
@ -773,7 +773,7 @@ sub validate_portpair( $ ) {
|
|||||||
|
|
||||||
my @ports = split/:/, $portpair, 3;
|
my @ports = split/:/, $portpair, 3;
|
||||||
|
|
||||||
fatal_error "Invalid port range" if @ports == 3;
|
fatal_error "Invalid port range ($portpair)" if @ports == 3;
|
||||||
|
|
||||||
for my $port ( @ports ) {
|
for my $port ( @ports ) {
|
||||||
my $value = $services{$port};
|
my $value = $services{$port};
|
||||||
@ -887,8 +887,8 @@ sub do_proto( $$$ )
|
|||||||
|
|
||||||
if ( $ports ne '' ) {
|
if ( $ports ne '' ) {
|
||||||
if ( $ports =~ tr/,/,/ > 0 || $sports =~ tr/,/,/ > 0 ) {
|
if ( $ports =~ tr/,/,/ > 0 || $sports =~ tr/,/,/ > 0 ) {
|
||||||
fatal_error "Port list requires Multiport support in your kernel/iptables: $ports" unless $capabilities{MULTIPORT};
|
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 port_count( $ports ) > 15;
|
fatal_error "Too many entries in port list ($ports)" if port_count( $ports ) > 15;
|
||||||
$ports = validate_port_list $ports;
|
$ports = validate_port_list $ports;
|
||||||
$output .= "-m multiport --dports $ports ";
|
$output .= "-m multiport --dports $ports ";
|
||||||
$multiport = 1;
|
$multiport = 1;
|
||||||
@ -902,7 +902,7 @@ sub do_proto( $$$ )
|
|||||||
|
|
||||||
if ( $sports ne '' ) {
|
if ( $sports ne '' ) {
|
||||||
if ( $multiport ) {
|
if ( $multiport ) {
|
||||||
fatal_error "Too many entries in port list: $sports" if port_count( $sports ) > 15;
|
fatal_error "Too many entries in port list ($sports)" if port_count( $sports ) > 15;
|
||||||
$sports = validate_port_list $sports;
|
$sports = validate_port_list $sports;
|
||||||
$output .= "-m multiport --sports $sports ";
|
$output .= "-m multiport --sports $sports ";
|
||||||
} else {
|
} else {
|
||||||
@ -963,7 +963,7 @@ sub verify_mark( $ ) {
|
|||||||
my $mark = $_[0];
|
my $mark = $_[0];
|
||||||
my $limit = $config{HIGH_ROUTE_MARKS} ? 0xFFFF : 0xFF;
|
my $limit = $config{HIGH_ROUTE_MARKS} ? 0xFFFF : 0xFF;
|
||||||
|
|
||||||
fatal_error "Invalid Mark or Mask value: $mark"
|
fatal_error "Invalid Mark or Mask value ($mark)"
|
||||||
unless numeric_value( $mark ) <= $limit;
|
unless numeric_value( $mark ) <= $limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1108,7 +1108,7 @@ sub get_set_flags( $$ ) {
|
|||||||
my ( $setname, $option ) = @_;
|
my ( $setname, $option ) = @_;
|
||||||
my $options = $option;
|
my $options = $option;
|
||||||
|
|
||||||
fatal_error "Your kernel and/or iptables does not include ipset match: $setname" unless $capabilities{IPSET_MATCH};
|
fatal_error "Your kernel and/or iptables does not include ipset match ($setname)" unless $capabilities{IPSET_MATCH};
|
||||||
|
|
||||||
if ( $setname =~ /(.*)\[([1-6])\]$/ ) {
|
if ( $setname =~ /(.*)\[([1-6])\]$/ ) {
|
||||||
$setname = $1;
|
$setname = $1;
|
||||||
|
@ -139,8 +139,8 @@ sub generate_script_1() {
|
|||||||
'',
|
'',
|
||||||
'local version=$(cat ${SHAREDIR}/version)',
|
'local version=$(cat ${SHAREDIR}/version)',
|
||||||
'',
|
'',
|
||||||
'if [ ${SHOREWALL_LIBVERSION:-0} -lt 30401 ]; then',
|
'if [ ${SHOREWALL_LIBVERSION:-0} -lt 30403 ]; then',
|
||||||
' fatal_error "This script requires Shorewall version 3.4.2 or later; current version is $version"',
|
' fatal_error "This script requires Shorewall version 3.4.3 or later; current version is $version"',
|
||||||
'fi',
|
'fi',
|
||||||
'#',
|
'#',
|
||||||
'# These variables are required by the library functions called in this script',
|
'# These variables are required by the library functions called in this script',
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#
|
s#
|
||||||
# Shorewall-perl 4.0 -- /usr/share/shorewall-perl/Shorewall/Config.pm
|
# Shorewall-perl 4.0 -- /usr/share/shorewall-perl/Shorewall/Config.pm
|
||||||
#
|
#
|
||||||
# This program is under GPL [http://www.gnu.org/copyleft/gpl.htm]
|
# This program is under GPL [http://www.gnu.org/copyleft/gpl.htm]
|
||||||
@ -1158,7 +1158,7 @@ sub get_configuration( $ ) {
|
|||||||
|
|
||||||
fatal_error "Invalid LOGFORMAT ($val)" if $@;
|
fatal_error "Invalid LOGFORMAT ($val)" if $@;
|
||||||
|
|
||||||
fatal_error "LOGFORMAT string is longer than 29 characters: \"$val\"" if length $result > 29;
|
fatal_error "LOGFORMAT string is longer than 29 characters ($val)" if length $result > 29;
|
||||||
|
|
||||||
$globals{MAXZONENAMELENGTH} = int ( 5 + ( ( 29 - (length $result ) ) / 2) );
|
$globals{MAXZONENAMELENGTH} = int ( 5 + ( ( 29 - (length $result ) ) / 2) );
|
||||||
} else {
|
} else {
|
||||||
|
@ -113,7 +113,7 @@ sub process_tos() {
|
|||||||
if ( defined ( my $tosval = $tosoptions{"\L$tos"} ) ) {
|
if ( defined ( my $tosval = $tosoptions{"\L$tos"} ) ) {
|
||||||
$tos = $tosval;
|
$tos = $tosval;
|
||||||
} elsif ( numeric_value( $tos ) > 0x1e ) {
|
} elsif ( numeric_value( $tos ) > 0x1e ) {
|
||||||
fatal_error "Invalid TOS value";
|
fatal_error "Invalid TOS value ($tos)";
|
||||||
}
|
}
|
||||||
|
|
||||||
my $chainref;
|
my $chainref;
|
||||||
|
@ -237,9 +237,9 @@ sub determine_zones()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fatal_error "Invalid zone name: $zone" unless "\L$zone" =~ /^[a-z]\w*$/ && length $zone <= $globals{MAXZONENAMELENGTH};
|
fatal_error "Invalid zone name ($zone)" unless "\L$zone" =~ /^[a-z]\w*$/ && length $zone <= $globals{MAXZONENAMELENGTH};
|
||||||
fatal_error "Invalid zone name: $zone" if $reservedName{$zone} || $zone =~ /^all2|2all$/;
|
fatal_error "Invalid zone name ($zone)" if $reservedName{$zone} || $zone =~ /^all2|2all$/;
|
||||||
fatal_error( "Duplicate zone name: $zone\n" ) if $zones{$zone};
|
fatal_error( "Duplicate zone name ($zone)" ) if $zones{$zone};
|
||||||
|
|
||||||
$type = "ipv4" unless $type;
|
$type = "ipv4" unless $type;
|
||||||
|
|
||||||
@ -252,7 +252,7 @@ sub determine_zones()
|
|||||||
$type = 'bport4';
|
$type = 'bport4';
|
||||||
} elsif ( $type eq 'firewall' ) {
|
} elsif ( $type eq 'firewall' ) {
|
||||||
fatal_error 'Firewall zone may not be nested' if @parents;
|
fatal_error 'Firewall zone may not be nested' if @parents;
|
||||||
fatal_error "Only one firewall zone may be defined: $zone" if $firewall_zone;
|
fatal_error "Only one firewall zone may be defined ($zone)" if $firewall_zone;
|
||||||
$firewall_zone = $zone;
|
$firewall_zone = $zone;
|
||||||
$ENV{FW} = $zone;
|
$ENV{FW} = $zone;
|
||||||
$type = "firewall";
|
$type = "firewall";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user