Skip to contentSkip to conversation

libiptc - 'string' match module - --hex-string

DISCUSSION Sourabh Nanoti 1 participant 1 message Jun 19, 2014

lore
Share & tools
lore
#0 lore raw

Hello,
I wanted to know how to have a rule in iptables that uses the –hex-string pattern matching module via libiptc.

Following are my xt_string_info structure:

1)

                strcpy(strinfo->algo,"bm"); strcpy(strinfo->pattern,"|05010001|\\"); strinfo->from_offset = 32; strinfo->to_offset = 36; strinfo->patlen = 11;

When I do iptables  -L I get the following:
STRING match  "|7c30353031303030317c5c|" ALGO name bm FROM 32 TO 36

2)
                strcpy(strinfo->algo,"bm"); strcpy(strinfo->pattern,"05010001\\"); strinfo->from_offset = 32; strinfo->to_offset = 36; strinfo->patlen = 9;

When I do iptables  -L I get the following:
STRING match  "|30353031303030315c|" ALGO name bm FROM 32 TO 36

Both seem incorrect. What am I missing here ?

Thanks
Sourabh