diff --git a/Shorewall-perl/Shorewall/Config.pm b/Shorewall-perl/Shorewall/Config.pm index 17f7ba327..70515d002 100644 --- a/Shorewall-perl/Shorewall/Config.pm +++ b/Shorewall-perl/Shorewall/Config.pm @@ -129,6 +129,8 @@ sub initialize() { TC_SCRIPT => '', VERSION => '4.0.0-RC1', CAPVERSION => 30405 , + MIN_COMMON_VERSION => 40000 , + MIN_COMMON_VERSION_PRINTABLE => '4.0.0', ); # # From shorewall.conf file @@ -934,6 +936,21 @@ sub ensure_config_path() { } } +# +# Ensure that the version of Shorewall-common currently installed is acceptable +# +sub validate_shorewall_common() { + my $f = "$globals{SHAREDIR}/version"; + fatal_error "$f does not exist" unless -f $f; + open V, '<', $f or fatal_error "Cannot open $f: $!"; + my $version = ; + close V; + chomp $version; + fatal_error "Invalid $f contents" unless $version =~ /(\d+)\.(\d+)\.(\d+)/; + $version = ( $1 * 10000 ) + ( $2 * 100 ) + $3; + fatal_error "Shorewall-perl $globals{VERSION} requires shorewall-common >= $globals{MIN_COMMON_VERSION_PRINTABLE}" unless $version >= $globals{MIN_COMMON_VERSION}; +} + # # Set $shorewall_dir # @@ -1029,6 +1046,8 @@ sub get_configuration( $ ) { my $export = $_[0]; + validate_shorewall_common; + ensure_config_path; process_shorewall_conf; diff --git a/Shorewall-shell/compiler b/Shorewall-shell/compiler index 373718cc4..42ad8592f 100755 --- a/Shorewall-shell/compiler +++ b/Shorewall-shell/compiler @@ -35,6 +35,9 @@ # SHOREWALL_DIR A directory name was passed to /sbin/shorewall # VERBOSE Standard Shorewall verbosity control. +MIN_COMMON_VERSION=40000 +MIN_COMMON_VERSION_PRINTABLE=4.0.0 + # # Fatal error -- stops the compiler after issuing the error message # @@ -5738,7 +5741,7 @@ done VERSION=$(cat $SHELLSHAREDIR/version) -[ $SHOREWALL_LIBVERSION -ge $MIN_COMMON_VERSION ] || fatal_error "Shorewall-shell $VERSION requires Shorewall-common >= 4.0.0" +[ $SHOREWALL_LIBVERSION -ge $MIN_COMMON_VERSION ] || fatal_error "Shorewall-shell $VERSION requires Shorewall-common >= $MIN_COMMON_VERSION_PRINTABLE" PROGRAM=compiler diff --git a/Shorewall-shell/diff-3.4-compiler b/Shorewall-shell/diff-3.4-compiler index 633a7ea01..650abc736 100644 --- a/Shorewall-shell/diff-3.4-compiler +++ b/Shorewall-shell/diff-3.4-compiler @@ -1,6 +1,16 @@ --- /home/teastep/shorewall/branches/3.4/Shorewall/compiler 2007-06-30 08:39:22.000000000 -0700 -+++ compiler 2007-07-02 10:12:28.000000000 -0700 -@@ -673,11 +673,11 @@ ++++ compiler 2007-07-02 10:15:12.000000000 -0700 +@@ -35,6 +35,9 @@ + # SHOREWALL_DIR A directory name was passed to /sbin/shorewall + # VERBOSE Standard Shorewall verbosity control. + ++MIN_COMMON_VERSION=40000 ++MIN_COMMON_VERSION_PRINTABLE=4.0.0 ++ + # + # Fatal error -- stops the compiler after issuing the error message + # +@@ -673,11 +676,11 @@ progress_message2 "Compiling IP Forwarding..." case "$IP_FORWARDING" in @@ -14,7 +24,7 @@ save_progress_message "IP Forwarding Disabled!" save_command "echo 0 > /proc/sys/net/ipv4/ip_forward" ;; -@@ -3767,7 +3767,7 @@ +@@ -3767,7 +3770,7 @@ save_progress_message "Setting up Route Filtering..." @@ -23,7 +33,7 @@ indent >&3 << __EOF__ for f in /proc/sys/net/ipv4/conf/*; do -@@ -3791,8 +3791,10 @@ +@@ -3791,8 +3794,10 @@ save_command "echo 1 > /proc/sys/net/ipv4/conf/all/rp_filter" @@ -35,7 +45,7 @@ fi save_command "[ -n \"\$NOROUTES\" ] || ip route flush cache" -@@ -3808,7 +3810,7 @@ +@@ -3808,7 +3813,7 @@ save_progress_message "Setting up Martian Logging..." @@ -44,7 +54,7 @@ indent >&3 << __EOF__ for f in /proc/sys/net/ipv4/conf/*; do -@@ -3831,9 +3833,12 @@ +@@ -3831,9 +3836,12 @@ __EOF__ done @@ -58,7 +68,7 @@ fi fi -@@ -4889,7 +4894,7 @@ +@@ -4889,7 +4897,7 @@ ;; esac @@ -67,13 +77,13 @@ } progress_message2 "Initializing..." -@@ -5731,6 +5736,10 @@ +@@ -5731,6 +5739,10 @@ fi done +VERSION=$(cat $SHELLSHAREDIR/version) + -+[ $SHOREWALL_LIBVERSION -ge $MIN_COMMON_VERSION ] || fatal_error "Shorewall-shell $VERSION requires Shorewall-common >= 4.0.0" ++[ $SHOREWALL_LIBVERSION -ge $MIN_COMMON_VERSION ] || fatal_error "Shorewall-shell $VERSION requires Shorewall-common >= $MIN_COMMON_VERSION_PRINTABLE" + PROGRAM=compiler