Skip to contentSkip to conversation

mptcp: add per-event MIB counters for MPTCP_RST_EMPTCP resets

PATCH Superseded Shardul Bankar 3 participants 6 messages May 9 – May 11

Subsystems (3)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 mptcp: add per-event MIB counters for MPTCP_RST_EMPTCP resets

MPTCP_RST_EMPTCP (reset reason 1) is used as a catch-all for several distinct error conditions across subflow setup, authentication, and data-path validation. The existing MPRstTx/MPRstRx counters only track aggregate reset volume, making it difficult to diagnose which code path is triggering subflow resets in production.

Add per-event MIB counters covering each MPTCP_RST_EMPTCP use site that is not already covered by an existing counter, named after the underlying event or condition rather than the reset action:

  MD5SigReset           MD5SIG enabled on listener (incompatible)
  MPJoinSynAckNoMPJoin  SYN/ACK missing MP_JOIN option
  MPJoinAckNoMPJoin     server-side ACK missing MP_JOIN option

(fallback path, MPJoin required)
MPJoinAckNoCtx server-side ACK with no subflow context
DssReset data mapping invalid (also fires on
MAPPING_NODSS / EMIDDLEBOX path)
MPJoinNotEstablished JOIN attempted on a not-fully-established msk

The aggregate MPRstTx/MPRstRx counters are unchanged.

---
v2:
- Drop MPRstNoToken (use MPTCP_MIB_JOINNOTOKEN)
- Drop MPRstHMAC (use MPJoinSynAckHMacFailure; SynAck site

    fixed in c4a99a921949)

- Rename MPRstMD5SIG -> MD5SigReset
- Rename MPRstNoMPJ -> MPJoinSynAckNoMPJoin
- Rename MPRstBadMap -> DssReset; also fire on EMIDDLEBOX branch
- Split MPRstFatalFallback into MPJoinAckNoMPJoin (fallback)
and MPJoinAckNoCtx (!ctx)
- Rename MPRstNotEstablished -> MPJoinNotEstablished (mptcp_finish_join is reached from both SYN/ACK and ACK paths)
v1: https://lore.kernel.org/all/[email protected]/

 net/mptcp/mib.c      | 6 ++++++
 net/mptcp/mib.h      | 6 ++++++
 net/mptcp/protocol.c | 1 +
 net/mptcp/subflow.c  | 9 +++++++++
 4 files changed, 22 insertions(+)
net/mptcp/mib.c +6 -0
index f23fda0c55a7..e44ae95c3e7e 100644
@@ -71,6 +71,12 @@ static const struct snmp_mib mptcp_snmp_list[] = {
 	SNMP_MIB_ITEM("MPFastcloseRx", MPTCP_MIB_MPFASTCLOSERX),
 	SNMP_MIB_ITEM("MPRstTx", MPTCP_MIB_MPRSTTX),
 	SNMP_MIB_ITEM("MPRstRx", MPTCP_MIB_MPRSTRX),
+	SNMP_MIB_ITEM("MD5SigReset", MPTCP_MIB_MD5SIGRESET),
+	SNMP_MIB_ITEM("MPJoinSynAckNoMPJoin", MPTCP_MIB_MPJOINSYNACKNOMPJOIN),
+	SNMP_MIB_ITEM("MPJoinAckNoMPJoin", MPTCP_MIB_MPJOINACKNOMPJOIN),
+	SNMP_MIB_ITEM("MPJoinAckNoCtx", MPTCP_MIB_MPJOINACKNOCTX),
+	SNMP_MIB_ITEM("DssReset", MPTCP_MIB_DSSRESET),
+	SNMP_MIB_ITEM("MPJoinNotEstablished", MPTCP_MIB_MPJOINNOTESTABLISHED),
 	SNMP_MIB_ITEM("SubflowStale", MPTCP_MIB_SUBFLOWSTALE),
 	SNMP_MIB_ITEM("SubflowRecover", MPTCP_MIB_SUBFLOWRECOVER),
 	SNMP_MIB_ITEM("SndWndShared", MPTCP_MIB_SNDWNDSHARED),
net/mptcp/mib.h +6 -0
index 812218b5ed2b..da0b08cfd35f 100644
@@ -70,6 +70,12 @@ enum linux_mptcp_mib_field {
 	MPTCP_MIB_MPFASTCLOSERX,	/* Received a MP_FASTCLOSE */
 	MPTCP_MIB_MPRSTTX,		/* Transmit a MP_RST */
 	MPTCP_MIB_MPRSTRX,		/* Received a MP_RST */
+	MPTCP_MIB_MD5SIGRESET,		/* MP_RST: MD5SIG enabled on listener */
+	MPTCP_MIB_MPJOINSYNACKNOMPJOIN,	/* MP_RST: missing MP_JOIN in SYN/ACK */
+	MPTCP_MIB_MPJOINACKNOMPJOIN,	/* MP_RST: missing MP_JOIN in ACK */
+	MPTCP_MIB_MPJOINACKNOCTX,	/* MP_RST: no subflow context on ACK */
+	MPTCP_MIB_DSSRESET,		/* MP_RST: bad data mapping */
+	MPTCP_MIB_MPJOINNOTESTABLISHED,	/* MP_RST: JOIN on not-fully-established msk */
 	MPTCP_MIB_SUBFLOWSTALE,		/* Subflows entered 'stale' status */
 	MPTCP_MIB_SUBFLOWRECOVER,	/* Subflows returned to active status after being stale */
 	MPTCP_MIB_SNDWNDSHARED,		/* Subflow snd wnd is overridden by msk's one */
net/mptcp/protocol.c +1 -0
index 93e7a42fc65c..e788ed45917b 100644
@@ -3837,6 +3837,7 @@ bool mptcp_finish_join(struct sock *ssk)
 
 	/* mptcp socket already closing? */
 	if (!mptcp_is_fully_established(parent)) {
+		MPTCP_INC_STATS(sock_net(parent), MPTCP_MIB_MPJOINNOTESTABLISHED);
 		subflow->reset_reason = MPTCP_RST_EMPTCP;
 		return false;
 	}
net/mptcp/subflow.c +9 -0
index d562e149606f..6fce3f431667 100644
@@ -160,6 +160,7 @@ static int subflow_check_req(struct request_sock *req,
 	 * TCP option space.
 	 */
 	if (rcu_access_pointer(tcp_sk(sk_listener)->md5sig_info)) {
+		MPTCP_INC_STATS(sock_net(sk_listener), MPTCP_MIB_MD5SIGRESET);
 		subflow_add_reset_reason(skb, MPTCP_RST_EMPTCP);
 		return -EINVAL;
 	}
@@ -568,6 +569,7 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb)
 		u8 hmac[SHA256_DIGEST_SIZE];
 
 		if (!(mp_opt.suboptions & OPTION_MPTCP_MPJ_SYNACK)) {
+			MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPJOINSYNACKNOMPJOIN);
 			subflow->reset_reason = MPTCP_RST_EMPTCP;
 			goto do_reset;
 		}
@@ -870,6 +872,12 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,
 		 */
 		if (!ctx || fallback) {
 			if (fallback_is_fatal) {
+				if (!ctx)
+					MPTCP_INC_STATS(sock_net(sk),
+							MPTCP_MIB_MPJOINACKNOCTX);
+				else
+					MPTCP_INC_STATS(sock_net(sk),
+							MPTCP_MIB_MPJOINACKNOMPJOIN);
 				subflow_add_reset_reason(skb, MPTCP_RST_EMPTCP);
 				goto dispose_child;
 			}
@@ -1421,6 +1429,7 @@ static bool subflow_check_data_avail(struct sock *ssk)
 			 * subflow_error_report() will introduce the appropriate barriers
 			 */
 			subflow->reset_transient = 0;
+			MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_DSSRESET);
 			subflow->reset_reason = status == MAPPING_NODSS ?
 						MPTCP_RST_EMIDDLEBOX :
 						MPTCP_RST_EMPTCP;

base-commit: 83b40ddf390d5eb34ca6b966e1428c0cc738b6f5

Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 2/2 selftests: mptcp: extend chk_rst_nr to validate per-event RST counters

Extend chk_rst_nr() with named env-var expectations for each per-event MPTCP_RST_EMPTCP counter, matching the pattern used by chk_join_nr(). Each counter defaults to 0 and is checked silently on success; mismatches print a check line and fail the test. Counters absent from the running kernel are skipped silently so older kernels do not false-fail.

Add a cross-namespace test that triggers MPJoinSynAckNoMPJoin: ns1 announces an address belonging to a third namespace (ns3) where MPTCP is disabled, the client (ns2) JOINs to ns3 and receives a plain TCP SYN/ACK without MP_JOIN, and the new counter increments on the client side.

Other per-event counters (MD5SigReset, MPJoinAckNoMPJoin, MPJoinAckNoCtx, DssReset, MPJoinNotEstablished) are not currently reachable from mptcp_join.sh; the env-var hooks are in place for future tests to set expectations explicitly.

Assisted-by Claude:claude-opus-4-7

---
v2:
New patch in this version, addressing the request from v1's review to validate the per-event counters in mptcp_join.sh.

 .../testing/selftests/net/mptcp/mptcp_join.sh | 94 +++++++++++++++++++
 1 file changed, 94 insertions(+)
tools/testing/selftests/net/mptcp/mptcp_join.sh +94 -0
index 5d4d0f127f79..5d4fc8951f05 100755
@@ -76,6 +76,13 @@ unset join_create_err
 unset join_bind_err
 unset join_connect_err
 
+unset rst_md5sig_reset
+unset rst_synack_no_mpjoin
+unset rst_ack_no_mpjoin
+unset rst_ack_no_ctx
+unset rst_dss_reset
+unset rst_not_established
+
 unset fb_ns1
 unset fb_ns2
 unset fb_infinite_map_tx
@@ -1349,6 +1356,12 @@ chk_rst_nr()
 	local rst_tx=$1
 	local rst_rx=$2
 	local ns_invert=${3:-""}
+	local md5sig_reset=${rst_md5sig_reset:-0}
+	local synack_no_mpjoin=${rst_synack_no_mpjoin:-0}
+	local ack_no_mpjoin=${rst_ack_no_mpjoin:-0}
+	local ack_no_ctx=${rst_ack_no_ctx:-0}
+	local dss_reset=${rst_dss_reset:-0}
+	local not_established=${rst_not_established:-0}
 	local count
 	local ns_tx=$ns1
 	local ns_rx=$ns2
@@ -1385,6 +1398,43 @@ chk_rst_nr()
 	else
 		print_ok
 	fi
+
+	# Per-event MPTCP_RST_EMPTCP counters; default 0, gated on availability.
+	count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtMD5SigReset")
+	if [ -n "$count" ] && [ "$count" != "$md5sig_reset" ]; then
+		print_check "MD5SigReset ${tx}"
+		fail_test "got $count MD5SigReset expected $md5sig_reset"
+	fi
+
+	count=$(mptcp_lib_get_counter ${ns_rx} "MPTcpExtMPJoinSynAckNoMPJoin")
+	if [ -n "$count" ] && [ "$count" != "$synack_no_mpjoin" ]; then
+		print_check "MPJoinSynAckNoMPJoin ${rx}"
+		fail_test "got $count MPJoinSynAckNoMPJoin expected $synack_no_mpjoin"
+	fi
+
+	count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtMPJoinAckNoMPJoin")
+	if [ -n "$count" ] && [ "$count" != "$ack_no_mpjoin" ]; then
+		print_check "MPJoinAckNoMPJoin ${tx}"
+		fail_test "got $count MPJoinAckNoMPJoin expected $ack_no_mpjoin"
+	fi
+
+	count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtMPJoinAckNoCtx")
+	if [ -n "$count" ] && [ "$count" != "$ack_no_ctx" ]; then
+		print_check "MPJoinAckNoCtx ${tx}"
+		fail_test "got $count MPJoinAckNoCtx expected $ack_no_ctx"
+	fi
+
+	count=$(mptcp_lib_get_counter ${ns_rx} "MPTcpExtDssReset")
+	if [ -n "$count" ] && [ "$count" != "$dss_reset" ]; then
+		print_check "DssReset ${rx}"
+		fail_test "got $count DssReset expected $dss_reset"
+	fi
+
+	count=$(mptcp_lib_get_counter ${ns_rx} "MPTcpExtMPJoinNotEstablished")
+	if [ -n "$count" ] && [ "$count" != "$not_established" ]; then
+		print_check "MPJoinNotEstablished ${rx}"
+		fail_test "got $count MPJoinNotEstablished expected $not_established"
+	fi
 }
 
 chk_infi_nr()
@@ -4477,6 +4527,49 @@ endpoint_tests()
 	fi
 }
 
+rst_emptcp_tests()
+{
+	# Validate per-event MPTCP_RST_EMPTCP counters.  Use a third
+	# namespace (ns3) to trigger paths that aren't reachable in the
+	# standard ns1/ns2 setup: ns1 announces an address belonging to
+	# ns3, the client (ns2) JOINs to ns3 where the SYN/ACK arrives
+	# without an MP_JOIN option (MPTCP disabled there), and the
+	# MPJoinSynAckNoMPJoin counter increments on the client side.
+	local ns3
+
+	if reset "rst per event no mpj"; then
+		if ! setup_ns ns3; then
+			print_check "create ns3"
+			print_skip
+			return
+		fi
+
+		ip link add ns2eth5 netns "$ns2" type veth peer name ns3eth1 netns "$ns3"
+		ip -net "$ns2" addr add 10.0.6.2/24 dev ns2eth5
+		ip -net "$ns2" link set ns2eth5 up
+		ip -net "$ns3" addr add 10.0.6.1/24 dev ns3eth1
+		ip -net "$ns3" link set ns3eth1 up
+		ip -net "$ns3" link set lo up
+		ip netns exec $ns3 sysctl -q net.mptcp.enabled=0
+
+		pm_nl_add_endpoint $ns1 10.0.6.1 flags signal id 5
+		pm_nl_set_limits $ns2 1 1
+
+		local tport=$(get_port)
+		ip netns exec ${ns3} ./mptcp_connect -l -t -1 -s TCP \
+			-p $tport 10.0.6.1 &
+
+		speed=slow \
+			run_tests $ns1 $ns2 10.0.1.1
+		wait_attempt_fail "$ns2"
+
+		rst_synack_no_mpjoin=1 \
+			chk_rst_nr 0 0
+
+		cleanup_ns "$ns3"
+	fi
+}
+
 # [$1: error message]
 usage()
 {
@@ -4527,6 +4620,7 @@ all_tests_sorted=(
 	F@fail_tests
 	u@userspace_tests
 	I@endpoint_tests
+	R@rst_emptcp_tests
 )
 
 all_tests_args=""
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH v2 2/2] selftests: mptcp: extend chk_rst_nr to validate per-event RST counters

Hi Shardul,

Thank you for your modifications, that's great!

Our CI did some validations and here is its report:

- KVM Validation: normal (except selftest_mptcp_join): Success! ✅
- KVM Validation: normal (only selftest_mptcp_join): Success! ✅
- KVM Validation: debug (except selftest_mptcp_join): Unstable: 1 failed test(s): packetdrill_sockopts ⚠️
- KVM Validation: debug (only selftest_mptcp_join): Success! ✅
- KVM Validation: btf-normal (only bpftest_all): Success! ✅
- KVM Validation: btf-debug (only bpftest_all): Success! ✅
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/25624708095

Initiator: Matthieu Baerts (NGI0)
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/7d57f74d5d41
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=1092095

If there are some issues, you can reproduce them using the same environment as the one used by the CI thanks to a docker image, e.g.:

    $ cd [kernel source code]
    $ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
        --pull always mptcp/mptcp-upstream-virtme-docker:latest \
        auto-normal

For more details:

https://github.com/multipath-tcp/mptcp-upstream-virtme-docker

Please note that despite all the efforts that have been already done to have a stable tests suite when executed on a public CI like here, it is possible some reported issues are not due to your modifications. Still, do not hesitate to help us improve that ;-)

Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (NGI0 Core)

maintainer
#3 lore raw

Re: [PATCH v2 2/2] selftests: mptcp: extend chk_rst_nr to validate per-event RST counters

In reply to Shardul Bankar

Hi Shardul,

Quoted 6 lines · Shardul Bankar

Extend chk_rst_nr() with named env-var expectations for each per-event MPTCP_RST_EMPTCP counter, matching the pattern used by chk_join_nr(). Each counter defaults to 0 and is checked silently on success; mismatches print a check line and fail the test. Counters absent from the running kernel are skipped silently so older kernels do not false-fail.

Thank you for adding a test. This part looks good to me!

Quoted 10 lines

Add a cross-namespace test that triggers MPJoinSynAckNoMPJoin: ns1 announces an address belonging to a third namespace (ns3) where MPTCP is disabled, the client (ns2) JOINs to ns3 and receives a plain TCP SYN/ACK without MP_JOIN, and the new counter increments on the client side.

Other per-event counters (MD5SigReset, MPJoinAckNoMPJoin, MPJoinAckNoCtx, DssReset, MPJoinNotEstablished) are not currently reachable from mptcp_join.sh; the env-var hooks are in place for future tests to set expectations explicitly.

I guess packetdrill should be easier to hit some of these paths.

Quoted 1 line
Assisted-by Claude:claude-opus-4-7

Thank you for mentioning this!

(...)

Quoted 4 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
index 5d4d0f127f79..5d4fc8951f05 100755

(...)

tools/testing/selftests/net/mptcp/mptcp_join.sh endpoint_tests() · line 4538

Quoted 9 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +9 -0
+rst_emptcp_tests()
+{
+	# Validate per-event MPTCP_RST_EMPTCP counters.  Use a third
+	# namespace (ns3) to trigger paths that aren't reachable in the
+	# standard ns1/ns2 setup: ns1 announces an address belonging to
+	# ns3, the client (ns2) JOINs to ns3 where the SYN/ACK arrives
+	# without an MP_JOIN option (MPTCP disabled there), and the
+	# MPJoinSynAckNoMPJoin counter increments on the client side.
+	local ns3

I'm not a big fan of adding a new netns here. Would it eventually work to have $ns1 announcing an address that is on $ns2 and with mptcp_connect listening on this address and port in TCP only?

If yes, then you can move this test to the end of signal_address_tests I suppose.

If no, I don't know if it is worth it to have a such different test here. Maybe it is enough to check the new RST counter like you did above? (Eventually, adding a new check on packetdrill side if there are already tests validating these paths.)

Quoted 14 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +14 -0
+
+	if reset "rst per event no mpj"; then
+		if ! setup_ns ns3; then
+			print_check "create ns3"
+			print_skip
+			return
+		fi
+
+		ip link add ns2eth5 netns "$ns2" type veth peer name ns3eth1 netns "$ns3"
+		ip -net "$ns2" addr add 10.0.6.2/24 dev ns2eth5
+		ip -net "$ns2" link set ns2eth5 up
+		ip -net "$ns3" addr add 10.0.6.1/24 dev ns3eth1
+		ip -net "$ns3" link set ns3eth1 up
+		ip -net "$ns3" link set lo up

tools/testing/selftests/net/mptcp/mptcp_join.sh endpoint_tests() · line 4562

Quoted 10 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +10 -0
+		ip netns exec $ns3 sysctl -q net.mptcp.enabled=0
+
+		pm_nl_add_endpoint $ns1 10.0.6.1 flags signal id 5
+		pm_nl_set_limits $ns2 1 1
+
+		local tport=$(get_port)
+		ip netns exec ${ns3} ./mptcp_connect -l -t -1 -s TCP \
+			-p $tport 10.0.6.1 &
+
+		speed=slow \

Do you really need the "slow" mode? Usually used when > 3 ADD_ADDR are used or when actions need to be done during the connection. That's not the case here.

Quoted 14 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +10 -0
+			run_tests $ns1 $ns2 10.0.1.1
+		wait_attempt_fail "$ns2"
+
+		rst_synack_no_mpjoin=1 \
+			chk_rst_nr 0 0
+
+		cleanup_ns "$ns3"
+	fi
+}
+
 # [$1: error message]
 usage()
 {

tools/testing/selftests/net/mptcp/mptcp_join.sh all_tests_sorted=( · line 4626

Quoted 7 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +1 -0
@@ -4527,6 +4620,7 @@ all_tests_sorted=(
 	F@fail_tests
 	u@userspace_tests
 	I@endpoint_tests
+	R@rst_emptcp_tests
 )
 
 all_tests_args=""

Cheers,
Matt

Signature · 1 line
Sponsored by the NGI0 Core fund.
maintainer
#4 lore raw

Re: [PATCH v2 2/2] selftests: mptcp: extend chk_rst_nr to validate per-event RST counters

Quoted 37 lines · Matthieu Baerts

Hi Shardul,

Quoted 6 lines · Shardul Bankar

Extend chk_rst_nr() with named env-var expectations for each per-event MPTCP_RST_EMPTCP counter, matching the pattern used by chk_join_nr(). Each counter defaults to 0 and is checked silently on success; mismatches print a check line and fail the test. Counters absent from the running kernel are skipped silently so older kernels do not false-fail.

Thank you for adding a test. This part looks good to me!

Quoted 10 lines

Add a cross-namespace test that triggers MPJoinSynAckNoMPJoin: ns1 announces an address belonging to a third namespace (ns3) where MPTCP is disabled, the client (ns2) JOINs to ns3 and receives a plain TCP SYN/ACK without MP_JOIN, and the new counter increments on the client side.

Other per-event counters (MD5SigReset, MPJoinAckNoMPJoin, MPJoinAckNoCtx, DssReset, MPJoinNotEstablished) are not currently reachable from mptcp_join.sh; the env-var hooks are in place for future tests to set expectations explicitly.

I guess packetdrill should be easier to hit some of these paths.

Quoted 1 line
Assisted-by Claude:claude-opus-4-7

Thank you for mentioning this!

(...)

Quoted 4 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
index 5d4d0f127f79..5d4fc8951f05 100755

(...)

Quoted 11 lines

tools/testing/selftests/net/mptcp/mptcp_join.sh endpoint_tests() · line 4538

Quoted 9 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +9 -0
+rst_emptcp_tests()
+{
+	# Validate per-event MPTCP_RST_EMPTCP counters.  Use a third
+	# namespace (ns3) to trigger paths that aren't reachable in the
+	# standard ns1/ns2 setup: ns1 announces an address belonging to
+	# ns3, the client (ns2) JOINs to ns3 where the SYN/ACK arrives
+	# without an MP_JOIN option (MPTCP disabled there), and the
+	# MPJoinSynAckNoMPJoin counter increments on the client side.
+	local ns3

I'm not a big fan of adding a new netns here.

To give a bit more details: it is a different way of testing stuff here, we might miss issues with it, e.g. if the test is stopped in the middle, the new netns will not be cleaned, etc.

Quoted 24 lines

Would it eventually work
to have $ns1 announcing an address that is on $ns2 and with mptcp_connect listening on this address and port in TCP only?

If yes, then you can move this test to the end of signal_address_tests I suppose.

If no, I don't know if it is worth it to have a such different test here. Maybe it is enough to check the new RST counter like you did above? (Eventually, adding a new check on packetdrill side if there are already tests validating these paths.)

Quoted 12 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +12 -0
+
+	if reset "rst per event no mpj"; then
+		if ! setup_ns ns3; then
+			print_check "create ns3"
+			print_skip
+			return
+		fi
+
+		ip link add ns2eth5 netns "$ns2" type veth peer name ns3eth1 netns "$ns3"
+		ip -net "$ns2" addr add 10.0.6.2/24 dev ns2eth5
+		ip -net "$ns2" link set ns2eth5 up
+		ip -net "$ns3" addr add 10.0.6.1/24 dev ns3eth1
Quoted 8 lines

tools/testing/selftests/net/mptcp/mptcp_join.sh endpoint_tests() · line 4558

Quoted 8 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +8 -0
+		ip -net "$ns3" link set ns3eth1 up
+		ip -net "$ns3" link set lo up
+		ip netns exec $ns3 sysctl -q net.mptcp.enabled=0
+
+		pm_nl_add_endpoint $ns1 10.0.6.1 flags signal id 5
+		pm_nl_set_limits $ns2 1 1
+
+		local tport=$(get_port)

Also, shellcheck is complaining here:

Quoted 34 lines

In mptcp_join.sh line 4558:

		local tport=$(get_port)
                      ^---^ SC2155 (warning): Declare and assign separately to avoid masking return values.

tools/testing/selftests/net/mptcp/mptcp_join.sh endpoint_tests() · line 4562

Quoted 4 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +4 -0
+		ip netns exec ${ns3} ./mptcp_connect -l -t -1 -s TCP \
+			-p $tport 10.0.6.1 &
+
+		speed=slow \

Do you really need the "slow" mode? Usually used when > 3 ADD_ADDR are used or when actions need to be done during the connection. That's not the case here.

Quoted 20 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +11 -0
+			run_tests $ns1 $ns2 10.0.1.1
+		wait_attempt_fail "$ns2"
+
+		rst_synack_no_mpjoin=1 \
+			chk_rst_nr 0 0
+
+		cleanup_ns "$ns3"
+	fi
+}
+
 # [$1: error message]
 usage()
 {
@@ -4527,6 +4620,7 @@ all_tests_sorted=(
 	F@fail_tests
 	u@userspace_tests
 	I@endpoint_tests
+	R@rst_emptcp_tests
 )
 
Quoted 4 lines

tools/testing/selftests/net/mptcp/mptcp_join.sh all_tests_sorted=( · line 4626

Quoted 1 line
tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
 all_tests_args=""

Cheers,
Matt

Cheers,
Matt

Signature · 1 line
Sponsored by the NGI0 Core fund.
maintainer
#5 lore raw
In reply to Shardul Bankar

Hi Shardul,

Quoted 28 lines · Shardul Bankar

MPTCP_RST_EMPTCP (reset reason 1) is used as a catch-all for several distinct error conditions across subflow setup, authentication, and data-path validation. The existing MPRstTx/MPRstRx counters only track aggregate reset volume, making it difficult to diagnose which code path is triggering subflow resets in production.

Add per-event MIB counters covering each MPTCP_RST_EMPTCP use site that is not already covered by an existing counter, named after the underlying event or condition rather than the reset action:

  MD5SigReset           MD5SIG enabled on listener (incompatible)
  MPJoinSynAckNoMPJoin  SYN/ACK missing MP_JOIN option
  MPJoinAckNoMPJoin     server-side ACK missing MP_JOIN option

(fallback path, MPJoin required)
MPJoinAckNoCtx server-side ACK with no subflow context
DssReset data mapping invalid (also fires on
MAPPING_NODSS / EMIDDLEBOX path)
MPJoinNotEstablished JOIN attempted on a not-fully-established msk

The aggregate MPRstTx/MPRstRx counters are unchanged.

---
v2:
- Drop MPRstNoToken (use MPTCP_MIB_JOINNOTOKEN)
- Drop MPRstHMAC (use MPJoinSynAckHMacFailure; SynAck site

    fixed in c4a99a921949)
Quoted 8 lines

- Rename MPRstMD5SIG -> MD5SigReset
- Rename MPRstNoMPJ -> MPJoinSynAckNoMPJoin
- Rename MPRstBadMap -> DssReset; also fire on EMIDDLEBOX branch
- Split MPRstFatalFallback into MPJoinAckNoMPJoin (fallback)
and MPJoinAckNoCtx (!ctx)
- Rename MPRstNotEstablished -> MPJoinNotEstablished (mptcp_finish_join is reached from both SYN/ACK and ACK paths)
v1: https://lore.kernel.org/all/[email protected]/

Thank you for the v2.

For next time, do you mind always adding a cover-letter when you have more than one patch, please? That's what is usually done here, and some automated tools expect one, and wait for it before validating the series (e.g. our CI).

(...)

Quoted 5 lines
net/mptcp/mib.c +0 -0
index f23fda0c55a7..e44ae95c3e7e 100644

net/mptcp/mib.c static const struct snmp_mib mptcp_snmp_list[] = { · line 79

Quoted 9 lines
net/mptcp/mib.c +6 -0
@@ -71,6 +71,12 @@ static const struct snmp_mib mptcp_snmp_list[] = {
 	SNMP_MIB_ITEM("MPFastcloseRx", MPTCP_MIB_MPFASTCLOSERX),
 	SNMP_MIB_ITEM("MPRstTx", MPTCP_MIB_MPRSTTX),
 	SNMP_MIB_ITEM("MPRstRx", MPTCP_MIB_MPRSTRX),
+	SNMP_MIB_ITEM("MD5SigReset", MPTCP_MIB_MD5SIGRESET),
+	SNMP_MIB_ITEM("MPJoinSynAckNoMPJoin", MPTCP_MIB_MPJOINSYNACKNOMPJOIN),
+	SNMP_MIB_ITEM("MPJoinAckNoMPJoin", MPTCP_MIB_MPJOINACKNOMPJOIN),
+	SNMP_MIB_ITEM("MPJoinAckNoCtx", MPTCP_MIB_MPJOINACKNOCTX),
+	SNMP_MIB_ITEM("DssReset", MPTCP_MIB_DSSRESET),
+	SNMP_MIB_ITEM("MPJoinNotEstablished", MPTCP_MIB_MPJOINNOTESTABLISHED),

Do you mind moving the declaration next to similar ones, please?

e.g. MD5SigReset after MD5SigFallback, MPJoinSynAckNoMPJoin after all the MPJoinSynAck(...) ones, etc.

Quoted 8 lines
net/mptcp/mib.c +0 -0
 	SNMP_MIB_ITEM("SubflowStale", MPTCP_MIB_SUBFLOWSTALE),
 	SNMP_MIB_ITEM("SubflowRecover", MPTCP_MIB_SUBFLOWRECOVER),
 	SNMP_MIB_ITEM("SndWndShared", MPTCP_MIB_SNDWNDSHARED),
net/mptcp/mib.h +0 -0
index 812218b5ed2b..da0b08cfd35f 100644

net/mptcp/mib.h enum linux_mptcp_mib_field { · line 78

Quoted 9 lines
net/mptcp/mib.h +6 -0
@@ -70,6 +70,12 @@ enum linux_mptcp_mib_field {
 	MPTCP_MIB_MPFASTCLOSERX,	/* Received a MP_FASTCLOSE */
 	MPTCP_MIB_MPRSTTX,		/* Transmit a MP_RST */
 	MPTCP_MIB_MPRSTRX,		/* Received a MP_RST */
+	MPTCP_MIB_MD5SIGRESET,		/* MP_RST: MD5SIG enabled on listener */
+	MPTCP_MIB_MPJOINSYNACKNOMPJOIN,	/* MP_RST: missing MP_JOIN in SYN/ACK */
+	MPTCP_MIB_MPJOINACKNOMPJOIN,	/* MP_RST: missing MP_JOIN in ACK */
+	MPTCP_MIB_MPJOINACKNOCTX,	/* MP_RST: no subflow context on ACK */
+	MPTCP_MIB_DSSRESET,		/* MP_RST: bad data mapping */
+	MPTCP_MIB_MPJOINNOTESTABLISHED,	/* MP_RST: JOIN on not-fully-established msk */

Same here for the order.

The rest looks good to me!

Cheers,
Matt

Signature · 1 line
Sponsored by the NGI0 Core fund.