All of lore.kernel.org
 help / color / mirror / Atom feed
From: bschenker <bschenker@privatereshalls.com>
To: lartc@vger.kernel.org
Subject: Re: [LARTC] tc del filter troubles
Date: Mon, 26 Jul 2004 13:48:56 +0000	[thread overview]
Message-ID: <1090849736.5401.84.camel@localhost> (raw)
In-Reply-To: <1090689106.11582.3.camel@zarhi.skknet.net>

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/

      reply	other threads:[~2004-07-26 13:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-24 17:12 [LARTC] tc del filter troubles zarhi
2004-07-26 13:48 ` bschenker [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1090849736.5401.84.camel@localhost \
    --to=bschenker@privatereshalls.com \
    --cc=lartc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.