with "u32 match ip sport 80" in Linux tc I can match port 80, but how can I match a port range 10000 – 20000 ?
How to match port range using u32 filter
tc
tc
with "u32 match ip sport 80" in Linux tc I can match port 80, but how can I match a port range 10000 – 20000 ?
Best Answer
You can use mask, but it difficult:
0xf000/0xe000 is the mask. The word extracted from the packet is bit-wise with this mask before comparison.
Also you can create many filter for one classid:
For your example, your need create several 'tc filter':
etc.
[Basically take the first number in the range (in this example 10,000) and convert it to binary ( 0010011100010000 ); then scan this binary number from right to left until you encounter the 1st non 0 bit; then make the bits from the left of that bit all into 1's inclusive, and all the bits to the right of it to zeros. That is how you come out to 0xfff0 as the mask.]