diff options
author | wbx <wbx@hydrogenium.(none)> | 2009-05-17 14:41:34 +0200 |
---|---|---|
committer | wbx <wbx@hydrogenium.(none)> | 2009-05-17 14:41:34 +0200 |
commit | 219a6dab8995aad9ac4860cc1a84d6f3509a03a4 (patch) | |
tree | b9c0f3c43aebba2fcfef777592d0add39f2072f4 /package/wondershaper |
Initial import
Diffstat (limited to 'package/wondershaper')
-rw-r--r-- | package/wondershaper/Config.in | 10 | ||||
-rw-r--r-- | package/wondershaper/Makefile | 26 | ||||
-rw-r--r-- | package/wondershaper/files/wondershaper.init | 25 | ||||
-rw-r--r-- | package/wondershaper/ipkg/wondershaper.conffiles | 1 | ||||
-rw-r--r-- | package/wondershaper/ipkg/wondershaper.control | 5 | ||||
-rw-r--r-- | package/wondershaper/ipkg/wondershaper.postinst | 3 | ||||
-rw-r--r-- | package/wondershaper/patches/01-change-default.patch | 217 |
7 files changed, 287 insertions, 0 deletions
diff --git a/package/wondershaper/Config.in b/package/wondershaper/Config.in new file mode 100644 index 000000000..96a0e816d --- /dev/null +++ b/package/wondershaper/Config.in @@ -0,0 +1,10 @@ +config ADK_PACKAGE_WONDERSHAPER + prompt "wondershaper...................... The Wonder Shaper" + tristate + default n + select ADK_PACKAGE_TC + help + WonderShaper is a tc based traffic shaping tool. + + Depends: tc + diff --git a/package/wondershaper/Makefile b/package/wondershaper/Makefile new file mode 100644 index 000000000..13617cfec --- /dev/null +++ b/package/wondershaper/Makefile @@ -0,0 +1,26 @@ +# $Id$ +#- +# This file is part of the OpenADK project. OpenADK is copyrighted +# material, please see the LICENCE file in the top-level directory. + +include ${TOPDIR}/rules.mk + +PKG_NAME:= wondershaper +PKG_VERSION:= 1.1a +PKG_RELEASE:= 7 +PKG_MD5SUM:= bbc5a3a4485ab286e337ce8550e7b990 +MASTER_SITES:= http://lartc.org/wondershaper/ + +include ${TOPDIR}/mk/package.mk + +$(eval $(call PKG_template,WONDERSHAPER,wondershaper,${PKG_VERSION}-${PKG_RELEASE},${ARCH})) + +do-install: + ${INSTALL_DIR} ${IDIR_WONDERSHAPER}/usr/sbin/ + ${INSTALL_DIR} ${IDIR_WONDERSHAPER}/etc/init.d/ + ${INSTALL_BIN} ${WRKBUILD}/wshaper.htb ${IDIR_WONDERSHAPER}/usr/sbin/wshaper + ${INSTALL_DATA} ${WRKBUILD}/wshaper.conf ${IDIR_WONDERSHAPER}/etc/ + $(INSTALL_BIN) ./files/wondershaper.init \ + $(IDIR_WONDERSHAPER)/etc/init.d/wondershaper + +include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/wondershaper/files/wondershaper.init b/package/wondershaper/files/wondershaper.init new file mode 100644 index 000000000..ec5c36e76 --- /dev/null +++ b/package/wondershaper/files/wondershaper.init @@ -0,0 +1,25 @@ +#!/bin/sh +#FWINIT 80 +. /etc/rc.conf + +case $1 in +autostop) ;; +autostart) + test x"${wondershaper:-NO}" = x"NO" && exit 0 + exec sh $0 start + ;; +start) + /usr/sbin/wshaper start + ;; +stop) + /usr/sbin/wshaper stop + ;; +restart) + sh $0 stop + sh $0 start + ;; +*) + echo "Usage: $0 {start | stop | restart}" + ;; +esac +exit 0 diff --git a/package/wondershaper/ipkg/wondershaper.conffiles b/package/wondershaper/ipkg/wondershaper.conffiles new file mode 100644 index 000000000..14e366cc9 --- /dev/null +++ b/package/wondershaper/ipkg/wondershaper.conffiles @@ -0,0 +1 @@ +/etc/wshaper.conf diff --git a/package/wondershaper/ipkg/wondershaper.control b/package/wondershaper/ipkg/wondershaper.control new file mode 100644 index 000000000..d90c7bb6f --- /dev/null +++ b/package/wondershaper/ipkg/wondershaper.control @@ -0,0 +1,5 @@ +Package: wondershaper +Priority: optional +Section: net +Depends: tc +Description: WonderShaper is a tc based traffic shaping tool. diff --git a/package/wondershaper/ipkg/wondershaper.postinst b/package/wondershaper/ipkg/wondershaper.postinst new file mode 100644 index 000000000..6e6c384a0 --- /dev/null +++ b/package/wondershaper/ipkg/wondershaper.postinst @@ -0,0 +1,3 @@ +#!/bin/sh +. $IPKG_INSTROOT/etc/functions.sh +add_rcconf wondershaper wondershaper NO diff --git a/package/wondershaper/patches/01-change-default.patch b/package/wondershaper/patches/01-change-default.patch new file mode 100644 index 000000000..64ae1d267 --- /dev/null +++ b/package/wondershaper/patches/01-change-default.patch @@ -0,0 +1,217 @@ +diff -Nur wondershaper-1.1a/wshaper.conf wondershaper-1.1a_openwrt/wshaper.conf +--- wondershaper-1.1a/wshaper.conf 1970-01-01 01:00:00.000000000 +0100 ++++ wondershaper-1.1a_openwrt/wshaper.conf 2005-09-09 00:31:54.239340744 +0200 +@@ -0,0 +1,27 @@ ++# Wonder Shaper ++# please read the README before filling out these values ++# ++# Set the following values to somewhat less than your actual download ++# and uplink speed. In kilobits. ++DOWNLINK=1000 ++UPLINK=220 ++ ++# low priority OUTGOING traffic - you can leave this blank if you want ++# low priority source netmasks ++NOPRIOHOSTSRC=80 ++ ++# low priority destination netmasks ++NOPRIOHOSTDST= ++ ++# low priority source ports ++NOPRIOPORTSRC= ++ ++# low priority destination ports ++NOPRIOPORTDST= ++ ++# WAN device ++DEV=ppp0 ++ ++# tc location ++TC=/usr/sbin/tc ++ +diff -Nur wondershaper-1.1a/wshaper.htb wondershaper-1.1a_openwrt/wshaper.htb +--- wondershaper-1.1a/wshaper.htb 2002-04-16 16:26:51.000000000 +0200 ++++ wondershaper-1.1a_openwrt/wshaper.htb 2005-09-11 13:24:56.143626544 +0200 +@@ -1,44 +1,22 @@ +-#!/bin/bash ++#!/bin/ash + # Wonder Shaper +-# please read the README before filling out these values +-# +-# Set the following values to somewhat less than your actual download +-# and uplink speed. In kilobits. Also set the device that is to be shaped. +- +-DOWNLINK=800 +-UPLINK=220 +-DEV=ppp0 +- +-# low priority OUTGOING traffic - you can leave this blank if you want +-# low priority source netmasks +-NOPRIOHOSTSRC= +- +-# low priority destination netmasks +-NOPRIOHOSTDST= ++. /etc/functions.sh ++. /etc/wshaper.conf + +-# low priority source ports +-NOPRIOPORTSRC= + +-# low priority destination ports +-NOPRIOPORTDST= +- +- +-# Now remove the following two lines :-) +- +-echo Please read the documentation in 'README' first +-exit ++# do the magic + + if [ "$1" = "status" ] + then +- tc -s qdisc ls dev $DEV +- tc -s class ls dev $DEV ++ $TC -s qdisc ls dev $DEV ++ $TC -s class ls dev $DEV + exit + fi + + + # clean existing down- and uplink qdiscs, hide errors +-tc qdisc del dev $DEV root 2> /dev/null > /dev/null +-tc qdisc del dev $DEV ingress 2> /dev/null > /dev/null ++$TC qdisc del dev $DEV root 2> /dev/null > /dev/null ++$TC qdisc del dev $DEV ingress 2> /dev/null > /dev/null + + if [ "$1" = "stop" ] + then +@@ -46,50 +24,66 @@ + fi + + ++# wondershaper must be executed everytime an interface comes up ++# if we have dynamic interface ppp0 add wondershaper to ip-up ++if [ $DEV = "ppp0" ] && ! grep -q wshaper /etc/ppp/ip-up ++then ++ echo "/usr/sbin/wshaper" >> /etc/ppp/ip-up ++ chmod 755 /etc/ppp/ip-up ++fi ++ ++ ++ ++# load the needed kernel modules ++for module in sch_prio sch_htb sch_sfq sch_ingress cls_tcindex cls_fw cls_route cls_u32 ++do ++ insmod $module 2> /dev/null > /dev/null ++done ++ + ###### uplink + + # install root HTB, point default traffic to 1:20: + +-tc qdisc add dev $DEV root handle 1: htb default 20 ++$TC qdisc add dev $DEV root handle 1: htb default 20 + + # shape everything at $UPLINK speed - this prevents huge queues in your + # DSL modem which destroy latency: + +-tc class add dev $DEV parent 1: classid 1:1 htb rate ${UPLINK}kbit burst 6k ++$TC class add dev $DEV parent 1: classid 1:1 htb rate ${UPLINK}kbit burst 6k + + # high prio class 1:10: + +-tc class add dev $DEV parent 1:1 classid 1:10 htb rate ${UPLINK}kbit \ ++$TC class add dev $DEV parent 1:1 classid 1:10 htb rate ${UPLINK}kbit \ + burst 6k prio 1 + + # bulk & default class 1:20 - gets slightly less traffic, + # and a lower priority: + +-tc class add dev $DEV parent 1:1 classid 1:20 htb rate $[9*$UPLINK/10]kbit \ ++$TC class add dev $DEV parent 1:1 classid 1:20 htb rate $((9*$UPLINK/10))kbit \ + burst 6k prio 2 + +-tc class add dev $DEV parent 1:1 classid 1:30 htb rate $[8*$UPLINK/10]kbit \ ++$TC class add dev $DEV parent 1:1 classid 1:30 htb rate $((8*$UPLINK/10))kbit \ + burst 6k prio 2 + + # all get Stochastic Fairness: +-tc qdisc add dev $DEV parent 1:10 handle 10: sfq perturb 10 +-tc qdisc add dev $DEV parent 1:20 handle 20: sfq perturb 10 +-tc qdisc add dev $DEV parent 1:30 handle 30: sfq perturb 10 ++$TC qdisc add dev $DEV parent 1:10 handle 10: sfq perturb 10 ++$TC qdisc add dev $DEV parent 1:20 handle 20: sfq perturb 10 ++$TC qdisc add dev $DEV parent 1:30 handle 30: sfq perturb 10 + + # TOS Minimum Delay (ssh, NOT scp) in 1:10: + +-tc filter add dev $DEV parent 1:0 protocol ip prio 10 u32 \ ++$TC filter add dev $DEV parent 1:0 protocol ip prio 10 u32 \ + match ip tos 0x10 0xff flowid 1:10 + + # ICMP (ip protocol 1) in the interactive class 1:10 so we + # can do measurements & impress our friends: +-tc filter add dev $DEV parent 1:0 protocol ip prio 10 u32 \ ++$TC filter add dev $DEV parent 1:0 protocol ip prio 10 u32 \ + match ip protocol 1 0xff flowid 1:10 + + # To speed up downloads while an upload is going on, put ACK packets in + # the interactive class: + +-tc filter add dev $DEV parent 1: protocol ip prio 10 u32 \ ++$TC filter add dev $DEV parent 1: protocol ip prio 10 u32 \ + match ip protocol 6 0xff \ + match u8 0x05 0x0f at 0 \ + match u16 0x0000 0xffc0 at 2 \ +@@ -101,31 +95,31 @@ + # some traffic however suffers a worse fate + for a in $NOPRIOPORTDST + do +- tc filter add dev $DEV parent 1: protocol ip prio 14 u32 \ ++ $TC filter add dev $DEV parent 1: protocol ip prio 14 u32 \ + match ip dport $a 0xffff flowid 1:30 + done + + for a in $NOPRIOPORTSRC + do +- tc filter add dev $DEV parent 1: protocol ip prio 15 u32 \ ++ $TC filter add dev $DEV parent 1: protocol ip prio 15 u32 \ + match ip sport $a 0xffff flowid 1:30 + done + + for a in $NOPRIOHOSTSRC + do +- tc filter add dev $DEV parent 1: protocol ip prio 16 u32 \ ++ $TC filter add dev $DEV parent 1: protocol ip prio 16 u32 \ + match ip src $a flowid 1:30 + done + + for a in $NOPRIOHOSTDST + do +- tc filter add dev $DEV parent 1: protocol ip prio 17 u32 \ ++ $TC filter add dev $DEV parent 1: protocol ip prio 17 u32 \ + match ip dst $a flowid 1:30 + done + + # rest is 'non-interactive' ie 'bulk' and ends up in 1:20 + +-tc filter add dev $DEV parent 1: protocol ip prio 18 u32 \ ++$TC filter add dev $DEV parent 1: protocol ip prio 18 u32 \ + match ip dst 0.0.0.0/0 flowid 1:20 + + +@@ -136,12 +130,12 @@ + # + # attach ingress policer: + +-tc qdisc add dev $DEV handle ffff: ingress ++$TC qdisc add dev $DEV handle ffff: ingress + + # filter *everything* to it (0.0.0.0/0), drop everything that's + # coming in too fast: + +-tc filter add dev $DEV parent ffff: protocol ip prio 50 u32 match ip src \ ++$TC filter add dev $DEV parent ffff: protocol ip prio 50 u32 match ip src \ + 0.0.0.0/0 police rate ${DOWNLINK}kbit burst 10k drop flowid :1 + + |