From: Matthieu Baerts <matttbe@kernel.org>
To: Jan Engelhardt <ej@inai.de>
Cc: Netfilter Devel <netfilter-devel@vger.kernel.org>,
Netfilter Coreteam <coreteam@netfilter.org>
Subject: Re: Netfilter: match "tcp option" with the same type present multiple times
Date: Tue, 29 Sep 2026 11:34:14 +0200 [thread overview]
Message-ID: <6260a189-aa8b-42c5-bc85-bc2367656fd5@kernel.org> (raw)
In-Reply-To: <ro0285nn-9p34-n561-q86n-1s668021npor@vanv.qr>
Hi Jan,
On 28/09/2026 23:54, Jan Engelhardt wrote:
> On Monday 2026-09-28 14:13, Matthieu Baerts wrote:
>
>> The MPTCP selftests are switching from IPTables to NFTables, and
>> Clashiko reported that this part of a rule wouldn't match anything:
>>
>> tcp option mptcp subtype remove-addr drop
>>
>> When an MPTCP REMOVE_ADDR suboption (type 0x30, len >=4, subtype 0x4) is
>> added to the TCP options, it is added after an MPTCP DSS option (type
>> 0x30, len >= 8, subtype 0x2). In other words, there will be two MPTCP
>> (type 30) options in the TCP options. It looks like Netfilter doesn't
>> handle that, because it stops processing other TCP options when the
>> expected type is found:
>>
>> net/netfilter/nft_exthdr.c:nft_exthdr_tcp_eval() {
>> ...
>> for (i = sizeof(*tcph); i < tcphdr_len - 1; i += optl) {
>> optl = optlen(opt, i);
>>
>> if ( priv->type != opt[i])
>> continue;
>> ...
>> return; // <== it will look at the first MPTCP option
>> }
>
> Hm, neither RFC 793 nor 9293 seem to define a general processing rule
> or error-handling behavior for duplicate or repeated options within
> the header of a TCP segment.
From what I understood at the IETF, new TCP extensions can only be
assigned one "type". If multiple message types should be passed, the
subtype should be either extracted from the size, or by using another
TLV inside. (MPTCP is using the two techniques.)
(Old extensions like SACK and echo are exceptions, because they are old
ones.)
> MPTCP RFC 8684 seems to acknowledge that, with:
>
> "it may not be possible to combine all desired options .. on a single
> packet"
The MPTCP RFC specifies this mainly because of the TCP options space
restriction (40 bytes). For example, the ADD_ADDR option can take up to
30 bytes (+2 for the alignment). If you add TCP Timestamp (10 + 2 for
the alignment) or SACK, you are over the limit.
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
prev parent reply other threads:[~2026-09-29 9:34 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
2026-09-28 21:54 ` Jan Engelhardt
2026-09-29 9:34 ` Matthieu Baerts [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=6260a189-aa8b-42c5-bc85-bc2367656fd5@kernel.org \
--to=matttbe@kernel.org \
--cc=coreteam@netfilter.org \
--cc=ej@inai.de \
--cc=netfilter-devel@vger.kernel.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