From ed90360b4c8a22427479d965f725ff39d164ea01 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Mon, 31 Aug 2015 14:21:41 -0700 Subject: [PATCH] Remove all of the update-specific options from the update command Leave -i and -A Signed-off-by: Tom Eastep --- Shorewall-core/lib.cli | 5 - Shorewall/Perl/Shorewall/Compiler.pm | 25 ++-- Shorewall/Perl/Shorewall/Config.pm | 26 ++-- Shorewall/Perl/Shorewall/Misc.pm | 14 +-- Shorewall/Perl/compiler.pl | 22 +--- Shorewall/lib.cli-std | 30 ----- Shorewall/manpages/shorewall.xml | 168 ++++++++++++-------------- Shorewall6/manpages/shorewall6.xml | 173 ++++++++++++--------------- 8 files changed, 183 insertions(+), 280 deletions(-) diff --git a/Shorewall-core/lib.cli b/Shorewall-core/lib.cli index cbc16deee..62685ab39 100644 --- a/Shorewall-core/lib.cli +++ b/Shorewall-core/lib.cli @@ -3969,7 +3969,6 @@ shorewall_cli() { g_refreshchains=:none: g_confess= g_update= - g_convert= g_annotate= g_recovering= g_timestamp= @@ -3978,14 +3977,10 @@ shorewall_cli() { g_conditional= g_file= g_doing="Compiling" - g_directives= g_inline= - g_tcrules= g_counters= g_loopback= g_compiled= - g_routestopped= - g_notrack= VERBOSE= VERBOSITY=1 diff --git a/Shorewall/Perl/Shorewall/Compiler.pm b/Shorewall/Perl/Shorewall/Compiler.pm index 357dc0d12..2734d7fcb 100644 --- a/Shorewall/Perl/Shorewall/Compiler.pm +++ b/Shorewall/Perl/Shorewall/Compiler.pm @@ -592,8 +592,8 @@ EOF # sub compiler { - my ( $scriptfilename, $directory, $verbosity, $timestamp , $debug, $chains , $log , $log_verbosity, $preview, $confess , $update , $annotate , $convert, $config_path, $shorewallrc , $shorewallrc1 , $directives, $inline, $tcrules, $routestopped , $notrack ) = - ( '', '', -1, '', 0, '', '', -1, 0, 0, 0, 0, , 0 , '' , '/usr/share/shorewall/shorewallrc', '' , 0 , 0 , 0 , 0 , 0 ); + my ( $scriptfilename, $directory, $verbosity, $timestamp , $debug, $chains , $log , $log_verbosity, $preview, $confess , $update , $annotate , $config_path, $shorewallrc , $shorewallrc1 , $inline ) = + ( '', '', -1, '', 0, '', '', -1, 0, 0, 0, 0, , '' , '/usr/share/shorewall/shorewallrc', '' , 0 ); $export = 0; $test = 0; @@ -629,13 +629,8 @@ sub compiler { preview => { store => \$preview, validate=> \&validate_boolean } , confess => { store => \$confess, validate=> \&validate_boolean } , update => { store => \$update, validate=> \&validate_boolean } , - convert => { store => \$convert, validate=> \&validate_boolean } , annotate => { store => \$annotate, validate=> \&validate_boolean } , inline => { store => \$inline, validate=> \&validate_boolean } , - directives => { store => \$directives, validate=> \&validate_boolean } , - tcrules => { store => \$tcrules, validate=> \&validate_boolean } , - routestopped => { store => \$routestopped, validate=> \&validate_boolean } , - notrack => { store => \$notrack, validate=> \&validate_boolean } , config_path => { store => \$config_path } , shorewallrc => { store => \$shorewallrc } , shorewallrc1 => { store => \$shorewallrc1 } , @@ -671,7 +666,7 @@ sub compiler { # # S H O R E W A L L . C O N F A N D C A P A B I L I T I E S # - get_configuration( $export , $update , $annotate , $directives , $inline ); + get_configuration( $export , $update , $annotate , $inline ); # # Chain table initialization depends on shorewall.conf and capabilities. So it must be deferred until # now when shorewall.conf has been processed and the capabilities have been determined. @@ -739,7 +734,7 @@ sub compiler { # # Do all of the zone-independent stuff (mostly /proc) # - add_common_rules( $convert, $tcrules , $routestopped ); + add_common_rules( $update ); # # More /proc # @@ -804,7 +799,7 @@ sub compiler { # # TCRules and Traffic Shaping # - setup_tc( $tcrules ); + setup_tc( $update ); if ( $scriptfilename || $debug ) { pop_indent; @@ -842,11 +837,11 @@ sub compiler { # # Process the rules file. # - process_rules( $convert ); + process_rules( $update ); # # Process the conntrack file # - setup_conntrack( $notrack ); + setup_conntrack( $update ); # # Add Tunnel rules. # @@ -913,7 +908,7 @@ sub compiler { # S T O P _ F I R E W A L L # (Writes the stop_firewall() function to the compiled script) # - compile_stop_firewall( $test, $export , $have_arptables, $routestopped ); + compile_stop_firewall( $test, $export , $have_arptables, $update ); # # U P D O W N # (Writes the updown() function to the compiled script) @@ -978,14 +973,14 @@ sub compiler { initialize_chain_table(0); if ( $debug ) { - compile_stop_firewall( $test, $export, $have_arptables, $routestopped ); + compile_stop_firewall( $test, $export, $have_arptables, $update ); disable_script; } else { # # compile_stop_firewall() also validates the stoppedrules file. Since we don't # call that function during normal 'check', we must validate stoppedrules here. # - convert_routestopped if $routestopped; + convert_routestopped if $update; process_stoppedrules; } # diff --git a/Shorewall/Perl/Shorewall/Config.pm b/Shorewall/Perl/Shorewall/Config.pm index d2b0c44ea..07c2dbba6 100644 --- a/Shorewall/Perl/Shorewall/Config.pm +++ b/Shorewall/Perl/Shorewall/Config.pm @@ -4772,8 +4772,8 @@ sub update_default($$) { $config{$var} = $val unless defined $config{$var}; } -sub update_config_file( $$ ) { - my ( $annotate, $directives ) = @_; +sub update_config_file( $ ) { + my ( $annotate ) = @_; sub is_set( $ ) { my $value = $_[0]; @@ -4926,14 +4926,6 @@ EOF warning_message "Unable to rename $configfile.bak to $configfile"; progress_message3 "No update required to configuration file $configfile"; } - - exit 0 unless ( $directives || - -f find_file 'blacklist' || - -f find_file 'tcrules' || - -f find_file 'routestopped' || - -f find_file 'notrack' || - -f find_file 'tos' - ); } } else { fatal_error "$fn does not exist"; @@ -4943,8 +4935,8 @@ EOF # # Small functions called by get_configuration. We separate them so profiling is more useful # -sub process_shorewall_conf( $$$ ) { - my ( $update, $annotate, $directives ) = @_; +sub process_shorewall_conf( $$ ) { + my ( $update, $annotate ) = @_; my $file = find_file "$product.conf"; if ( -f $file ) { @@ -4996,7 +4988,7 @@ sub process_shorewall_conf( $$$ ) { # # Now update the config file if asked # - update_config_file( $annotate, $directives ) if $update; + update_config_file( $annotate ) if $update; # # Config file update requires that the option values not have # Shell variables expanded. We do that now. @@ -5385,9 +5377,9 @@ EOF # - Read the capabilities file, if any # - establish global hashes %params, %config , %globals and %capabilities # -sub get_configuration( $$$$$ ) { +sub get_configuration( $$$$ ) { - ( my ( $export, $update, $annotate, $directives ) , $checkinline ) = @_; + ( my ( $export, $update, $annotate ) , $checkinline ) = @_; $globals{EXPORT} = $export; @@ -5431,7 +5423,7 @@ sub get_configuration( $$$$$ ) { get_params( $export ); - process_shorewall_conf( $update, $annotate, $directives ); + process_shorewall_conf( $update, $annotate ); ensure_config_path; @@ -6099,7 +6091,7 @@ sub get_configuration( $$$$$ ) { $variables{$var} = $config{$val}; } - convert_to_directives if $directives; + convert_to_directives if $update; cleanup_iptables if $sillyname && ! $config{LOAD_HELPERS_ONLY}; } diff --git a/Shorewall/Perl/Shorewall/Misc.pm b/Shorewall/Perl/Shorewall/Misc.pm index f85c33ced..9c00af82f 100644 --- a/Shorewall/Perl/Shorewall/Misc.pm +++ b/Shorewall/Perl/Shorewall/Misc.pm @@ -617,8 +617,8 @@ sub process_stoppedrules() { sub setup_mss(); -sub add_common_rules ( $$$ ) { - my ( $upgrade_blacklist, $upgrade_tcrules , $upgrade_routestopped ) = @_; +sub add_common_rules ( $ ) { + my ( $upgrade ) = @_; my $interface; my $chainref; my $target; @@ -788,8 +788,8 @@ sub add_common_rules ( $$$ ) { run_user_exit1 'initdone'; - if ( $upgrade_blacklist ) { - exit 0 unless convert_blacklist || $upgrade_tcrules || $upgrade_routestopped; + if ( $upgrade ) { + convert_blacklist; } elsif ( -f ( my $fn = find_file 'blacklist' ) ) { warning_message "The blacklist file is no longer supported -- use '$product update -b' to convert $fn to the equivalent blrules file"; } @@ -2252,7 +2252,7 @@ sub setup_mss( ) { # Compile the stop_firewall() function # sub compile_stop_firewall( $$$$ ) { - my ( $test, $export, $have_arptables, $routestopped ) = @_; + my ( $test, $export, $have_arptables, $convert ) = @_; my $input = $filter_table->{INPUT}; my $output = $filter_table->{OUTPUT}; @@ -2430,10 +2430,10 @@ EOF } } - if ( $routestopped ) { + if ( $convert ) { convert_routestopped; } elsif ( -f ( my $fn = find_file 'routestopped' ) ) { - warning_message "The routestopped file is no longer supported - use '$product update -s' to convert $fn to an equivalent 'stoppedrules' file"; + warning_message "The routestopped file is no longer supported - use '$product update' to convert $fn to an equivalent 'stoppedrules' file"; } process_stoppedrules; diff --git a/Shorewall/Perl/compiler.pl b/Shorewall/Perl/compiler.pl index 067d6730c..35ec7ff6a 100755 --- a/Shorewall/Perl/compiler.pl +++ b/Shorewall/Perl/compiler.pl @@ -41,6 +41,7 @@ # --shorewallrc1= # Path to export shorewallrc file. # --config_path= # Search path for config files # --inline # Update alternative column specifications +# --update # Update configuration to this release # --tcrules # Create mangle from tcrules # --routestopped # Create stoppedrules from routestopped # --notrack # Create conntrack from notrack @@ -72,15 +73,10 @@ usage: compiler.pl [