Convert some lexical variables to globals

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@6463 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2007-06-05 16:49:13 +00:00
parent 3ee0d1fddc
commit 95a269a825
10 changed files with 70 additions and 69 deletions

View File

@ -40,9 +40,10 @@ our @VERSION = 1.00;
# #
# Accounting # Accounting
# #
my $jumpchainref;
sub process_accounting_rule( $$$$$$$$$ ) { sub process_accounting_rule( $$$$$$$$$ ) {
our $jumpchainref;
my ($action, $chain, $source, $dest, $proto, $ports, $sports, $user, $mark ) = @_; my ($action, $chain, $source, $dest, $proto, $ports, $sports, $user, $mark ) = @_;
sub accounting_error() { sub accounting_error() {

View File

@ -243,15 +243,15 @@ use constant { NO_RESTRICT => 0,
# #
# Used to sequence 'exclusion' chains with names 'excl0', 'excl1', ... # Used to sequence 'exclusion' chains with names 'excl0', 'excl1', ...
# #
my $exclseq = 0; our $exclseq = 0;
# #
# Used to suppress duplicate match specifications. # Used to suppress duplicate match specifications.
# #
my $iprangematch = 0; our $iprangematch = 0;
# #
# Sequence for naming temporary chains # Sequence for naming temporary chains
# #
my $chainseq; our $chainseq;
# #
# Add a run-time command to a chain. Arguments are: # Add a run-time command to a chain. Arguments are:
# #

View File

@ -67,12 +67,12 @@ our ( $command, $doing, $done ) = qw/ compile Compiling Compiled/; #describe the
our $verbose; # Verbosity setting. 0 = almost silent, 1 = major progress messages only, 2 = all progress messages (very noisy) our $verbose; # Verbosity setting. 0 = almost silent, 1 = major progress messages only, 2 = all progress messages (very noisy)
my $timestamp; # If true, we are to timestamp each progress message our $timestamp; # If true, we are to timestamp each progress message
my $object = 0; # Object (script) file Handle Reference our $object = 0; # Object (script) file Handle Reference
my $lastlineblank = 0; # Avoid extra blank lines in the output our $lastlineblank = 0; # Avoid extra blank lines in the output
my $indent = ''; # Current indentation our $indent = ''; # Current indentation
my ( $dir, $file ); # Object's Directory and File our ( $dir, $file ); # Object's Directory and File
my $tempfile; # Temporary File Name our $tempfile; # Temporary File Name
INIT { INIT {
$verbose = $ENV{VERBOSE} || 0; $verbose = $ENV{VERBOSE} || 0;

View File

@ -173,8 +173,8 @@ our %config =
# #
# Config options and global settings that are to be copied to object script # Config options and global settings that are to be copied to object script
# #
my @propagateconfig = qw/ CLEAR_TC DISABLE_IPV6 ADMINISABSENTMINDED IP_FORWARDING MODULESDIR MODULE_SUFFIX LOGFORMAT SUBSYSLOCK LOCKFILE/; our @propagateconfig = qw/ CLEAR_TC DISABLE_IPV6 ADMINISABSENTMINDED IP_FORWARDING MODULESDIR MODULE_SUFFIX LOGFORMAT SUBSYSLOCK LOCKFILE /;
my @propagateenv = qw/ LOGLIMIT LOGTAGONLY LOGRULENUMBERS /; our @propagateenv = qw/ LOGLIMIT LOGTAGONLY LOGRULENUMBERS /;
# #
# From parsing the capabilities file # From parsing the capabilities file
@ -217,50 +217,50 @@ our %services;
# #
# Capabilities # Capabilities
# #
my %capdesc = ( NAT_ENABLED => 'NAT', our %capdesc = ( NAT_ENABLED => 'NAT',
MANGLE_ENABLED => 'Packet Mangling', MANGLE_ENABLED => 'Packet Mangling',
MULTIPORT => 'Multi-port Match' , MULTIPORT => 'Multi-port Match' ,
XMULTIPORT => 'Extended Multi-port Match', XMULTIPORT => 'Extended Multi-port Match',
CONNTRACK_MATCH => 'Connection Tracking Match', CONNTRACK_MATCH => 'Connection Tracking Match',
USEPKTTYPE => 'Packet Type Match', USEPKTTYPE => 'Packet Type Match',
POLICY_MATCH => 'Policy Match', POLICY_MATCH => 'Policy Match',
PHYSDEV_MATCH => 'Physdev Match', PHYSDEV_MATCH => 'Physdev Match',
LENGTH_MATCH => 'Packet length Match', LENGTH_MATCH => 'Packet length Match',
IPRANGE_MATCH => 'IP Range Match', IPRANGE_MATCH => 'IP Range Match',
RECENT_MATCH => 'Recent Match', RECENT_MATCH => 'Recent Match',
OWNER_MATCH => 'Owner Match', OWNER_MATCH => 'Owner Match',
IPSET_MATCH => 'Ipset Match', IPSET_MATCH => 'Ipset Match',
CONNMARK => 'CONNMARK Target', CONNMARK => 'CONNMARK Target',
XCONNMARK => 'Extended CONNMARK Target', XCONNMARK => 'Extended CONNMARK Target',
CONNMARK_MATCH => 'Connmark Match', CONNMARK_MATCH => 'Connmark Match',
XCONNMARK_MATCH => 'Extended Connmark Match', XCONNMARK_MATCH => 'Extended Connmark Match',
RAW_TABLE => 'Raw Table', RAW_TABLE => 'Raw Table',
IPP2P_MATCH => 'IPP2P Match', IPP2P_MATCH => 'IPP2P Match',
CLASSIFY_TARGET => 'CLASSIFY Target', CLASSIFY_TARGET => 'CLASSIFY Target',
ENHANCED_REJECT => 'Extended Reject', ENHANCED_REJECT => 'Extended Reject',
KLUDGEFREE => 'Repeat match', KLUDGEFREE => 'Repeat match',
MARK => 'MARK Target', MARK => 'MARK Target',
XMARK => 'Extended Mark Target', XMARK => 'Extended Mark Target',
MANGLE_FORWARD => 'Mangle FORWARD Chain', MANGLE_FORWARD => 'Mangle FORWARD Chain',
COMMENTS => 'Comments', COMMENTS => 'Comments',
ADDRTYPE => 'Address Type Match', ADDRTYPE => 'Address Type Match',
); );
# #
# Directories to search for configuration files # Directories to search for configuration files
# #
my @config_path; our @config_path;
# #
# Stash away file references here when we encounter INCLUDE # Stash away file references here when we encounter INCLUDE
# #
my @includestack; our @includestack;
# #
# Allow nested opens # Allow nested opens
# #
my @openstack; our @openstack;
my $currentfile; # File handle reference our $currentfile; # File handle reference
my $currentfilename; # File NAME our $currentfilename; # File NAME
my $currentlinenumber = 0; # Line number our $currentlinenumber = 0; # Line number
# #
# Issue a Warning Message # Issue a Warning Message
@ -1135,15 +1135,15 @@ sub get_configuration( $ ) {
} }
# #
# The values of the options in @Shorewall:Config::propagateconfig are copied to the object file in OPTION=<value> format. # The values of the options in @propagateconfig are copied to the object file in OPTION=<value> format.
# #
sub propagateconfig() { sub propagateconfig() {
for my $option ( @Shorewall::Config::propagateconfig ) { for my $option ( @propagateconfig ) {
my $value = $config{$option} || ''; my $value = $config{$option} || '';
emit "$option=\"$value\""; emit "$option=\"$value\"";
} }
for my $option ( @Shorewall::Config::propagateenv ) { for my $option ( @propagateenv ) {
my $value = $globals{$option} || ''; my $value = $globals{$option} || '';
emit "$option=\"$value\""; emit "$option=\"$value\"";
} }

View File

@ -40,8 +40,8 @@ our @EXPORT = qw( setup_masq setup_nat setup_netmap add_addresses );
our @EXPORT_OK = (); our @EXPORT_OK = ();
our @VERSION = 1.00; our @VERSION = 1.00;
my @addresses_to_add; our @addresses_to_add;
my %addresses_to_add; our %addresses_to_add;
# #
# Handle IPSEC Options in a masq record # Handle IPSEC Options in a masq record

View File

@ -38,7 +38,7 @@ our @EXPORT = qw(
our @EXPORT_OK = qw( ); our @EXPORT_OK = qw( );
our @VERSION = 1.00; our @VERSION = 1.00;
my @proxyarp; our @proxyarp;
sub setup_one_proxy_arp( $$$$$ ) { sub setup_one_proxy_arp( $$$$$ ) {
my ( $address, $interface, $external, $haveroute, $persistent) = @_; my ( $address, $interface, $external, $haveroute, $persistent) = @_;

View File

@ -56,11 +56,11 @@ our @VERSION = 1.00;
# #
# Keep track of chains for the /var/lib/shorewall[-lite]/chains file # Keep track of chains for the /var/lib/shorewall[-lite]/chains file
# #
my @rule_chains; our @rule_chains;
# #
# Set to one if we find a SECTION # Set to one if we find a SECTION
# #
my $sectioned = 0; our $sectioned = 0;
use constant { MAX_MACRO_NEST_LEVEL => 5 }; use constant { MAX_MACRO_NEST_LEVEL => 5 };

View File

@ -43,10 +43,10 @@ our @EXPORT = qw( setup_tc );
our @EXPORT_OK = qw( process_tc_rule ); our @EXPORT_OK = qw( process_tc_rule );
our @VERSION = 1.00; our @VERSION = 1.00;
my %tcs = ( T => { chain => 'tcpost', our %tcs = ( T => { chain => 'tcpost',
connmark => 0, connmark => 0,
fw => 1 fw => 1
} , } ,
CT => { chain => 'tcpost' , CT => { chain => 'tcpost' ,
target => 'CONNMARK --set-mark' , target => 'CONNMARK --set-mark' ,
connmark => 1 , connmark => 1 ,
@ -93,11 +93,11 @@ use constant { NOMARK => 0 ,
HIGHMARK => 2 HIGHMARK => 2
}; };
my @tccmd = ( { match => sub ( $ ) { $_[0] eq 'SAVE' } , our @tccmd = ( { match => sub ( $ ) { $_[0] eq 'SAVE' } ,
target => 'CONNMARK --save-mark --mask' , target => 'CONNMARK --save-mark --mask' ,
mark => SMALLMARK , mark => SMALLMARK ,
mask => '0xFF' mask => '0xFF'
} , } ,
{ match => sub ( $ ) { $_[0] eq 'RESTORE' }, { match => sub ( $ ) { $_[0] eq 'RESTORE' },
target => 'CONNMARK --restore-mark --mask' , target => 'CONNMARK --restore-mark --mask' ,
mark => SMALLMARK , mark => SMALLMARK ,

View File

@ -107,10 +107,10 @@ our $firewall_zone;
# #
our %interfaces; our %interfaces;
my %reservedName = ( all => 1, our %reservedName = ( all => 1,
none => 1, none => 1,
SOURCE => 1, SOURCE => 1,
DEST => 1 ); DEST => 1 );
# #
# Parse the passed option list and return a reference to a hash as follows: # Parse the passed option list and return a reference to a hash as follows:

View File

@ -55,7 +55,7 @@ use Shorewall::Rules;
use Shorewall::Proc; use Shorewall::Proc;
use Shorewall::Proxyarp; use Shorewall::Proxyarp;
my $export; our $export;
INIT { INIT {
$export = $ENV{EXPORT}; $export = $ENV{EXPORT};