source: freewrt/package/wondershaper/patches/01-change-default.patch@ 6fd6093

freewrt_1_0 freewrt_2_0
Last change on this file since 6fd6093 was 6fd6093, checked in by Waldemar Brodkorb <wbx@…>, 19 years ago

add a startup script

git-svn-id: svn://www.freewrt.org/branches/freewrt_1_0@2346 afb5a338-a214-0410-bd46-81f09a774fd1

  • Property mode set to 100644
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.
     6DOWNLINK=1000
     7UPLINK=220
     8
     9# low priority OUTGOING traffic - you can leave this blank if you want
     10# low priority source netmasks
     11NOPRIOHOSTSRC=80
     12
     13# low priority destination netmasks
     14NOPRIOHOSTDST=
     15
     16# low priority source ports
     17NOPRIOPORTSRC=
     18
     19# low priority destination ports
     20NOPRIOPORTDST=
     21
     22# WAN device
     23DEV=ppp0
     24
     25# tc location
     26TC=/usr/sbin/tc
     27
  • wondershaper-1.

    diff -Nur wondershaper-1.1a/wshaper.htb wondershaper-1.1a_openwrt/wshaper.htb
    old new  
    1 #!/bin/bash
     1#!/bin/ash
    22# 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
    185
    19 # low priority source ports
    20 NOPRIOPORTSRC=
    216
    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
    308
    319if [ "$1" = "status" ]
    3210then
    33         tc -s qdisc ls dev $DEV
    34         tc -s class ls dev $DEV
     11        $TC -s qdisc ls dev $DEV
     12        $TC -s class ls dev $DEV
    3513        exit
    3614fi
    3715
    3816
    3917# clean existing down- and uplink qdiscs, hide errors
    40 tc qdisc del dev $DEV root    2> /dev/null > /dev/null
    41 tc qdisc del dev $DEV ingress 2> /dev/null > /dev/null
     18$TC qdisc del dev $DEV root    2> /dev/null > /dev/null
     19$TC qdisc del dev $DEV ingress 2> /dev/null > /dev/null
    4220
    4321if [ "$1" = "stop" ]
    4422then
     
    4624fi
    4725
    4826
     27# wondershaper must be executed everytime an interface comes up
     28# if we have dynamic interface ppp0 add wondershaper to ip-up
     29if [ $DEV = "ppp0" ] && ! grep -q wshaper /etc/ppp/ip-up
     30then
     31  echo "/usr/sbin/wshaper" >> /etc/ppp/ip-up
     32  chmod 755 /etc/ppp/ip-up
     33fi
     34
     35
     36
     37# load the needed kernel modules
     38for module in sch_prio sch_htb sch_sfq sch_ingress cls_tcindex cls_fw cls_route cls_u32
     39do
     40  insmod $module 2> /dev/null > /dev/null
     41done
     42
    4943###### uplink
    5044
    5145# install root HTB, point default traffic to 1:20:
    5246
    53 tc qdisc add dev $DEV root handle 1: htb default 20
     47$TC qdisc add dev $DEV root handle 1: htb default 20
    5448
    5549# shape everything at $UPLINK speed - this prevents huge queues in your
    5650# DSL modem which destroy latency:
    5751
    58 tc class add dev $DEV parent 1: classid 1:1 htb rate ${UPLINK}kbit burst 6k
     52$TC class add dev $DEV parent 1: classid 1:1 htb rate ${UPLINK}kbit burst 6k
    5953
    6054# high prio class 1:10:
    6155
    62 tc class 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 \
    6357   burst 6k prio 1
    6458
    6559# bulk & default class 1:20 - gets slightly less traffic,
    6660# and a lower priority:
    6761
    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 \
    6963   burst 6k prio 2
    7064
    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 \
    7266   burst 6k prio 2
    7367
    7468# all get Stochastic Fairness:
    75 tc qdisc add dev $DEV parent 1:10 handle 10: sfq perturb 10
    76 tc qdisc add dev $DEV parent 1:20 handle 20: sfq perturb 10
    77 tc qdisc add dev $DEV parent 1:30 handle 30: sfq perturb 10
     69$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
    7872
    7973# TOS Minimum Delay (ssh, NOT scp) in 1:10:
    8074
    81 tc filter 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 \
    8276      match ip tos 0x10 0xff  flowid 1:10
    8377
    8478# ICMP (ip protocol 1) in the interactive class 1:10 so we
    8579# can do measurements & impress our friends:
    86 tc filter 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 \
    8781        match ip protocol 1 0xff flowid 1:10
    8882
    8983# To speed up downloads while an upload is going on, put ACK packets in
    9084# the interactive class:
    9185
    92 tc filter add dev $DEV parent 1: protocol ip prio 10 u32 \
     86$TC filter add dev $DEV parent 1: protocol ip prio 10 u32 \
    9387   match ip protocol 6 0xff \
    9488   match u8 0x05 0x0f at 0 \
    9589   match u16 0x0000 0xffc0 at 2 \
     
    10195# some traffic however suffers a worse fate
    10296for a in $NOPRIOPORTDST
    10397do
    104         tc filter add dev $DEV parent 1: protocol ip prio 14 u32 \
     98        $TC filter add dev $DEV parent 1: protocol ip prio 14 u32 \
    10599           match ip dport $a 0xffff flowid 1:30
    106100done
    107101
    108102for a in $NOPRIOPORTSRC
    109103do
    110         tc filter add dev $DEV parent 1: protocol ip prio 15 u32 \
     104        $TC filter add dev $DEV parent 1: protocol ip prio 15 u32 \
    111105           match ip sport $a 0xffff flowid 1:30
    112106done
    113107
    114108for a in $NOPRIOHOSTSRC
    115109do
    116         tc filter add dev $DEV parent 1: protocol ip prio 16 u32 \
     110        $TC filter add dev $DEV parent 1: protocol ip prio 16 u32 \
    117111           match ip src $a flowid 1:30
    118112done
    119113
    120114for a in $NOPRIOHOSTDST
    121115do
    122         tc filter add dev $DEV parent 1: protocol ip prio 17 u32 \
     116        $TC filter add dev $DEV parent 1: protocol ip prio 17 u32 \
    123117           match ip dst $a flowid 1:30
    124118done
    125119
    126120# rest is 'non-interactive' ie 'bulk' and ends up in 1:20
    127121
    128 tc filter add dev $DEV parent 1: protocol ip prio 18 u32 \
     122$TC filter add dev $DEV parent 1: protocol ip prio 18 u32 \
    129123   match ip dst 0.0.0.0/0 flowid 1:20
    130124
    131125
     
    136130#
    137131# attach ingress policer:
    138132
    139 tc qdisc add dev $DEV handle ffff: ingress
     133$TC qdisc add dev $DEV handle ffff: ingress
    140134
    141135# filter *everything* to it (0.0.0.0/0), drop everything that's
    142136# coming in too fast:
    143137
    144 tc filter 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 \
    145139   0.0.0.0/0 police rate ${DOWNLINK}kbit burst 10k drop flowid :1
    146140
    147141
Note: See TracBrowser for help on using the repository browser.