netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Phil Sutter <phil@nwl.cc>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [iptables PATCH] extensions: string: Clarify description of --to
Date: Thu, 12 Oct 2023 21:47:31 +0200	[thread overview]
Message-ID: <ZShNU7wRaTuNWUjv@calendula> (raw)
In-Reply-To: <20231012160842.18584-1-phil@nwl.cc>

On Thu, Oct 12, 2023 at 06:08:42PM +0200, Phil Sutter wrote:
> String match indeed returns a match as long as the given pattern starts
> in the range of --from and --to, update the text accordingly.
> Also add a note regarding fragment boundaries.
>
> Closes: https://bugzilla.netfilter.org/show_bug.cgi?id=1707
> Signed-off-by: Phil Sutter <phil@nwl.cc>
> ---
>  extensions/libxt_string.man | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/extensions/libxt_string.man b/extensions/libxt_string.man
> index 2a470ece19c9d..efdda492ae78d 100644
> --- a/extensions/libxt_string.man
> +++ b/extensions/libxt_string.man
> @@ -7,9 +7,13 @@ Select the pattern matching strategy. (bm = Boyer-Moore, kmp = Knuth-Pratt-Morri
>  Set the offset from which it starts looking for any matching. If not passed, default is 0.
>  .TP
>  \fB\-\-to\fP \fIoffset\fP
> -Set the offset up to which should be scanned. That is, byte \fIoffset\fP-1
> -(counting from 0) is the last one that is scanned.
> +Set the offset up to which should be scanned. If the pattern does not start
> +within this offset, it is not considered a match.
>  If not passed, default is the packet size.
> +A second function of this parameter is instructing the kernel how much data
> +from the packet should be provided. With non-linear skbuffs (e.g. due to
> +fragmentation), a pattern extending past this offset may not be found. Also see
> +the related note below about Boyer-Moore algorithm in these cases.

Then, matching on:

- linear skbuff: if the pattern falls within from-to, all good.
- non-linear skbuff: if pattern falls within from-to, but remaining
  patter

This is clearly broken, the fix is just to document this?

No attempt to fix it this from the kernel?

  parent reply	other threads:[~2023-10-12 19:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-12 16:08 [iptables PATCH] extensions: string: Clarify description of --to Phil Sutter
2023-10-12 18:17 ` Phil Sutter
2023-10-12 19:47 ` Pablo Neira Ayuso [this message]
2023-10-12 20:14   ` Pablo Neira Ayuso
2023-10-13  9:28     ` Phil Sutter
2023-10-13 10:08       ` Pablo Neira Ayuso

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=ZShNU7wRaTuNWUjv@calendula \
    --to=pablo@netfilter.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=phil@nwl.cc \
    /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).