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
#
my $jumpchainref;
sub process_accounting_rule( $$$$$$$$$ ) {
our $jumpchainref;
my ($action, $chain, $source, $dest, $proto, $ports, $sports, $user, $mark ) = @_;
sub accounting_error() {

View File

@ -243,15 +243,15 @@ use constant { NO_RESTRICT => 0,
#
# Used to sequence 'exclusion' chains with names 'excl0', 'excl1', ...
#
my $exclseq = 0;
our $exclseq = 0;
#
# Used to suppress duplicate match specifications.
#
my $iprangematch = 0;
our $iprangematch = 0;
#
# Sequence for naming temporary chains
#
my $chainseq;
our $chainseq;
#
# 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)
my $timestamp; # If true, we are to timestamp each progress message
my $object = 0; # Object (script) file Handle Reference
my $lastlineblank = 0; # Avoid extra blank lines in the output
my $indent = ''; # Current indentation
my ( $dir, $file ); # Object's Directory and File
my $tempfile; # Temporary File Name
our $timestamp; # If true, we are to timestamp each progress message
our $object = 0; # Object (script) file Handle Reference
our $lastlineblank = 0; # Avoid extra blank lines in the output
our $indent = ''; # Current indentation
our ( $dir, $file ); # Object's Directory and File
our $tempfile; # Temporary File Name
INIT {
$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
#
my @propagateconfig = qw/ CLEAR_TC DISABLE_IPV6 ADMINISABSENTMINDED IP_FORWARDING MODULESDIR MODULE_SUFFIX LOGFORMAT SUBSYSLOCK LOCKFILE/;
my @propagateenv = qw/ LOGLIMIT LOGTAGONLY LOGRULENUMBERS /;
our @propagateconfig = qw/ CLEAR_TC DISABLE_IPV6 ADMINISABSENTMINDED IP_FORWARDING MODULESDIR MODULE_SUFFIX LOGFORMAT SUBSYSLOCK LOCKFILE /;
our @propagateenv = qw/ LOGLIMIT LOGTAGONLY LOGRULENUMBERS /;
#
# From parsing the capabilities file
@ -217,50 +217,50 @@ our %services;
#
# Capabilities
#
my %capdesc = ( NAT_ENABLED => 'NAT',
MANGLE_ENABLED => 'Packet Mangling',
MULTIPORT => 'Multi-port Match' ,
XMULTIPORT => 'Extended Multi-port Match',
CONNTRACK_MATCH => 'Connection Tracking Match',
USEPKTTYPE => 'Packet Type Match',
POLICY_MATCH => 'Policy Match',
PHYSDEV_MATCH => 'Physdev Match',
LENGTH_MATCH => 'Packet length Match',
IPRANGE_MATCH => 'IP Range Match',
RECENT_MATCH => 'Recent Match',
OWNER_MATCH => 'Owner Match',
IPSET_MATCH => 'Ipset Match',
CONNMARK => 'CONNMARK Target',
XCONNMARK => 'Extended CONNMARK Target',
CONNMARK_MATCH => 'Connmark Match',
XCONNMARK_MATCH => 'Extended Connmark Match',
RAW_TABLE => 'Raw Table',
IPP2P_MATCH => 'IPP2P Match',
CLASSIFY_TARGET => 'CLASSIFY Target',
ENHANCED_REJECT => 'Extended Reject',
KLUDGEFREE => 'Repeat match',
MARK => 'MARK Target',
XMARK => 'Extended Mark Target',
MANGLE_FORWARD => 'Mangle FORWARD Chain',
COMMENTS => 'Comments',
ADDRTYPE => 'Address Type Match',
);
our %capdesc = ( NAT_ENABLED => 'NAT',
MANGLE_ENABLED => 'Packet Mangling',
MULTIPORT => 'Multi-port Match' ,
XMULTIPORT => 'Extended Multi-port Match',
CONNTRACK_MATCH => 'Connection Tracking Match',
USEPKTTYPE => 'Packet Type Match',
POLICY_MATCH => 'Policy Match',
PHYSDEV_MATCH => 'Physdev Match',
LENGTH_MATCH => 'Packet length Match',
IPRANGE_MATCH => 'IP Range Match',
RECENT_MATCH => 'Recent Match',
OWNER_MATCH => 'Owner Match',
IPSET_MATCH => 'Ipset Match',
CONNMARK => 'CONNMARK Target',
XCONNMARK => 'Extended CONNMARK Target',
CONNMARK_MATCH => 'Connmark Match',
XCONNMARK_MATCH => 'Extended Connmark Match',
RAW_TABLE => 'Raw Table',
IPP2P_MATCH => 'IPP2P Match',
CLASSIFY_TARGET => 'CLASSIFY Target',
ENHANCED_REJECT => 'Extended Reject',
KLUDGEFREE => 'Repeat match',
MARK => 'MARK Target',
XMARK => 'Extended Mark Target',
MANGLE_FORWARD => 'Mangle FORWARD Chain',
COMMENTS => 'Comments',
ADDRTYPE => 'Address Type Match',
);
#
# Directories to search for configuration files
#
my @config_path;
our @config_path;
#
# Stash away file references here when we encounter INCLUDE
#
my @includestack;
our @includestack;
#
# Allow nested opens
#
my @openstack;
our @openstack;
my $currentfile; # File handle reference
my $currentfilename; # File NAME
my $currentlinenumber = 0; # Line number
our $currentfile; # File handle reference
our $currentfilename; # File NAME
our $currentlinenumber = 0; # Line number
#
# 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() {
for my $option ( @Shorewall::Config::propagateconfig ) {
for my $option ( @propagateconfig ) {
my $value = $config{$option} || '';
emit "$option=\"$value\"";
}
for my $option ( @Shorewall::Config::propagateenv ) {
for my $option ( @propagateenv ) {
my $value = $globals{$option} || '';
emit "$option=\"$value\"";
}

View File

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

View File

@ -38,7 +38,7 @@ our @EXPORT = qw(
our @EXPORT_OK = qw( );
our @VERSION = 1.00;
my @proxyarp;
our @proxyarp;
sub setup_one_proxy_arp( $$$$$ ) {
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
#
my @rule_chains;
our @rule_chains;
#
# Set to one if we find a SECTION
#
my $sectioned = 0;
our $sectioned = 0;
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 @VERSION = 1.00;
my %tcs = ( T => { chain => 'tcpost',
connmark => 0,
fw => 1
} ,
our %tcs = ( T => { chain => 'tcpost',
connmark => 0,
fw => 1
} ,
CT => { chain => 'tcpost' ,
target => 'CONNMARK --set-mark' ,
connmark => 1 ,
@ -93,11 +93,11 @@ use constant { NOMARK => 0 ,
HIGHMARK => 2
};
my @tccmd = ( { match => sub ( $ ) { $_[0] eq 'SAVE' } ,
target => 'CONNMARK --save-mark --mask' ,
mark => SMALLMARK ,
mask => '0xFF'
} ,
our @tccmd = ( { match => sub ( $ ) { $_[0] eq 'SAVE' } ,
target => 'CONNMARK --save-mark --mask' ,
mark => SMALLMARK ,
mask => '0xFF'
} ,
{ match => sub ( $ ) { $_[0] eq 'RESTORE' },
target => 'CONNMARK --restore-mark --mask' ,
mark => SMALLMARK ,

View File

@ -107,10 +107,10 @@ our $firewall_zone;
#
our %interfaces;
my %reservedName = ( all => 1,
none => 1,
SOURCE => 1,
DEST => 1 );
our %reservedName = ( all => 1,
none => 1,
SOURCE => 1,
DEST => 1 );
#
# 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::Proxyarp;
my $export;
our $export;
INIT {
$export = $ENV{EXPORT};