Need help understanding tc filter

Hello
In my lost time I turn to linux in particular TC filter and at the moment I can't understand something about tc filter.
I give you an example:
tc filter add dev eth0 parent 1:0 protocol ip prio 1 u32 match ip sport 25500 0xffff flowid 1:1
What does 0xffff mean in this rule and I also know there is 0xfc00 ,0xff but can't find on the net;
Thank you and sorry for my english

It is the match range (or mask, noted in bits) of the value you're editing in decimal value.

For example, Internet Protocol specifies there's 65,535 TCP and UDP ports, respectively.

65535 == 0xffff

This means: "match port 25500" (i.e. a single port).

A mathematical example provided here (see the section entitled "dst-port"): https://infocenter.nokia.com/public/770562R1A/topic/com.sar.system/html/security-commands.html?cp=9_2_10_1_0_2#i1635807

Refrences:

0xfc00 == 64512

(1023 less than 65536)

Would mean "match port x thru x +1023".

Lastly:

0xff == 255

2 Likes

thank you very much for all these explanations

1 Like

One last question if I create a qdisc I have to assign it to all the interfaces in my case eth0, eth1, br0

  • Can you explain how this is related to your OpenWrt device?
  • Model of device?
  • OpenWrt version?

Perhaps we can better assist if we know what you wish to setup.

I am on an x86 version 22.03.3 I would like to set up a qdisc prio for my local network by classifying some port in priority.
I've done it before but I just want to refine

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.