V
V
Vitaly2017-11-27 23:20:46
iptables
Vitaly, 2017-11-27 23:20:46

How to compare bytes in iptables u32?

Tell me what's wrong:
there is a u32 module in IPtables, for example, I compare the packet starting from the 6th byte, the first 2 values ​​​​to find out if this packet is UDP or not: "0x6&0xFF=0x11" - everything is fine here, everything works
now I want compare 0x1101, which starts with 64 bytes, try: 0x40&0xFFFF=0x1101 and nothing works.
Let's say you can't immediately go to the middle of the part of the packet, so we first try to go to 42 bytes where the contents of the packet begin, and then move another 22 and try to compare: 0x0>>0x16&[email protected]=0x1101 - does not work, so: >0x16=0x110100 doesn't work either.
I just do not see the logic in this or I do not understand how the @ and >> operators work, please explain.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question