Allow a parameter to INLINE

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2013-04-11 11:54:58 -07:00
parent 38f3ae0934
commit b33bdeaa02
2 changed files with 23 additions and 16 deletions

View File

@ -207,7 +207,7 @@ our %EXPORT_TAGS = ( internal => [ qw( create_temp_script
Exporter::export_ok_tags('internal');
our $VERSION = '4.5_12';
our $VERSION = 'MODULEVERSION';
#
# describe the current command, it's present progressive, and it's completion.
@ -1955,7 +1955,7 @@ sub split_line1( $$;$$ ) {
$pairs =~ s/^\s*//;
$pairs =~ s/\s*$//;
if ( $first eq 'INLINE') {
if ( $first =~ /^INLINE(?:\(.*\))?$/) {
$inline_matches = $pairs;
} else {
my @pairs = split( /,?\s+/, $pairs );

View File

@ -2089,6 +2089,27 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$ ) {
$param = '' unless defined $param;
if ( $basictarget eq 'INLINE' ) {
my $inline_matches = get_inline_matches;
if ( $inline_matches =~ /^(.*\s+)-j\s+(.+)$/ ) {
$matches .= $1;
$action = $2;
fatal_error "INLINE may not have a parameter when '-j' is specified in the free-form area" if $param ne '';
} else {
$matches .= "$inline_matches ";
if ( $param eq '' ) {
$action = '';
} else {
( $action, $loglevel ) = split_action $param;
( $basictarget, $param ) = get_target_param $action;
$param = '' unless defined $param;
}
}
$rule = $matches;
}
#
# Determine the validity of the action
#
@ -2238,20 +2259,6 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$ ) {
fatal_error "HELPER requires require that the helper be specified in the HELPER column" if $helper eq '-';
fatal_error "HELPER rules may only appear in the NEW section" unless $section == NEW_SECTION;
$action = ''; } ,
INLINE => sub {
my $inline_matches = get_inline_matches;
if ( $inline_matches =~ /^(.*\s+)-j\s+(.+)$/ ) {
$matches .= $1;
$action = $2;
} else {
$matches .= "$inline_matches ";
$action = '';
}
$rule = $matches;
} ,
);
my $function = $functions{ $bt };