From 5551fe45899928fcfd4d8afb5105d12ab1720c36 Mon Sep 17 00:00:00 2001 From: teastep Date: Wed, 1 Nov 2006 18:57:35 +0000 Subject: [PATCH] Avoid compiling traffic shaping twice git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@4781 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall/changelog.txt | 2 ++ Shorewall/compiler | 26 +++++++++++++++++++++----- Shorewall/lib.tc | 17 +++++++++++++++++ 3 files changed, 40 insertions(+), 5 deletions(-) diff --git a/Shorewall/changelog.txt b/Shorewall/changelog.txt index b47631c47..f6d23e550 100644 --- a/Shorewall/changelog.txt +++ b/Shorewall/changelog.txt @@ -9,6 +9,8 @@ Changes in 3.3.4 4) Turn off POLICY_MATCH if no IPSEC. +5) Only compile traffic shaping once. + Changes in 3.3.4 1) Make exclusion work with "show zones" diff --git a/Shorewall/compiler b/Shorewall/compiler index 5486f34a0..7ccd41cd1 100755 --- a/Shorewall/compiler +++ b/Shorewall/compiler @@ -937,8 +937,11 @@ setup_tc1() { save_progress_message "Setting up Traffic Control..." append_file $TC_SCRIPT elif [ "$TC_ENABLED" = Internal ]; then - strip_file_and_lib_load tcdevices tc - strip_file_and_lib_load tcclasses tc && setup_traffic_shaping + if [ -n "$LIB_tc_LOADED" ]; then + save_command + save_command setup_traffic_shaping + save_command + fi fi } @@ -1047,8 +1050,10 @@ __EOF__ if [ -n "$TC_SCRIPT" ]; then save_progress_message "Refreshing Traffic Shaping" run_user_exit $TC_SCRIPT - elif [ "$TC_ENABLED" = Internal ]; then - [ -n "$LIB_tc_LOADED" ] && setup_traffic_shaping + elif [ "$TC_ENABLED" = Internal -a -n "$LIB_tc_LOADED" ]; then + save_command + save_command setup_traffic_shaping + save_command fi } @@ -1089,6 +1094,7 @@ compile_refresh_firewall() INDENT="" save_command "}" + save_command } @@ -4540,7 +4546,7 @@ activate_rules() fi done # - # Now add the jumps to the interface (first) chains from FORWARD, INPUT and POSTROUTING + # Now add the jumps to the interface chains from FORWARD, INPUT, OUTPUT and POSTROUTING # for interface in $ALL_INTERFACES ; do run_iptables -A FORWARD -i $interface -j $(forward_chain $interface) @@ -5227,6 +5233,16 @@ __EOF__ [ -d \${VARDIR} ] || mkdir -p \${VARDIR} } +__EOF__ + + if [ "$TC_ENABLED" = Internal ]; then + strip_file_and_lib_load tcdevices tc + strip_file_and_lib_load tcclasses tc + + [ -n "$LIB_tc_LOADED" ] && setup_traffic_shaping + fi + + cat >&3 << __EOF__ # # Start/Restart/Reload the firewall diff --git a/Shorewall/lib.tc b/Shorewall/lib.tc index ad4c41859..0e632ada5 100644 --- a/Shorewall/lib.tc +++ b/Shorewall/lib.tc @@ -291,6 +291,17 @@ setup_traffic_shaping() validate_tcdevices_file validate_tcclasses_file + cat >&3 << __EOF__ + +# +# Set up Traffic Shaping +# +setup_traffic_shaping() +{ +__EOF__ + + INDENT=" " + if [ -s $TMP_DIR/tcdevices ]; then save_progress_message "Setting up Traffic Control..." progress_message2 "$DOING $devfile..." @@ -330,5 +341,11 @@ setup_traffic_shaping() done < $TMP_DIR/tcclasses [ -n "$last_device" ] && finish_device + fi + + INDENT= + + save_command "}" + save_command }