dynamic qos limit based on outbound port usage

Discussion in 'Tomato Firmware' started by david101, Oct 29, 2008.

  1. david101

    david101 Addicted to LI Member

    hey guys,

    first id like to say--props to everyone for getting some open-source firmware on these routers :p

    now--my issue

    i got pppoe dsl, and my ping spikes to 'unacceptable' levels based on my download rate. my maximum d/l is 120 KB/sec...and if i go over around my qos-limited 70 KB/sec (even if my upload is only like 5 KB/sec) my ping will spike to double-triple which isnt that good for instagib :p

    ping is good and qog works...but at 70 KB/sec. however by having this low download rate, everything is slow and i find myself disabling qos when i'm not in a game.

    so, my question:

    can i write a script to have qos change the inbound limit to 960 when activity is detected on port 7777 (unreal tournament) and then to 999999999999 otherwise?

    i don't expect anyone to write the script for me...just if i could be pointed in the right direction, then i could probably learn myself from the examples. (i got soem programming experience..but i don't really understand these scripts lol). i took a look and i found how to change this limit, but i don't know the part about detecting the activity on port 7777.

    any help would be greatly appreciated...i could post my qos settings but it seems regardless of my outbound rate and classifications, its the inbound that i need to limit for adequate ping


  2. david101

    david101 Addicted to LI Member

    ok, i did some research and i think i know how to write everything except...when i do netstat it only shows the tcp connections and not udp (the game is udp 7777) :( so im guessing i need to look through the logs to see when udp packets were sent. all i need to know, i guess, is how tomato's qos page which shows the connections knows udp packets were sent through port 7777? if i can access it the same way then i guess i can just make a simple loop which activates every 30 seconds to perform this qos-changing effect

    one more question :p since this will be changing semi-often (i guess) is it recommended that i go to debugging and enable 'avoid performing nvram commit'? my understanding is that nvram is NOT RAM and only has limited number of writes, and by checking this option it won't write to it and only keep it in ram? (i dont care if it changes upon reboot, obviously, since its just gonna check anyways :p --and i wont be changing any other options so if they dont stick its fine too)

    thanks a bunch,


    EDIT: i forgot to say..i look in /var/log but there is no 'message' file since i got logging eneabled to send to my comp...so how does the qos page have that log of the connection distribution? is it asking my computer to find out? how can i do that in a script? :p thanks
  3. david101

    david101 Addicted to LI Member

    ok, i wrote the script (my first :p) but i got a problem...

    my code
    `grep -c 'dport=7777 ' /proc/net/ip_conntrack`
    doesnt work for some reason sometimes...when im in the game (shooter game so its udp, which is why im not using netstat) this code only returns >=1 sometimes..even when im still in the game. my 'connection' is gone. i tried increasing udp timeout but its still a problem.

    any ideas? here's my code. its fully functional other than this problem.
    thanks in advance

    while sleep 4; do (if [ `grep -c 'dport=7777 ' /proc/net/ip_conntrack` -ge 1 -a `nvram get qos_ibw` -eq 999999 ]; then (nvram set qos_ibw=960;service qos restart) fi; if [ `grep -c 'dport=7777 ' /proc/net/ip_conntrack` -eq 0 -a `nvram get qos_ibw` -eq 960 ]; then (nvram set qos_ibw=999999;service qos restart) fi); done
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice