netfilter.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sourabh Nanoti <snanoti@parallelwireless.com>
To: netfilter@vger.kernel.org
Subject: libiptc - 'string' match module - --hex-string
Date: Thu, 19 Jun 2014 18:08:50 +0530	[thread overview]
Message-ID: <2d22d536c6674e70b5d453a2d7a803df@mail.gmail.com> (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

                 reply	other threads:[~2014-06-19 12:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2d22d536c6674e70b5d453a2d7a803df@mail.gmail.com \
    --to=snanoti@parallelwireless.com \
    --cc=netfilter@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).