Linux Netfilter development
 help / color / mirror / Atom feed
From: Matthieu Baerts <matttbe@kernel.org>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Netfilter Devel <netfilter-devel@vger.kernel.org>,
	Netfilter Coreteam <coreteam@netfilter.org>,
	Fernando Fernandez Mancera <fmancera@suse.de>
Subject: Re: Netfilter: match "tcp option" with the same type present multiple times
Date: Wed, 7 Oct 2026 10:17:39 +0200	[thread overview]
Message-ID: <230c857e-9560-40d5-8e9e-99d875e3a3c1@kernel.org> (raw)
In-Reply-To: <asWEWpVJLk0so8zM@chamomile>

Hi Pablo,

Thank you for your reply!

On 07/10/2026 01:29, Pablo Neira Ayuso wrote:
> On Wed, Sep 30, 2026 at 08:33:36PM +0200, Matthieu Baerts wrote:
>> On 29/09/2026 14:03, Pablo Neira Ayuso wrote:
>>> On Tue, Sep 29, 2026 at 12:40:47PM +0200, Matthieu Baerts wrote:
>>>> On 29/09/2026 12:00, Pablo Neira Ayuso wrote:
>>>>> On Tue, Sep 29, 2026 at 11:21:15AM +0200, Matthieu Baerts wrote:

(...)

>> If someone gives ...
>>
>>   tcp option mptcp subtype { mp-capable, mp-join, remove-addr } drop
>>
>> ... a bitmap could be used, but then that's specific to MPTCP I suppose.
> 
> I think this makes sense from user perspective.
> 
> The nft_exthdr expression needs iterate over the whole list of tcp
> options, then if type is 30, make a set lookup to check if the subtype
> value is in the set.
> 
> Something like:
> 
>  - loop
>  |  r1 <- exthdr     [ if no more tcp options, break loop ]
>  |  r2 <- lookup(r1) [ if found, break loop ]
> 
> but exthdr need to be taugh to resume from the last visited tcp
> option. A new loop expression would wrap these two exthdr and lookup
> expression (similar to nft_inner) and store the iteration context (ie.
> last visited tcp option to continue from there).
> 
> exthdr tcp option support needs advertise a new NFT_EXPR_LOOP flag, so
> it can be used with within this new nft_loop expression.

Yes, this or Fernando's idea (BTW, thank you for looking at that!). Both
will need to expose a new capability to the userspace from what I
understand, so any of them are fine for me.

> Another question: Would you still like to validate that DSS comes
> before REMOVE_ADDR?

I don't think that's needed: the RFC doesn't impose an order nor a
specific combination. When multiple MPTCP options are used, they are
notifying two different things.

If people are interested in validating that option A comes before option
B, that's certainly because they are trying to find a specific pattern
-- e.g. to identify a specific stack or kernel version -- not to
identify packets of a certain protocol. For them, they can use other
techniques, but I don't think we need to increase the complexity to
support that case. (At least for MPTCP.)

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.


  parent reply	other threads:[~2026-10-07  8:17 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-28 12:13 Netfilter: match "tcp option" with the same type present multiple times Matthieu Baerts
2026-09-28 13:13 ` Florian Westphal
2026-09-28 20:26   ` Matthieu Baerts
2026-09-28 21:08     ` Florian Westphal
2026-09-28 20:56   ` Fernando Fernandez Mancera
2026-09-28 21:22     ` Florian Westphal
2026-09-28 21:23       ` Fernando Fernandez Mancera
2026-09-28 20:54 ` Fernando Fernandez Mancera
2026-09-28 21:17   ` Fernando Fernandez Mancera
2026-09-28 21:22     ` Matthieu Baerts
2026-09-28 21:52 ` Pablo Neira Ayuso
2026-09-29  9:21   ` Matthieu Baerts
2026-09-29 10:00     ` Pablo Neira Ayuso
2026-09-29 10:40       ` Matthieu Baerts
2026-09-29 12:03         ` Pablo Neira Ayuso
2026-09-30 18:33           ` Matthieu Baerts
2026-10-06 23:29             ` Pablo Neira Ayuso
2026-10-07  8:01               ` Fernando Fernandez Mancera
2026-10-07 10:47                 ` Pablo Neira Ayuso
2026-10-07  8:17               ` Matthieu Baerts [this message]
2026-09-28 21:54 ` Jan Engelhardt
2026-09-29  9:34   ` Matthieu Baerts

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=230c857e-9560-40d5-8e9e-99d875e3a3c1@kernel.org \
    --to=matttbe@kernel.org \
    --cc=coreteam@netfilter.org \
    --cc=fmancera@suse.de \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.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