[LARTC] U32 port masks

Linux Advanced Routing and Traffic Control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

Can anybody explain me how does the mask work in filters?

This example set filter for exactly port #2000 :
tc filter add dev eth1 parent 1:0 protocol ip prio 100 u32 match ip sport 2000
0xffff classid 1:256

But if I need to set filter for the range of ports, for example, ports
from 2000 till 3000, what mask do I need?

Trying google, I've read that Mask = 0xffff - (high_port - low_port),
that in my case will be: Mask = 0xffff - (3000 - 2000) = 0xfc17

tc filter add dev eth1 parent 1:0 protocol ip prio 100 u32 match ip sport 2000
0xfc17 classid 1:256

But this example doesn't work correctly and I suppose that I'm wrong
with mask defying algorithm.

Any ideas?
Hope for your help!



[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux