[LARTC] tc del filter

原文地址:http://mailman.ds9a.nl/pipermail/lartc/2004q4/014500.html

 

[LARTC] tc del filter

Thomas Graf tgraf@suug.ch
Sun, 19 Dec 2004 22:36:20 +0100


 

* ncrfgs <20041130162601.GB1470@ncrfgs3.ncrfgs> 2004-11-30 17:26
> Hi,
> 
> How can I delete an existing filter? Is it possible?

You must at least provide the following:
  dev
  parent (qdisc or class)
  prio
  kind (filter type)
  handle

The kernel will then lookup the device, find the qdisc or class
according to your parent, lookup the filter ops according to the kind
and prio and then calls get() in the filter to look it up. The get() is
dependant on the filter type and thus deleting may vary from filter to
filter.

handle == 0 will destroy the whole filter tree

example 1: (destroying the whole tree)
# tc filter add dev eth0 parent 10:0 prio 10 protocol all u32 match \
      ip tos 1 0 flowid 10:12
# tc filter list dev eth0 parent 10:0
filter protocol all pref 10 u32 
filter protocol all pref 10 u32 fh 800: ht divisor 1 
filter protocol all pref 10 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 10:12 
  match 00000000/00000000 at 0
# tc filter del dev eth0 parent 10:0 prio 10 u32
# tc filter list dev eth0 parent 10:0
#

example 2: (destroying a single filter)
# tc filter add dev eth0 parent 10:0 prio 10 protocol all u32 match \
      ip tos 1 0 flowid 10:12
# tc filter add dev eth0 parent 10:0 prio 10 protocol all u32 match \
      ip tos 1 0 flowid 10:12
# tc filter list dev eth0 parent 10:0
filter protocol all pref 10 u32 
filter protocol all pref 10 u32 fh 800: ht divisor 1 
filter protocol all pref 10 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 10:12 
  match 00000000/00000000 at 0
filter protocol all pref 10 u32 fh 800::801 order 2049 key ht 800 bkt 0 flowid 10:12 
  match 00000000/00000000 at 0
# tc filter del dev eth0 parent 10:0 prio 10 handle 800::801 u32
# tc filter list dev eth0 parent 10:0
filter protocol all pref 10 u32 
filter protocol all pref 10 u32 fh 800: ht divisor 1 
filter protocol all pref 10 u32 fh 800::800 order 2048 key ht 800 bkt 0
flowid 10:12 
  match 00000000/00000000 at 0
#

rule of thumb:
- deleting a filter with handle NOT specified deletes whole filter tree
- deleting a filter with handle specified deletes only the filter with
  the given handle

This does not apply to all filters though.


 

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值