[LARTC] Incomprehensive problem with tc filter & mangle...

Linux Advanced Routing and Traffic Control

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

 



First of all, hi !!!
And please be comprehensive for my poor english, cause I'm French and French
do not speak very well foreign language :o).

So my problem :

I use -j MARK in mangle table to catch packets with tc filter and to put
them in one or another class, but this doesn't work.

Here is the script I try to use to do QoS :

# This script try to give priority to small packets traffic
# This is due to always have good ping in online game, even if some
uploading are on.

UPLINK=124
UPLINK_OTHER=70

LAN_IFACE=eth1
EXT_IFACE=ppp0

# Mark all packets
$IPTABLES -t mangle -A PREROUTING -i $LAN_IFACE -m length --length 0:200 -j
MARK --set-mark 10
$IPTABLES -t mangle -A PREROUTING -i $LAN_IFACE -m length --length
200:400 -j MARK --set-mark 15
$IPTABLES -t mangle -A PREROUTING -i $LAN_IFACE -m length --length
400:800 -j MARK --set-mark 20
$IPTABLES -t mangle -A PREROUTING -i $LAN_IFACE -m length --length
800:1500 -j MARK --set-mark 25

$TC qdisc del dev $EXT_IFACE root    2> /dev/null > /dev/null
$TC qdisc del dev $EXT_IFACE ingress 2> /dev/null > /dev/null

$TC qdisc add dev $EXT_IFACE root handle 1: htb default 20

$TC class add dev $EXT_IFACE parent 1: classid 1:1 htb rate ${UPLINK}kbit
burst 6k

$TC class add dev $EXT_IFACE parent 1:1 classid 1:10 htb rate ${UPLINK}kbit
\
   burst 6k prio 1
$TC class add dev $EXT_IFACE parent 1:1 classid 1:20 htb rate
${UPLINK_OTHER}kbit \
   burst 6k prio 2

$TC qdisc add dev $EXT_IFACE parent 1:10 handle 10: sfq perturb 10
$TC qdisc add dev $EXT_IFACE parent 1:20 handle 20: sfq perturb 10

# The rules that's didn't work, and I don't now why.
$TC filter add dev $EXT_IFACE parent 1: protocol ip prio 15 \
   handle 10 fw classid 1:10
$TC filter add dev $EXT_IFACE parent 1: protocol ip prio 20 \
   handle 15 fw classid 1:10

# End of rc.qos

I don't now why this doesn't work, because filter rules are setting up, a
"tc filter show" gives :

filter parent 1: protocol ip pref 15 fw
filter parent 1: protocol ip pref 15 fw handle 0xa classid 1:10
filter parent 1: protocol ip pref 20 fw
filter parent 1: protocol ip pref 20 fw handle 0xf classid 1:10

But "tc class show" always gives :

class htb 1:1 root rate 124Kbit ceil 124Kbit burst 6Kb/8 mpu 0b cburst
1757b/8 mpu 0b level 7
 Sent 205068 bytes 151 pkts (dropped 0, overlimits 0)
 rate 2122bps 1pps
 lended: 0 borrowed: 0 giants: 0
 tokens: 217601 ctokens: -8773

class htb 1:10 parent 1:1 leaf 10: prio 1 quantum 1587 rate 124Kbit ceil
124Kbit burst 6Kb/8 mpu 0b cburst 1757b/8 mpu 0b level 0
 Sent 0 bytes 0 pkts (dropped 0, overlimits 0)
 lended: 0 borrowed: 0 giants: 0
 tokens: 317109 ctokens: 90735

class htb 1:20 parent 1:1 leaf 20: prio 2 quantum 1000 rate 70Kbit ceil
70Kbit burst 6Kb/8 mpu 0b cburst 1688b/8 mpu 0b level 0
 Sent 205068 bytes 151 pkts (dropped 0, overlimits 0)
 rate 2029bps 1pps
 lended: 151 borrowed: 0 giants: 0
 tokens: 385463 ctokens: -21851

This is always the default option that is used, it's as if the filter
weren't there.

And as this is my firts attempt to make something like this, I do not
necessaraly understand all the subtibility of tc rules (like u32 matches).

Ronan LAVIEC.



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