mptcp: per-event MIB counters for MPTCP_RST_EMPTCP
Subsystems (3)
v4 cover mptcp: per-event MIB counters for MPTCP_RST_EMPTCP
MPTCP_RST_EMPTCP (reset reason 1) is currently used as a catch-all for several distinct conditions across subflow setup, authentication, and data-path validation. This series adds per-event MIB counters at each of those use sites and validates them from mptcp_join.sh.
Patch 1 adds seven counters (MD5SigReset, MPJoinSynAckNoMPJoin, MPJoinAckNoMPJoin, MPJoinAckNoCtx, MPJoinNoIdFound, DssReset, MPJoinNotEstablished) and increments them in mib.c/mib.h, subflow.c and protocol.c.
Patch 2 adds named env-var expectations for each counter: the JOIN-related ones in chk_join_nr() and the two reset ones in chk_rst_nr(), both on fixed namespaces. It also adds one test inside signal_address_tests that triggers MPJoinSynAckNoMPJoin from the existing ns1/ns2 setup.
v4 (this version):
patch 1: add MPJoinNoIdFound for an MP_JOIN that carries a valid token
but for which the path manager returns no local id; it reaches the same MPTCP_RST_EMPTCP that MPJoinNoTokenFound only counts the no-token half of (Matt).
patch 2: move the MPJoin* checks into chk_join_nr() with fixed
namespaces, leaving only MD5SigReset and DssReset in chk_rst_nr() (Matt); rename the env vars (join_* / rst_md5sig / rst_dss); the new test uses mptcp_lib_wait_local_port_listen() and asserts with chk_join_nr().
v3: https://lore.kernel.org/all/[email protected]/
v2: https://lore.kernel.org/all/[email protected]/
v1: https://lore.kernel.org/all/[email protected]/
Shardul Bankar (2):
mptcp: add per-event MIB counters for MPTCP_RST_EMPTCP resets
selftests: mptcp: check per-event MPTCP_RST_EMPTCP counters
net/mptcp/mib.c | 7 ++ net/mptcp/mib.h | 7 ++ net/mptcp/protocol.c | 1 + net/mptcp/subflow.c | 10 ++ .../testing/selftests/net/mptcp/mptcp_join.sh | 93 +++++++++++++++++++ 5 files changed, 118 insertions(+)
Signature · 1 line
2.34.1
PATCH v4 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
MPJoinNoIdFound MP_JOIN with a valid token but no PM local ID
DssReset data mapping invalid (also fires on MAPPING_NODSS / EMIDDLEBOX path)
MPJoinNotEstablished JOIN attempted on a not-fully-established msk
MPJoinNoIdFound covers the second half of the no-msk MP_JOIN reset:
the existing MPJoinNoTokenFound (MPTCP_MIB_JOINNOTOKEN) only counts the missing-token case in subflow_token_join_request(), while a JOIN that carries a valid token but for which the path manager returns no local id reaches the same MPTCP_RST_EMPTCP in subflow_check_req() uncounted.
The aggregate MPRstTx/MPRstRx counters are unchanged.
--- net/mptcp/mib.c | 7 +++++++ net/mptcp/mib.h | 7 +++++++ net/mptcp/protocol.c | 1 + net/mptcp/subflow.c | 10 ++++++++++ 4 files changed, 25 insertions(+)
net/mptcp/mib.c +7 -0
@@ -21,14 +21,19 @@ static const struct snmp_mib mptcp_snmp_list[] = {SNMP_MIB_ITEM ("MPFallbackTokenInit" ,MPTCP_MIB_TOKENFALLBACKINIT ),SNMP_MIB_ITEM ("MPTCPRetrans" ,MPTCP_MIB_RETRANSSEGS ),SNMP_MIB_ITEM ("MPJoinNoTokenFound" ,MPTCP_MIB_JOINNOTOKEN ), +SNMP_MIB_ITEM ("MPJoinNoIdFound" ,MPTCP_MIB_MPJOINNOIDFOUND ),SNMP_MIB_ITEM ("MPJoinSynRx" ,MPTCP_MIB_JOINSYNRX ),SNMP_MIB_ITEM ("MPJoinSynBackupRx" ,MPTCP_MIB_JOINSYNBACKUPRX ),SNMP_MIB_ITEM ("MPJoinSynAckRx" ,MPTCP_MIB_JOINSYNACKRX ),SNMP_MIB_ITEM ("MPJoinSynAckBackupRx" ,MPTCP_MIB_JOINSYNACKBACKUPRX ),SNMP_MIB_ITEM ("MPJoinSynAckHMacFailure" ,MPTCP_MIB_JOINSYNACKMAC ), +SNMP_MIB_ITEM ("MPJoinSynAckNoMPJoin" ,MPTCP_MIB_MPJOINSYNACKNOMPJOIN ),SNMP_MIB_ITEM ("MPJoinAckRx" ,MPTCP_MIB_JOINACKRX ),SNMP_MIB_ITEM ("MPJoinAckHMacFailure" ,MPTCP_MIB_JOINACKMAC ), +SNMP_MIB_ITEM ("MPJoinAckNoMPJoin" ,MPTCP_MIB_MPJOINACKNOMPJOIN ), +SNMP_MIB_ITEM ("MPJoinAckNoCtx" ,MPTCP_MIB_MPJOINACKNOCTX ),SNMP_MIB_ITEM ("MPJoinRejected" ,MPTCP_MIB_JOINREJECTED ), +SNMP_MIB_ITEM ("MPJoinNotEstablished" ,MPTCP_MIB_MPJOINNOTESTABLISHED ),SNMP_MIB_ITEM ("MPJoinSynTx" ,MPTCP_MIB_JOINSYNTX ),SNMP_MIB_ITEM ("MPJoinSynTxCreatSkErr" ,MPTCP_MIB_JOINSYNTXCREATSKERR ), SNMP_MIB_ITEM("MPJoinSynTxBindErr", MPTCP_MIB_JOINSYNTXBINDERR),
@@ -81,7 +86,9 @@ static const struct snmp_mib mptcp_snmp_list[] = {SNMP_MIB_ITEM ("Blackhole" ,MPTCP_MIB_BLACKHOLE ),SNMP_MIB_ITEM ("MPCapableDataFallback" ,MPTCP_MIB_MPCAPABLEDATAFALLBACK ),SNMP_MIB_ITEM ("MD5SigFallback" ,MPTCP_MIB_MD5SIGFALLBACK ), +SNMP_MIB_ITEM ("MD5SigReset" ,MPTCP_MIB_MD5SIGRESET ),SNMP_MIB_ITEM ("DssFallback" ,MPTCP_MIB_DSSFALLBACK ), +SNMP_MIB_ITEM ("DssReset" ,MPTCP_MIB_DSSRESET ),SNMP_MIB_ITEM ("SimultConnectFallback" ,MPTCP_MIB_SIMULTCONNFALLBACK ),SNMP_MIB_ITEM ("FallbackFailed" ,MPTCP_MIB_FALLBACKFAILED ), SNMP_MIB_ITEM("WinProbe", MPTCP_MIB_WINPROBE),
net/mptcp/mib.h +7 -0
@@ -16,14 +16,19 @@ enum linux_mptcp_mib_field {MPTCP_MIB_TOKENFALLBACKINIT ,/* Could not init/allocate token */ MPTCP_MIB_RETRANSSEGS ,/* Segments retransmitted at the MPTCP-level */ MPTCP_MIB_JOINNOTOKEN ,/* Received MP_JOIN but the token was not found */ +MPTCP_MIB_MPJOINNOIDFOUND ,/* Received MP_JOIN but no local ID was found */ MPTCP_MIB_JOINSYNRX ,/* Received a SYN + MP_JOIN */ MPTCP_MIB_JOINSYNBACKUPRX ,/* Received a SYN + MP_JOIN + backup flag */ MPTCP_MIB_JOINSYNACKRX ,/* Received a SYN/ACK + MP_JOIN */ MPTCP_MIB_JOINSYNACKBACKUPRX ,/* Received a SYN/ACK + MP_JOIN + backup flag */ MPTCP_MIB_JOINSYNACKMAC ,/* HMAC was wrong on SYN/ACK + MP_JOIN */ +MPTCP_MIB_MPJOINSYNACKNOMPJOIN ,/* MP_RST: missing MP_JOIN in SYN/ACK */ MPTCP_MIB_JOINACKRX ,/* Received an ACK + MP_JOIN */ MPTCP_MIB_JOINACKMAC ,/* HMAC was wrong on ACK + MP_JOIN */ +MPTCP_MIB_MPJOINACKNOMPJOIN ,/* MP_RST: missing MP_JOIN in ACK */ +MPTCP_MIB_MPJOINACKNOCTX ,/* MP_RST: no subflow context on ACK */ MPTCP_MIB_JOINREJECTED ,/* The PM rejected the JOIN request */ +MPTCP_MIB_MPJOINNOTESTABLISHED ,/* MP_RST: JOIN on not-fully-established msk */ MPTCP_MIB_JOINSYNTX ,/* Sending a SYN + MP_JOIN */ MPTCP_MIB_JOINSYNTXCREATSKERR ,/* Not able to create a socket when sending a SYN + MP_JOIN */ MPTCP_MIB_JOINSYNTXBINDERR, /* Not able to bind() the address when sending a SYN + MP_JOIN */
@@ -84,7 +89,9 @@ enum linux_mptcp_mib_field {* established packet */ MPTCP_MIB_MD5SIGFALLBACK ,/* Conflicting TCP option enabled */ +MPTCP_MIB_MD5SIGRESET ,/* MP_RST: MD5SIG enabled on listener */ MPTCP_MIB_DSSFALLBACK ,/* Bad or missing DSS */ +MPTCP_MIB_DSSRESET ,/* MP_RST: bad data mapping */ MPTCP_MIB_SIMULTCONNFALLBACK ,/* Simultaneous connect */ MPTCP_MIB_FALLBACKFAILED ,/* Can't fallback due to msk status */ MPTCP_MIB_WINPROBE, /* MPTCP-level zero window probe */
net/mptcp/protocol.c +1 -0
@@ -3976,6 +3976,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 +10 -0
@@ -96,6 +96,7 @@ static struct mptcp_sock *subflow_token_join_request(struct request_sock *req) local_id =mptcp_pm_get_local_id (msk, (struct sock_common *)req);if (local_id <0 ) { +SUBFLOW_REQ_INC_STATS (req,MPTCP_MIB_MPJOINNOIDFOUND );sock_put ((struct sock *)msk);return NULL ; }
@@ -160,6 +161,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 +570,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 +873,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 +1430,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 ;
Signature · 1 line
2.34.1
PATCH v4 2/2 selftests: mptcp: check per-event MPTCP_RST_EMPTCP counters
In reply to Shardul BankarAdd named env-var expectations for each per-event MPTCP_RST_EMPTCP counter, matching the pattern used by the existing JOIN/RST checks. Each defaults to 0 and is checked silently on success; a mismatch prints a check line and fails the test. Counters absent from the running kernel are skipped silently so older kernels do not false-fail.
The JOIN-related counters (MPJoinSynAckNoMPJoin, MPJoinAckNoMPJoin, MPJoinAckNoCtx, MPJoinNotEstablished, MPJoinNoIdFound) are checked in chk_join_nr() on fixed namespaces; the two remaining reset counters (MD5SigReset, DssReset) stay in chk_rst_nr().
Add a test at the end of signal_address_tests that triggers
MPJoinSynAckNoMPJoin: ns1 signals an address that is already bound on the client (ns2), where a TCP-only mptcp_connect listener is started. The client's MP_JOIN routes locally to the TCP listener, which responds with a plain SYN/ACK without the MP_JOIN option, and the new counter increments on the client side.
Other per-event counters (MD5SigReset, MPJoinAckNoMPJoin, MPJoinAckNoCtx, DssReset, MPJoinNotEstablished, MPJoinNoIdFound) are not currently reachable from mptcp_join.sh; the env-var hooks are in place for future tests to set expectations explicitly.
--- .../testing/selftests/net/mptcp/mptcp_join.sh | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+)
tools/testing/selftests/net/mptcp/mptcp_join.sh +93 -0
@@ -75,6 +75,14 @@ unset join_syn_tx unset join_create_err unset join_bind_err unset join_connect_err +unset join_synack_no_mpjoin +unset join_ack_no_mpjoin +unset join_ack_no_ctx +unset join_not_established +unset join_no_id_found + +unset rst_md5sig +unset rst_dss unset fb_ns1 unset fb_ns2
@@ -1353,6 +1361,8 @@ chk_rst_nr() local rst_tx=$1 local rst_rx=$2 local ns_invert=${3:-""} + local md5sig=${rst_md5sig:-0} + local dss=${rst_dss:-0} local count local ns_tx=$ns1 local ns_rx=$ns2
@@ -1389,6 +1399,21 @@ chk_rst_nr() else print_ok fi + + # MPTCP_RST_EMPTCP reset-event counters; default 0, gated on + # availability. Fixed namespaces: MD5SigReset fires on the listener + # (server), DssReset on the data receiver (client). + count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMD5SigReset") + if [ -n "$count" ] && [ "$count" != "$md5sig" ]; then + print_check "MD5SigReset" + fail_test "got $count MD5SigReset expected $md5sig" + fi + + count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtDssReset") + if [ -n "$count" ] && [ "$count" != "$dss" ]; then + print_check "DssReset" + fail_test "got $count DssReset expected $dss" + fi } chk_infi_nr()
@@ -1587,6 +1612,11 @@ chk_join_nr() local rst_nr=${join_rst_nr:-0} local infi_nr=${join_infi_nr:-0} local corrupted_pkts=${join_corrupted_pkts:-0} + local synack_no_mpjoin=${join_synack_no_mpjoin:-0} + local ack_no_mpjoin=${join_ack_no_mpjoin:-0} + local ack_no_ctx=${join_ack_no_ctx:-0} + local not_established=${join_not_established:-0} + local no_id_found=${join_no_id_found:-0} local rc=${KSFT_PASS} local count local with_cookie
@@ -1655,6 +1685,44 @@ chk_join_nr() fail_test "got $count JOIN[s] syn rejected expected $syn_rej" fi + # Per-event MPTCP_RST_EMPTCP JOIN counters; default 0, gated on + # availability. Fixed namespaces: the *SynAck* one fires on the + # client receiving the SYN/ACK, the others on the server. + count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtMPJoinSynAckNoMPJoin") + if [ -n "$count" ] && [ "$count" != "$synack_no_mpjoin" ]; then + rc=${KSFT_FAIL} + print_check "synack no mpjoin" + fail_test "got $count JOIN[s] synack no mpjoin expected $synack_no_mpjoin" + fi + + count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMPJoinAckNoMPJoin") + if [ -n "$count" ] && [ "$count" != "$ack_no_mpjoin" ]; then + rc=${KSFT_FAIL} + print_check "ack no mpjoin" + fail_test "got $count JOIN[s] ack no mpjoin expected $ack_no_mpjoin" + fi + + count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMPJoinAckNoCtx") + if [ -n "$count" ] && [ "$count" != "$ack_no_ctx" ]; then + rc=${KSFT_FAIL} + print_check "ack no ctx" + fail_test "got $count JOIN[s] ack no ctx expected $ack_no_ctx" + fi + + count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMPJoinNotEstablished") + if [ -n "$count" ] && [ "$count" != "$not_established" ]; then + rc=${KSFT_FAIL} + print_check "join not established" + fail_test "got $count JOIN[s] not established expected $not_established" + fi + + count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMPJoinNoIdFound") + if [ -n "$count" ] && [ "$count" != "$no_id_found" ]; then + rc=${KSFT_FAIL} + print_check "join no id found" + fail_test "got $count JOIN[s] no id found expected $no_id_found" + fi + print_results "join Rx" ${rc} join_syn_tx="${join_syn_tx:-${syn_nr}}" \
@@ -2359,6 +2427,31 @@ signal_address_tests() chk_add_nr 4 4 fi fi + + # signalled address belongs to the client, where a TCP-only + # listener is bound at it: the client's MP_JOIN routes locally + # to the listener and receives a SYN/ACK without MP_JOIN. + # MPJoinSynAckNoMPJoin increments on the client side. + if reset "signal address, TCP-only listener on client"; then + local extra_bind + local port + + pm_nl_set_limits $ns1 0 1 + pm_nl_set_limits $ns2 1 1 + pm_nl_add_endpoint $ns1 10.0.2.2 flags signal + + port=$(get_port) + ip netns exec ${ns2} ./mptcp_connect -l -t -1 -p "$port" \ + -s TCP 10.0.2.2 & + extra_bind=$! + mptcp_lib_wait_local_port_listen "$ns2" "$port" + + run_tests $ns1 $ns2 10.0.1.1 + join_synack_no_mpjoin=1 join_syn_tx=1 \ + chk_join_nr 0 0 0 + + kill ${extra_bind} 2>/dev/null + fi } laminar_endp_tests()
Signature · 1 line
2.34.1
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): Success! ✅
- 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/27376133346
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/5d23d993f27c
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=1110277
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-normalFor 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)
Hi Shardul,
Quoted 16 lines · Shardul Bankar
MPTCP_RST_EMPTCP(reset reason 1) is currently used as a catch-all for several distinct conditions across subflow setup, authentication, and data-path validation. This series adds per-event MIB counters at each of those use sites and validates them frommptcp_join.sh.Patch 1 adds seven counters (MD5SigReset, MPJoinSynAckNoMPJoin, MPJoinAckNoMPJoin, MPJoinAckNoCtx, MPJoinNoIdFound, DssReset, MPJoinNotEstablished) and increments them in
mib.c/mib.h,subflow.candprotocol.c.Patch 2 adds named env-var expectations for each counter: the JOIN-related ones in
chk_join_nr()and the two reset ones inchk_rst_nr(), both on fixed namespaces. It also adds one test insidesignal_address_teststhat triggers MPJoinSynAckNoMPJoin from the existing ns1/ns2 setup.
Quoted 10 lines
v4 (this version):
patch 1: add MPJoinNoIdFound for anMP_JOINthat carries a valid token
but for which the path manager returns no local id; it reaches the sameMPTCP_RST_EMPTCPthat MPJoinNoTokenFound only counts the no-token half of (Matt).
patch 2: move the MPJoin* checks intochk_join_nr()with fixed
namespaces, leaving only MD5SigReset and DssReset inchk_rst_nr()(Matt); rename the env vars (join_* /rst_md5sig/rst_dss); the new test usesmptcp_lib_wait_local_port_listen()and asserts withchk_join_nr().
Thank you for the v4, and sorry for the exceptionally long delay!
The new version looks good to me:
New patches for t/upstream:
- 4ef5be975394: mptcp: add per-event MIB counters for MPTCP_RST_EMPTCP resets
- 69359746fd42: selftests: mptcp: check per-event MPTCP_RST_EMPTCP counters
- Results: b67053e5e63b..25452f1bb469 (export)
Tests are now in progress:
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.