Skip to contentSkip to conversation

mptcp: MIB counters for sent MP_JOIN

PATCH Superseded Matthieu Baerts (NGI0) 3 participants 9 messages Jul 29, 2024 – Aug 6, 2024

Subsystems (3)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Matthieu Baerts (NGI0)

author maintainer
#0 lore raw

v2 cover mptcp: MIB counters for sent MP_JOIN

Recently, a few issues have been discovered around the creation of additional subflows. Without these counters, it was difficult to point out the reason why some subflows were not created as expected.

All error paths from __mptcp_subflow_connect() are covered.

These new counters are also verified in the MPTCP Join selftest.

---
Changes in v2:
- Patch 1/2: Add "ERR" suffix in variable names. (Geliang)
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Matthieu Baerts (NGI0) (2):
mptcp: MIB counters for sent MP_JOIN
selftests: mptcp: join: validate MPJ SYN TX MIB counters

 net/mptcp/mib.c                                 |  5 ++
 net/mptcp/mib.h                                 |  5 ++
 net/mptcp/subflow.c                             | 24 ++++++++--
 tools/testing/selftests/net/mptcp/mptcp_join.sh | 63 +++++++++++++++++++++++++
 4 files changed, 93 insertions(+), 4 deletions(-)

---
base-commit: a9a9b3b154d187864b73eb0e86a0ff737d79a10a
change-id: 20240724-mptcp-join-tx-mib-84e21ea4b236

Best regards,

Signature · 1 line
Matthieu Baerts (NGI0) <[email protected]>
author maintainer
#1 lore raw

PATCH v2 1/2 mptcp: MIB counters for sent MP_JOIN

Recently, a few issues have been discovered around the creation of additional subflows. Without these counters, it was difficult to point out the reason why some subflows were not created as expected.

These counters should have been added earlier, because there is no other simple ways to extract such information from the kernel, and understand why subflows have not been created.

While at it, some pr_debug() have been added, just in case the errno needs to be printed.

---
Notes:
- v2:
- Add "ERR" suffix in variable names. (Geliang)

---
 net/mptcp/mib.c     |  5 +++++
 net/mptcp/mib.h     |  5 +++++
 net/mptcp/subflow.c | 24 ++++++++++++++++++++----
 3 files changed, 30 insertions(+), 4 deletions(-)
net/mptcp/mib.c +5 -0
index 7884217f33eb..36edef1e6861 100644
@@ -25,6 +25,11 @@ static const struct snmp_mib mptcp_snmp_list[] = {
 	SNMP_MIB_ITEM("MPJoinSynAckHMacFailure", MPTCP_MIB_JOINSYNACKMAC),
 	SNMP_MIB_ITEM("MPJoinAckRx", MPTCP_MIB_JOINACKRX),
 	SNMP_MIB_ITEM("MPJoinAckHMacFailure", MPTCP_MIB_JOINACKMAC),
+	SNMP_MIB_ITEM("MPJoinSynTx", MPTCP_MIB_JOINSYNTX),
+	SNMP_MIB_ITEM("MPJoinSynTxFEstabErr", MPTCP_MIB_JOINSYNTXFESTABERR),
+	SNMP_MIB_ITEM("MPJoinSynTxCreatSkErr", MPTCP_MIB_JOINSYNTXCREATSKERR),
+	SNMP_MIB_ITEM("MPJoinSynTxBindErr", MPTCP_MIB_JOINSYNTXBINDERR),
+	SNMP_MIB_ITEM("MPJoinSynTxConnectErr", MPTCP_MIB_JOINSYNTXCONNECTERR),
 	SNMP_MIB_ITEM("DSSNotMatching", MPTCP_MIB_DSSNOMATCH),
 	SNMP_MIB_ITEM("InfiniteMapTx", MPTCP_MIB_INFINITEMAPTX),
 	SNMP_MIB_ITEM("InfiniteMapRx", MPTCP_MIB_INFINITEMAPRX),
net/mptcp/mib.h +5 -0
index 66aa67f49d03..6f2e1ef1dce9 100644
@@ -20,6 +20,11 @@ enum linux_mptcp_mib_field {
 	MPTCP_MIB_JOINSYNACKMAC,	/* HMAC was wrong on SYN/ACK + MP_JOIN */
 	MPTCP_MIB_JOINACKRX,		/* Received an ACK + MP_JOIN */
 	MPTCP_MIB_JOINACKMAC,		/* HMAC was wrong on ACK + MP_JOIN */
+	MPTCP_MIB_JOINSYNTX,		/* Sending a SYN + MP_JOIN */
+	MPTCP_MIB_JOINSYNTXFESTABERR,	/* Not in fully established when 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 */
+	MPTCP_MIB_JOINSYNTXCONNECTERR,	/* Not able to connect() when sending a SYN + MP_JOIN */
 	MPTCP_MIB_DSSNOMATCH,		/* Received a new mapping that did not match the previous one */
 	MPTCP_MIB_INFINITEMAPTX,	/* Sent an infinite mapping */
 	MPTCP_MIB_INFINITEMAPRX,	/* Received an infinite mapping */
net/mptcp/subflow.c +20 -4
index a21c712350c3..69568d928b35 100644
@@ -1577,12 +1577,18 @@ int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc,
 	int ifindex;
 	u8 flags;
 
-	if (!mptcp_is_fully_established(sk))
+	if (!mptcp_is_fully_established(sk)) {
+		MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNTXFESTABERR);
 		goto err_out;
+	}
 
 	err = mptcp_subflow_create_socket(sk, loc->family, &sf);
-	if (err)
+	if (err) {
+		MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNTXCREATSKERR);
+		pr_debug("msk=%p local=%d remote:%d create sock error: %d\n",
+			 msk, local_id, remote_id, err);
 		goto err_out;
+	}
 
 	ssk = sf->sk;
 	subflow = mptcp_subflow_ctx(ssk);
@@ -1608,8 +1614,12 @@ int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc,
 #endif
 	ssk->sk_bound_dev_if = ifindex;
 	err = kernel_bind(sf, (struct sockaddr *)&addr, addrlen);
-	if (err)
+	if (err) {
+		MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNTXBINDERR);
+		pr_debug("msk=%p local=%d remote:%d bind error: %d\n",
+			 msk, local_id, remote_id, err);
 		goto failed;
+	}
 
 	mptcp_crypto_key_sha(subflow->remote_key, &remote_token, NULL);
 	pr_debug("msk=%p remote_token=%u local_id=%d remote_id=%d", msk,
@@ -1624,8 +1634,14 @@ int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc,
 	sock_hold(ssk);
 	list_add_tail(&subflow->node, &msk->conn_list);
 	err = kernel_connect(sf, (struct sockaddr *)&addr, addrlen, O_NONBLOCK);
-	if (err && err != -EINPROGRESS)
+	if (err && err != -EINPROGRESS) {
+		MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNTXCONNECTERR);
+		pr_debug("msk=%p local=%d remote:%d connect error: %d\n",
+			 msk, local_id, remote_id, err);
 		goto failed_unlink;
+	}
+
+	MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNTX);
 
 	/* discard the subflow socket */
 	mptcp_sock_graft(ssk, sk->sk_socket);
Signature · 1 line
2.45.2
author maintainer
#2 lore raw

PATCH v2 2/2 selftests: mptcp: join: validate MPJ SYN TX MIB counters

In reply to Matthieu Baerts (NGI0)

A few new MIB counters have been added. They are being validated here.

Most of the time, there are no errors, but sometimes, more MPJ SYN are queued compared to the numbers that are received.

Only one test has an error, the one to connect to a broadcast IP address.

---
 tools/testing/selftests/net/mptcp/mptcp_join.sh | 63 +++++++++++++++++++++++++
 1 file changed, 63 insertions(+)
tools/testing/selftests/net/mptcp/mptcp_join.sh +63 -0
index fbb0174145ad..c1f1ebd2340c 100755
@@ -1372,6 +1372,66 @@ chk_join_nr()
 	fi
 }
 
+chk_join_tx_nr()
+{
+	local syn_nr=$1
+	local festab=$2
+	local create=$3
+	local bind=$4
+	local connect=$5
+	local count
+
+	print_check "syn TX"
+	count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtMPJoinSynTx")
+	if [ -z "$count" ]; then
+		print_skip
+	elif [ "$count" != "$syn_nr" ]; then
+		fail_test "got $count JOIN[s] syn TX expected $syn_nr"
+	else
+		print_ok
+	fi
+
+	print_check "syn TX Fully Estab Error"
+	count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtMPJoinSynTxFEstabErr")
+	if [ -z "$count" ]; then
+		print_skip
+	elif [ "$count" != "$festab" ]; then
+		fail_test "got $count JOIN[s] syn TX Fully Estab Error expected $festab"
+	else
+		print_ok
+	fi
+
+	print_check "syn TX Create Socket Error"
+	count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtMPJoinSynTxCreatSkErr")
+	if [ -z "$count" ]; then
+		print_skip
+	elif [ "$count" != "$create" ]; then
+		fail_test "got $count JOIN[s] syn TX Create Socket Error expected $create"
+	else
+		print_ok
+	fi
+
+	print_check "syn TX Bind Error"
+	count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtMPJoinSynTxBindErr")
+	if [ -z "$count" ]; then
+		print_skip
+	elif [ "$count" != "$bind" ]; then
+		fail_test "got $count JOIN[s] syn TX Bind Error expected $bind"
+	else
+		print_ok
+	fi
+
+	print_check "syn TX Connect Error"
+	count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtMPJoinSynTxConnectErr")
+	if [ -z "$count" ]; then
+		print_skip
+	elif [ "$count" != "$connect" ]; then
+		fail_test "got $count JOIN[s] syn TX Connect Error expected $connect"
+	else
+		print_ok
+	fi
+}
+
 # a negative value for 'stale_max' means no upper bound:
 # for bidirectional transfer, if one peer sleep for a while
 # - as these tests do - we can have a quite high number of
@@ -1907,6 +1967,7 @@ subflows_error_tests()
 		speed=slow \
 			run_tests $ns1 $ns2 10.0.1.1
 		chk_join_nr 0 0 0
+		chk_join_tx_nr 0 0 0 0 0
 	fi
 
 	# multiple subflows, with subflow creation error
@@ -1919,6 +1980,7 @@ subflows_error_tests()
 		speed=slow \
 			run_tests $ns1 $ns2 10.0.1.1
 		chk_join_nr 1 1 1
+		chk_join_tx_nr 2 0 0 0 0
 	fi
 
 	# multiple subflows, with subflow timeout on MPJ
@@ -2306,6 +2368,7 @@ remove_tests()
 		addr_nr_ns1=-3 speed=10 \
 			run_tests $ns1 $ns2 10.0.1.1
 		chk_join_nr 1 1 1
+		chk_join_tx_nr 2 0 0 0 1
 		chk_add_nr 3 3
 		chk_rm_nr 3 1 invert
 		chk_rst_nr 0 0
Signature · 1 line
2.45.2
reviewer
#3 lore raw

Re: [PATCH mptcp-next v2 2/2] selftests: mptcp: join: validate MPJ SYN TX MIB counters

Hi Matt,

Thanks for these patches.

Quoted 41 lines · On Mon, 2024-07-29 at 12:18 +0200, Matthieu Baerts (NGI0) wrote:

A few new MIB counters have been added. They are being validated here.

Most of the time, there are no errors, but sometimes, more MPJ SYN are
queued compared to the numbers that are received.

Only one test has an error, the one to connect to a broadcast IP address.

---
 tools/testing/selftests/net/mptcp/mptcp_join.sh | 63
+++++++++++++++++++++++++

 1 file changed, 63 insertions(+)
tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
index fbb0174145ad..c1f1ebd2340c 100755
@@ -1372,6 +1372,66 @@ chk_join_nr()

  fi
 }

tools/testing/selftests/net/mptcp/mptcp_join.sh +15 -0
+chk_join_tx_nr()
+{
+	local syn_nr=$1
+	local festab=$2
+	local create=$3
+	local bind=$4
+	local connect=$5
+	local count
+
+	print_check "syn TX"
+	count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtMPJoinSynTx")
+	if [ -z "$count" ]; then
+		print_skip
+	elif [ "$count" != "$syn_nr" ]; then
+		fail_test "got $count JOIN[s] syn TX expected

$syn_nr"

tools/testing/selftests/net/mptcp/mptcp_join.sh chk_join_nr() · line 1392

Quoted 3 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +3 -0
+	else
+		print_ok
+	fi

Do you think it is necessary to check MPTcpExtMPJoinSynTx in chk_join_nr()?

Quoted 21 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +3 -0
+
+	print_check "syn TX Fully Estab Error"
+	count=$(mptcp_lib_get_counter ${ns2}

"MPTcpExtMPJoinSynTxFEstabErr")

tools/testing/selftests/net/mptcp/mptcp_join.sh +4 -0
+	if [ -z "$count" ]; then
+		print_skip
+	elif [ "$count" != "$festab" ]; then
+		fail_test "got $count JOIN[s] syn TX Fully Estab

Error expected $festab"

tools/testing/selftests/net/mptcp/mptcp_join.sh +6 -0
+	else
+		print_ok
+	fi
+
+	print_check "syn TX Create Socket Error"
+	count=$(mptcp_lib_get_counter ${ns2}

"MPTcpExtMPJoinSynTxCreatSkErr")

tools/testing/selftests/net/mptcp/mptcp_join.sh +4 -0
+	if [ -z "$count" ]; then
+		print_skip
+	elif [ "$count" != "$create" ]; then
+		fail_test "got $count JOIN[s] syn TX Create Socket

Error expected $create"

tools/testing/selftests/net/mptcp/mptcp_join.sh chk_join_nr() · line 1392

Quoted 3 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +3 -0
+	else
+		print_ok
+	fi

There is no test that can trigger MPTcpExtMPJoinSynTxFEstabErr and MPTcpExtMPJoinSynTxCreatSkErr. Does this mean that there is no need to add these two MIBs? Maybe adding pr_debug logs is enough? WDYT?

tools/testing/selftests/net/mptcp/mptcp_join.sh subflows_error_tests()

Quoted 30 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +3 -0
+
+	print_check "syn TX Bind Error"
+	count=$(mptcp_lib_get_counter ${ns2}

"MPTcpExtMPJoinSynTxBindErr")

tools/testing/selftests/net/mptcp/mptcp_join.sh +4 -0
+	if [ -z "$count" ]; then
+		print_skip
+	elif [ "$count" != "$bind" ]; then
+		fail_test "got $count JOIN[s] syn TX Bind Error

expected $bind"

tools/testing/selftests/net/mptcp/mptcp_join.sh +6 -0
+	else
+		print_ok
+	fi
+
+	print_check "syn TX Connect Error"
+	count=$(mptcp_lib_get_counter ${ns2}

"MPTcpExtMPJoinSynTxConnectErr")

tools/testing/selftests/net/mptcp/mptcp_join.sh +4 -0
+	if [ -z "$count" ]; then
+		print_skip
+	elif [ "$count" != "$connect" ]; then
+		fail_test "got $count JOIN[s] syn TX Connect Error

expected $connect"

tools/testing/selftests/net/mptcp/mptcp_join.sh +5 -0
+	else
+		print_ok
+	fi
+}
+
 # a negative value for 'stale_max' means no upper bound:
 # for bidirectional transfer, if one peer sleep for a while
 # - as these tests do - we can have a quite high number of
tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -1907,6 +1967,7 @@ subflows_error_tests()

Add an invalid address here in this test:

	pm_nl_add_endpoint $ns2 10.0.5.2 flags subflow

tools/testing/selftests/net/mptcp/mptcp_join.sh subflows_error_tests() · line 1970

Quoted 4 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
  		speed=slow \

  run_tests $ns1 $ns2 10.0.1.1 chk_join_nr 0 0 0

tools/testing/selftests/net/mptcp/mptcp_join.sh +1 -0
+		chk_join_tx_nr 0 0 0 0 0

It will trigger a "syn TX Bind Error":

		chk_join_tx_nr 0 0 0 1 0

Thanks!
Geliang

Quoted 18 lines
 	# multiple subflows, with subflow creation error
tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -1919,6 +1980,7 @@ subflows_error_tests()
  		speed=slow \

  run_tests $ns1 $ns2 10.0.1.1 chk_join_nr 1 1 1

tools/testing/selftests/net/mptcp/mptcp_join.sh +1 -0
+		chk_join_tx_nr 2 0 0 0 0

  fi

 	# multiple subflows, with subflow timeout on MPJ
tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -2306,6 +2368,7 @@ remove_tests()
  		addr_nr_ns1=-3 speed=10 \

  run_tests $ns1 $ns2 10.0.1.1 chk_join_nr 1 1 1

tools/testing/selftests/net/mptcp/mptcp_join.sh +1 -0
+		chk_join_tx_nr 2 0 0 0 1

  chk_add_nr 3 3
  chk_rm_nr 3 1 invert
  chk_rst_nr 0 0

author maintainer
#4 lore raw

Re: [PATCH mptcp-next v2 2/2] selftests: mptcp: join: validate MPJ SYN TX MIB counters

Hi Geliang,

Thank you for the review!

Quoted 44 lines · Geliang Tang

Hi Matt,

Thanks for these patches.

Quoted 39 lines · On Mon, 2024-07-29 at 12:18 +0200, Matthieu Baerts (NGI0) wrote:

A few new MIB counters have been added. They are being validated here.

Most of the time, there are no errors, but sometimes, more MPJ SYN are
queued compared to the numbers that are received.

Only one test has an error, the one to connect to a broadcast IP address.

---
 tools/testing/selftests/net/mptcp/mptcp_join.sh | 63
+++++++++++++++++++++++++

 1 file changed, 63 insertions(+)
tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
index fbb0174145ad..c1f1ebd2340c 100755
@@ -1372,6 +1372,66 @@ chk_join_nr()

  fi
 }

tools/testing/selftests/net/mptcp/mptcp_join.sh +14 -0
+chk_join_tx_nr()
+{
+	local syn_nr=$1
+	local festab=$2
+	local create=$3
+	local bind=$4
+	local connect=$5
+	local count
+
+	print_check "syn TX"
+	count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtMPJoinSynTx")
+	if [ -z "$count" ]; then
+		print_skip
+	elif [ "$count" != "$syn_nr" ]; then
Quoted 8 lines

tools/testing/selftests/net/mptcp/mptcp_join.sh chk_join_nr() · line 1392

Quoted 5 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +1 -0
+		fail_test "got $count JOIN[s] syn TX expected

$syn_nr"

tools/testing/selftests/net/mptcp/mptcp_join.sh +3 -0
+	else
+		print_ok
+	fi

Do you think it is necessary to check MPTcpExtMPJoinSynTx in chk_join_nr()?

I thought about that, then I realised some tests were sending more MP_JOIN than the received ones (e.g. when using "invalid addresses"). We would then need to change the default counters, but chk_join_nr() can already optionally check the checksum, making it difficult to read when we have to pass 14 parameters:

chk_join_nr 1 1 1 0 0 0 0 0 0 2 0 0 0 1

It looks simpler with a dedicated helper, and checking this only in some places. WDYT?

Quoted 20 lines
Quoted 20 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +3 -0
+
+	print_check "syn TX Fully Estab Error"
+	count=$(mptcp_lib_get_counter ${ns2}

"MPTcpExtMPJoinSynTxFEstabErr")

tools/testing/selftests/net/mptcp/mptcp_join.sh +4 -0
+	if [ -z "$count" ]; then
+		print_skip
+	elif [ "$count" != "$festab" ]; then
+		fail_test "got $count JOIN[s] syn TX Fully Estab

Error expected $festab"

tools/testing/selftests/net/mptcp/mptcp_join.sh +6 -0
+	else
+		print_ok
+	fi
+
+	print_check "syn TX Create Socket Error"
+	count=$(mptcp_lib_get_counter ${ns2}

"MPTcpExtMPJoinSynTxCreatSkErr")

tools/testing/selftests/net/mptcp/mptcp_join.sh +4 -0
+	if [ -z "$count" ]; then
+		print_skip
+	elif [ "$count" != "$create" ]; then
+		fail_test "got $count JOIN[s] syn TX Create Socket
Quoted 8 lines

tools/testing/selftests/net/mptcp/mptcp_join.sh chk_join_nr() · line 1392

Quoted 4 lines

Error expected $create"

tools/testing/selftests/net/mptcp/mptcp_join.sh +3 -0
+	else
+		print_ok
+	fi

There is no test that can trigger MPTcpExtMPJoinSynTxFEstabErr and MPTcpExtMPJoinSynTxCreatSkErr. Does this mean that there is no need to add these two MIBs? Maybe adding pr_debug logs is enough? WDYT?

MPTcpExtMPJoinSynTxFEstabErr can be easily triggered by the userspace PM. Maybe we don't need the counter for this case then? We could also do the check in the userspace PM side, and return a netlink message instead, but I don't think it is needed. Not sure what's best here. I can remove it or leave it.

For MPTcpExtMPJoinSynTxCreatSkErr, it can be triggered if it cannot allocate memory, if the socket limit has been reached out, if a security module blocked it, etc. I think we should keep it, and we don't need to validate it in the tests.

Quoted 35 lines

tools/testing/selftests/net/mptcp/mptcp_join.sh subflows_error_tests()

Quoted 30 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +3 -0
+
+	print_check "syn TX Bind Error"
+	count=$(mptcp_lib_get_counter ${ns2}

"MPTcpExtMPJoinSynTxBindErr")

tools/testing/selftests/net/mptcp/mptcp_join.sh +4 -0
+	if [ -z "$count" ]; then
+		print_skip
+	elif [ "$count" != "$bind" ]; then
+		fail_test "got $count JOIN[s] syn TX Bind Error

expected $bind"

tools/testing/selftests/net/mptcp/mptcp_join.sh +6 -0
+	else
+		print_ok
+	fi
+
+	print_check "syn TX Connect Error"
+	count=$(mptcp_lib_get_counter ${ns2}

"MPTcpExtMPJoinSynTxConnectErr")

tools/testing/selftests/net/mptcp/mptcp_join.sh +4 -0
+	if [ -z "$count" ]; then
+		print_skip
+	elif [ "$count" != "$connect" ]; then
+		fail_test "got $count JOIN[s] syn TX Connect Error

expected $connect"

tools/testing/selftests/net/mptcp/mptcp_join.sh +5 -0
+	else
+		print_ok
+	fi
+}
+
 # a negative value for 'stale_max' means no upper bound:
 # for bidirectional transfer, if one peer sleep for a while
 # - as these tests do - we can have a quite high number of
tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -1907,6 +1967,7 @@ subflows_error_tests()

Add an invalid address here in this test:

	pm_nl_add_endpoint $ns2 10.0.5.2 flags subflow
Quoted 8 lines

tools/testing/selftests/net/mptcp/mptcp_join.sh subflows_error_tests() · line 1970

Quoted 4 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
  		speed=slow \

  run_tests $ns1 $ns2 10.0.1.1 chk_join_nr 0 0 0

tools/testing/selftests/net/mptcp/mptcp_join.sh +1 -0
+		chk_join_tx_nr 0 0 0 0 0

It will trigger a "syn TX Bind Error":

		chk_join_tx_nr 0 0 0 1 0

Good idea! I will do that in the v3.

Cheers,
Matt

Signature · 1 line
Sponsored by the NGI0 Core fund.
reviewer
#5 lore raw

Re: [PATCH mptcp-next v2 2/2] selftests: mptcp: join: validate MPJ SYN TX MIB counters

Hi Matt,

Quoted 68 lines · Matthieu Baerts

Hi Geliang,

Thank you for the review!

Quoted 46 lines · Geliang Tang

Hi Matt,

Thanks for these patches.

Quoted 41 lines · On Mon, 2024-07-29 at 12:18 +0200, Matthieu Baerts (NGI0) wrote:

A few new MIB counters have been added. They are being validated here.

Most of the time, there are no errors, but sometimes, more MPJ SYN
are
queued compared to the numbers that are received.

Only one test has an error, the one to connect to a broadcast IP address.

---
 tools/testing/selftests/net/mptcp/mptcp_join.sh | 63
+++++++++++++++++++++++++

 1 file changed, 63 insertions(+)
tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
index fbb0174145ad..c1f1ebd2340c 100755
@@ -1372,6 +1372,66 @@ chk_join_nr()

  fi
 }

tools/testing/selftests/net/mptcp/mptcp_join.sh +11 -0
+chk_join_tx_nr()
+{
+	local syn_nr=$1
+	local festab=$2
+	local create=$3
+	local bind=$4
+	local connect=$5
+	local count
+
+	print_check "syn TX"
+	count=$(mptcp_lib_get_counter ${ns2}

"MPTcpExtMPJoinSynTx")

tools/testing/selftests/net/mptcp/mptcp_join.sh +3 -0
+	if [ -z "$count" ]; then
+		print_skip
+	elif [ "$count" != "$syn_nr" ]; then
Quoted 8 lines

tools/testing/selftests/net/mptcp/mptcp_join.sh chk_join_nr() · line 1392

Quoted 5 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +1 -0
+		fail_test "got $count JOIN[s] syn TX expected

$syn_nr"

tools/testing/selftests/net/mptcp/mptcp_join.sh +3 -0
+	else
+		print_ok
+	fi

Do you think it is necessary to check MPTcpExtMPJoinSynTx in chk_join_nr()?

I thought about that, then I realised some tests were sending more MP_JOIN than the received ones (e.g. when using "invalid addresses"). We
would then need to change the default counters, but chk_join_nr() can already optionally check the checksum, making it difficult to read when
we have to pass 14 parameters:

Quoted 5 lines

  chk_join_nr 1 1 1 0 0 0 0 0 0 2 0 0 0 1

It looks simpler with a dedicated helper, and checking this only in some
places. WDYT?

We can handle this like "addr_nr_ns1". In chk_join_nr(), the default value of this "syn_tx_nr" is the same as "syn_nr". If we need a specific value, we can pass it to run_tests() through a "syn_tx_nr" variable:

	syn_tx_nr=1 \
		run_tests $ns1 $ns2 10.0.1.1
Quoted 32 lines
Quoted 23 lines
Quoted 23 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +3 -0
+
+	print_check "syn TX Fully Estab Error"
+	count=$(mptcp_lib_get_counter ${ns2}

"MPTcpExtMPJoinSynTxFEstabErr")

tools/testing/selftests/net/mptcp/mptcp_join.sh +4 -0
+	if [ -z "$count" ]; then
+		print_skip
+	elif [ "$count" != "$festab" ]; then
+		fail_test "got $count JOIN[s] syn TX Fully Estab

Error expected $festab"

tools/testing/selftests/net/mptcp/mptcp_join.sh +6 -0
+	else
+		print_ok
+	fi
+
+	print_check "syn TX Create Socket Error"
+	count=$(mptcp_lib_get_counter ${ns2}

"MPTcpExtMPJoinSynTxCreatSkErr")

tools/testing/selftests/net/mptcp/mptcp_join.sh +4 -0
+	if [ -z "$count" ]; then
+		print_skip
+	elif [ "$count" != "$create" ]; then
+		fail_test "got $count JOIN[s] syn TX Create

Socket
Error expected $create"

Quoted 8 lines

tools/testing/selftests/net/mptcp/mptcp_join.sh chk_join_nr() · line 1392

Quoted 3 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +3 -0
+	else
+		print_ok
+	fi

There is no test that can trigger MPTcpExtMPJoinSynTxFEstabErr and MPTcpExtMPJoinSynTxCreatSkErr. Does this mean that there is no need to
add these two MIBs? Maybe adding pr_debug logs is enough? WDYT?

Quoted 6 lines

MPTcpExtMPJoinSynTxFEstabErr can be easily triggered by the userspace PM. Maybe we don't need the counter for this case then? We could also do
the check in the userspace PM side, and return a netlink message instead, but I don't think it is needed. Not sure what's best here. I can remove it or leave it.

If so I think it's better to remove it, since too many MIBs are added in this function.

Quoted 7 lines

For MPTcpExtMPJoinSynTxCreatSkErr, it can be triggered if it cannot allocate memory, if the socket limit has been reached out, if a security
module blocked it, etc. I think we should keep it, and we don't need to
validate it in the tests.

These errors are not related to MPTCP protocol. I think we can remove this MIB but keep its pr_debug log. WDYT?

Regards,
-Geliang

Quoted 50 lines
Quoted 37 lines

tools/testing/selftests/net/mptcp/mptcp_join.sh subflows_error_tests()

Quoted 32 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +3 -0
+
+	print_check "syn TX Bind Error"
+	count=$(mptcp_lib_get_counter ${ns2}

"MPTcpExtMPJoinSynTxBindErr")

tools/testing/selftests/net/mptcp/mptcp_join.sh +4 -0
+	if [ -z "$count" ]; then
+		print_skip
+	elif [ "$count" != "$bind" ]; then
+		fail_test "got $count JOIN[s] syn TX Bind Error

expected $bind"

tools/testing/selftests/net/mptcp/mptcp_join.sh +6 -0
+	else
+		print_ok
+	fi
+
+	print_check "syn TX Connect Error"
+	count=$(mptcp_lib_get_counter ${ns2}

"MPTcpExtMPJoinSynTxConnectErr")

tools/testing/selftests/net/mptcp/mptcp_join.sh +4 -0
+	if [ -z "$count" ]; then
+		print_skip
+	elif [ "$count" != "$connect" ]; then
+		fail_test "got $count JOIN[s] syn TX Connect

Error
expected $connect"

tools/testing/selftests/net/mptcp/mptcp_join.sh +5 -0
+	else
+		print_ok
+	fi
+}
+
 # a negative value for 'stale_max' means no upper bound:
 # for bidirectional transfer, if one peer sleep for a while
 # - as these tests do - we can have a quite high number of
tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -1907,6 +1967,7 @@ subflows_error_tests()

Add an invalid address here in this test:

	pm_nl_add_endpoint $ns2 10.0.5.2 flags subflow
Quoted 8 lines

tools/testing/selftests/net/mptcp/mptcp_join.sh subflows_error_tests() · line 1970

Quoted 4 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
  		speed=slow \

  run_tests $ns1 $ns2 10.0.1.1 chk_join_nr 0 0 0

tools/testing/selftests/net/mptcp/mptcp_join.sh +1 -0
+		chk_join_tx_nr 0 0 0 0 0

It will trigger a "syn TX Bind Error":

		chk_join_tx_nr 0 0 0 1 0

Good idea! I will do that in the v3.

Cheers,
Matt

reviewer
#6 lore raw

Re: [PATCH mptcp-next v2 2/2] selftests: mptcp: join: validate MPJ SYN TX MIB counters

In reply to Matthieu Baerts

Hi Matt,

Quoted 68 lines · Matthieu Baerts

Hi Geliang,

Thank you for the review!

Quoted 46 lines · Geliang Tang

Hi Matt,

Thanks for these patches.

Quoted 41 lines · On Mon, 2024-07-29 at 12:18 +0200, Matthieu Baerts (NGI0) wrote:

A few new MIB counters have been added. They are being validated here.

Most of the time, there are no errors, but sometimes, more MPJ SYN
are
queued compared to the numbers that are received.

Only one test has an error, the one to connect to a broadcast IP address.

---
 tools/testing/selftests/net/mptcp/mptcp_join.sh | 63
+++++++++++++++++++++++++

 1 file changed, 63 insertions(+)
tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
index fbb0174145ad..c1f1ebd2340c 100755
@@ -1372,6 +1372,66 @@ chk_join_nr()

  fi
 }

tools/testing/selftests/net/mptcp/mptcp_join.sh +11 -0
+chk_join_tx_nr()
+{
+	local syn_nr=$1
+	local festab=$2
+	local create=$3
+	local bind=$4
+	local connect=$5
+	local count
+
+	print_check "syn TX"
+	count=$(mptcp_lib_get_counter ${ns2}

"MPTcpExtMPJoinSynTx")

tools/testing/selftests/net/mptcp/mptcp_join.sh +3 -0
+	if [ -z "$count" ]; then
+		print_skip
+	elif [ "$count" != "$syn_nr" ]; then
Quoted 8 lines

tools/testing/selftests/net/mptcp/mptcp_join.sh chk_join_nr() · line 1392

Quoted 5 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +1 -0
+		fail_test "got $count JOIN[s] syn TX expected

$syn_nr"

tools/testing/selftests/net/mptcp/mptcp_join.sh +3 -0
+	else
+		print_ok
+	fi

Do you think it is necessary to check MPTcpExtMPJoinSynTx in chk_join_nr()?

I thought about that, then I realised some tests were sending more MP_JOIN than the received ones (e.g. when using "invalid addresses"). We
would then need to change the default counters, but chk_join_nr() can already optionally check the checksum, making it difficult to read when
we have to pass 14 parameters:

Quoted 5 lines

  chk_join_nr 1 1 1 0 0 0 0 0 0 2 0 0 0 1

It looks simpler with a dedicated helper, and checking this only in some
places. WDYT?

We can handle this like "addr_nr_ns1". In chk_join_nr(), the default value of this "syn_tx_nr" is the same as "syn_nr". If we need a specific value, we can pass it to run_tests() through a "syn_tx_nr" variable:

	syn_tx_nr=1 \
		run_tests $ns1 $ns2 10.0.1.1
Quoted 32 lines
Quoted 23 lines
Quoted 23 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +3 -0
+
+	print_check "syn TX Fully Estab Error"
+	count=$(mptcp_lib_get_counter ${ns2}

"MPTcpExtMPJoinSynTxFEstabErr")

tools/testing/selftests/net/mptcp/mptcp_join.sh +4 -0
+	if [ -z "$count" ]; then
+		print_skip
+	elif [ "$count" != "$festab" ]; then
+		fail_test "got $count JOIN[s] syn TX Fully Estab

Error expected $festab"

tools/testing/selftests/net/mptcp/mptcp_join.sh +6 -0
+	else
+		print_ok
+	fi
+
+	print_check "syn TX Create Socket Error"
+	count=$(mptcp_lib_get_counter ${ns2}

"MPTcpExtMPJoinSynTxCreatSkErr")

tools/testing/selftests/net/mptcp/mptcp_join.sh +4 -0
+	if [ -z "$count" ]; then
+		print_skip
+	elif [ "$count" != "$create" ]; then
+		fail_test "got $count JOIN[s] syn TX Create

Socket
Error expected $create"

Quoted 8 lines

tools/testing/selftests/net/mptcp/mptcp_join.sh chk_join_nr() · line 1392

Quoted 3 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +3 -0
+	else
+		print_ok
+	fi

There is no test that can trigger MPTcpExtMPJoinSynTxFEstabErr and MPTcpExtMPJoinSynTxCreatSkErr. Does this mean that there is no need to
add these two MIBs? Maybe adding pr_debug logs is enough? WDYT?

Quoted 6 lines

MPTcpExtMPJoinSynTxFEstabErr can be easily triggered by the userspace PM. Maybe we don't need the counter for this case then? We could also do
the check in the userspace PM side, and return a netlink message instead, but I don't think it is needed. Not sure what's best here. I can remove it or leave it.

If so I think it's better to remove it, since too many MIBs are added in this function.

Quoted 7 lines

For MPTcpExtMPJoinSynTxCreatSkErr, it can be triggered if it cannot allocate memory, if the socket limit has been reached out, if a security
module blocked it, etc. I think we should keep it, and we don't need to
validate it in the tests.

These errors are not related to MPTCP protocol. I think we can remove this MIB but keep its pr_debug log. WDYT?

Regards,
-Geliang

Quoted 50 lines
Quoted 37 lines

tools/testing/selftests/net/mptcp/mptcp_join.sh subflows_error_tests()

Quoted 32 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +3 -0
+
+	print_check "syn TX Bind Error"
+	count=$(mptcp_lib_get_counter ${ns2}

"MPTcpExtMPJoinSynTxBindErr")

tools/testing/selftests/net/mptcp/mptcp_join.sh +4 -0
+	if [ -z "$count" ]; then
+		print_skip
+	elif [ "$count" != "$bind" ]; then
+		fail_test "got $count JOIN[s] syn TX Bind Error

expected $bind"

tools/testing/selftests/net/mptcp/mptcp_join.sh +6 -0
+	else
+		print_ok
+	fi
+
+	print_check "syn TX Connect Error"
+	count=$(mptcp_lib_get_counter ${ns2}

"MPTcpExtMPJoinSynTxConnectErr")

tools/testing/selftests/net/mptcp/mptcp_join.sh +4 -0
+	if [ -z "$count" ]; then
+		print_skip
+	elif [ "$count" != "$connect" ]; then
+		fail_test "got $count JOIN[s] syn TX Connect

Error
expected $connect"

tools/testing/selftests/net/mptcp/mptcp_join.sh +5 -0
+	else
+		print_ok
+	fi
+}
+
 # a negative value for 'stale_max' means no upper bound:
 # for bidirectional transfer, if one peer sleep for a while
 # - as these tests do - we can have a quite high number of
tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -1907,6 +1967,7 @@ subflows_error_tests()

Add an invalid address here in this test:

	pm_nl_add_endpoint $ns2 10.0.5.2 flags subflow
Quoted 8 lines

tools/testing/selftests/net/mptcp/mptcp_join.sh subflows_error_tests() · line 1970

Quoted 4 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
  		speed=slow \

  run_tests $ns1 $ns2 10.0.1.1 chk_join_nr 0 0 0

tools/testing/selftests/net/mptcp/mptcp_join.sh +1 -0
+		chk_join_tx_nr 0 0 0 0 0

It will trigger a "syn TX Bind Error":

		chk_join_tx_nr 0 0 0 1 0

Good idea! I will do that in the v3.

Cheers,
Matt

author maintainer
#7 lore raw

Re: [PATCH mptcp-next v2 2/2] selftests: mptcp: join: validate MPJ SYN TX MIB counters

Hi Geliang,

Quoted 77 lines · Geliang Tang

Hi Matt,

Quoted 68 lines · Matthieu Baerts

Hi Geliang,

Thank you for the review!

Quoted 46 lines · Geliang Tang

Hi Matt,

Thanks for these patches.

Quoted 41 lines · On Mon, 2024-07-29 at 12:18 +0200, Matthieu Baerts (NGI0) wrote:

A few new MIB counters have been added. They are being validated here.

Most of the time, there are no errors, but sometimes, more MPJ SYN
are
queued compared to the numbers that are received.

Only one test has an error, the one to connect to a broadcast IP address.

---
 tools/testing/selftests/net/mptcp/mptcp_join.sh | 63
+++++++++++++++++++++++++

 1 file changed, 63 insertions(+)
tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
index fbb0174145ad..c1f1ebd2340c 100755
@@ -1372,6 +1372,66 @@ chk_join_nr()

  fi
 }

tools/testing/selftests/net/mptcp/mptcp_join.sh +11 -0
+chk_join_tx_nr()
+{
+	local syn_nr=$1
+	local festab=$2
+	local create=$3
+	local bind=$4
+	local connect=$5
+	local count
+
+	print_check "syn TX"
+	count=$(mptcp_lib_get_counter ${ns2}

"MPTcpExtMPJoinSynTx")

tools/testing/selftests/net/mptcp/mptcp_join.sh +3 -0
+	if [ -z "$count" ]; then
+		print_skip
+	elif [ "$count" != "$syn_nr" ]; then
Quoted 8 lines

tools/testing/selftests/net/mptcp/mptcp_join.sh chk_join_nr() · line 1392

Quoted 5 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +1 -0
+		fail_test "got $count JOIN[s] syn TX expected

$syn_nr"

tools/testing/selftests/net/mptcp/mptcp_join.sh +3 -0
+	else
+		print_ok
+	fi

Do you think it is necessary to check MPTcpExtMPJoinSynTx in chk_join_nr()?

I thought about that, then I realised some tests were sending more MP_JOIN than the received ones (e.g. when using "invalid addresses"). We
would then need to change the default counters, but chk_join_nr() can already optionally check the checksum, making it difficult to read when
we have to pass 14 parameters:

Quoted 5 lines

  chk_join_nr 1 1 1 0 0 0 0 0 0 2 0 0 0 1

It looks simpler with a dedicated helper, and checking this only in some
places. WDYT?

Quoted 7 lines

We can handle this like "addr_nr_ns1". In chk_join_nr(), the default value of this "syn_tx_nr" is the same as "syn_nr". If we need a specific value, we can pass it to run_tests() through a "syn_tx_nr" variable:

	syn_tx_nr=1 \
		run_tests $ns1 $ns2 10.0.1.1

Yes, I can. But if we do that, we might want to reduce the number of checks being displayed, not to display 5 more lines per test.

Maybe we can have two "Join [RT]x: OK" in case of success, and a detail of the failures if not? I can look at that.

Quoted 38 lines
Quoted 31 lines
Quoted 22 lines
Quoted 22 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +3 -0
+
+	print_check "syn TX Fully Estab Error"
+	count=$(mptcp_lib_get_counter ${ns2}

"MPTcpExtMPJoinSynTxFEstabErr")

tools/testing/selftests/net/mptcp/mptcp_join.sh +4 -0
+	if [ -z "$count" ]; then
+		print_skip
+	elif [ "$count" != "$festab" ]; then
+		fail_test "got $count JOIN[s] syn TX Fully Estab

Error expected $festab"

tools/testing/selftests/net/mptcp/mptcp_join.sh +6 -0
+	else
+		print_ok
+	fi
+
+	print_check "syn TX Create Socket Error"
+	count=$(mptcp_lib_get_counter ${ns2}

"MPTcpExtMPJoinSynTxCreatSkErr")

tools/testing/selftests/net/mptcp/mptcp_join.sh +4 -0
+	if [ -z "$count" ]; then
+		print_skip
+	elif [ "$count" != "$create" ]; then
+		fail_test "got $count JOIN[s] syn TX Create

Socket
Error expected $create"

Quoted 8 lines

tools/testing/selftests/net/mptcp/mptcp_join.sh chk_join_nr() · line 1392

Quoted 3 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +3 -0
+	else
+		print_ok
+	fi

There is no test that can trigger MPTcpExtMPJoinSynTxFEstabErr and MPTcpExtMPJoinSynTxCreatSkErr. Does this mean that there is no need to
add these two MIBs? Maybe adding pr_debug logs is enough? WDYT?

Quoted 6 lines

MPTcpExtMPJoinSynTxFEstabErr can be easily triggered by the userspace PM. Maybe we don't need the counter for this case then? We could also do
the check in the userspace PM side, and return a netlink message instead, but I don't think it is needed. Not sure what's best here. I can remove it or leave it.

Quoted 2 lines

If so I think it's better to remove it, since too many MIBs are added in this function.

For this one, it looks like only the userspace PM can cause it, and the userspace daemon will get feedback in this case. So OK for me to remove it.

Quoted 9 lines
Quoted 6 lines

For MPTcpExtMPJoinSynTxCreatSkErr, it can be triggered if it cannot allocate memory, if the socket limit has been reached out, if a security
module blocked it, etc. I think we should keep it, and we don't need to
validate it in the tests.

These errors are not related to MPTCP protocol. I think we can remove this MIB but keep its pr_debug log. WDYT?

I think we should keep it, otherwise it will be difficult to debug this issue if we don't cover all cases. The other ones should mainly be due to a wrong config from the user, but theyu could also fail due to security restrictions. The pr_debug()'s don't work for everybody, they require CONFIG_DEBUG=y or CONFIG_DYNAMIC_DEBUG=y, or a specific build per file, etc.

In other words, it sounds safer to me to keep this one to cover all cases. Otherwise, we might struggle during to help users, and ending up asking the users to compile a modified kernel.

Cheers,
Matt

Signature · 1 line
Sponsored by the NGI0 Core fund.
#8 lore raw
In reply to Matthieu Baerts (NGI0)

Hi Matthieu,

Thank you for your modifications, that's great!

Our CI did some validations and here is its report:

- KVM Validation: normal: Success! ✅
- KVM Validation: debug: Success! ✅
- KVM Validation: btf (only bpftest_all): Success! ✅
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/10142618180

Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/9a0132449be1
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=874506

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)