Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Jan Engelhardt <jengelh@medozas.de>
Cc: "Gáspár Lajos" <swifty@freemail.hu>,
	"JeHo Park" <linuxpark@gmail.com>,
	"netfilter list" <netfilter@vger.kernel.org>
Subject: Re: [HELP] why the string match does not work in nat tables?
Date: Tue, 01 Feb 2011 13:57:07 +0100	[thread overview]
Message-ID: <4D480323.2000607@netfilter.org> (raw)
In-Reply-To: <alpine.LNX.2.01.1102011346100.9559@obet.zrqbmnf.qr>

On 01/02/11 13:47, Jan Engelhardt wrote:
> 
> On Tuesday 2011-02-01 13:41, Pablo Neira Ayuso wrote:
>>>> On 01/02/11 13:01, Gáspár Lajos wrote:
>>>>> The string match is much like a toy and not a real help in the iptables.
>>>>> (Sorry, I do not really "believe" in this match. But also I understand
>>>>> the need for such match. Sometimes it can be very usefull.)  As already
>>>>> mentioned before, the main problem is the fragmentation.
>>>>
>>>> fragmentation is not a problem for algorithms like knuth-pratt-morris,
>>>> which is implemented in textsearch. boyer-moore is faster but if the
>>>> text is splitted among fragments, it won't find a matching.
>>>>
>>>> segmentation is a problem for textsearch, it wouldn't be hard to extend
>>>> the string matching to make it flow-based.
>>>
>>> How so? You would have to collect the packets like l7-filter.
>>
>> You can store the partial matching in the ts_state structure, which
>> would be stored in every ct flow object, with a conntrack extension.
>> You'll have to make the string match stateful, of course.
> 
> Though that would not solve the problem as to requiring to
> forward the frames before the match.

Yes, you'll have to forward the initial frames.

>> BTW, I'm working on something new to provide a replacement l7-filter.
> 
> With regex engine? :-)

Not exactly, although there's already one naive finite state engine in
the textsearch infrastructure that people could use to define the patterns.

regex matching really consumes lots of cpu cycles, specifically if you
look for patterns in the entire packet. Same thing happens with the
textsearch, although algorithms like boyer-moore and aho-corasick can
help here.

      reply	other threads:[~2011-02-01 12:57 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-31  1:53 [HELP] why the string match does not work in nat tables? JeHo Park
2011-01-31  2:09 ` Jan Engelhardt
     [not found]   ` <AANLkTik02D=agfFrc8VX+Wh4WAg_odm6cEcpbXvbgtqM@mail.gmail.com>
2011-01-31  2:38     ` Jan Engelhardt
2011-01-31  2:47       ` JeHo Park
2011-01-31  2:51         ` Jan Engelhardt
2011-01-31  2:59           ` JeHo Park
2011-01-31  3:34         ` netfilter - u32 module Sridhar Kumar
2011-01-31  9:36           ` Pablo Neira Ayuso
2011-01-31 15:31             ` Sridhar Kumar
2011-01-31  9:35         ` [HELP] why the string match does not work in nat tables? Pablo Neira Ayuso
2011-01-31 10:33           ` Pascal Hambourg
2011-01-31 11:17             ` JeHo Park
2011-02-01  1:50           ` JeHo Park
2011-02-01 11:51             ` Jan Engelhardt
2011-02-01 12:01             ` Gáspár Lajos
2011-02-01 12:32               ` Pablo Neira Ayuso
2011-02-01 12:35                 ` Jan Engelhardt
2011-02-01 12:41                   ` Pablo Neira Ayuso
2011-02-01 12:47                     ` Jan Engelhardt
2011-02-01 12:57                       ` Pablo Neira Ayuso [this message]

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=4D480323.2000607@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=jengelh@medozas.de \
    --cc=linuxpark@gmail.com \
    --cc=netfilter@vger.kernel.org \
    --cc=swifty@freemail.hu \
    /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