Default to FORMAT-2 macros and actions.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2015-08-14 16:11:41 -07:00
parent 12f8cbae29
commit c604823053
2 changed files with 11 additions and 25 deletions

View File

@ -2332,8 +2332,8 @@ sub do_open_file( $ ) {
# - ?COMMENT allowed in this file
# - Ignore ?COMMENT in ths file
#
sub open_file( $;$$$ ) {
my ( $fname, $mf, $ca, $nc ) = @_;
sub open_file( $;$$$$ ) {
my ( $fname, $mf, $ca, $nc, $cf ) = @_;
$fname = find_file $fname;
@ -2341,7 +2341,7 @@ sub open_file( $;$$$ ) {
if ( -f $fname && -s _ ) {
$first_entry = 0;
$file_format = 1;
$file_format = supplied $cf ? $cf : 1;
$max_format = supplied $mf ? $mf : 1;
$comments_allowed = supplied $ca ? $ca : 0;
$nocomment = $nc;
@ -2968,15 +2968,15 @@ EOF
# The following two functions allow module clients to nest opens. This happens frequently
# in the Rules module.
#
sub push_open( $;$$$ ) {
my ( $file, $max , $ca, $nc ) = @_;
sub push_open( $;$$$$ ) {
my ( $file, $max , $ca, $nc, $cf ) = @_;
push_include;
clear_section_function;
my @a = @includestack;
push @openstack, \@a;
@includestack = ();
$currentfile = undef;
open_file( $file , $max, $comments_allowed || $ca, $nc );
open_file( $file , $max, $comments_allowed || $ca, $nc , $cf );
}
sub pop_open() {

View File

@ -1703,7 +1703,7 @@ sub process_action($$) {
progress_message2 "$doing $actionfile for chain $chainref->{name}...";
push_open $actionfile, 2, 1;
push_open $actionfile, 2, 1, undef, 2;
my $oldparms = push_action_params( $action, $chainref, $param, $level, $tag, $caller );
@ -1719,14 +1719,7 @@ sub process_action($$) {
my ($target, $source, $dest, $proto, $ports, $sports, $origdest, $rate, $user, $mark, $connlimit, $time, $headers, $condition, $helper );
if ( $file_format == 1 ) {
warning_message( "FORMAT-1 actions are deprecated and support will be dropped in a future release" ) unless $fmt1actionwarn{$action}++;
($target, $source, $dest, $proto, $ports, $sports, $rate, $user, $mark ) =
split_line1(
'action file',
{ target => 0, source => 1, dest => 2, proto => 3, dport => 4, sport => 5, rate => 6, user => 7, mark => 8 },
$rule_commands );
$origdest = $connlimit = $time = $headers = $condition = $helper = '-';
fatal_error( "FORMAT-1 actions are no longer supported" );
} else {
($target, $source, $dest, $proto, $ports, $sports, $origdest, $rate, $user, $mark, $connlimit, $time, $headers, $condition, $helper )
= split_line2( 'action file',
@ -1972,7 +1965,7 @@ sub process_macro ($$$$$$$$$$$$$$$$$$$$$) {
progress_message "..Expanding Macro $macrofile...";
push_open $macrofile, 2, 1, no_comment;
push_open $macrofile, 2, 1, no_comment, 2;
macro_comment $macro;
@ -1981,14 +1974,7 @@ sub process_macro ($$$$$$$$$$$$$$$$$$$$$) {
my ( $mtarget, $msource, $mdest, $mproto, $mports, $msports, $morigdest, $mrate, $muser, $mmark, $mconnlimit, $mtime, $mheaders, $mcondition, $mhelper);
if ( $file_format == 1 ) {
warning_message( "FORMAT-1 macros are deprecated and support will be dropped in a future release" ) unless $fmt1macrowarn{$macro}++;
( $mtarget, $msource, $mdest, $mproto, $mports, $msports, $mrate, $muser ) =
split_line2( 'macro file',
\%rulecolumns,
$rule_commands,
undef, #Columns
1 ); #Allow inline matches
fatal_error( "FORMAT-1 macros are no longer supported" );
( $morigdest, $mmark, $mconnlimit, $mtime, $mheaders, $mcondition, $mhelper ) = qw/- - - - - - -/;
} else {
( $mtarget,
@ -2116,7 +2102,7 @@ sub process_inline ($$$$$$$$$$$$$$$$$$$$$$) {
progress_message "..Expanding inline action $inlinefile...";
push_open $inlinefile, 2, 1;
push_open $inlinefile, 2, 1, undef , 2;
my $save_comment = push_comment;