From 5890e5ddb56b90b961baaa5e74c9c0583198538c Mon Sep 17 00:00:00 2001 From: teastep Date: Sat, 24 Mar 2007 18:11:32 +0000 Subject: [PATCH] Rationalize VERSION git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@5664 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- New/Shorewall/Config.pm | 23 ++++++++++++----------- New/compiler.pl | 14 ++++++-------- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/New/Shorewall/Config.pm b/New/Shorewall/Config.pm index 81c3f6e0d..eedd6b5fd 100644 --- a/New/Shorewall/Config.pm +++ b/New/Shorewall/Config.pm @@ -32,6 +32,15 @@ our @EXPORT = qw(find_file get_configuration report_capabilities propagateconfig our @EXPORT_OK = (); our @VERSION = 1.00; +# +# Misc Globals +# +our %env = ( SHAREDIR => '/usr/share/shorewall' , + CONFDIR => '/etc/shorewall', + LOGPARMS => '', + VERSION => '3.9.0-1', + ); + # # From shorewall.conf file # @@ -123,14 +132,6 @@ my @propagateconfig = qw/ CLEAR_TC DISABLE_IPV6 ADMINISABSENTMINDED IP_FORWARDIN my @propagateenv = qw/ LOGLIMIT LOGTAGONLY LOGRULENUMBERS /; -# Misc Globals -# -our %env = ( SHAREDIR => '/usr/share/shorewall' , - CONFDIR => '/etc/shorewall', - LOGPARMS => '', - VERSION => '3.9.0', - ); - # # From parsing the capabilities file # @@ -375,11 +376,11 @@ sub get_configuration() { default_yes_no 'RFC1918_STRICT' , ''; default_yes_no 'SAVE_IPSETS' , ''; - warning_message 'SAVE_IPSETS=Yes is not supported by Shorewall4 ' . VERSION if $config{SAVE_IPSETS}; + warning_message 'SAVE_IPSETS=Yes is not supported by Shorewall4 ' . $env{VERSION} if $config{SAVE_IPSETS}; default_yes_no 'MAPOLDACTIONS' , ''; - warning_message 'MAPOLDACTIONS=Yes is not supported by Shorewall4 ' . VERSION if $config{MAPOLDACTIONS}; + warning_message 'MAPOLDACTIONS=Yes is not supported by Shorewall4 ' . $env{VERSION} if $config{MAPOLDACTIONS}; default_yes_no 'FASTACCEPT' , ''; default_yes_no 'IMPLICIT_CONTINUE' , ''; @@ -570,7 +571,7 @@ sub generate_aux_config() { create_temp_aux_config; - emit( "#\n# Shorewall auxiliary configuration file created by Shorewall4 version " . VERSION . ' - ' . localtime . "\n#" ); + emit( "#\n# Shorewall auxiliary configuration file created by Shorewall4 version " . $env{VERSION} . ' - ' . ( localtime ) . "\n#" ); for my $option qw(VERBOSITY LOGFILE LOGFORMAT IPTABLES PATH SHOREWALL_SHELL SUBSYSLOCK RESTOREFILE SAVE_IPSETS) { conditionally_add_option $option; diff --git a/New/compiler.pl b/New/compiler.pl index ddf35fa7d..67cddf08c 100755 --- a/New/compiler.pl +++ b/New/compiler.pl @@ -59,14 +59,12 @@ use Shorewall::Rules; use Shorewall::Proc; use Shorewall::Proxyarp; -use constant { VERSION => '3.9.0-1' }; - sub generate_script_1 { copy '/usr/share/shorewall4/prog.header'; my $date = localtime; - emit( "#\n# Compiled firewall script generated by Shorewall " . VERSION . " - $date\n#" ); + emit( "#\n# Compiled firewall script generated by Shorewall " . $env{VERSION} . " - $date\n#" ); if ( $ENV{EXPORT} ) { emit 'SHAREDIR=/usr/share/shorewall-lite'; @@ -131,7 +129,7 @@ sub generate_script_1 { emit '[ -n "${VERBOSE:=0}" ]'; emit '[ -n "${RESTOREFILE:=$RESTOREFILE}" ]'; emit '[ -n "$LOGFORMAT" ] || LOGFORMAT="Shorewall:%s:%s:"'; - emit( 'VERSION="' . VERSION . '"' ); + emit( 'VERSION="' . $env{VERSION} . '"' ); emit "PATH=\"$config{PATH}\""; emit 'TERMINATOR=fatal_error'; @@ -595,13 +593,13 @@ sub compile_firewall( $ ) { report_capabilities if $ENV{VERBOSE} > 1; - fatal_error( 'Shorewall4 ' . VERSION . ' requires Conntrack Match Support' ) + fatal_error( 'Shorewall4 ' . $env{VERSION} . ' requires Conntrack Match Support' ) unless $capabilities{CONNTRACK_MATCH}; - fatal_error( 'Shorewall4 ' . VERSION . ' requires Extended Multi-port Match Support' ) + fatal_error( 'Shorewall4 ' . $env{VERSION} . ' requires Extended Multi-port Match Support' ) unless $capabilities{XMULTIPORT}; - fatal_error( 'Shorewall4 ' . VERSION . ' requires Address Type Match Support' ) + fatal_error( 'Shorewall4 ' . $env{VERSION} . ' requires Address Type Match Support' ) unless $capabilities{ADDRTYPE}; - fatal_error 'BRIDGING=Yes is not supported by the ' . VERSION . ' Perl-based compiler' + fatal_error 'BRIDGING=Yes is not supported by the ' . $env{VERSION} . ' Perl-based compiler' if $config{BRIDGING}; fatal_error 'MACLIST_TTL requires the Recent Match capability which is not present in your Kernel and/or iptables' if $config{MACLIST_TTL} && ! $capabilities{RECENT_MATCH};