[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
problem cascading meters
Hi everyone!
I am trying to mark outgoing packets at an edge device following a
cascading meter pattern. Quoting an example from Petri Manila, I would
like something like:
if !exceed meter1 tag as AF41
else
if !exceed meter2 tag as AF42
else
drop
The problem is that when I declare the action "continue" when the first
meter is exceeded, I get an error from the kernel. This is my
configuration script (based on Almesberger's example Edge device):
----------------------------------------------------------------------------
#!/bin/bash -x
TC=tc
DEVICE=eth0
# delete root qdisc, if there was one previously
$TC qdisc ls dev $DEVICE | grep -q ".*"
if [ $? = 0 ]; then
$TC qdisc del dev $DEVICE root
fi
# add dsmark qdisc and related classes
$TC qdisc add dev $DEVICE handle 1:0 root dsmark indices 64
$TC class change dev $DEVICE classid 1:1 dsmark mask 0x3 value 0xb8
$TC class change dev $DEVICE classid 1:2 dsmark mask 0x3 value 0x68
$TC class change dev $DEVICE classid 1:3 dsmark mask 0x3 value 0x48
# add filter
$TC filter add dev $DEVICE parent 1:0 protocol ip prio 4 handle 1: \
u32 divisor 1
# add filter specs
# TBF that limits access to class 1:1
$TC filter add dev $DEVICE parent 1:0 prio 4 u32 \
match ip dst 10.0.0.10/24 \
police rate 0.5Mbit burst 1Mbit continue \
flowid 1:1
# if meter exceeded, retag to class 1:2
$TC filter add dev $DEVICE parent 1:0 prio 4 u32 \
match ip dst 20.20.20.20/24 \
flowid 1:2
----------------------------------------------------------------------------
These are the results I get when I run the script:
----------------------------------------------------------------------------
+ TC=tc
+ DEVICE=eth0
+ tc qdisc ls dev eth0
+ grep -q .*
+ [ 0 = 0 ]
+ tc qdisc del dev eth0 root
+ tc qdisc add dev eth0 handle 1:0 root dsmark indices 64
+ tc class change dev eth0 classid 1:1 dsmark mask 0x3 value 0xb8
+ tc class change dev eth0 classid 1:2 dsmark mask 0x3 value 0x68
+ tc class change dev eth0 classid 1:3 dsmark mask 0x3 value 0x48
+ tc filter add dev eth0 parent 1:0 protocol ip prio 4 handle 1: u32
divisor 1
+ tc filter add dev eth0 parent 1:0 prio 4 u32 match ip dst 10.0.0.10/24
police rate 0.5Mbit burst 1Mbit continue flowid 1:1
What is "continue"?
Usage: ... u32 [ match SELECTOR ... ] [ link HTID ] [ classid CLASSID ]
[ police POLICE_SPEC ] [ offset OFFSET_SPEC ]
[ ht HTID ] [ hashkey HASHKEY_SPEC ]
[ sample SAMPLE ]
or u32 divisor DIVISOR
Where: SELECTOR := SAMPLE SAMPLE ...
SAMPLE := { ip | ip6 | udp | tcp | icmp | u{32|16|8} }
SAMPLE_ARGS
FILTERID := X:Y:Z
+ tc filter add dev eth0 parent 1:0 prio 4 u32 match ip dst
20.20.20.20/24 flowid 1:2
-----------------------------------------------------------------------------
As I see it, the tc command can't understand the "continue" statement.
If I check the filter with "tc -s filter", I get that the selected
action for the filter is "reclassify", which is not what I stated.
If I use the non-diffserv tc command (the one that's included in the
iproute2-yymmdd package), the "continue" statement works OK (but of
course, it doesn't understand the dsmark qdisc).
IIRC, I am using the ip comand included in the diffserv-enabled
iproute2 tarball. Is this a bug int the command, is my script wrong or
should I simply try to recompile tc?
Thanks in advance
Mariano Korman