From 6f8f08076728c428ab3fac6855ff5499163e3ad1 Mon Sep 17 00:00:00 2001 From: teastep Date: Wed, 25 Oct 2006 19:32:59 +0000 Subject: [PATCH] Improve editing of TC file entries git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@4732 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall/lib.tc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Shorewall/lib.tc b/Shorewall/lib.tc index 9be4a3a61..2290b3ca6 100644 --- a/Shorewall/lib.tc +++ b/Shorewall/lib.tc @@ -44,22 +44,23 @@ setup_traffic_shaping() local rateunit rate rate=$1 rateunit=$( echo $rate | sed -e 's/[0-9]*//') - rate=$( echo $rate | sed -e 's/[a-z]*//g') + rate=$( echo $rate | sed -e 's/[a-zA-Z]*//g') case $rateunit in - kbit) + kbit|Kbit) rate=$rate ;; - mbit) + mbit|Mbit) rate=$(expr $rate \* 1024) ;; - mbps) + mbps|Mbps) rate=$(expr $rate \* 8192) ;; - kbps) + kbps|Kbps) rate=$(expr $rate \* 8) ;; *) + [ -n "$rateunit" ] && fatal_error "Invalid Rate ($1)" rate=$(expr $rate / 128) ;; esac @@ -134,6 +135,8 @@ setup_traffic_shaping() ;; esac list_search $device $devices && fatal_error "Interface $device is defined more than once in tcdevices" + inband=$(rate_to_kbit $inband) + outband=$(rate_to_kbit $outband) tc_all_devices="$tc_all_devices $device" done < $TMP_DIR/tcdevices }