All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH mptcp-next] selftests: mptcp: use offset to match RM_ADDR message
@ 2026-10-08 10:06 Hangbin Liu
  2026-10-08 11:21 ` MPTCP CI
  2026-10-08 11:46 ` Matthieu Baerts
  0 siblings, 2 replies; 5+ messages in thread
From: Hangbin Liu @ 2026-10-08 10:06 UTC (permalink / raw)
  To: MPTCP Linux; +Cc: Florian Westphal, Hangbin Liu, Hangbin Liu

From: Hangbin Liu <liuhangbin@kylinos.cn>

nft cannot match RM_ADDR when it is the second MPTCP option,
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.

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 \
+			drop || nft=0
 		pm_nl_del_endpoint $ns1 42 10.0.1.1
 		sleep 0.5
 		chk_subflow_nr "after delete ID 0" 2

---
base-commit: 9651c766735c19e7a6b90d731bab53ef7959def8
change-id: 20261008-mptcp_rm_addr-92ab7ff3d94d

Best regards,
-- 
Hangbin Liu <liuhangbin@kylinos.cn>


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

end of thread, other threads:[~2026-10-08 13:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2026-10-08 13:43     ` Matthieu Baerts

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.