From 1af4d541a08a84a1ee713293b2194baf8589dced Mon Sep 17 00:00:00 2001 From: teastep Date: Sun, 9 Oct 2005 15:47:47 +0000 Subject: [PATCH] Add TC_ENABLED=Internal git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@2836 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall/changelog.txt | 2 +- Shorewall/firewall | 34 ++++++++++++++++++++++++++-------- Shorewall/releasenotes.txt | 23 ++++++++--------------- Shorewall/shorewall.conf | 17 ++++++++++------- 4 files changed, 45 insertions(+), 31 deletions(-) diff --git a/Shorewall/changelog.txt b/Shorewall/changelog.txt index 5a035ace0..f56bd0066 100755 --- a/Shorewall/changelog.txt +++ b/Shorewall/changelog.txt @@ -1,6 +1,6 @@ Changes in 2.5.9 -1) Add TC_SCRIPT +1) Add TC_ENABLED=Internal 2) Fix default tc class bug. diff --git a/Shorewall/firewall b/Shorewall/firewall index daa739a16..f0e013b44 100755 --- a/Shorewall/firewall +++ b/Shorewall/firewall @@ -3701,13 +3701,13 @@ setup_tc1() { run_iptables -t mangle -A FORWARD -j tcfor run_iptables -t mangle -A POSTROUTING -j tcpost - if [ -n "$TC_SCRIPT" ]; then + if [ -n "$TC_ENABLED" ]; then run_user_exit $TC_SCRIPT save_progress_message "Restoring Traffic Control..." save_command . $TC_SCRIPT - else + elif [ -n "$TC_ENABLED" ]; then setup_traffic_shaping fi } @@ -4129,7 +4129,7 @@ refresh_tc() { if [ -n "$TC_SCRIPT" ]; then run_user_exit $TC_SCRIPT - else + elif [ -n "$TC_ENABLED" ]; then setup_traffic_shaping fi @@ -9185,7 +9185,7 @@ do_initialize() { LOGLIMIT= ADD_IP_ALIASES= ADD_SNAT_ALIASES= - TC_SCRIPT= + TC_ENABLED= BLACKLIST_DISPOSITION= BLACKLIST_LOGLEVEL= CLAMPMSS= @@ -9434,10 +9434,28 @@ do_initialize() { ;; esac - if [ -n "$TC_SCRIPT" ] ; then - f="$TC_SCRIPT" - TC_SCRIPT=$(find_file $TC_SCRIPT) - [ -f $TC_SCRIPT ] || startup_error "Unable to find TC_SCRIPT file ($f)" + TC_SCRIPT= + + if [ -n "$TC_ENABLED" ] ; then + case "$TC_ENABLED" in + [Yy][Ee][Ss]) + TC_ENABLED= + TC_SCRIPT=$(find_file tcstart) + [ -f $TC_SCRIPT ] || startup_error "Unable to find tcstart file" + ;; + [Ii][Nn][Tt][Ee][Rr][Nn][Aa][Ll]) + TC_ENABLED=Yes + ;; + [Nn][Oo]) + TC_ENABLED= + ;; + esac + else + TC_ENABLED=Yes + fi + + if [ -n "$TC_ENABLED" ];then + [ -n "$MANGLE_ENABLED" ] || startup_error "Traffic Shaping requires mangle support in your kernel and iptables" fi [ "x${SHOREWALL_DIR}" = "x." ] && SHOREWALL_DIR="$PWD" diff --git a/Shorewall/releasenotes.txt b/Shorewall/releasenotes.txt index 058ef47fd..f29bd21c8 100755 --- a/Shorewall/releasenotes.txt +++ b/Shorewall/releasenotes.txt @@ -4,13 +4,10 @@ Problems Corrected in 2.5.9: New Features in 2.5.9: -1) A new TC_SCRIPT option replaces TC_ENABLED in shorewall.conf. If the - option is not set then the internal shaper (tc4shorewall by Arne - Bernin) is used. Otherwise, the script named in the variable is - used. - - Users who currently use an /etc/shorewall/tcstart file should set - TC_SCRIPT=/etc/shorewall/tcstart in shorewall.conf. +1) A new value is defined for the TC_ENABLED option in shorewall.conf to + enable the builtin tc4shorewall traffic shaper. If you set + TC_ENABLED=internal then tc4shorewall will be used. If the option is + set to Yes then Shorewall will continue to look for a 'tcstart' script. 2) The default traffic shaping class for a device was being incorrectly specified by tc4shorewall. @@ -205,14 +202,10 @@ Migration Considerations: Note that the rule is added at the front of the NEW section of the rules file. -11) A new TC_SCRIPT option replaces TC_ENABLED in shorewall.conf. If the - option is not set then the internal shaper (tc4shorewall by Arne - Bernin) is used. Otherwise, the script named in the variable is - used. - - Users who currently use an /etc/shorewall/tcstart file and wish to - continue to do so should set - TC_SCRIPT=/etc/shorewall/tcstart in shorewall.conf. +11) A new value is defined for the TC_ENABLED option in shorewall.conf to + enable the builtin tc4shorewall traffic shaper. If you set + TC_ENABLED=internal then tc4shorewall will be used. If the option is + set to Yes then Shorewall will continue to look for a 'tcstart' script. New Features in Shorewall 2.5.* diff --git a/Shorewall/shorewall.conf b/Shorewall/shorewall.conf index 4d3c3167c..0e6de3bc4 100755 --- a/Shorewall/shorewall.conf +++ b/Shorewall/shorewall.conf @@ -394,18 +394,21 @@ ADD_SNAT_ALIASES=No RETAIN_ALIASES=No # -# ENABLE EXTERNAL TRAFFIC SHAPER +# ENABLE TRAFFIC SHAPING # -# If you wish for Shorewall to run an external traffic shaping script such as -# WonderShaper then set TC_SCRIPT to the file name of that script. +# If you say "Yes" or "yes" here, Shorewall will use a script that you +# supply to configure traffic shaping. The script must be named 'tcstart' +# and must be placed in a directory on your CONFIG_PATH. # -# Example: TC_SCRIPT=/etc/shorewall/tcstart +# If you say "No" or "no" then traffic shaping is not enabled. # -# If you leave the option empty then Shorewall will use its internal traffic -# shaper "tc4shorewall" by Arne Bernin. +# If you set TC_ENABLED=Internal or internal or leave the option empty then +# Shorewall will use its builtin traffic shaper (tc4shorewall written by +# Arne Bernin). # +# See http://shorewall.net/traffic_shaping.htm for more information. -TC_SCRIPT= +TC_ENABLED=Internal # # Clear Traffic Shapping/Control