Skip to contentSkip to conversation

question about filter priorities and "tc -d filter show" output

LARTC jacob martinson 1 participant 2 messages Jan 27, 2005

lore
Share & tools
lore
#0 lore raw

The interface is setup like this:

# tc qdisc del dev eth0 root
# tc qdisc add dev eth0 root handle 1: htb default 2
# tc class add dev eth0 parent 1: classid 1:2 htb rate 20mbit ceil 20mbit

If I add a second class and a filter to send traffic to it like this:

# tc class add dev eth0 parent 1: classid 1:130 htb rate 1Mbit ceil 1Mbit
# tc filter add dev eth0 protocol ip parent 1:0 prio 130 u32 match ip dst \
Quoted 1 line

1.1.1.10 flowid 1:130

The output of "tc -d filter show dev eth0" makes sense to me and looks like this:
filter parent 1: protocol ip pref 130 u32
filter parent 1: protocol ip pref 130 u32 fh 800: ht divisor 1 filter parent 1: protocol ip pref 130 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:130
match 0101010a/ffffffff at 16

If I add a third class and a filter for it, things start looking weird to me:

# tc filter add dev eth0 protocol ip parent 1:0 prio 131 u32 match ip
dst 1.1.1.11 \
Quoted 1 line

flowid 1:131

# tc class add dev eth0 parent 1: classid 1:132 htb rate 1Mbit ceil 1Mbit
# tc -d filter show dev eth0
filter parent 1: protocol ip pref 130 u32 
filter parent 1: protocol ip pref 130 u32 fh 801: ht divisor 1 
filter parent 1: protocol ip pref 130 u32 fh 801::800 order 2048 key
ht 801 bkt 0 flowid 1:131
  match 0101010b/ffffffff at 16
filter parent 1: protocol ip pref 130 u32 fh 800: ht divisor 1 
filter parent 1: protocol ip pref 130 u32 fh 800::800 order 2048 key
ht 800 bkt 0 flowid 1:130
  match 0101010a/ffffffff at 16
filter parent 1: protocol ip pref 131 u32 
filter parent 1: protocol ip pref 131 u32 fh 801: ht divisor 1 
filter parent 1: protocol ip pref 131 u32 fh 801::800 order 2048 key
ht 801 bkt 0 flowid 1:131
  match 0101010b/ffffffff at 16
filter parent 1: protocol ip pref 131 u32 fh 800: ht divisor 1 
filter parent 1: protocol ip pref 131 u32 fh 800::800 order 2048 key
ht 800 bkt 0 flowid 1:130
  match 0101010a/ffffffff at 16

If N is the number of filters I have on the root qdisc, I get N-squared entries from the "show filter" command.

Can someone explain how this works or point me to documentation that explains it? My system doesn't have a "tc-filters" manpage.

Thanks!

-Jacob
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#1 lore raw

forgot the [LARTC] prefix in the subject...

Quoted 47 lines · jacob martinson

The interface is setup like this:

# tc qdisc del dev eth0 root
# tc qdisc add dev eth0 root handle 1: htb default 2
# tc class add dev eth0 parent 1: classid 1:2 htb rate 20mbit ceil 20mbit

If I add a second class and a filter to send traffic to it like this:

# tc class add dev eth0 parent 1: classid 1:130 htb rate 1Mbit ceil 1Mbit
# tc filter add dev eth0 protocol ip parent 1:0 prio 130 u32 match ip dst \
Quoted 1 line

1.1.1.10 flowid 1:130

The output of "tc -d filter show dev eth0" makes sense to me and looks like this:
filter parent 1: protocol ip pref 130 u32
filter parent 1: protocol ip pref 130 u32 fh 800: ht divisor 1 filter parent 1: protocol ip pref 130 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:130
match 0101010a/ffffffff at 16

If I add a third class and a filter for it, things start looking weird to me:

# tc filter add dev eth0 protocol ip parent 1:0 prio 131 u32 match ip
dst 1.1.1.11 \
Quoted 1 line

flowid 1:131

# tc class add dev eth0 parent 1: classid 1:132 htb rate 1Mbit ceil 1Mbit
# tc -d filter show dev eth0
filter parent 1: protocol ip pref 130 u32
filter parent 1: protocol ip pref 130 u32 fh 801: ht divisor 1
filter parent 1: protocol ip pref 130 u32 fh 801::800 order 2048 key
ht 801 bkt 0 flowid 1:131
  match 0101010b/ffffffff at 16
filter parent 1: protocol ip pref 130 u32 fh 800: ht divisor 1
filter parent 1: protocol ip pref 130 u32 fh 800::800 order 2048 key
ht 800 bkt 0 flowid 1:130
  match 0101010a/ffffffff at 16
filter parent 1: protocol ip pref 131 u32
filter parent 1: protocol ip pref 131 u32 fh 801: ht divisor 1
filter parent 1: protocol ip pref 131 u32 fh 801::800 order 2048 key
ht 801 bkt 0 flowid 1:131
  match 0101010b/ffffffff at 16
filter parent 1: protocol ip pref 131 u32 fh 800: ht divisor 1
filter parent 1: protocol ip pref 131 u32 fh 800::800 order 2048 key
ht 800 bkt 0 flowid 1:130
  match 0101010a/ffffffff at 16

If N is the number of filters I have on the root qdisc, I get N-squared entries from the "show filter" command.

Quoted 7 lines

Can someone explain how this works or point me to documentation that explains it? My system doesn't have a "tc-filters" manpage.

Thanks!

-Jacob

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/