TC哈希filter – 单个规则删除

对于stream量整形,我目前使用的设置看起来完全像LARTC的设置,在此页面上:

http://lartc.org/howto/lartc.adv-filter.hashing.html

我有一个简单的问题 – 每次我想修改哈希表中的东西(如分配一个IP到不同的flowid),我需要删除整个filter表,并再次添加它filter筛选器。 (我实际上不是手工做的,我有一个很好的程序,这对我来说…但还是…)有一个问题 – 我有大约10kfilter分配这种方式,删除和重新填充整个filtertable可能会变得很长,这对于stream量整形并不是很好。 我的程序可以很容易地删除只需要删除的规则(因此减less了几个命令和毫秒的整个问题),但我根本不知道只删除一个哈希规则的命令。

我的tcfilter显示:

filter parent 1: protocol ip pref 1 u32 filter parent 1: protocol ip pref 1 u32 fh 2: ht divisor 256 filter parent 1: protocol ip pref 1 u32 fh 2:a:800 order 2048 key ht 2 bkt a flowid 1:101 match 0a0a0a0a/ffffffff at 16 filter parent 1: protocol ip pref 1 u32 fh 2:c:800 order 2048 key ht 2 bkt c flowid 1:102 match 0a0a0a0c/ffffffff at 16 filter parent 1: protocol ip pref 1 u32 fh 800: ht divisor 1 filter parent 1: protocol ip pref 1 u32 fh 800::800 order 2048 key ht 800 bkt 0 link 2: match 00000000/00000000 at 16 hash mask 000000ff at 16 

希望:'tc filter del …'命令删除一个特定的filter(例如0a0a0a0a IP匹配(IP地址10.10.10.10))。 去除一些小的小组也是很好的 – 例如,我仍然可以很快地重新创build一个桶(bkt a)。

我的尝试:我试图使用prio编号所有的filter,但没有任何帮助 – 他们只是在下面创build一些不可用的(但是可删除的),但是在被删除之后,分支的filter保持在那里。

有任何想法吗?


编辑 – 我添加一个简化的tl;博士问题描述:

  1. 我在一些界面上创build了哈希filter,就像这个http://lartc.org/howto/lartc.adv-filter.hashing.html

  2. 我想find一个命令,从表中删除一个规则(例如1.2.1.123),其余部分保持不变并正常工作。

我知道这是一个旧的post,但我使用这个,它似乎运作良好:

添加filter:

 tc filter add dev eth1 parent 1: handle ::100 prio 1 protocol ip u32 match ip dst 10.10.10.10/32 flowid 1:100 

删除filter:

 tc filter del dev eth1 parent 1: handle 800::100 prio 1 protocol ip u32 

只需要改变你需要的每个filter的数字“100”

我试过下面的命令,它似乎工作:

 $ sudo tc filter delete dev eth1 protocol ip parent 1: prio 1 u32 match ip src 10.10.10.10 flowid 1:2 

相同的命令add在单词filter之后使用addreplacedelete选项。