Does traffic control (tc) command have a rate limit?

26 views Asked by At

I am trying to delete / add filters using the tc command every 100ms. These operations are applied and behave as expected for some time and then abruptly stops applying.

My commands are as follows:

sudo tc filter del dev eth pref 1 // Delete all filters for this network interface
for src_ip, dst_ip in IP_DICTIONARY.items(): // This has a constant number of pairs
  class_id = f"{i}0"
  sudo tc class add dev eth parent 1: classid 1:{class_id} htb rate 125Mbps ceil 125Mbps
  sudo tc filter add dev eth protocol ip parent 1:0 prio 1 u32 match ip src {src_ip} match ip dst {dst_ip} flowid 1:{class_id}

I am running these set of commands every 100ms - 500ms. The IP_DICTIONARY keeps changing, which is why i need to delete the filters and create new filters.

Problem I'm facing is that after some iterations of applying these commands, subsequent attempts to apply the same set of commands will result in this message:

ubuntu@ip-172-31-89-174:~$ sudo tc filter add dev eth protocol ip parent 1:0 prio 1 u32 match ip src 1.2.3.4 match ip dst 8.9.10.11 flowid 1:20
Error: Filter already exists.
We have an error talking to the kernel
ubuntu@ip-172-31-89-174:~$ sudo tc filter show dev eth
filter parent 1: protocol ip pref 2 u32 chain 0
filter parent 1: protocol ip pref 2 u32 chain 0 fh 800: ht divisor 1
filter parent 1: protocol ip pref 2 u32 chain 0 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:1 not_in_hw
  match 00000000/00000000 at 12
  match 00000000/00000000 at 16

As it can be seen above, the show command does not have the filter i am trying to add.

So I'm wondering if tc commands have rate limits. In any case, is there a work around for this issue? Any other tool to apply filters at high frequency?

0

There are 0 answers