All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Adam Towarnyckyj" <adamt@commspeed.net>
To: lartc@vger.kernel.org
Subject: RE: [LARTC] TC Hashing Filters
Date: Tue, 13 Jul 2004 17:45:08 +0000	[thread overview]
Message-ID: <065d01c46901$23a8df10$903113d8@uranus> (raw)
In-Reply-To: <005c01c2c1b1$e006a820$0200a8c0@monster>

First off, no need to be rude. I read the documentation; I just missed
the number limit.
Second, I know it's in hex and that's what I'm using.
Third, the script is rather large. I didn't want to post even a snippet
because it is so big. But, if that's what you require in order to give
me some advice, then here it is:

Action("$tc qdisc del dev $dev root");
Action("$tc qdisc add dev $dev root handle 1:0 cbq bandwidth 200mbit
avpkt 1000");

# Create 'transit class', tc hash tables, and hash filter

Action("$tc class add dev $dev parent 1: classid 1:2 cbq bandwidth
200Mbit rate 200MBit allot 1514 weight 2Mbit prio 8 maxburst 20 avpkt
1000");
Action("$tc filter add dev $dev parent 1: handle 2: protocol ip u32
divisor 256");
Action("$tc filter add dev $dev protocol ip parent 1: u32 match ip dst
0.0.0.0/0 hashkey mask 0x000000ff at 16 link 2:");

# Create classes for rate groups

@RATES = SelectSQL("SELECT dsrate FROM dsrate");
my $classid = 3;
foreach $dsrate (@RATES) {
        $ds = $$dsrate{dsrate};
        if ($ds = "0" || $ds = "1") {
                next;
        }
        Action("$tc class add dev eth1 parent 1: classid 1:$classid cbq
bandwidth 200Mbit rate $$dsrate{dsrate}Kbit allot 1514 prio 5 maxburst
20 avpkt 1000 bounded");
        $rates{$ds} = $classid;
        $classid++;
}

# Get our list of accounts

@MODEMS = SelectSQL("SELECT mid, dsrate FROM modems");

$z = 0;
# Figure out account IPs and put 'em in!
foreach $modem (@MODEMS) {
        if ($$modem{dsrate} = "0" || $$modem{dsrate} = "1") {
                next;
        }
        my @COMPUTERS = SelectSQL("SELECT ipid FROM computers WHERE
mid='$$modem{mid}'");
        foreach $computer (@COMPUTERS) {
                my $ip = SelectSingleSQL("SELECT ipaddr FROM ips WHERE
ipid='$$computer{ipid}'");
                @octets = split(/\./,$ip);
                $table = $octets[3];
                $table = sprintf("%X", $table);
                $classid = $rates{$$modem{dsrate}};
                Action("$tc filter add dev $dev protocol ip parent 1:
u32 ht 2:$table: match ip dst $ip flowid 1:$classid");
                $z++;
                print "$z\n";
        }
}

"Action" is a sub that performs a system action and reports errors to
another sub.
"SelectSQL" is a sub that performs a sql query to our database.

COMMENT: Why is it whenever anyone new posts a question to a list even
after reading through the documentation, someone always has to jump down
his throat instead of being helpful and kind? This is a mailing list
which was created so people can ask questions and get a helpful response
from a community. I have been nothing but nice to everyone here and I am
really grateful for all the help that has been provided so far. Instead
of barking at people, simply stating that you require a snippet of code
and providing an answer would be much more helpful and wouldn't cause
people like me to bark back which is surely going to cause an argument
between us.

Thanks again!
Adam Towarnyckyj


-----Original Message-----
From: gypsy [mailto:gypsy@iswest.com] 
Sent: Monday, July 12, 2004 6:24 PM
To: adamt@commspeed.net; LARTC
Subject: Re: [LARTC] TC Hashing Filters

Adam Towarnyckyj wrote:
> 
> Hey all,
>         So I got the script to run and populate everything. I watch as
> the script uses the tc commands to add filters for each IP into their
> appropriate tables. After 2045 entries, it starts to give me a "File
> Exists" error. I've done extensive testing on the script and
everything

COMMENT: Why is it that everyone who has a bad script does not post
(even a snip of) it?

The limit is 65536.

If you don't get the significance of that, it means the numbers are hex
and you're trying to make 'em be decimal.  Go read docum.org.


_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

  parent reply	other threads:[~2004-07-13 17:45 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-22  1:02 [LARTC] TC Hashing Filters mjoachimiak
2003-01-23  0:08 ` mjoachimiak
2004-07-02 22:54 ` Adam Towarnyckyj
2004-07-03  0:12 ` zoop
2004-07-06 17:02 ` Adam Towarnyckyj
2004-07-06 18:08 ` Adam Towarnyckyj
2004-07-06 19:14 ` zoop
2004-07-06 19:16 ` zoop
2004-07-06 19:36 ` Walt Wyndroski
2004-07-06 20:16 ` Adam Towarnyckyj
2004-07-06 21:15 ` Adam Towarnyckyj
2004-07-06 21:25 ` Ed Wildgoose
2004-07-12 20:48 ` Adam Towarnyckyj
2004-07-13  1:23 ` gypsy
2004-07-13 17:45 ` Adam Towarnyckyj [this message]
2004-07-14  5:57 ` Catalin BOIE
2004-07-14 13:48 ` gypsy
2004-07-14 18:06 ` Adam Towarnyckyj
2004-07-14 18:25 ` Jason Boxman
2004-07-15  2:13 ` gypsy
2004-07-15 12:36 ` Glen Mabey
2004-07-15 17:40 ` Adam Towarnyckyj
2004-07-16  3:36 ` gypsy
2004-07-22 22:07 ` Adam Towarnyckyj

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='065d01c46901$23a8df10$903113d8@uranus' \
    --to=adamt@commspeed.net \
    --cc=lartc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.