tc filter ... ht HANDLE ... does not allow buckets of 8 bits

0

TC-u32 man page states that HANDLE is:

HANDLE := { u12_hex_htid:[**u8_hex_hash:[u12_hex_nodeid]** | 0xu32_hex_value }

so the size of the bucket should range from 0x00 to 0xff as it is a u8 value.

The problem is I can't create a bucket greater than 0x1f (five bits). I got: RTNETLINK answers: Invalid argument We have an error talking to the kernel

/sbin/tc filter add dev ifb0 parent 1:0 protocol ip prio 5 u32 ht 5:2: match ip src 10.16.240.0/24 hashkey mask 0x000000ff at 12 link 100:

is OK

/sbin/tc filter add dev ifb0 parent 1:0 protocol ip prio 5 u32 ht 5:20: match ip src 10.16.240.0/24 hashkey mask 0x000000ff at 12 link 100:

yelds to error.

Environment:

iproute2 version 4.3.0-1ubuntu3.16

Ubuntu 16.04.5 LTS

Any hints?

tkx

iproute2
filter
asked on Server Fault Aug 2, 2019 by Ethy • edited Aug 2, 2019 by Ethy

1 Answer

1

To answer my own question: I had incorrectly understood that the bucket had to be greater than the number of filters I intended to hash, but no. The bucket has to be greater or equal (limited to 0xff) than the largest hash I intend to use on it.

So, since I intended to use 26 filters inside the bucket I created a "divisor 32" bucket. And since my 26 hashes to this bucket randomly ranges from 0 to 255 (last IP address octet) I got overflowed and the kernel complained about it.

I then created a bucket using "divisor 256", despite the fact I will only use 26 of these, and the error went away.

I hope this help someone in the future

Cheers

(BTW: how do I mark this "SOLVED" ??

answered on Server Fault Aug 2, 2019 by Ethy

User contributions licensed under CC BY-SA 3.0