From: <abe...@us...> - 2015-12-30 21:54:27
|
Revision: 7432 http://sourceforge.net/p/astlinux/code/7432 Author: abelbeck Date: 2015-12-30 21:54:25 +0000 (Wed, 30 Dec 2015) Log Message: ----------- arnofw, traffic shaper plugin, automatically disable ethernet offloading on the shaper interface Modified Paths: -------------- branches/1.0/package/arnofw/traffic-shaper/60traffic-shaper.plugin.sh Modified: branches/1.0/package/arnofw/traffic-shaper/60traffic-shaper.plugin.sh =================================================================== --- branches/1.0/package/arnofw/traffic-shaper/60traffic-shaper.plugin.sh 2015-12-27 22:22:20 UTC (rev 7431) +++ branches/1.0/package/arnofw/traffic-shaper/60traffic-shaper.plugin.sh 2015-12-30 21:54:25 UTC (rev 7432) @@ -2,10 +2,10 @@ # -= Arno's iptables firewall - HTB & HFSC traffic shaper plugin =- # PLUGIN_NAME="Traffic-Shaper plugin" -PLUGIN_VERSION="1.2.08-astlinux" +PLUGIN_VERSION="1.2.09-astlinux" PLUGIN_CONF_FILE="traffic-shaper.conf" # -# Last changed : July 31, 2015 +# Last changed : December 30, 2015 # Requirements : kernel 2.6 + iproute2 # Comments : This plugin will shape traffic. It borrows heavily on # the logic of Maciej's original script (below), with @@ -207,6 +207,16 @@ fi } +disable_ethernet_offloading() +{ + local eth="$1" + + # Disable offloading on ethernet devices + if [ "$eth" != "${eth#eth}" ]; then + ethtool -K $eth tso off gso off gro off 2>/dev/null + fi +} + # Plugin start function plugin_start() { @@ -283,6 +293,8 @@ ul rate ${UPLINK}kbit incoming_traffic_limit $eif1 + + disable_ethernet_offloading $eif1 done # add SHAPER_CHAIN chain to mangle table in iptables @@ -348,6 +360,8 @@ tc qdisc add dev $eif1 parent 1:60 handle 60: sfq perturb 10 incoming_traffic_limit $eif1 + + disable_ethernet_offloading $eif1 done # add SHAPER_CHAIN chain to mangle table in iptables @@ -421,6 +435,11 @@ return 1 fi + if ! check_command ethtool; then + printf "\033[40m\033[1;31m${INDENT}ERROR: Required binary \"ethtool\" is not available!\n\033[0m" >&2 + return 1 + fi + return 0 } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |