1 diff -Nur wondershaper-1.1a/wshaper wondershaper-1.1a_openwrt/wshaper
2 --- wondershaper-1.1a/wshaper 2002-04-16 16:26:35.000000000 +0200
3 +++ wondershaper-1.1a_openwrt/wshaper 2005-09-09 00:46:22.095406568 +0200
9 -# please read the README before filling out these values
11 -# Set the following values to somewhat less than your actual download
12 -# and uplink speed. In kilobits. Also set the device that is to be shaped.
17 -# low priority OUTGOING traffic - you can leave this blank if you want
18 -# low priority source netmasks
21 -# low priority destination netmasks
24 -# low priority source ports
27 -# low priority destination ports
30 -# Now remove the following two lines :-)
32 -echo Please read the documentation in 'README' first :-\)
35 -#########################################################
39 if [ "$1" = "status" ]
51 # bulk and default class 1:20 - gets slightly less traffic,
52 # and a lower priority:
54 -tc class add dev $DEV parent 1:1 classid 1:20 cbq rate $[9*$UPLINK/10]kbit \
55 +tc class add dev $DEV parent 1:1 classid 1:20 cbq rate $((9*$UPLINK/10))kbit \
56 allot 1600 prio 2 avpkt 1000
60 -tc class add dev $DEV parent 1:1 classid 1:30 cbq rate $[8*$UPLINK/10]kbit \
61 +tc class add dev $DEV parent 1:1 classid 1:30 cbq rate $((8*$UPLINK/10))kbit \
62 allot 1600 prio 2 avpkt 1000
64 # all get Stochastic Fairness:
65 diff -Nur wondershaper-1.1a/wshaper.conf wondershaper-1.1a_openwrt/wshaper.conf
66 --- wondershaper-1.1a/wshaper.conf 1970-01-01 01:00:00.000000000 +0100
67 +++ wondershaper-1.1a_openwrt/wshaper.conf 2005-09-09 00:31:54.239340744 +0200
70 +# please read the README before filling out these values
72 +# Set the following values to somewhat less than your actual download
73 +# and uplink speed. In kilobits.
77 +# low priority OUTGOING traffic - you can leave this blank if you want
78 +# low priority source netmasks
81 +# low priority destination netmasks
84 +# low priority source ports
87 +# low priority destination ports
91 +DEV=$(nvram get wan_ifname)
96 diff -Nur wondershaper-1.1a/wshaper.htb wondershaper-1.1a_openwrt/wshaper.htb
97 --- wondershaper-1.1a/wshaper.htb 2002-04-16 16:26:51.000000000 +0200
98 +++ wondershaper-1.1a_openwrt/wshaper.htb 2005-09-11 12:03:39.756950000 +0200
103 -# please read the README before filling out these values
105 -# Set the following values to somewhat less than your actual download
106 -# and uplink speed. In kilobits. Also set the device that is to be shaped.
112 -# low priority OUTGOING traffic - you can leave this blank if you want
113 -# low priority source netmasks
116 -# low priority destination netmasks
121 -# low priority source ports
124 -# low priority destination ports
128 -# Now remove the following two lines :-)
130 -echo Please read the documentation in 'README' first
134 if [ "$1" = "status" ]
136 - tc -s qdisc ls dev $DEV
137 - tc -s class ls dev $DEV
138 + $TC -s qdisc ls dev $DEV
139 + $TC -s class ls dev $DEV
144 # clean existing down- and uplink qdiscs, hide errors
145 -tc qdisc del dev $DEV root 2> /dev/null > /dev/null
146 -tc qdisc del dev $DEV ingress 2> /dev/null > /dev/null
147 +$TC qdisc del dev $DEV root 2> /dev/null > /dev/null
148 +$TC qdisc del dev $DEV ingress 2> /dev/null > /dev/null
156 +# wondershaper must be executed everytime an interface comes up
157 +# if we have dynamic interface ppp0 add wondershaper to ip-up
158 +if [ $DEV = "ppp0" ] && ! grep -q wshaper /etc/ppp/ip-up
160 + echo "/usr/sbin/wshaper" >> /etc/ppp/ip-up
165 +# load the needed kernel modules
166 +for module in sch_prio sch_htb sch_sfq sch_ingress cls_tcindex cls_fw cls_route cls_u32
168 + insmod $module 2> /dev/null > /dev/null
173 # install root HTB, point default traffic to 1:20:
175 -tc qdisc add dev $DEV root handle 1: htb default 20
176 +$TC qdisc add dev $DEV root handle 1: htb default 20
178 # shape everything at $UPLINK speed - this prevents huge queues in your
179 # DSL modem which destroy latency:
181 -tc class add dev $DEV parent 1: classid 1:1 htb rate ${UPLINK}kbit burst 6k
182 +$TC class add dev $DEV parent 1: classid 1:1 htb rate ${UPLINK}kbit burst 6k
184 # high prio class 1:10:
186 -tc class add dev $DEV parent 1:1 classid 1:10 htb rate ${UPLINK}kbit \
187 +$TC class add dev $DEV parent 1:1 classid 1:10 htb rate ${UPLINK}kbit \
190 # bulk & default class 1:20 - gets slightly less traffic,
191 # and a lower priority:
193 -tc class add dev $DEV parent 1:1 classid 1:20 htb rate $[9*$UPLINK/10]kbit \
194 +$TC class add dev $DEV parent 1:1 classid 1:20 htb rate $((9*$UPLINK/10))kbit \
197 -tc class add dev $DEV parent 1:1 classid 1:30 htb rate $[8*$UPLINK/10]kbit \
198 +$TC class add dev $DEV parent 1:1 classid 1:30 htb rate $((8*$UPLINK/10))kbit \
201 # all get Stochastic Fairness:
202 -tc qdisc add dev $DEV parent 1:10 handle 10: sfq perturb 10
203 -tc qdisc add dev $DEV parent 1:20 handle 20: sfq perturb 10
204 -tc qdisc add dev $DEV parent 1:30 handle 30: sfq perturb 10
205 +$TC qdisc add dev $DEV parent 1:10 handle 10: sfq perturb 10
206 +$TC qdisc add dev $DEV parent 1:20 handle 20: sfq perturb 10
207 +$TC qdisc add dev $DEV parent 1:30 handle 30: sfq perturb 10
209 # TOS Minimum Delay (ssh, NOT scp) in 1:10:
211 -tc filter add dev $DEV parent 1:0 protocol ip prio 10 u32 \
212 +$TC filter add dev $DEV parent 1:0 protocol ip prio 10 u32 \
213 match ip tos 0x10 0xff flowid 1:10
215 # ICMP (ip protocol 1) in the interactive class 1:10 so we
216 # can do measurements & impress our friends:
217 -tc filter add dev $DEV parent 1:0 protocol ip prio 10 u32 \
218 +$TC filter add dev $DEV parent 1:0 protocol ip prio 10 u32 \
219 match ip protocol 1 0xff flowid 1:10
221 # To speed up downloads while an upload is going on, put ACK packets in
222 # the interactive class:
224 -tc filter add dev $DEV parent 1: protocol ip prio 10 u32 \
225 +$TC filter add dev $DEV parent 1: protocol ip prio 10 u32 \
226 match ip protocol 6 0xff \
227 match u8 0x05 0x0f at 0 \
228 match u16 0x0000 0xffc0 at 2 \
230 # some traffic however suffers a worse fate
231 for a in $NOPRIOPORTDST
233 - tc filter add dev $DEV parent 1: protocol ip prio 14 u32 \
234 + $TC filter add dev $DEV parent 1: protocol ip prio 14 u32 \
235 match ip dport $a 0xffff flowid 1:30
238 for a in $NOPRIOPORTSRC
240 - tc filter add dev $DEV parent 1: protocol ip prio 15 u32 \
241 + $TC filter add dev $DEV parent 1: protocol ip prio 15 u32 \
242 match ip sport $a 0xffff flowid 1:30
245 for a in $NOPRIOHOSTSRC
247 - tc filter add dev $DEV parent 1: protocol ip prio 16 u32 \
248 + $TC filter add dev $DEV parent 1: protocol ip prio 16 u32 \
249 match ip src $a flowid 1:30
252 for a in $NOPRIOHOSTDST
254 - tc filter add dev $DEV parent 1: protocol ip prio 17 u32 \
255 + $TC filter add dev $DEV parent 1: protocol ip prio 17 u32 \
256 match ip dst $a flowid 1:30
259 # rest is 'non-interactive' ie 'bulk' and ends up in 1:20
261 -tc filter add dev $DEV parent 1: protocol ip prio 18 u32 \
262 +$TC filter add dev $DEV parent 1: protocol ip prio 18 u32 \
263 match ip dst 0.0.0.0/0 flowid 1:20
266 @@ -136,12 +129,12 @@
268 # attach ingress policer:
270 -tc qdisc add dev $DEV handle ffff: ingress
271 +$TC qdisc add dev $DEV handle ffff: ingress
273 # filter *everything* to it (0.0.0.0/0), drop everything that's
274 # coming in too fast:
276 -tc filter add dev $DEV parent ffff: protocol ip prio 50 u32 match ip src \
277 +$TC filter add dev $DEV parent ffff: protocol ip prio 50 u32 match ip src \
278 0.0.0.0/0 police rate ${DOWNLINK}kbit burst 10k drop flowid :1