mirror of
https://gitlab.com/shorewall/code.git
synced 2025-06-19 17:28:35 +02:00
Improve maintainability of @colums vis a vis @rulecolumns.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
8d28c44946
commit
abca3a2024
@ -109,6 +109,11 @@ our @builtins;
|
|||||||
our $rule_commands = { SECTION => 2 };
|
our $rule_commands = { SECTION => 2 };
|
||||||
our $action_commands = { SECTION => 2, DEFAULTS => 2 };
|
our $action_commands = { SECTION => 2, DEFAULTS => 2 };
|
||||||
our $macro_commands = { SECTION => 2, DEFAULT => 2 };
|
our $macro_commands = { SECTION => 2, DEFAULT => 2 };
|
||||||
|
#
|
||||||
|
# There is an implicit assumption that the last column of the @rulecolumns hash is always the last column of the @columns array.
|
||||||
|
# The @columns array doesn't include the ACTION but does include a 'wildcard' last element.
|
||||||
|
#
|
||||||
|
use constant { LAST_COLUMN => 14 };
|
||||||
|
|
||||||
our %rulecolumns = ( action => 0,
|
our %rulecolumns = ( action => 0,
|
||||||
source => 1,
|
source => 1,
|
||||||
@ -124,7 +129,7 @@ our %rulecolumns = ( action => 0,
|
|||||||
time => 11,
|
time => 11,
|
||||||
headers => 12,
|
headers => 12,
|
||||||
switch => 13,
|
switch => 13,
|
||||||
helper => 14,
|
helper => LAST_COLUMN,
|
||||||
);
|
);
|
||||||
|
|
||||||
use constant { MAX_MACRO_NEST_LEVEL => 10 };
|
use constant { MAX_MACRO_NEST_LEVEL => 10 };
|
||||||
@ -241,13 +246,8 @@ sub initialize( $ ) {
|
|||||||
# Action variants actually used. Key is <action>:<loglevel>:<tag>:<params>; value is corresponding chain name
|
# Action variants actually used. Key is <action>:<loglevel>:<tag>:<params>; value is corresponding chain name
|
||||||
#
|
#
|
||||||
%usedactions = ();
|
%usedactions = ();
|
||||||
#
|
|
||||||
# Columns $source through $wildcard -- with the exception of the latter, these correspond to the rules file columns
|
@columns = ( ( '-' ) x LAST_COLUMN, 0 );
|
||||||
# The columns array is a hidden argument to perl_action_helper() and perl_action_tcp_helper() that allows Perl
|
|
||||||
# code in inline actions to generate proper rules.
|
|
||||||
#
|
|
||||||
# SOURCE DEST PROTO PORT SPORT ORIG RATE USER MARK CONNLIMIT TIME HEADERS SWITCH HELPER WILDCARD
|
|
||||||
@columns = ( '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', 0 );
|
|
||||||
@columnstack = ();
|
@columnstack = ();
|
||||||
|
|
||||||
if ( $family == F_IPV4 ) {
|
if ( $family == F_IPV4 ) {
|
||||||
@ -2719,7 +2719,7 @@ sub perl_action_tcp_helper($$) {
|
|||||||
'',
|
'',
|
||||||
@columns[0,1],
|
@columns[0,1],
|
||||||
'-',
|
'-',
|
||||||
@columns[3..14]
|
@columns[3..LAST_COLUMN]
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$result = process_rule( $chainref,
|
$result = process_rule( $chainref,
|
||||||
@ -2728,7 +2728,7 @@ sub perl_action_tcp_helper($$) {
|
|||||||
'', # Current Param
|
'', # Current Param
|
||||||
'-', # Source
|
'-', # Source
|
||||||
'-', # Dest
|
'-', # Dest
|
||||||
"-", # Proto
|
'-', # Proto
|
||||||
'-', # Port(s)
|
'-', # Port(s)
|
||||||
'-', # Source Port(s)
|
'-', # Source Port(s)
|
||||||
'-', # Original Dest
|
'-', # Original Dest
|
||||||
|
Loading…
x
Reference in New Issue
Block a user