All of lore.kernel.org
 help / color / mirror / Atom feed
From: hangbin.liu@linux.dev
To: "Matthieu Baerts" <matttbe@kernel.org>,
	"MPTCP Linux" <mptcp@lists.linux.dev>
Cc: "Florian Westphal" <fw@strlen.de>, "Hangbin Liu" <liuhangbin@kylinos.cn>
Subject: Re: [PATCH mptcp-next] selftests: mptcp: use offset to match RM_ADDR message
Date: Thu, 08 Oct 2026 13:40:07 +0000	[thread overview]
Message-ID: <a07411464cafcb016436eb3c17ffca73730d7fe1@linux.dev> (raw)
In-Reply-To: <b7438cbf-0674-4b8f-aa23-3ba5791cfe26@kernel.org>

Hi Matthieu,

October 8, 2026 at 7:46 PM, "Matthieu Baerts" <matttbe@kernel.org> wrote:
> 
> Hi Hangbin,
> 
> Thank you for the follow-up!
> 
> On 08/10/2026 12:06, Hangbin Liu wrote:
> 
> > 
> > From: Hangbin Liu <liuhangbin@kylinos.cn>
> >  
> >  nft cannot match RM_ADDR when it is the second MPTCP option,
> > 
> Do you mind adding a short explanation why or just a ref to:
> 
>  https://lore.kernel.org/a391d81c-0bce-41e6-886e-a558765c6891@kernel.org

OK, I will.

> 
> Also, could you title this patch:
> 
>  Squash to "selftests: mptcp: convert iptables to nftables for
>  mptcp_join.sh"
> 
> And mention what should be added to the original commit message, please?

OK, no problem.

> 
> > 
> > so we rely on hard-coded offsets. A tcpdump capture of the RM_ADDR
> >  message looks like:
> >  
> >  [TCP header: 20 bytes] [nop] [nop] [timestamp: 10 bytes] \
> >  [MPTCP DSS: 12 bytes] [MPTCP RM_ADDR: 4 bytes]
> >  
> >  We verify: TCP Data Offset (TCP[12] × 8) equals 48 bytes (12 x 4),
> >  DSS length (TCP[33] x 8) is 12 bytes, and RM_ADDR subtype (TCP[46] × 8)
> >  is 4. This matches the old cBPF check, which calculated offsets starting
> >  from the IP header:
> >  
> >  (ip[32] & 0xf0) == 0xc0 && ip[53] == 0x0c && (ip[66] & 0xf0) == 0x40
> >  
> >  Also add MPTCP kind (30) checks for the DSS (TCP[32] x 8) and RM_ADDR
> >  (TCP[44] x 8) options.
> > 
> Good idea.
> 
> > 
> > Signed-off-by: Hangbin Liu <liuhangbin@kylinos.cn>
> >  ---
> >  tools/testing/selftests/net/mptcp/mptcp_join.sh | 14 ++++++++++++--
> >  1 file changed, 12 insertions(+), 2 deletions(-)
> >  
> >  diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> >  index b16e24418e73..194b80277ae2 100755
> >  --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
> >  +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> >  @@ -4375,7 +4375,12 @@ endpoint_tests()
> >  local nft=1
> >  ip netns exec "${ns2}" nft insert rule ip filter OUTPUT \
> >  ip saddr 10.0.1.2 meta l4proto tcp \
> >  - tcp option mptcp subtype remove-addr drop || nft=0
> >  + @th,96,4 == 12 \
> >  + @th,256,8 == 30 \
> >  + @th,264,8 == 12 \
> >  + @th,352,8 == 30 \
> >  + @th,368,4 == 4 \
> >  + drop || nft=0
> >  local i
> >  for i in $(seq 3); do
> >  pm_nl_del_endpoint $ns2 1 10.0.1.2
> >  @@ -4454,7 +4459,12 @@ endpoint_tests()
> >  local nft=1
> >  ip netns exec "${ns1}" nft insert rule ip filter OUTPUT \
> >  ip saddr 10.0.1.1 meta l4proto tcp \
> >  - tcp option mptcp subtype remove-addr drop || nft=0
> >  + @th,96,4 == 12 \
> >  + @th,256,8 == 30 \
> >  + @th,264,8 == 12 \
> >  + @th,352,8 == 30 \
> >  + @th,368,4 == 4 \
> > 
> Do you mind just adding this sequence to a global variable (an array?),
> similar to what was done before with the cBPF filter, with a short
> comment, please?
> 
> That would be easier to understand here, and to avoid duplicated code.

Yes, I will.

BTW, For mptcp_sockopt.sh,

    # just to debug: check we have multiple subflows connection requests
    add rule $table filter OUTPUT \
        tcp flags & (fin | syn | rst | ack) == syn \
        meta mark $m accept

do you think if there is a need to add counter or remove this rule?

Thanks
Hangbin

  reply	other threads:[~2026-10-08 13:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-08 10:06 [PATCH mptcp-next] selftests: mptcp: use offset to match RM_ADDR message Hangbin Liu
2026-10-08 11:21 ` MPTCP CI
2026-10-08 11:46 ` Matthieu Baerts
2026-10-08 13:40   ` hangbin.liu [this message]
2026-10-08 13:43     ` 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=a07411464cafcb016436eb3c17ffca73730d7fe1@linux.dev \
    --to=hangbin.liu@linux.dev \
    --cc=fw@strlen.de \
    --cc=liuhangbin@kylinos.cn \
    --cc=matttbe@kernel.org \
    --cc=mptcp@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.