mirror of
https://gitlab.com/shorewall/code.git
synced 2025-01-03 03:59:16 +01:00
Allow parameters to be omitted in action invocations.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
e664b6bafb
commit
eaa6d72a4f
@ -1812,8 +1812,12 @@ sub split_list2( $$ ) {
|
||||
|
||||
sub split_list3( $$ ) {
|
||||
my ($list, $type ) = @_;
|
||||
|
||||
fatal_error "Invalid $type ($list)" if $list =~ /^,|,,/;
|
||||
#
|
||||
# We allow omitted arguments in action invocations.
|
||||
#
|
||||
$list =~ s/^,/-,/;
|
||||
$list =~ s/,$/,-/;
|
||||
$list =~ s/,,/,-,/g;
|
||||
|
||||
my @list1 = split /,/, $list;
|
||||
my @list2;
|
||||
|
@ -2121,8 +2121,6 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$ ) {
|
||||
|
||||
return $generated;
|
||||
|
||||
} elsif ( $actiontype & ( ACTION | INLINE ) ) {
|
||||
split_list1 $param, 'Action parameter';
|
||||
} elsif ( $actiontype & NFQ ) {
|
||||
require_capability( 'NFQUEUE_TARGET', 'NFQUEUE Rules', '' );
|
||||
my $paramval = $param eq '' ? 0 : numeric_value( $param );
|
||||
@ -2140,7 +2138,7 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$ ) {
|
||||
validate_level( $action );
|
||||
$loglevel = supplied $loglevel ? join( ':', $action, $loglevel ) : $action;
|
||||
$action = 'LOG';
|
||||
} else {
|
||||
} elsif ( ! ( $actiontype & (ACTION | INLINE) ) ) {
|
||||
fatal_error "The $basictarget TARGET does not accept a parameter" unless $param eq '';
|
||||
}
|
||||
|
||||
|
@ -394,6 +394,13 @@ REDIRECT net - tcp 80 - 1.2.3.4</programlisting>
|
||||
|
||||
<para>In the above example, $2 would expand to nothing.</para>
|
||||
|
||||
<para>Beginning with Shorewall 4.5.13, completely omitting a arameter is
|
||||
equivalent to passing '-'.</para>
|
||||
|
||||
<para>Example: ACTION(REDIRECT,,info)</para>
|
||||
|
||||
<para>This example behaves the same as the one shown above.</para>
|
||||
|
||||
<para>If you want to make '-' a parameter value, use '--' (e.g.,
|
||||
ACTION(REDIRECT,--.info)).</para>
|
||||
|
||||
@ -407,10 +414,6 @@ REDIRECT net - tcp 80 - 1.2.3.4</programlisting>
|
||||
for the second parameter and so on. You can specify an empty default
|
||||
using '-' (e.g. DEFAULTS DROP,-,audit).</para>
|
||||
|
||||
<para>The DEFAULTS directive also determines the maximum number of
|
||||
parameters that an action may have. If more parameters are passed than
|
||||
have default values, an error message is issued.</para>
|
||||
|
||||
<para>For additional information about actions, see the <ulink
|
||||
url="configuration_file_basics.htm#ActionVariables">Action Variables
|
||||
section</ulink> of the Configuration Basics article.</para>
|
||||
|
Loading…
Reference in New Issue
Block a user