From 7ffb2d7ad62f1a26d8791a654465dbd350c49f4a Mon Sep 17 00:00:00 2001 From: teastep Date: Tue, 12 Jun 2007 14:32:42 +0000 Subject: [PATCH] Restore compatibility with Shorewall 3.4 git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@6525 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall-common/releasenotes.txt | 49 +++++++++++++++++++++---------- Shorewall-perl/compiler.pl | 10 +++++-- 2 files changed, 40 insertions(+), 19 deletions(-) diff --git a/Shorewall-common/releasenotes.txt b/Shorewall-common/releasenotes.txt index 8e3d578c0..8541ac026 100644 --- a/Shorewall-common/releasenotes.txt +++ b/Shorewall-common/releasenotes.txt @@ -17,9 +17,9 @@ You must install Shorewall and at least one of the compiler packages Problems corrected in 4.0.0 Beta 5. -1) With Shorewall-perl, if a bridge port is used to qualify the SOURCE - in a rule where there is also a DEST interface, then the following - diagnostic is produced: +1) With Shorewall-perl, if a bridge port was used to qualify the SOURCE + in a rule where there was also a DEST interface, then the following + diagnostic was produced: Undefined subroutine &Shorewall::Chains::source_port_to_bridge called at /usr/share/shorewall-perl/Shorewall/Chains.pm line 1521, <$currentfile> @@ -73,6 +73,17 @@ Other changes in Shorewall 4.0.0 Beta 5. /usr/share/shorewall-perl/compiler.pl -v 2 -d . firewall + Note: For compatibility with Shorewall 3.4.2 and later 3.4 + releases, options not passed on the run-line get their values from + environmental variables: + + Option Variable + + --verbosity VERBOSE + --export EXPORT + --directory SHOREWALL_DIR + --timestamp TIMESTAMP + To use the Shorewall::Compiler module: use lib '/usr/share/shorewall-perl'; @@ -82,12 +93,13 @@ Other changes in Shorewall 4.0.0 Beta 5. configure( $export, $directory, $verbose, $timestamp ) - The arguments corresponding to the similarly-named - run-line options. If passed as '', the value will be + The arguments correspond to the similarly-named + run-line options. Values passed as empty strings are ignored. - configure will raise an exception with die if $directory - is passed and does not name an existing directory. + The function will raise an exception with die if + $directory is not '' and does not name an existing + directory. Example: configure( '', '.', 2, '' ); @@ -114,13 +126,18 @@ Other changes in Shorewall 4.0.0 Beta 5. eval { configure( ... ) compiler( ... ) - } + }; if ( $@ ) { } } + Warning: There is currently a memory leak in the compiler + caused by hard reference loops. I'll work to correct that + problem but it is not a high priority since compiler.pl only + calls Shorewall::Compiler::compiler once then exits. + Migration Considerations: 1) You cannot simply upgrade your existing Shorewall package. You must @@ -128,26 +145,26 @@ Migration Considerations: If you attempt to upgrade using the RPM, you get this result: - gateway:~ # rpm -Uvh shorewall-3.9.2-1.noarch.rpm + gateway:~ # rpm -Uvh shorewall-4.0.0.noarch.rpm error: Failed dependencies: - shorewall_compiler is needed by shorewall-3.9.2-1.noarch + shorewall_compiler is needed by shorewall-4.0.0-1.noarch gateway:~ # You must either: - rpm -U shorewall-3.9.2.noarch.rpm shorewall-shell-3.9.2.noarch.rpm + rpm -U shorewall-4.0.0.noarch.rpm shorewall-shell-4.0.0.noarch.rpm or - rpm -U shorewall-3.9.2.noarch.rpm shorewall-perl-3.9.2.noarch.rpm + rpm -U shorewall-4.0.0.noarch.rpm shorewall-perl-4.0.0.noarch.rpm or - rpm -i shorewall-shell-3.9.2.noarch.rpm - rpm -U shorewall-3.9.2.noarch.rpm + rpm -i shorewall-shell-4.0.0.noarch.rpm + rpm -U shorewall-4.0.0.noarch.rpm or - rpm -i shorewall-perl-3.9.2.noarch.rpm - rpm -U shorewall-3.9.2.noarch.rpm + rpm -i shorewall-perl-4.0.0.noarch.rpm + rpm -U shorewall-4.0.0.noarch.rpm If you are upgrading using the tarball, you must install either shorewall-shell or shorewall-perl before you upgrade diff --git a/Shorewall-perl/compiler.pl b/Shorewall-perl/compiler.pl index 9577d9725..928412978 100755 --- a/Shorewall-perl/compiler.pl +++ b/Shorewall-perl/compiler.pl @@ -31,12 +31,16 @@ sub usage() { print STDERR "usage: compiler.pl [ --export ] [ --directory= ] [ --verbose={0-2} ] [ --timestamp ] [ ]\n"; exit 1; } + # # E x e c u t i o n S t a r t s H e r e # -Getopt::Long::Configure ('bundling'); +my $export = $ENV{EXPORT} || 0; +my $shorewall_dir = $ENV{SHOREWALL_DIR} || ''; +my $verbose = $ENV{VERBOSE} || 0; +my $timestamp = $ENV{TIMESTAMP} || ''; -my ( $export , $shorewall_dir, $verbose, $timestamp ) = ( 0, '', '', '' ); +Getopt::Long::Configure ('bundling'); my $result = GetOptions('export' => \$export, 'e' => \$export, @@ -48,7 +52,7 @@ my $result = GetOptions('export' => \$export, 't' => \$timestamp ); usage unless $result && @ARGV < 2; - + eval { use Shorewall::Compiler; configure( $export, $shorewall_dir, $verbose, $timestamp );