error in TC FILTER documentation ???

Linux Advanced Routing and Traffic Control

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

 



I've done some tests with TC FILTER and his PRIO

and think that is an error or OMISION on TC FILTER DOCUMENTATION


from: http://lartc.org/howto/lartc.qdisc.filters.html#AEN1100


	Let's say we have a PRIO qdisc called '10:' which contains three
	classes, and we want to assign all traffic from and to port 22
	to the highest priority band, the filters would be:

	# tc filter add dev eth0 protocol ip parent 10: prio 1 u32 match \
	  ip dport 22 0xffff flowid 10:1
	# tc filter add dev eth0 protocol ip parent 10: prio 1 u32 match \
	  ip sport 80 0xffff flowid 10:1
	# tc filter add dev eth0 protocol ip parent 10: prio 2 flowid 10:2

	What does this say? It says: attach to eth0, node 10: a priority 1
	u32 filter that matches on IP destination port 22 *exactly* and send
	it to band 10:1. And it then repeats the same for source port 80.

	The last command says that anything unmatched so far should go to
	band 10:2, the next-highest priority.


Well... with this I understand that LOWER PRIO =  HIGHER PRIO.

and by default TC FILTER PRIO = 0

then: default TC FILTER prio is HIGHEST PRIO.

ERROR !!!!!!!

HIGHEST TC FILTER PRIO is 1 and LOWEST TC FILTER PRIO is 0 !!

example see this script in order to share 64k internet upload link
on 3 customers.

but linux router has a FTP server. and I want to classify 1:3 FTP traffic
to linux server:


# initialize

DEV="imq0"

CUSTOMER_A_IP="172.16.10.10"
CUSTOMER_B_IP="172.16.10.11"
CUSTOMER_C_IP="172.16.10.12"
FTP_SERVER="172.16.10.254"

MODPROBE="/sbin/modprobe"
IP="/sbin/ip"
TC="/sbin/tc"
FW="/sbin/iptables"

$MODPROBE imq
$IP l s dev imq0 up

$TC qdisc del root dev $DEV  2> /dev/null > /dev/null
$TC qdisc add dev $DEV handle 1: root htb

echo "************** MAIN HTB CLASSes ***************"

$TC class add dev $DEV parent 1: classid 1:1 htb rate 64kbit quantum 1500

$TC class add dev $DEV parent 1: classid 1:3 htb rate 10240kbit
$TC qdisc add dev $DEV parent 1:3 handle 3: sfq perturb 10

$TC class add dev $DEV parent 1:1 classid 1:10 htb rate 64kbit quantum 1500


echo "************** MARK PACKETS and IMQ  ***************"

$FW -t mangle -F
$FW -t mangle -A PREROUTING -i eth1 -j IMQ --todev 0
$FW -t mangle -A PREROUTING -p tcp --dport 20 -d $FTP_SERVER -j
MARK --set-mark 40
$FW -t mangle -A PREROUTING -p tcp --dport 21 -d $FTP_SERVER -j
MARK --set-mark 40


# HERE, I must put "prio 1" in order to process this rule BEFORE others TC
FILTERs

$TC filter add dev $DEV parent 1:0 protocol ip  prio 1 handle 40 fw flowid
1:3   # FILTRO FAST_PIPE


echo "************** CUSTOMERS ***************"

$TC class add dev $DEV parent 1:10 classid 1:1000 htb rate 21kbit ceil
64kbit  quantum 1500
$TC qdisc add dev $DEV parent 1:1000 handle 1000: sfq perturb 10
$TC filter add dev $DEV protocol ip parent 1:0 u32 match ip src
$CUSTOMER_A_IP flowid 1:1000

$TC class add dev $DEV parent 1:10 classid 1:1010 htb rate 21kbit ceil
64kbit  quantum 1500
$TC qdisc add dev $DEV parent 1:1010 handle 1010: sfq perturb 10
$TC filter add dev $DEV protocol ip parent 1:0 u32 match ip src
$CUSTOMER_B_IP  flowid 1:1010

$TC class add dev $DEV parent 1:10 classid 1:1020 htb rate 21kbit ceil
64kbit  quantum 1500
$TC qdisc add dev $DEV parent 1:1020 handle 1020: sfq perturb 10
$TC filter add dev $DEV protocol ip parent 1:0 u32 match ip src
$CUSTOMER_C_IP  flowid 1:1020



run this script and under shell type:

root:/scripts# tc -s -d filter ls dev imq0
filter parent 1: protocol ip pref 1 fw
filter parent 1: protocol ip pref 1 fw handle 0x28 classid 1:3

					PREF 1 = PRIO 1

filter parent 1: protocol ip pref 49151 u32

					PREF 49151 = PRIO 0 !!

				then PRIO 0 has low prio that PRIO 1.

filter parent 1: protocol ip pref 49151 u32 fh 802: ht divisor 1
filter parent 1: protocol ip pref 49151 u32 fh 802::800 order 2048 key ht
802 bkt 0 flowid 1:1020
  match ac100a0c/ffffffff at 12
filter parent 1: protocol ip pref 49151 u32 fh 801: ht divisor 1
filter parent 1: protocol ip pref 49151 u32 fh 801::800 order 2048 key ht
801 bkt 0 flowid 1:1010
  match ac100a0b/ffffffff at 12
filter parent 1: protocol ip pref 49151 u32 fh 800: ht divisor 1
filter parent 1: protocol ip pref 49151 u32 fh 800::800 order 2048 key ht
800 bkt 0 flowid 1:1000
  match ac100a0a/ffffffff at 12
filter parent 1: protocol ip pref 49151 u32
filter parent 1: protocol ip pref 49151 u32 fh 802: ht divisor 1
filter parent 1: protocol ip pref 49151 u32 fh 802::800 order 2048 key ht
802 bkt 0 flowid 1:1020
  match ac100a0c/ffffffff at 12
filter parent 1: protocol ip pref 49151 u32 fh 801: ht divisor 1
filter parent 1: protocol ip pref 49151 u32 fh 801::800 order 2048 key ht
801 bkt 0 flowid 1:1010
  match ac100a0b/ffffffff at 12
filter parent 1: protocol ip pref 49151 u32 fh 800: ht divisor 1
filter parent 1: protocol ip pref 49151 u32 fh 800::800 order 2048 key ht
800 bkt 0 flowid 1:1000
  match ac100a0a/ffffffff at 12
filter parent 1: protocol ip pref 49152 u32
filter parent 1: protocol ip pref 49152 u32 fh 802: ht divisor 1
filter parent 1: protocol ip pref 49152 u32 fh 802::800 order 2048 key ht
802 bkt 0 flowid 1:1020
  match ac100a0c/ffffffff at 12
filter parent 1: protocol ip pref 49152 u32 fh 801: ht divisor 1
filter parent 1: protocol ip pref 49152 u32 fh 801::800 order 2048 key ht
801 bkt 0 flowid 1:1010
  match ac100a0b/ffffffff at 12
filter parent 1: protocol ip pref 49152 u32 fh 800: ht divisor 1
filter parent 1: protocol ip pref 49152 u32 fh 800::800 order 2048 key ht
800 bkt 0 flowid 1:1000
  match ac100a0a/ffffffff at 12



Andres.

_______________________________________________
LARTC mailing list
LARTC@xxxxxxxxxxxxxxx
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

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