TC hashing filters - single rule deletion

Posted by exa on Server Fault See other posts from Server Fault or by exa
Published on 2011-11-13T20:09:57Z Indexed on 2012/07/10 15:18 UTC
Read the original article Hit count: 253

For traffic shaping I'm currently using a setup that looks exactly like the setup from LARTC, on this page:

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

I have a simple problem with that - everytime I want to modify something in the hash table (like assign a IP to different flowid), I need to delete the whole filter table and add it again filter by filter. (I actually don't do it by hand, I have a nice program that does it for me... but still...) There is a problem - I got roughly 10k filters allocated this way and deleting and refilling the whole filtertable can get pretty lengthy, which is not exactly good for traffic shaping. My program could easily manage to delete only the rules that need to be deleted (thus reducing the whole problem to several commands and miliseconds), but I simply don't know the command that deletes only the one hashing rule.

My tc filter show:

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 

The wish: 'tc filter del ...' command that removes only one specific filter (for example the 0a0a0a0a IP match (IP address 10.10.10.10)). Removal of some small subgroup would also be good - for example I could still recreate a bucket (bkt a) pretty fast.

My attempts: I tried to number all the filters using prio, but with no help -- they just create something unusuable (but deletable) below, but the bucketed filters remain there after that gets deleted.

Any ideas?


edit - I'm adding a simplified tl;dr description of the problem:

  1. I created hash filter on some interfce just like in this http://lartc.org/howto/lartc.adv-filter.hashing.html

  2. I want to find a command that deletes one rule (e.g. 1.2.1.123) from the table, leaving the rest untouched and working.

© Server Fault or respective owner

Related posts about linux

Related posts about networking