1 diff -Nur wondershaper-1.1a/wshaper.conf wondershaper-1.1a_openwrt/wshaper.conf
2 --- wondershaper-1.1a/wshaper.conf 1970-01-01 01:00:00.000000000 +0100
3 +++ wondershaper-1.1a_openwrt/wshaper.conf 2005-09-09 00:31:54.239340744 +0200
6 +# please read the README before filling out these values
8 +# Set the following values to somewhat less than your actual download
9 +# and uplink speed. In kilobits.
13 +# low priority OUTGOING traffic - you can leave this blank if you want
14 +# low priority source netmasks
17 +# low priority destination netmasks
20 +# low priority source ports
23 +# low priority destination ports
27 +DEV=$(nvram get wan_ifname)
32 diff -Nur wondershaper-1.1a/wshaper.htb wondershaper-1.1a_openwrt/wshaper.htb
33 --- wondershaper-1.1a/wshaper.htb 2002-04-16 16:26:51.000000000 +0200
34 +++ wondershaper-1.1a_openwrt/wshaper.htb 2005-09-11 13:24:56.143626544 +0200
39 -# please read the README before filling out these values
41 -# Set the following values to somewhat less than your actual download
42 -# and uplink speed. In kilobits. Also set the device that is to be shaped.
48 -# low priority OUTGOING traffic - you can leave this blank if you want
49 -# low priority source netmasks
52 -# low priority destination netmasks
57 -# low priority source ports
60 -# low priority destination ports
64 -# Now remove the following two lines :-)
66 -echo Please read the documentation in 'README' first
70 if [ "$1" = "status" ]
72 - tc -s qdisc ls dev $DEV
73 - tc -s class ls dev $DEV
74 + $TC -s qdisc ls dev $DEV
75 + $TC -s class ls dev $DEV
80 # clean existing down- and uplink qdiscs, hide errors
81 -tc qdisc del dev $DEV root 2> /dev/null > /dev/null
82 -tc qdisc del dev $DEV ingress 2> /dev/null > /dev/null
83 +$TC qdisc del dev $DEV root 2> /dev/null > /dev/null
84 +$TC qdisc del dev $DEV ingress 2> /dev/null > /dev/null
92 +# wondershaper must be executed everytime an interface comes up
93 +# if we have dynamic interface ppp0 add wondershaper to ip-up
94 +if [ $DEV = "ppp0" ] && ! grep -q wshaper /etc/ppp/ip-up
96 + echo "/usr/sbin/wshaper" >> /etc/ppp/ip-up
97 + chmod 755 /etc/ppp/ip-up
102 +# load the needed kernel modules
103 +for module in sch_prio sch_htb sch_sfq sch_ingress cls_tcindex cls_fw cls_route cls_u32
105 + insmod $module 2> /dev/null > /dev/null
110 # install root HTB, point default traffic to 1:20:
112 -tc qdisc add dev $DEV root handle 1: htb default 20
113 +$TC qdisc add dev $DEV root handle 1: htb default 20
115 # shape everything at $UPLINK speed - this prevents huge queues in your
116 # DSL modem which destroy latency:
118 -tc class add dev $DEV parent 1: classid 1:1 htb rate ${UPLINK}kbit burst 6k
119 +$TC class add dev $DEV parent 1: classid 1:1 htb rate ${UPLINK}kbit burst 6k
121 # high prio class 1:10:
123 -tc class add dev $DEV parent 1:1 classid 1:10 htb rate ${UPLINK}kbit \
124 +$TC class add dev $DEV parent 1:1 classid 1:10 htb rate ${UPLINK}kbit \
127 # bulk & default class 1:20 - gets slightly less traffic,
128 # and a lower priority:
130 -tc class add dev $DEV parent 1:1 classid 1:20 htb rate $[9*$UPLINK/10]kbit \
131 +$TC class add dev $DEV parent 1:1 classid 1:20 htb rate $((9*$UPLINK/10))kbit \
134 -tc class add dev $DEV parent 1:1 classid 1:30 htb rate $[8*$UPLINK/10]kbit \
135 +$TC class add dev $DEV parent 1:1 classid 1:30 htb rate $((8*$UPLINK/10))kbit \
138 # all get Stochastic Fairness:
139 -tc qdisc add dev $DEV parent 1:10 handle 10: sfq perturb 10
140 -tc qdisc add dev $DEV parent 1:20 handle 20: sfq perturb 10
141 -tc qdisc add dev $DEV parent 1:30 handle 30: sfq perturb 10
142 +$TC qdisc add dev $DEV parent 1:10 handle 10: sfq perturb 10
143 +$TC qdisc add dev $DEV parent 1:20 handle 20: sfq perturb 10
144 +$TC qdisc add dev $DEV parent 1:30 handle 30: sfq perturb 10
146 # TOS Minimum Delay (ssh, NOT scp) in 1:10:
148 -tc filter add dev $DEV parent 1:0 protocol ip prio 10 u32 \
149 +$TC filter add dev $DEV parent 1:0 protocol ip prio 10 u32 \
150 match ip tos 0x10 0xff flowid 1:10
152 # ICMP (ip protocol 1) in the interactive class 1:10 so we
153 # can do measurements & impress our friends:
154 -tc filter add dev $DEV parent 1:0 protocol ip prio 10 u32 \
155 +$TC filter add dev $DEV parent 1:0 protocol ip prio 10 u32 \
156 match ip protocol 1 0xff flowid 1:10
158 # To speed up downloads while an upload is going on, put ACK packets in
159 # the interactive class:
161 -tc filter add dev $DEV parent 1: protocol ip prio 10 u32 \
162 +$TC filter add dev $DEV parent 1: protocol ip prio 10 u32 \
163 match ip protocol 6 0xff \
164 match u8 0x05 0x0f at 0 \
165 match u16 0x0000 0xffc0 at 2 \
167 # some traffic however suffers a worse fate
168 for a in $NOPRIOPORTDST
170 - tc filter add dev $DEV parent 1: protocol ip prio 14 u32 \
171 + $TC filter add dev $DEV parent 1: protocol ip prio 14 u32 \
172 match ip dport $a 0xffff flowid 1:30
175 for a in $NOPRIOPORTSRC
177 - tc filter add dev $DEV parent 1: protocol ip prio 15 u32 \
178 + $TC filter add dev $DEV parent 1: protocol ip prio 15 u32 \
179 match ip sport $a 0xffff flowid 1:30
182 for a in $NOPRIOHOSTSRC
184 - tc filter add dev $DEV parent 1: protocol ip prio 16 u32 \
185 + $TC filter add dev $DEV parent 1: protocol ip prio 16 u32 \
186 match ip src $a flowid 1:30
189 for a in $NOPRIOHOSTDST
191 - tc filter add dev $DEV parent 1: protocol ip prio 17 u32 \
192 + $TC filter add dev $DEV parent 1: protocol ip prio 17 u32 \
193 match ip dst $a flowid 1:30
196 # rest is 'non-interactive' ie 'bulk' and ends up in 1:20
198 -tc filter add dev $DEV parent 1: protocol ip prio 18 u32 \
199 +$TC filter add dev $DEV parent 1: protocol ip prio 18 u32 \
200 match ip dst 0.0.0.0/0 flowid 1:20
203 @@ -136,12 +130,12 @@
205 # attach ingress policer:
207 -tc qdisc add dev $DEV handle ffff: ingress
208 +$TC qdisc add dev $DEV handle ffff: ingress
210 # filter *everything* to it (0.0.0.0/0), drop everything that's
211 # coming in too fast:
213 -tc filter add dev $DEV parent ffff: protocol ip prio 50 u32 match ip src \
214 +$TC filter add dev $DEV parent ffff: protocol ip prio 50 u32 match ip src \
215 0.0.0.0/0 police rate ${DOWNLINK}kbit burst 10k drop flowid :1