Implement '+' to specify inline matches as "early"

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2016-03-12 16:39:46 -08:00
parent c36cee28fb
commit 90ace544eb

View File

@ -2487,6 +2487,7 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
my $raw_matches = ''; my $raw_matches = '';
my $exceptionrule = ''; my $exceptionrule = '';
my $usergenerated; my $usergenerated;
my $prerule = '';
if ( $inchain = defined $chainref ) { if ( $inchain = defined $chainref ) {
( $inaction, undef, undef, undef ) = split /:/, $normalized_action = $chainref->{action}, 4 if $chainref->{action}; ( $inaction, undef, undef, undef ) = split /:/, $normalized_action = $chainref->{action}, 4 if $chainref->{action};
@ -2500,6 +2501,13 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
$raw_matches = get_inline_matches(0); $raw_matches = get_inline_matches(0);
} }
# #
# Handle early matches
#
if ( $raw_matches =~ s/s*\+// ) {
$prerule = $raw_matches;
$raw_matches = '';
}
#
# Determine the validity of the action # Determine the validity of the action
# #
$actiontype = ( $targets{$basictarget} || find_macro ( $basictarget ) ); $actiontype = ( $targets{$basictarget} || find_macro ( $basictarget ) );
@ -3142,7 +3150,7 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
expand_rule( $chainref , expand_rule( $chainref ,
$restriction , $restriction ,
'' , $prerule ,
$rule , $rule ,
$source , $source ,
$dest , $dest ,