diff --git a/Shorewall/Perl/Shorewall/Chains.pm b/Shorewall/Perl/Shorewall/Chains.pm index 29ab2d198..b1e5dc865 100644 --- a/Shorewall/Perl/Shorewall/Chains.pm +++ b/Shorewall/Perl/Shorewall/Chains.pm @@ -96,6 +96,7 @@ our @EXPORT = ( qw( INLINE TERMINATING STATEMATCH + USERBUILTIN %chain_table %targets @@ -402,6 +403,7 @@ use constant { STANDARD => 0x1, #defined by Netfilter NFLOG => 0x4000, #NFLOG or ULOG INLINE => 0x8000, #Inline action STATEMATCH => 0x10000, #action.Invalid, action.Related, etc. + USERBUILTIN => 0x20000, #Builtin action from user's actions file. }; # # Valid Targets -- value is a combination of one or more of the above @@ -2119,7 +2121,9 @@ sub add_jump( $$$;$$$ ) { # # Ensure that we have the chain unless it is a builtin like 'ACCEPT' # - $toref = ensure_chain( $fromref->{table} , $to ) unless $builtin_target{$to} || $to =~ / --/; #If the target has options, it must be a builtin. + my ( $target ) = split ' ', $to; + $toref = $chain_table{$fromref->{table}}{$target}; + fatal_error "Unknown rule target ($to)" unless $toref || $builtin_target{$target}; } # @@ -2170,7 +2174,9 @@ sub add_ijump( $$$;@ ) { # # Ensure that we have the chain unless it is a builtin like 'ACCEPT' # - $toref = ensure_chain( $fromref->{table} , $to ) unless $builtin_target{$to} || $to =~ / --/; #If the target has options, it must be a builtin. + my ( $target ) = split ' ', $to; + $toref = $chain_table{$fromref->{table}}{$target}; + fatal_error "Unknown rule target ($to)" unless $toref || $builtin_target{$target}; } # diff --git a/Shorewall/Perl/Shorewall/Config.pm b/Shorewall/Perl/Shorewall/Config.pm index 9b8ddd398..613ce8251 100644 --- a/Shorewall/Perl/Shorewall/Config.pm +++ b/Shorewall/Perl/Shorewall/Config.pm @@ -1947,6 +1947,8 @@ sub split_line1( $$;$$ ) { push @line, '-' while @line < $maxcolumns; + $inline_matches = ''; + if ( supplied $pairs ) { $pairs =~ s/^\s*//; $pairs =~ s/\s*$//; diff --git a/Shorewall/Perl/Shorewall/Rules.pm b/Shorewall/Perl/Shorewall/Rules.pm index 5d185f0e3..0f1af7d7d 100644 --- a/Shorewall/Perl/Shorewall/Rules.pm +++ b/Shorewall/Perl/Shorewall/Rules.pm @@ -1664,7 +1664,7 @@ sub process_actions() { } if ( $builtin ) { - $targets{$action} = STANDARD; + $targets{$action} = USERBUILTIN; $builtin_target{$action} = 1; } else { new_action $action, $type, $noinline, $nolog; @@ -2151,6 +2151,7 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$ ) { $loglevel = supplied $loglevel ? join( ':', $action, $loglevel ) : $action; $action = 'LOG'; } elsif ( ! ( $actiontype & (ACTION | INLINE) ) ) { + fatal_error "'builtin' actions may only be used in INLINE rules" if $actiontype == USERBUILTIN; fatal_error "The $basictarget TARGET does not accept a parameter" unless $param eq ''; }