I had the same problem and just resolved it a week ago. I was reloading all of
close to 1000 thb filter rules and re-wrote my scripts to delete and re-add one
particular rule. The solutions were all in archives of lartc mailing list, but
they are difficult to all track down. First you have to specify your filter
properly. Here is a line in my script:
/sbin/tc filter add dev $INTIF protocol ip prio 1 parent 1:0 handle
::${FIELD_VARIABLES2[1]} u32 ..... flowid 1:${FIELD_VARIABLES[2]}
First, you must specify a prio in your filter otherwise you will not be able to
reference the filter later for deletion.
Second. You must specify a handle if you want to work on that rule in a script
later. In my script I specify a handle as "handle ::###" where ### is
whatever you want--in this case a variable that looks up info in a database.
Now for deleting :
/sbin/tc filter del dev $INTIF parent 1: protocol ip prio 1 handle
800::${FIELD_VARIABLES[2]} u32
You must use this same format. u32 while not spelled out must be the last thing
in your command line. Notice that the handle becomes 800::###. when adding
filters, each prio level will have a number associated with it in the order you
use it. So if your first filter has prio 1, prio 1 filters will be called
800::###. If you next use a prio 0 filter, it and all other prio 0 filters will
be named 801::###.
Hope this helps and good luck.
-------------------------------------------------------------------------
hello,
I have working htb system with about 1000 users. Until now I reload all
rules at change, but it take too much time to apply.
I cannot delete applyed filters. There is rules for one user:
#!/bin/bash -v
# Download shaper EX -> 2:20
/sbin/tc class add dev eth2 parent 2:20 classid 2:1775 htb rate 8000Kbit
ceil 10000Kbit quantum 1514
/sbin/tc qdisc add dev eth2 parent 2:1775 sfq perturb 10
/sbin/tc filter add dev eth2 parent 2:20 protocol ip handle 1775 fw
flowid 2:1775
# Download shaper peering -> 2:30
/sbin/tc class add dev eth2 parent 2:30 classid 2:2775 htb rate 100Kbit
ceil 25000Kbit quantum 1514
/sbin/tc qdisc add dev eth2 parent 2:2775 sfq perturb 10
/sbin/tc filter add dev eth2 parent 2:30 protocol ip handle 1775 fw
flowid 2:2775
# Download shaper international -> 2:40
/sbin/tc class add dev eth2 parent 2:40 classid 2:3775 htb rate 384Kbit
ceil 800Kbit quantum 1514
/sbin/tc qdisc add dev eth2 parent 2:3775 sfq perturb 10
/sbin/tc filter add dev eth2 parent 2:40 protocol ip handle 1775 fw
flowid 2:3775
I change ''add'' with ''del'' but only sfq qdisc
are deleted:
#!/bin/bash -v
# Download shaper EX -> 2:20
/sbin/tc class del dev eth2 parent 2:20 classid 2:1775 htb rate 8000Kbit
ceil 10000Kbit quantum 1514
RTNETLINK answers: Device or resource busy
/sbin/tc qdisc del dev eth2 parent 2:1775 sfq perturb 10
/sbin/tc filter del dev eth2 parent 2:20 protocol ip handle 1775 fw
flowid 2:1775
RTNETLINK answers: No such file or directory
# Download shaper peering -> 2:30
/sbin/tc class del dev eth2 parent 2:30 classid 2:2775 htb rate 100Kbit
ceil 25000Kbit quantum 1514
RTNETLINK answers: Device or resource busy
/sbin/tc qdisc del dev eth2 parent 2:2775 sfq perturb 10
/sbin/tc filter del dev eth2 parent 2:30 protocol ip handle 1775 fw
flowid 2:2775
RTNETLINK answers: No such file or directory
# Download shaper international -> 2:40
/sbin/tc class del dev eth2 parent 2:40 classid 2:3775 htb rate 384Kbit
ceil 800Kbit quantum 1514
RTNETLINK answers: Device or resource busy
/sbin/tc qdisc del dev eth2 parent 2:3775 sfq perturb 10
/sbin/tc filter del dev eth2 parent 2:40 protocol ip handle 1775 fw
flowid 2:3775
RTNETLINK answers: No such file or directory
If I try to run this again result is:
# Download shaper EX -> 2:20
/sbin/tc class del dev eth2 parent 2:20 classid 2:1775 htb rate 8000Kbit
ceil 10000Kbit quantum 1514
RTNETLINK answers: Device or resource busy
/sbin/tc qdisc del dev eth2 parent 2:1775 sfq perturb 10
RTNETLINK answers: Invalid argument
/sbin/tc filter del dev eth2 parent 2:20 protocol ip handle 1775 fw
flowid 2:1775
RTNETLINK answers: No such file or directory
I think that class cannot be deleted becouse there is filter pointing to
it. But how to delete that filters?
Any hint will be extreme usefull.
Svetozar Mihailov.
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/