Skip to contentSkip to conversation

iptable - string matching - from to offset values

DISCUSSION Suganthi K 1 participant 1 message Dec 22, 2009

lore
Share & tools
lore

Suganthi K

author
#0 lore raw

Hi,

I have a packet with the octets 32,33 having the values 0x21 and 0x12 respectively.

I am trying to filter out the packets using iptables rule "iptables -t raw -A INPUT -m string --algo bm --from 31 --to 32 --hex-string '|21 12|' -j LOG"

This rule filters the packet and I could find it in the logs.

starting with the first octet of the packet at offset 0, the required pattern "21 12" appears at offset 32 and 33 of the packet.

rule "iptables -t raw -A INPUT -m string --algo bm --from 32 --to 33 --hex-string '|21 12|' -j LOG" fails to filter the packet.

Please let me know if anybody has faced a similar situation before. Any help on the --from and --to values for string pattern matching will be appreciated.

Thanks & Regards,
Suganthi