Implement 'builtin' actions.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2013-04-08 16:14:26 -07:00
parent f176f91b7e
commit 183a0a75a1
2 changed files with 13 additions and 4 deletions

View File

@ -252,6 +252,7 @@ our %EXPORT_TAGS = (
create_stop_load
initialize_switches
%targets
%builtin_target
%dscpmap
%nfobjects
) ],

View File

@ -1621,6 +1621,7 @@ sub process_actions() {
my $type = ACTION;
my $noinline = 0;
my $nolog = 0;
my $builtin = 0;
if ( $action =~ /:/ ) {
warning_message 'Default Actions are now specified in /etc/shorewall/shorewall.conf';
@ -1637,6 +1638,8 @@ sub process_actions() {
$noinline = 1;
} elsif ( $_ eq 'nolog' ) {
$nolog = 1;
} elsif ( $_ eq 'builtin' ) {
$builtin = 1;
} else {
fatal_error "Invalid option ($_)";
}
@ -1660,13 +1663,18 @@ sub process_actions() {
}
}
new_action $action, $type, $noinline, $nolog;
if ( $builtin ) {
$targets{$action} = STANDARD;
$builtin_target{$action} = 1;
} else {
new_action $action, $type, $noinline, $nolog;
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;
$inlines{$action} = { file => $actionfile, nolog => $nolog } if $type == INLINE;
$inlines{$action} = { file => $actionfile, nolog => $nolog } if $type == INLINE;
}
}
}