Skip to contentSkip to conversation

Fix up string match man page

PATCH In review Phil Sutter 1 participant 4 messages Oct 24, 2023 – Oct 25, 2023 netfilter

lore
Share & tools
lore

Phil Sutter

author reviewer
#0 lore raw

cover Fix up string match man page

My earlier adjustment to describe the actual behaviour is obsolete given that I adjusted said behaviour upon request. Revert the change in patch 1 and introduce a new copy-edit in patch 2 making the text a bit more clear and removing a mistake.

I will fold both commits before pushing them out. Keeping them separated for the sake of easier reviews.

Phil Sutter (2):
Revert "extensions: string: Clarify description of --to"
extensions: string: Clarify description of --to

 extensions/libxt_string.man | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
Signature · 1 line
2.41.0
author reviewer
#1 lore raw

PATCH 1/2 Revert "extensions: string: Clarify description of --to"

This reverts commit 920ece2b392fb83bd26416e0e6f8f6a847aacbaa.

---
 extensions/libxt_string.man | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
extensions/libxt_string.man +2 -6
index efdda492ae78d..2a470ece19c9d 100644
@@ -7,13 +7,9 @@ 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. If the pattern does not start
-within this offset, it is not considered a match.
+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.
 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.
 .TP
 [\fB!\fP] \fB\-\-string\fP \fIpattern\fP
 Matches the given pattern.
Signature · 1 line
2.41.0
author reviewer
#2 lore raw

PATCH 2/2 extensions: string: Clarify description of --to

In reply to Phil Sutter

Since kernel commit c4eee56e14fe ("net: skb_find_text: Ignore patterns extending past 'to'"), pattern scanning no longer happens past --to offset even if skb_seq_read() returned a larger block. Point this out in the description and also drop the '-1' offset which is not true as kernel's selftest in tools/testing/selftests/netfilter/xt_string.sh shows.

---
 extensions/libxt_string.man | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
extensions/libxt_string.man +3 -2
index 2a470ece19c9d..bdeb0a6200a88 100644
@@ -7,8 +7,9 @@ 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. That is, byte \fIoffset\fP
+(counting from 0) is the last one that is scanned and the maximum position of
+\fIpattern\fP's last character.
 If not passed, default is the packet size.
 .TP
 [\fB!\fP] \fB\-\-string\fP \fIpattern\fP
Signature · 1 line
2.41.0
author reviewer
#3 lore raw
In reply to Phil Sutter
Quoted 7 lines · Phil Sutter

My earlier adjustment to describe the actual behaviour is obsolete given that I adjusted said behaviour upon request. Revert the change in patch 1 and introduce a new copy-edit in patch 2 making the text a bit more clear and removing a mistake.

I will fold both commits before pushing them out. Keeping them separated for the sake of easier reviews.

Patch applied after folding the series into one.