Marco Fabiani wrote:Hello Wener and subscriber,
> I need a class that drops ALL the incoming packtes when a particular
> condition is trueDropping everything in a class is easy:
tc filter add ... police rate 1kbit burst 1k action drop/drop
(should work with any filter.)> (in particular when the stats->packets of the class 1:2 is over a
> certain value, the class 1:3 must drop all the packets in the queue and all
> the incoming packtes)That's probably a bit more difficult ... in particular, there is no
easily accessible mechanism in place to conditionally discard the
contents of a queue. You'll probably have to write your own qdisc.- Werner
--
_________________________________________________________________________
/ Werner Almesberger, ICA, EPFL, CH werner.almesberger@ica.epfl.ch /
/_IN_N_032__Tel_+41_21_693_6621__Fax_+41_21_693_6610_____________________/
This is the configuration of the filter that should drops everything:
MATCH_Probe="match ip dst 129.247.173.249/32
match ip dport 6011 0xffff"
POLICE="police rate 0kbit burst 0k
action drop/drop"
tc filter add $DEV parent 1:0 protocol
ip prio 2 u32 $MATCH_Probe $POLICE flowid 1:3
...and these are the statisticals:
class cbq 1:3 parent 1:1 rate 2Mbit
(bounded,isolated) prio 7
Sent 2131248 bytes 31425 pkts
(dropped 33809, overlimits 180836)
backlog 101p
borrowed 0 overactions 1008
avgidle -60 undertime 160
...hence not ALL the incoming packets are dropped!!!
What is the right configuration of the parameters in $POLICE?
Thanks in advance
Marco
PS: Below you can find all the script file and the whole statistical
outputs
------------------------------------------
---- TC CONFIGURATION FILE -----
------------------------------------------
#!/bin/sh
DEV="dev eth1"
RATE_TOT="rate 10Mbit"
RATE_QoS="rate 8Mbit"
RATE_Probe="rate 2Mbit"
WEIGHT_TOT="weight 1Mbit"
WEIGHT_QoS="weight 800Kbit"
WEIGHT_Probe="weight 200Kbit"
BW_TOT="bandwidth 10Mbit"
BW_QoS="bandwidth 10Mbit"
BW_Probe="bandwidth 10Mbit"
ALLOT="1514"
CELL="8"
AVPKT="1000"
MPU="mpu 64"
BLA="allot 1514 cell 8 avpkt 1000"
MATCH_QoS="match ip dst 129.247.173.249/32
match ip dport 6010 0xffff"
MATCH_Probe="match ip dst 129.247.173.249/32
match ip dport 6011 0xffff"
#-------------------------------------------
# clear everything
tc qdisc del $DEV root
#Attach the Qdisc to the eth0
tc qdisc add $DEV root handle 1:
cbq $BW_TOT $BLA
#Add the ROOT CLASS the queueing
discipline.
#The root has 10 Mbit completely
tc class add $DEV parent 1:0 classid
1:1 cbq $BW_TOT $RATE_TOT \
$BLA $WEIGHT_TOT prio 8 maxburst 20 bounded isolated
# QoS traffic
tc class add $DEV parent 1:1 classid
1:2 cbq $BW_QoS $RATE_QoS \
$BLA $WEIGHT_QoS prio
3 maxburst 20 bounded isolated
# PROBING traffic
tc class add $DEV parent 1:1 classid
1:3 cbq $BW_Probe $RATE_Probe \
$BLA $WEIGHT_Probe prio 7 maxburst 20 bounded isolated
# u32 Classifierc
tc filter add $DEV parent 1:0 protocol
ip prio 1 u32 $MATCH_QoS flowid 1:2
POLICE="police rate 0kbit burst 0k
action drop"
tc filter add $DEV parent 1:0 protocol
ip prio 2 u32 $MATCH_Probe $POLICE flowid 1:3
-----------------------------------------
------------STATISTICALS-----------
------------------------------------------------
class cbq 1: root rate 10Mbit (bounded,isolated)
prio no-transmit
Sent 42 bytes 1 pkts (dropped
0, overlimits 0)
borrowed 0 overactions 0 avgidle
624 undertime 0
class cbq 1:1 parent 1: rate 10Mbit
(bounded,isolated) prio no-transmit
Sent 0 bytes 0 pkts (dropped
0, overlimits 0)
borrowed 0 overactions 0 avgidle
624 undertime 0
class cbq 1:2 parent 1:1 rate 8Mbit
(bounded,isolated) prio 3
Sent 0 bytes 0 pkts (dropped
0, overlimits 0)
borrowed 0 overactions 0 avgidle
4434 undertime 0
class cbq 1:3 parent 1:1 rate 2Mbit
(bounded,isolated) prio 7
Sent 2131248 bytes 31425 pkts
(dropped 33809, overlimits 180836)
backlog 101p
borrowed 0 overactions 1008
avgidle -60 undertime 160