Add some documentation and remove a couple of double-initialization cases

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@6542 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2007-06-14 22:07:45 +00:00
parent 09dd725a3c
commit 8b4f23252f
13 changed files with 123 additions and 10 deletions

View File

@ -39,6 +39,15 @@ our @EXPORT = qw( setup_accounting );
our @EXPORT_OK = qw( ); our @EXPORT_OK = qw( );
our @VERSION = 1.00; our @VERSION = 1.00;
#
# Initialize globals -- we take this novel approach to globals initialization to allow
# the compiler to run multiple times in the same process. The
# initialize() function does globals initialization for this
# module and is called from an INIT block below. The function is
# also called by Shorewall::Compiler::compiler at the beginning of
# the second and subsequent calls to that function.
#
sub initialize() { sub initialize() {
our $jumpchainref; our $jumpchainref;
$jumpchainref = undef; $jumpchainref = undef;

View File

@ -76,10 +76,12 @@ our %actions;
# #
my %logactionchains; my %logactionchains;
# #
# Maps each used macro to it's 'macro. ...' file. # Initialize globals -- we take this novel approach to globals initialization to allow
# # the compiler to run multiple times in the same process. The
# # initialize() function does globals initialization for this
# This function determines the logging for a subordinate action or a rule within a superior action # module and is called from an INIT block below. The function is
# also called by Shorewall::Compiler::compiler at the beginning of
# the second and subsequent calls to that function.
# #
sub initialize() { sub initialize() {
@ -95,6 +97,9 @@ INIT {
initialize; initialize;
} }
#
# This function determines the logging for a subordinate action or a rule within a superior action
#
sub merge_levels ($$) { sub merge_levels ($$) {
my ( $superior, $subordinate ) = @_; my ( $superior, $subordinate ) = @_;

View File

@ -164,12 +164,12 @@ our @VERSION = 1.00;
# #
our @policy_chains; our @policy_chains;
our %chain_table; our %chain_table;
our $nat_table = $chain_table{nat}; our $nat_table;
our $mangle_table = $chain_table{mangle}; our $mangle_table;
our $filter_table = $chain_table{filter}; our $filter_table;
our %sections; our %sections;
our $section; our $section;
our $comment = ''; our $comment;
use constant { STANDARD => 1, #defined by Netfilter use constant { STANDARD => 1, #defined by Netfilter
NATRULE => 2, #Involves NAT NATRULE => 2, #Involves NAT
@ -181,6 +181,7 @@ use constant { STANDARD => 1, #defined by Netfilter
MACRO => 128, #A Macro MACRO => 128, #A Macro
LOGRULE => 256, #'LOG' LOGRULE => 256, #'LOG'
}; };
our %targets; our %targets;
# #
# expand_rule() restrictions # expand_rule() restrictions
@ -192,10 +193,19 @@ use constant { NO_RESTRICT => 0, # FORWARD chain rule - Both -i and
POSTROUTE_RESTRICT => 16, # POSTROUTING chain rule - -i converted to -s <address list> using main routing table POSTROUTE_RESTRICT => 16, # POSTROUTING chain rule - -i converted to -s <address list> using main routing table
ALL_RESTRICT => 12 # fw->fw rule - neither -i nor -o allowed ALL_RESTRICT => 12 # fw->fw rule - neither -i nor -o allowed
}; };
our $exclseq = 0; our $exclseq;
our $iprangematch = 0; our $iprangematch;
our $chainseq; our $chainseq;
#
# Initialize globals -- we take this novel approach to globals initialization to allow
# the compiler to run multiple times in the same process. The
# initialize() function does globals initialization for this
# module and is called from an INIT block below. The function is
# also called by Shorewall::Compiler::compiler at the beginning of
# the second and subsequent calls to that function.
#
sub initialize() { sub initialize() {
@policy_chains = (); @policy_chains = ();
%chain_table = ( raw => {} , %chain_table = ( raw => {} ,

View File

@ -73,6 +73,15 @@ our $indent;
our ( $dir, $file ); # Object's Directory and File our ( $dir, $file ); # Object's Directory and File
our $tempfile; # Temporary File Name our $tempfile; # Temporary File Name
#
# Initialize globals -- we take this novel approach to globals initialization to allow
# the compiler to run multiple times in the same process. The
# initialize() function does globals initialization for this
# module and is called from an INIT block below. The function is
# also called by Shorewall::Compiler::compiler at the beginning of
# the second and subsequent calls to that function.
#
sub initialize() { sub initialize() {
$line = ''; # Current config file line $line = ''; # Current config file line

View File

@ -113,6 +113,14 @@ our $currentlinenumber; # Line number
our $shorewall_dir; #Shorewall Directory our $shorewall_dir; #Shorewall Directory
#
# Initialize globals -- we take this novel approach to globals initialization to allow
# the compiler to run multiple times in the same process. The
# initialize() function does globals initialization for this
# module and is called from an INIT block below. The function is
# also called by Shorewall::Compiler::compiler at the beginning of
# the second and subsequent calls to that function.
#
sub initialize() { sub initialize() {
# #
# Misc Globals # Misc Globals

View File

@ -67,6 +67,15 @@ our @interfaces;
our %interfaces; our %interfaces;
our @bridges; our @bridges;
#
# Initialize globals -- we take this novel approach to globals initialization to allow
# the compiler to run multiple times in the same process. The
# initialize() function does globals initialization for this
# module and is called from an INIT block below. The function is
# also called by Shorewall::Compiler::compiler at the beginning of
# the second and subsequent calls to that function.
#
sub initialize() { sub initialize() {
@interfaces = (); @interfaces = ();
%interfaces = (); %interfaces = ();

View File

@ -45,6 +45,15 @@ our @VERSION = 1.00;
our %macros; our %macros;
#
# Initialize globals -- we take this novel approach to globals initialization to allow
# the compiler to run multiple times in the same process. The
# initialize() function does globals initialization for this
# module and is called from an INIT block below. The function is
# also called by Shorewall::Compiler::compiler at the beginning of
# the second and subsequent calls to that function.
#
sub initialize() { sub initialize() {
%macros = (); %macros = ();
} }

View File

@ -43,6 +43,15 @@ our @VERSION = 1.00;
our @addresses_to_add; our @addresses_to_add;
our %addresses_to_add; our %addresses_to_add;
#
# Initialize globals -- we take this novel approach to globals initialization to allow
# the compiler to run multiple times in the same process. The
# initialize() function does globals initialization for this
# module and is called from an INIT block below. The function is
# also called by Shorewall::Compiler::compiler at the beginning of
# the second and subsequent calls to that function.
#
sub initialize() { sub initialize() {
@addresses_to_add = (); @addresses_to_add = ();
%addresses_to_add = (); %addresses_to_add = ();

View File

@ -54,6 +54,15 @@ our %providers;
our @providers; our @providers;
#
# Initialize globals -- we take this novel approach to globals initialization to allow
# the compiler to run multiple times in the same process. The
# initialize() function does globals initialization for this
# module and is called from an INIT block below. The function is
# also called by Shorewall::Compiler::compiler at the beginning of
# the second and subsequent calls to that function.
#
sub initialize() { sub initialize() {
@providers = (); @providers = ();
%routemarked_interfaces = (); %routemarked_interfaces = ();

View File

@ -40,6 +40,15 @@ our @VERSION = 1.00;
our @proxyarp; our @proxyarp;
#
# Initialize globals -- we take this novel approach to globals initialization to allow
# the compiler to run multiple times in the same process. The
# initialize() function does globals initialization for this
# module and is called from an INIT block below. The function is
# also called by Shorewall::Compiler::compiler at the beginning of
# the second and subsequent calls to that function.
#
sub initialize() { sub initialize() {
@proxyarp = (); @proxyarp = ();
} }

View File

@ -62,6 +62,15 @@ our @rule_chains;
# #
our $sectioned; our $sectioned;
#
# Initialize globals -- we take this novel approach to globals initialization to allow
# the compiler to run multiple times in the same process. The
# initialize() function does globals initialization for this
# module and is called from an INIT block below. The function is
# also called by Shorewall::Compiler::compiler at the beginning of
# the second and subsequent calls to that function.
#
sub initialize() { sub initialize() {
@rule_chains = (); @rule_chains = ();
$sectioned = 0; $sectioned = 0;

View File

@ -123,6 +123,15 @@ our %classids;
our @deferred_rules; our @deferred_rules;
#
# Initialize globals -- we take this novel approach to globals initialization to allow
# the compiler to run multiple times in the same process. The
# initialize() function does globals initialization for this
# module and is called from an INIT block below. The function is
# also called by Shorewall::Compiler::compiler at the beginning of
# the second and subsequent calls to that function.
#
sub initialize() { sub initialize() {
%classids = (); %classids = ();
@deferred_rules = (); @deferred_rules = ();

View File

@ -114,6 +114,15 @@ our %reservedName = ( all => 1,
SOURCE => 1, SOURCE => 1,
DEST => 1 ); DEST => 1 );
#
# Initialize globals -- we take this novel approach to globals initialization to allow
# the compiler to run multiple times in the same process. The
# initialize() function does globals initialization for this
# module and is called from an INIT block below. The function is
# also called by Shorewall::Compiler::compiler at the beginning of
# the second and subsequent calls to that function.
#
sub initialize() { sub initialize() {
@zones = (); @zones = ();
%zones = (); %zones = ();