source:
freewrt/package/wondershaper/patches/01-change-default.patch@
428f140
| Last change on this file since 428f140 was 57729ea, checked in by , 19 years ago | |
|---|---|
|
|
| File size: 6.4 KB | |
-
wondershaper-1.
diff -Nur wondershaper-1.1a/wshaper.conf wondershaper-1.1a_openwrt/wshaper.conf
old new 1 # Wonder Shaper 2 # please read the README before filling out these values 3 # 4 # Set the following values to somewhat less than your actual download 5 # and uplink speed. In kilobits. 6 DOWNLINK=1000 7 UPLINK=220 8 9 # low priority OUTGOING traffic - you can leave this blank if you want 10 # low priority source netmasks 11 NOPRIOHOSTSRC=80 12 13 # low priority destination netmasks 14 NOPRIOHOSTDST= 15 16 # low priority source ports 17 NOPRIOPORTSRC= 18 19 # low priority destination ports 20 NOPRIOPORTDST= 21 22 # WAN device 23 DEV=$(nvram get wan_ifname) 24 25 # tc location 26 TC=/usr/sbin/tc 27 -
wondershaper-1.
diff -Nur wondershaper-1.1a/wshaper.htb wondershaper-1.1a_openwrt/wshaper.htb
old new 1 #!/bin/ bash1 #!/bin/ash 2 2 # Wonder Shaper 3 # please read the README before filling out these values 4 # 5 # Set the following values to somewhat less than your actual download 6 # and uplink speed. In kilobits. Also set the device that is to be shaped. 7 8 DOWNLINK=800 9 UPLINK=220 10 DEV=ppp0 11 12 # low priority OUTGOING traffic - you can leave this blank if you want 13 # low priority source netmasks 14 NOPRIOHOSTSRC= 15 16 # low priority destination netmasks 17 NOPRIOHOSTDST= 3 . /etc/functions.sh 4 . /etc/wshaper.conf 18 5 19 # low priority source ports20 NOPRIOPORTSRC=21 6 22 # low priority destination ports 23 NOPRIOPORTDST= 24 25 26 # Now remove the following two lines :-) 27 28 echo Please read the documentation in 'README' first 29 exit 7 # do the magic 30 8 31 9 if [ "$1" = "status" ] 32 10 then 33 tc-s qdisc ls dev $DEV34 tc-s class ls dev $DEV11 $TC -s qdisc ls dev $DEV 12 $TC -s class ls dev $DEV 35 13 exit 36 14 fi 37 15 38 16 39 17 # clean existing down- and uplink qdiscs, hide errors 40 tcqdisc del dev $DEV root 2> /dev/null > /dev/null41 tcqdisc del dev $DEV ingress 2> /dev/null > /dev/null18 $TC qdisc del dev $DEV root 2> /dev/null > /dev/null 19 $TC qdisc del dev $DEV ingress 2> /dev/null > /dev/null 42 20 43 21 if [ "$1" = "stop" ] 44 22 then … … 46 24 fi 47 25 48 26 27 # wondershaper must be executed everytime an interface comes up 28 # if we have dynamic interface ppp0 add wondershaper to ip-up 29 if [ $DEV = "ppp0" ] && ! grep -q wshaper /etc/ppp/ip-up 30 then 31 echo "/usr/sbin/wshaper" >> /etc/ppp/ip-up 32 chmod 755 /etc/ppp/ip-up 33 fi 34 35 36 37 # load the needed kernel modules 38 for module in sch_prio sch_htb sch_sfq sch_ingress cls_tcindex cls_fw cls_route cls_u32 39 do 40 insmod $module 2> /dev/null > /dev/null 41 done 42 49 43 ###### uplink 50 44 51 45 # install root HTB, point default traffic to 1:20: 52 46 53 tcqdisc add dev $DEV root handle 1: htb default 2047 $TC qdisc add dev $DEV root handle 1: htb default 20 54 48 55 49 # shape everything at $UPLINK speed - this prevents huge queues in your 56 50 # DSL modem which destroy latency: 57 51 58 tcclass add dev $DEV parent 1: classid 1:1 htb rate ${UPLINK}kbit burst 6k52 $TC class add dev $DEV parent 1: classid 1:1 htb rate ${UPLINK}kbit burst 6k 59 53 60 54 # high prio class 1:10: 61 55 62 tcclass add dev $DEV parent 1:1 classid 1:10 htb rate ${UPLINK}kbit \56 $TC class add dev $DEV parent 1:1 classid 1:10 htb rate ${UPLINK}kbit \ 63 57 burst 6k prio 1 64 58 65 59 # bulk & default class 1:20 - gets slightly less traffic, 66 60 # and a lower priority: 67 61 68 tc class add dev $DEV parent 1:1 classid 1:20 htb rate $[9*$UPLINK/10]kbit \62 $TC class add dev $DEV parent 1:1 classid 1:20 htb rate $((9*$UPLINK/10))kbit \ 69 63 burst 6k prio 2 70 64 71 tc class add dev $DEV parent 1:1 classid 1:30 htb rate $[8*$UPLINK/10]kbit \65 $TC class add dev $DEV parent 1:1 classid 1:30 htb rate $((8*$UPLINK/10))kbit \ 72 66 burst 6k prio 2 73 67 74 68 # all get Stochastic Fairness: 75 tcqdisc add dev $DEV parent 1:10 handle 10: sfq perturb 1076 tcqdisc add dev $DEV parent 1:20 handle 20: sfq perturb 1077 tcqdisc add dev $DEV parent 1:30 handle 30: sfq perturb 1069 $TC qdisc add dev $DEV parent 1:10 handle 10: sfq perturb 10 70 $TC qdisc add dev $DEV parent 1:20 handle 20: sfq perturb 10 71 $TC qdisc add dev $DEV parent 1:30 handle 30: sfq perturb 10 78 72 79 73 # TOS Minimum Delay (ssh, NOT scp) in 1:10: 80 74 81 tcfilter add dev $DEV parent 1:0 protocol ip prio 10 u32 \75 $TC filter add dev $DEV parent 1:0 protocol ip prio 10 u32 \ 82 76 match ip tos 0x10 0xff flowid 1:10 83 77 84 78 # ICMP (ip protocol 1) in the interactive class 1:10 so we 85 79 # can do measurements & impress our friends: 86 tcfilter add dev $DEV parent 1:0 protocol ip prio 10 u32 \80 $TC filter add dev $DEV parent 1:0 protocol ip prio 10 u32 \ 87 81 match ip protocol 1 0xff flowid 1:10 88 82 89 83 # To speed up downloads while an upload is going on, put ACK packets in 90 84 # the interactive class: 91 85 92 tcfilter add dev $DEV parent 1: protocol ip prio 10 u32 \86 $TC filter add dev $DEV parent 1: protocol ip prio 10 u32 \ 93 87 match ip protocol 6 0xff \ 94 88 match u8 0x05 0x0f at 0 \ 95 89 match u16 0x0000 0xffc0 at 2 \ … … 101 95 # some traffic however suffers a worse fate 102 96 for a in $NOPRIOPORTDST 103 97 do 104 tcfilter add dev $DEV parent 1: protocol ip prio 14 u32 \98 $TC filter add dev $DEV parent 1: protocol ip prio 14 u32 \ 105 99 match ip dport $a 0xffff flowid 1:30 106 100 done 107 101 108 102 for a in $NOPRIOPORTSRC 109 103 do 110 tcfilter add dev $DEV parent 1: protocol ip prio 15 u32 \104 $TC filter add dev $DEV parent 1: protocol ip prio 15 u32 \ 111 105 match ip sport $a 0xffff flowid 1:30 112 106 done 113 107 114 108 for a in $NOPRIOHOSTSRC 115 109 do 116 tcfilter add dev $DEV parent 1: protocol ip prio 16 u32 \110 $TC filter add dev $DEV parent 1: protocol ip prio 16 u32 \ 117 111 match ip src $a flowid 1:30 118 112 done 119 113 120 114 for a in $NOPRIOHOSTDST 121 115 do 122 tcfilter add dev $DEV parent 1: protocol ip prio 17 u32 \116 $TC filter add dev $DEV parent 1: protocol ip prio 17 u32 \ 123 117 match ip dst $a flowid 1:30 124 118 done 125 119 126 120 # rest is 'non-interactive' ie 'bulk' and ends up in 1:20 127 121 128 tcfilter add dev $DEV parent 1: protocol ip prio 18 u32 \122 $TC filter add dev $DEV parent 1: protocol ip prio 18 u32 \ 129 123 match ip dst 0.0.0.0/0 flowid 1:20 130 124 131 125 … … 136 130 # 137 131 # attach ingress policer: 138 132 139 tcqdisc add dev $DEV handle ffff: ingress133 $TC qdisc add dev $DEV handle ffff: ingress 140 134 141 135 # filter *everything* to it (0.0.0.0/0), drop everything that's 142 136 # coming in too fast: 143 137 144 tcfilter add dev $DEV parent ffff: protocol ip prio 50 u32 match ip src \138 $TC filter add dev $DEV parent ffff: protocol ip prio 50 u32 match ip src \ 145 139 0.0.0.0/0 police rate ${DOWNLINK}kbit burst 10k drop flowid :1 146 140 147 141
Note:
See TracBrowser
for help on using the repository browser.
