Results 1 to 4 of 4

Thread: Wondershaper modification to exclude lan should be included

  1. #1
    Join Date
    Feb 2011
    Location
    UK
    Posts
    18

    Default Wondershaper modification to exclude lan should be included

    Hi all!

    I have just entered the world of openSUSE after a chain of other linux distros over the last few years. Btw I love it, its already my favourite.

    I have a suggestion for the wondershaper package. It is useless for most people who are behind a router, because any transfers between same-network computers are subject to the same rules = slow and unnecessary.

    I used #256461 - wondershaper: Option to limit range of rules? - Debian Bug report logs for these mods.

    Suggested /usr/sbin/wshaper.htb
    Code:
    #!/bin/bash
    #
    # 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.
    #
    # Source sysconfig file
    if [ -f /etc/sysconfig/wondershaper ]; then
    . /etc/sysconfig/wondershaper
    fi
    
    
    DOWNLINK="$WSHAPER_DOWNLINK"
    UPLINK="$WSHAPER_UPLINK"
    DEV="$WSHAPER_DEV"
    export DOWNLINK UPLINK DEV
    
    # low priority OUTGOING traffic - you can leave this blank if you want
    # low priority source netmasks
    NOPRIOHOSTSRC="$WSHAPER_NOPRIOHOSTSRC"
    
    # low priority destination netmasks
    NOPRIOHOSTDST="$WSHAPER_NOPRIOHOSTDST"
    
    # low priority source ports
    NOPRIOPORTSRC="$WSHAPER_NOPRIOPORTSRC"
    
    # low priority destination ports
    NOPRIOPORTDST="$WSHAPER_NOPRIOPORTDST"
    
    # Check for QOS in the kernel
    if tc -s qdisc ls dev lo > /dev/null 2>&1; then
            true
    else
            echo "Your Kernel lacks QOS Support or you dont have the 'tc' tool installed" > /dev/stderr
            exit 1
    fi
    
    # Check for sysconfig settings
    function checkconf {
    if [ -z "$DEV" ]; then
            echo "Please set WSHAPER_DEV in /etc/sysconfig/wondershaper" > /dev/stderr
            exit 1
    elif
            [ -z "$DOWNLINK" ]; then
            echo "Please set WSHAPER_DOWNLINK in /etc/sysconfig/wondershaper" > /dev/stderr
            exit 1
    elif
            [ -z "$UPLINK" ];then
            echo "Please set WSHAPER_UPLINK in /etc/sysconfig/wondershaper" > /dev/stderr
            exit 1
    fi
    }
    
    # start|stop|status
    
    case "$@" in
    	start) 
    	checkconf
    	;;
    	status)
    	checkconf
    	tc -s qdisc ls dev $DEV
    	tc -s class ls dev $DEV
    	exit 0
    	;;
    	stop)
            tc qdisc del dev $DEV root    > /dev/null 2>&1
    	tc qdisc del dev $DEV ingress > /dev/null 2>&1
     	exit 0
    esac
    
    # 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
    
    ###### uplink
    
    # install root HTB, point default traffic to 1:20:
    
    tc qdisc add dev $DEV root handle 1: htb default 20
    
    # added 18/02/2011 exclude LAN
    #add fat class
    tc class add dev $DEV parent 1: classid 1:2 htb rate ${LAN_SPEED}kbit quantum 1500
    #add local lan child
    tc class add dev $DEV parent 1:2 classid 1:3 htb rate $(($LAN_SPEED-$UPLINK))kbit quantum 1500
    
    # 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
    
    # high prio class 1:10:
    
    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 \
       burst 6k prio 2
    
    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
    
    # added 18/02/2011 exclude lan
    #put lan traffic into lan class
    tc filter add dev $DEV parent 1:0 protocol ip prio 1 u32 \
       match ip src $LAN_SUBNET/24 \
       match ip dst $LAN_SUBNET/24 \
       flowid 1:3
    
    # TOS Minimum Delay (ssh, NOT scp) in 1:10:
    
    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 \
            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 \
       match ip protocol 6 0xff \
       match u8 0x05 0x0f at 0 \
       match u16 0x0000 0xffc0 at 2 \
       match u8 0x10 0xff at 33 \
       flowid 1:10
    
    # rest is 'non-interactive' ie 'bulk' and ends up in 1:20
    
    # some traffic however suffers a worse fate
    for a in $NOPRIOPORTDST
    do
    	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 \
    	   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 \
    	   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 \
    	   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 \
       match ip dst 0.0.0.0/0 flowid 1:20
    
    
    ########## downlink #############
    # slow downloads down to somewhat less than the real speed  to prevent 
    # queuing at our ISP. Tune to see how high you can set it.
    # ISPs tend to have *huge* queues to make sure big downloads are fast
    #
    # attach ingress policer:
    
    tc qdisc add dev $DEV handle ffff: ingress
    
    # added 18/02/2011 exclude LAN traffic
    tc filter add dev $DEV parent ffff: prio 1 u32 \
       match ip src $LAN_SUBNET/24 \
       match ip dst $LAN_SUBNET/24 \
       flowid :1
    
    # 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 \
       0.0.0.0/0 police rate ${DOWNLINK}kbit burst 10k drop flowid :1
    add following lines to /etc/sysconfig/wondershaper
    Code:
    # added 18/02/2011 to exclude LAN
    LAN_SPEED="100000"
    LAN_SUBNET="192.168.0.0"
    This works very well for me.

    Should this be filed as a bug report? It seems like an obvious feature to me.

    Roo

  2. #2
    Join Date
    Jun 2008
    Location
    Earth - Denmark
    Posts
    10,730

    Default Re: Wondershaper modification to exclude lan should be included

    On 02/18/2011 02:06 PM, roobinatube wrote:
    >
    > Hi all!
    >
    > I have just entered the world of openSUSE ...
    >
    > Should this be filed as a bug report? It seems like an obvious feature
    > to me.


    thank you for your interest in helping...but, why do you tell us all
    of this?

    you seem to think you are making an input to the maker of
    wondershaper--s/he is not here...this is the openSUSE forum, not the
    WonderShaper Forum

    as far as i can tell it might be difficult to find the person who
    wrote the script [the LAST update to it was NINE years ago], but you
    should try...use google....please..

    to me, it seem a lot like snake-oil (unneeded) but google shows a
    following of fans over in the Ubuntu forums....why don't you see if
    someone over there wants to help you produce a new and improved
    WonderShaper Professional Ultimate Enterprise 2011 Deluxe Gold version..

    --
    DenverD
    CAVEAT: http://is.gd/bpoMD
    [NNTP posted w/openSUSE 11.3, KDE4.5.5, Thunderbird3.0.11, nVidia
    173.14.28 3D, Athlon 64 3000+]
    "It is far easier to read, understand and follow the instructions than
    to undo the problems caused by not." DD 23 Jan 11

  3. #3
    Join Date
    Feb 2011
    Location
    UK
    Posts
    18

    Default Re: Wondershaper modification to exclude lan should be included

    The reason I posted here, is because the openSUSE package for wondershaper is actually more of a complete package than the debian package, it creates a config file, an entry to /etc/init.d and the script itself, so I assumed it was more maintained here. Sorry if I was wrong...

    I couldnt find any sort of project for wondershaper so if a change is to be made, it must lie with the distros using the script to make that change, right?

    I posted on the openSUSE forum, because I thought it might help openSUSE users... again, sorry if I was wrong...

    Roo

  4. #4
    Join Date
    Jun 2008
    Location
    Earth - Denmark
    Posts
    10,730

    Default Re: Wondershaper modification to exclude lan should be included

    On 02/18/2011 03:36 PM, roobinatube wrote:
    >
    > again, sorry if I was wrong...


    it is not that you did anything 'wrong' just it seems to me you
    thought you were talking to the maker of the program...or the keeper
    of the program...kinda like you wanted us to give you permission to
    update the program..

    my point is: see if you can find the maker of the program...ask
    him/her if s/he wants to incorporate your improvements..

    if not, you can always build on the work of others by giving them
    credit for what they did, then just move on, improve it under a
    different name..

    done all the time (ever hear of CentOS, for example?)

    --
    DenverD
    CAVEAT: http://is.gd/bpoMD
    [NNTP posted w/openSUSE 11.3, KDE4.5.5, Thunderbird3.0.11, nVidia
    173.14.28 3D, Athlon 64 3000+]
    "It is far easier to read, understand and follow the instructions than
    to undo the problems caused by not." DD 23 Jan 11

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •