netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2] man: tc-u32: Fix page to match new firstfrag behavior
@ 2021-11-04 14:42 Anssi Hannula
  2021-11-04 16:06 ` Phil Sutter
  0 siblings, 1 reply; 2+ messages in thread
From: Anssi Hannula @ 2021-11-04 14:42 UTC (permalink / raw)
  To: netdev; +Cc: stephen, Phil Sutter, Hiroaki SHIMODA

Commit 690b11f4a6b8 ("tc: u32: Fix firstfrag filter.") applied in 2012
changed the "ip firstfrag" selector to not match non-fragmented packets
anymore.

However, the documentation added in f15a23966fff ("tc: add a man page
for u32 filter") in 2015 includes an example that relies on the previous
behavior (non-fragmented packet counted as first fragment).

Due to this, the example does not work correctly and does not actually
classify regular SSH packets.

Modify the example to use a raw u16 selector on the fragment offset to
make it work, and also make the firstfrag description more clear about
the current behavior.

Fixes: f15a23966fff ("tc: add a man page for u32 filter")
Signed-off-by: Anssi Hannula <anssi.hannula@bitwise.fi>
Cc: Phil Sutter <phil@nwl.cc>
Cc: Hiroaki SHIMODA <shimoda.hiroaki@gmail.com>
---

I suspect the original behavior was intentional, but the new one has
been out for 9 years now so I guess it is too late to change again.

 man/man8/tc-u32.8 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/man/man8/tc-u32.8 b/man/man8/tc-u32.8
index fec9af7f..507589bd 100644
--- a/man/man8/tc-u32.8
+++ b/man/man8/tc-u32.8
@@ -427,7 +427,7 @@ Also minimal header size for IPv4 and lack of IPv6 extension headers is assumed.
 IPv4 only, check certain flags and fragment offset values. Match if the packet
 is not a fragment
 .RB ( nofrag ),
-the first fragment
+the first fragment of a fragmented packet
 .RB ( firstfrag ),
 if Don't Fragment
 .RB ( df )
@@ -644,7 +644,7 @@ tc filter add dev eth0 parent 1:0 protocol ip \\
 tc filter add dev eth0 parent 1:0 protocol ip \\
         u32 ht 800: \\
         match ip protocol 6 FF \\
-        match ip firstfrag \\
+        match u16 0 1fff at 6 \\
         offset at 0 mask 0f00 shift 6 \\
         link 1:
 .EE
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH iproute2] man: tc-u32: Fix page to match new firstfrag behavior
  2021-11-04 14:42 [PATCH iproute2] man: tc-u32: Fix page to match new firstfrag behavior Anssi Hannula
@ 2021-11-04 16:06 ` Phil Sutter
  0 siblings, 0 replies; 2+ messages in thread
From: Phil Sutter @ 2021-11-04 16:06 UTC (permalink / raw)
  To: Anssi Hannula; +Cc: netdev, stephen, Hiroaki SHIMODA

On Thu, Nov 04, 2021 at 04:42:05PM +0200, Anssi Hannula wrote:
> Commit 690b11f4a6b8 ("tc: u32: Fix firstfrag filter.") applied in 2012
> changed the "ip firstfrag" selector to not match non-fragmented packets
> anymore.
> 
> However, the documentation added in f15a23966fff ("tc: add a man page
> for u32 filter") in 2015 includes an example that relies on the previous
> behavior (non-fragmented packet counted as first fragment).
> 
> Due to this, the example does not work correctly and does not actually
> classify regular SSH packets.
> 
> Modify the example to use a raw u16 selector on the fragment offset to
> make it work, and also make the firstfrag description more clear about
> the current behavior.
> 
> Fixes: f15a23966fff ("tc: add a man page for u32 filter")
> Signed-off-by: Anssi Hannula <anssi.hannula@bitwise.fi>
> Cc: Phil Sutter <phil@nwl.cc>
> Cc: Hiroaki SHIMODA <shimoda.hiroaki@gmail.com>

Acked-by: Phil Sutter <phil@nwl.cc>

> I suspect the original behavior was intentional, but the new one has
> been out for 9 years now so I guess it is too late to change again.

At least it seems nobody really depends on the old behaviour (or doesn't
update iproute2 then). :)

Thanks, Phil

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-04 16:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-04 14:42 [PATCH iproute2] man: tc-u32: Fix page to match new firstfrag behavior Anssi Hannula
2021-11-04 16:06 ` Phil Sutter

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).