RE: TC Hashing Filters

Linux Advanced Routing and Traffic Control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx] 
Sent: Monday, July 12, 2004 6:24 PM
To: adamt@xxxxxxxxxxxxx; LARTC
Subject: Re:  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@xxxxxxxxxxxxxxx
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux