mirror of
https://gitlab.com/shorewall/code.git
synced 2024-12-15 02:41:01 +01:00
Improve editing of TC file entries
git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@4732 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
parent
30b1cf7153
commit
6f8f080767
@ -44,22 +44,23 @@ setup_traffic_shaping()
|
|||||||
local rateunit rate
|
local rateunit rate
|
||||||
rate=$1
|
rate=$1
|
||||||
rateunit=$( echo $rate | sed -e 's/[0-9]*//')
|
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
|
case $rateunit in
|
||||||
kbit)
|
kbit|Kbit)
|
||||||
rate=$rate
|
rate=$rate
|
||||||
;;
|
;;
|
||||||
mbit)
|
mbit|Mbit)
|
||||||
rate=$(expr $rate \* 1024)
|
rate=$(expr $rate \* 1024)
|
||||||
;;
|
;;
|
||||||
mbps)
|
mbps|Mbps)
|
||||||
rate=$(expr $rate \* 8192)
|
rate=$(expr $rate \* 8192)
|
||||||
;;
|
;;
|
||||||
kbps)
|
kbps|Kbps)
|
||||||
rate=$(expr $rate \* 8)
|
rate=$(expr $rate \* 8)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
[ -n "$rateunit" ] && fatal_error "Invalid Rate ($1)"
|
||||||
rate=$(expr $rate / 128)
|
rate=$(expr $rate / 128)
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@ -134,6 +135,8 @@ setup_traffic_shaping()
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
list_search $device $devices && fatal_error "Interface $device is defined more than once in tcdevices"
|
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"
|
tc_all_devices="$tc_all_devices $device"
|
||||||
done < $TMP_DIR/tcdevices
|
done < $TMP_DIR/tcdevices
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user