MPTCP Linux Development
 help / color / mirror / Atom feed
* [PATCH mptcp-next v2 0/6] add fastclose testcases
@ 2022-02-13 14:50 Geliang Tang
  2022-02-13 14:50 ` [PATCH mptcp-next v2 1/6] mptcp: add the mibs for MP_FASTCLOSE Geliang Tang
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Geliang Tang @ 2022-02-13 14:50 UTC (permalink / raw)
  To: mptcp; +Cc: Geliang Tang

v2:
 - merge the squash-to patch ("Squash to "selftests: mptcp: add the
MP_RST mibs check") into v2.
 - update the commit logs.

This patchset is related to issue #48 and issue #197. The two MP_RST
patches are moved from the "add mp_fail testcases" series.

Geliang Tang (6):
  mptcp: add the mibs for MP_FASTCLOSE
  selftests: mptcp: add the MP_FASTCLOSE mibs check
  mptcp: add the mibs for MP_RST
  selftests: mptcp: add the MP_RST mibs check
  selftests: mptcp: add extra_args in do_transfer
  selftests: mptcp: add fastclose testcases

 net/mptcp/mib.c                               |   4 +
 net/mptcp/mib.h                               |   4 +
 net/mptcp/options.c                           |   5 +
 .../testing/selftests/net/mptcp/mptcp_join.sh | 143 ++++++++++++++++--
 4 files changed, 140 insertions(+), 16 deletions(-)

-- 
2.34.1


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

* [PATCH mptcp-next v2 1/6] mptcp: add the mibs for MP_FASTCLOSE
  2022-02-13 14:50 [PATCH mptcp-next v2 0/6] add fastclose testcases Geliang Tang
@ 2022-02-13 14:50 ` Geliang Tang
  2022-02-13 14:50 ` [PATCH mptcp-next v2 2/6] selftests: mptcp: add the MP_FASTCLOSE mibs check Geliang Tang
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Geliang Tang @ 2022-02-13 14:50 UTC (permalink / raw)
  To: mptcp; +Cc: Geliang Tang

This patch added two more mibs for MP_FASTCLOSE, MPTCP_MIB_MPFASTCLOSETX
for the MP_FASTCLOSE sending and MPTCP_MIB_MPFASTCLOSERX for receiving.

Also added a debug log for MP_FASTCLOSE receiving, printed out the recv_key
of MP_FASTCLOSE in mptcp_parse_option to show that MP_RST is received.

Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
 net/mptcp/mib.c     | 2 ++
 net/mptcp/mib.h     | 2 ++
 net/mptcp/options.c | 3 +++
 3 files changed, 7 insertions(+)

diff --git a/net/mptcp/mib.c b/net/mptcp/mib.c
index 7cef7409e300..684643f8af53 100644
--- a/net/mptcp/mib.c
+++ b/net/mptcp/mib.c
@@ -49,6 +49,8 @@ static const struct snmp_mib mptcp_snmp_list[] = {
 	SNMP_MIB_ITEM("MPPrioRx", MPTCP_MIB_MPPRIORX),
 	SNMP_MIB_ITEM("MPFailTx", MPTCP_MIB_MPFAILTX),
 	SNMP_MIB_ITEM("MPFailRx", MPTCP_MIB_MPFAILRX),
+	SNMP_MIB_ITEM("MPFastcloseTx", MPTCP_MIB_MPFASTCLOSETX),
+	SNMP_MIB_ITEM("MPFastcloseRx", MPTCP_MIB_MPFASTCLOSERX),
 	SNMP_MIB_ITEM("RcvPruned", MPTCP_MIB_RCVPRUNED),
 	SNMP_MIB_ITEM("SubflowStale", MPTCP_MIB_SUBFLOWSTALE),
 	SNMP_MIB_ITEM("SubflowRecover", MPTCP_MIB_SUBFLOWRECOVER),
diff --git a/net/mptcp/mib.h b/net/mptcp/mib.h
index 785cf751e5c0..93dd5176fd5e 100644
--- a/net/mptcp/mib.h
+++ b/net/mptcp/mib.h
@@ -42,6 +42,8 @@ enum linux_mptcp_mib_field {
 	MPTCP_MIB_MPPRIORX,		/* Received a MP_PRIO */
 	MPTCP_MIB_MPFAILTX,		/* Transmit a MP_FAIL */
 	MPTCP_MIB_MPFAILRX,		/* Received a MP_FAIL */
+	MPTCP_MIB_MPFASTCLOSETX,	/* Transmit a MP_FASTCLOSE */
+	MPTCP_MIB_MPFASTCLOSERX,	/* Received a MP_FASTCLOSE */
 	MPTCP_MIB_RCVPRUNED,		/* Incoming packet dropped due to memory limit */
 	MPTCP_MIB_SUBFLOWSTALE,		/* Subflows entered 'stale' status */
 	MPTCP_MIB_SUBFLOWRECOVER,	/* Subflows returned to active status after being stale */
diff --git a/net/mptcp/options.c b/net/mptcp/options.c
index 0401b22128c4..e775d75807fd 100644
--- a/net/mptcp/options.c
+++ b/net/mptcp/options.c
@@ -323,6 +323,7 @@ static void mptcp_parse_option(const struct sk_buff *skb,
 		mp_opt->rcvr_key = get_unaligned_be64(ptr);
 		ptr += 8;
 		mp_opt->suboptions |= OPTION_MPTCP_FASTCLOSE;
+		pr_debug("MP_FASTCLOSE: recv_key=%llu", mp_opt->rcvr_key);
 		break;
 
 	case MPTCPOPT_RST:
@@ -832,6 +833,7 @@ bool mptcp_established_options(struct sock *sk, struct sk_buff *skb,
 		    mptcp_established_options_mp_fail(sk, &opt_size, remaining, opts)) {
 			*size += opt_size;
 			remaining -= opt_size;
+			MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPFASTCLOSETX);
 		}
 		/* MP_RST can be used with MP_FASTCLOSE and MP_FAIL if there is room */
 		if (mptcp_established_options_rst(sk, skb, &opt_size, remaining, opts)) {
@@ -1124,6 +1126,7 @@ bool mptcp_incoming_options(struct sock *sk, struct sk_buff *skb)
 		    msk->local_key == mp_opt.rcvr_key) {
 			WRITE_ONCE(msk->rcv_fastclose, true);
 			mptcp_schedule_work((struct sock *)msk);
+			MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPFASTCLOSERX);
 		}
 
 		if ((mp_opt.suboptions & OPTION_MPTCP_ADD_ADDR) &&
-- 
2.34.1


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

* [PATCH mptcp-next v2 2/6] selftests: mptcp: add the MP_FASTCLOSE mibs check
  2022-02-13 14:50 [PATCH mptcp-next v2 0/6] add fastclose testcases Geliang Tang
  2022-02-13 14:50 ` [PATCH mptcp-next v2 1/6] mptcp: add the mibs for MP_FASTCLOSE Geliang Tang
@ 2022-02-13 14:50 ` Geliang Tang
  2022-02-13 14:50 ` [PATCH mptcp-next v2 3/6] mptcp: add the mibs for MP_RST Geliang Tang
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Geliang Tang @ 2022-02-13 14:50 UTC (permalink / raw)
  To: mptcp; +Cc: Geliang Tang

This patch added a new function chk_fclose_nr() to check the numbers
of the MP_FASTCLOSE sending and receiving mibs.

Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
 .../testing/selftests/net/mptcp/mptcp_join.sh | 32 +++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index b48b11714817..f71494b87d5e 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -834,6 +834,38 @@ chk_infi_nr()
 	[ "${dump_stats}" = 1 ] && dump_stats
 }
 
+chk_fclose_nr()
+{
+	local fclose_tx=$1
+	local fclose_rx=$2
+	local count
+	local dump_stats
+
+	printf "%-${nr_blank}s %s" " " "ctx"
+	count=`ip netns exec $ns2 nstat -as | grep MPTcpExtMPFastcloseTx | awk '{print $2}'`
+	[ -z "$count" ] && count=0
+	if [ "$count" != "$fclose_tx" ]; then
+		echo "[fail] got $count MP_FASTCLOSE[s] TX expected $fclose_tx"
+		ret=1
+		dump_stats=1
+	else
+		echo -n "[ ok ]"
+	fi
+
+	echo -n " - fclzrx"
+	count=`ip netns exec $ns1 nstat -as | grep MPTcpExtMPFastcloseRx | awk '{print $2}'`
+	[ -z "$count" ] && count=0
+	if [ "$count" != "$fclose_rx" ]; then
+		echo "[fail] got $count MP_FASTCLOSE[s] RX expected $fclose_rx"
+		ret=1
+		dump_stats=1
+	else
+		echo "[ ok ]"
+	fi
+
+	[ "${dump_stats}" = 1 ] && dump_stats
+}
+
 chk_join_nr()
 {
 	local msg="$1"
-- 
2.34.1


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

* [PATCH mptcp-next v2 3/6] mptcp: add the mibs for MP_RST
  2022-02-13 14:50 [PATCH mptcp-next v2 0/6] add fastclose testcases Geliang Tang
  2022-02-13 14:50 ` [PATCH mptcp-next v2 1/6] mptcp: add the mibs for MP_FASTCLOSE Geliang Tang
  2022-02-13 14:50 ` [PATCH mptcp-next v2 2/6] selftests: mptcp: add the MP_FASTCLOSE mibs check Geliang Tang
@ 2022-02-13 14:50 ` Geliang Tang
  2022-02-13 14:50 ` [PATCH mptcp-next v2 4/6] selftests: mptcp: add the MP_RST mibs check Geliang Tang
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Geliang Tang @ 2022-02-13 14:50 UTC (permalink / raw)
  To: mptcp; +Cc: Geliang Tang

This patch added two more mibs for MP_RST, MPTCP_MIB_MPRSTTX for
the MP_RST sending and MPTCP_MIB_MPRSTRX for the MP_RST receiving.

Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
 net/mptcp/mib.c     | 2 ++
 net/mptcp/mib.h     | 2 ++
 net/mptcp/options.c | 2 ++
 3 files changed, 6 insertions(+)

diff --git a/net/mptcp/mib.c b/net/mptcp/mib.c
index 684643f8af53..d93a8c9996fd 100644
--- a/net/mptcp/mib.c
+++ b/net/mptcp/mib.c
@@ -51,6 +51,8 @@ static const struct snmp_mib mptcp_snmp_list[] = {
 	SNMP_MIB_ITEM("MPFailRx", MPTCP_MIB_MPFAILRX),
 	SNMP_MIB_ITEM("MPFastcloseTx", MPTCP_MIB_MPFASTCLOSETX),
 	SNMP_MIB_ITEM("MPFastcloseRx", MPTCP_MIB_MPFASTCLOSERX),
+	SNMP_MIB_ITEM("MPRstTx", MPTCP_MIB_MPRSTTX),
+	SNMP_MIB_ITEM("MPRstRx", MPTCP_MIB_MPRSTRX),
 	SNMP_MIB_ITEM("RcvPruned", MPTCP_MIB_RCVPRUNED),
 	SNMP_MIB_ITEM("SubflowStale", MPTCP_MIB_SUBFLOWSTALE),
 	SNMP_MIB_ITEM("SubflowRecover", MPTCP_MIB_SUBFLOWRECOVER),
diff --git a/net/mptcp/mib.h b/net/mptcp/mib.h
index 93dd5176fd5e..529d07af9e14 100644
--- a/net/mptcp/mib.h
+++ b/net/mptcp/mib.h
@@ -44,6 +44,8 @@ enum linux_mptcp_mib_field {
 	MPTCP_MIB_MPFAILRX,		/* Received a MP_FAIL */
 	MPTCP_MIB_MPFASTCLOSETX,	/* Transmit a MP_FASTCLOSE */
 	MPTCP_MIB_MPFASTCLOSERX,	/* Received a MP_FASTCLOSE */
+	MPTCP_MIB_MPRSTTX,		/* Transmit a MP_RST */
+	MPTCP_MIB_MPRSTRX,		/* Received a MP_RST */
 	MPTCP_MIB_RCVPRUNED,		/* Incoming packet dropped due to memory limit */
 	MPTCP_MIB_SUBFLOWSTALE,		/* Subflows entered 'stale' status */
 	MPTCP_MIB_SUBFLOWRECOVER,	/* Subflows returned to active status after being stale */
diff --git a/net/mptcp/options.c b/net/mptcp/options.c
index e775d75807fd..88f4ebbd6515 100644
--- a/net/mptcp/options.c
+++ b/net/mptcp/options.c
@@ -839,6 +839,7 @@ bool mptcp_established_options(struct sock *sk, struct sk_buff *skb,
 		if (mptcp_established_options_rst(sk, skb, &opt_size, remaining, opts)) {
 			*size += opt_size;
 			remaining -= opt_size;
+			MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPRSTTX);
 		}
 		return true;
 	}
@@ -1161,6 +1162,7 @@ bool mptcp_incoming_options(struct sock *sk, struct sk_buff *skb)
 			subflow->reset_seen = 1;
 			subflow->reset_reason = mp_opt.reset_reason;
 			subflow->reset_transient = mp_opt.reset_transient;
+			MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPRSTRX);
 		}
 
 		if (!(mp_opt.suboptions & OPTION_MPTCP_DSS))
-- 
2.34.1


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

* [PATCH mptcp-next v2 4/6] selftests: mptcp: add the MP_RST mibs check
  2022-02-13 14:50 [PATCH mptcp-next v2 0/6] add fastclose testcases Geliang Tang
                   ` (2 preceding siblings ...)
  2022-02-13 14:50 ` [PATCH mptcp-next v2 3/6] mptcp: add the mibs for MP_RST Geliang Tang
@ 2022-02-13 14:50 ` Geliang Tang
  2022-02-13 14:50 ` [PATCH mptcp-next v2 5/6] selftests: mptcp: add extra_args in do_transfer Geliang Tang
  2022-02-13 14:50 ` [PATCH mptcp-next v2 6/6] selftests: mptcp: add fastclose testcases Geliang Tang
  5 siblings, 0 replies; 7+ messages in thread
From: Geliang Tang @ 2022-02-13 14:50 UTC (permalink / raw)
  To: mptcp; +Cc: Geliang Tang

This patch added a new function chk_rst_nr() to check the numbers
of the MP_RST sending and receiving mibs.

Showed in the output whether the inverted namespaces check order is used.
Since if we pass -Cz to mptcp_join.sh, the MP_RST information is showed
twice.

Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
 .../testing/selftests/net/mptcp/mptcp_join.sh | 50 +++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index f71494b87d5e..3252865352f3 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -802,6 +802,55 @@ chk_fail_nr()
 	[ "${dump_stats}" = 1 ] && dump_stats
 }
 
+chk_rst_nr()
+{
+	local rst_tx=$1
+	local rst_rx=$2
+	local ns_invert=${3:-""}
+	local count
+	local dump_stats
+
+	if [ -z $ns_invert ]; then
+		ns_tx=$ns1
+		ns_rx=$ns2
+	elif [ $ns_invert = "invert" ]; then
+		ns_tx=$ns2
+		ns_rx=$ns1
+	fi
+
+	printf "%-${nr_blank}s %s" " " "rtx"
+	count=`ip netns exec $ns_tx nstat -as | grep MPTcpExtMPRstTx | awk '{print $2}'`
+	[ -z "$count" ] && count=0
+	if [ "$count" != "$rst_tx" ]; then
+		echo "[fail] got $count MP_RST[s] TX expected $rst_tx"
+		ret=1
+		dump_stats=1
+	else
+		echo -n "[ ok ]"
+	fi
+
+	echo -n " - rstrx "
+	count=`ip netns exec $ns_rx nstat -as | grep MPTcpExtMPRstRx | awk '{print $2}'`
+	[ -z "$count" ] && count=0
+	if [ "$count" != "$rst_rx" ]; then
+		echo "[fail] got $count MP_RST[s] RX expected $rst_rx"
+		ret=1
+		dump_stats=1
+	else
+		if [ -z $ns_invert ]; then
+			echo "[ ok ]"
+		elif [ $ns_invert = "invert" ]; then
+			echo -n "[ ok ]"
+		fi
+	fi
+
+	if [ ! -z $ns_invert ] && [ $ns_invert = "invert" ]; then
+		echo " - invert"
+	fi
+
+	[ "${dump_stats}" = 1 ] && dump_stats
+}
+
 chk_infi_nr()
 {
 	local mp_infi_nr_tx=$1
@@ -920,6 +969,7 @@ chk_join_nr()
 	if [ $checksum -eq 1 ]; then
 		chk_csum_nr
 		chk_fail_nr 0 0
+		chk_rst_nr 0 0
 		chk_infi_nr 0 0
 	fi
 }
-- 
2.34.1


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

* [PATCH mptcp-next v2 5/6] selftests: mptcp: add extra_args in do_transfer
  2022-02-13 14:50 [PATCH mptcp-next v2 0/6] add fastclose testcases Geliang Tang
                   ` (3 preceding siblings ...)
  2022-02-13 14:50 ` [PATCH mptcp-next v2 4/6] selftests: mptcp: add the MP_RST mibs check Geliang Tang
@ 2022-02-13 14:50 ` Geliang Tang
  2022-02-13 14:50 ` [PATCH mptcp-next v2 6/6] selftests: mptcp: add fastclose testcases Geliang Tang
  5 siblings, 0 replies; 7+ messages in thread
From: Geliang Tang @ 2022-02-13 14:50 UTC (permalink / raw)
  To: mptcp; +Cc: Geliang Tang

Instead of using a global variable mptcp_connect, this patch added
a new local variable extra_args in do_transfer() to store the extra
argments passing to the mptcp_connect commands.

Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
 .../testing/selftests/net/mptcp/mptcp_join.sh | 24 +++++++++----------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index 3252865352f3..ee747f4a4c7d 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -12,7 +12,6 @@ cout=""
 ksft_skip=4
 timeout_poll=30
 timeout_test=$((timeout_poll * 2 + 1))
-mptcp_connect=""
 capture=0
 checksum=0
 ip_mptcp=0
@@ -454,12 +453,13 @@ do_transfer()
 	NSTAT_HISTORY=/tmp/${connector_ns}.nstat ip netns exec ${connector_ns} \
 		nstat -n
 
+	local extra_args
 	if [ $speed = "fast" ]; then
-		mptcp_connect="./mptcp_connect -j"
+		extra_args="-j"
 	elif [ $speed = "slow" ]; then
-		mptcp_connect="./mptcp_connect -r 50"
+		extra_args="-r 50"
 	elif [ $speed = "least" ]; then
-		mptcp_connect="./mptcp_connect -r 10"
+		extra_args="-r 10"
 	fi
 
 	local local_addr
@@ -472,13 +472,13 @@ do_transfer()
 	if [ "$test_link_fail" -eq 2 ];then
 		timeout ${timeout_test} \
 			ip netns exec ${listener_ns} \
-				$mptcp_connect -t ${timeout_poll} -l -p $port -s ${srv_proto} \
-					${local_addr} < "$sinfail" > "$sout" &
+				./mptcp_connect -t ${timeout_poll} -l -p $port -s ${srv_proto} \
+					$extra_args ${local_addr} < "$sinfail" > "$sout" &
 	else
 		timeout ${timeout_test} \
 			ip netns exec ${listener_ns} \
-				$mptcp_connect -t ${timeout_poll} -l -p $port -s ${srv_proto} \
-					${local_addr} < "$sin" > "$sout" &
+				./mptcp_connect -t ${timeout_poll} -l -p $port -s ${srv_proto} \
+					$extra_args ${local_addr} < "$sin" > "$sout" &
 	fi
 	spid=$!
 
@@ -487,15 +487,15 @@ do_transfer()
 	if [ "$test_link_fail" -eq 0 ];then
 		timeout ${timeout_test} \
 			ip netns exec ${connector_ns} \
-				$mptcp_connect -t ${timeout_poll} -p $port -s ${cl_proto} \
-					$connect_addr < "$cin" > "$cout" &
+				./mptcp_connect -t ${timeout_poll} -p $port -s ${cl_proto} \
+					$extra_args $connect_addr < "$cin" > "$cout" &
 	else
 		( cat "$cinfail" ; sleep 2; link_failure $listener_ns ; cat "$cinfail" ) | \
 			tee "$cinsent" | \
 			timeout ${timeout_test} \
 				ip netns exec ${connector_ns} \
-					$mptcp_connect -t ${timeout_poll} -p $port -s ${cl_proto} \
-						$connect_addr > "$cout" &
+					./mptcp_connect -t ${timeout_poll} -p $port -s ${cl_proto} \
+						$extra_args $connect_addr > "$cout" &
 	fi
 	cpid=$!
 
-- 
2.34.1


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

* [PATCH mptcp-next v2 6/6] selftests: mptcp: add fastclose testcases
  2022-02-13 14:50 [PATCH mptcp-next v2 0/6] add fastclose testcases Geliang Tang
                   ` (4 preceding siblings ...)
  2022-02-13 14:50 ` [PATCH mptcp-next v2 5/6] selftests: mptcp: add extra_args in do_transfer Geliang Tang
@ 2022-02-13 14:50 ` Geliang Tang
  5 siblings, 0 replies; 7+ messages in thread
From: Geliang Tang @ 2022-02-13 14:50 UTC (permalink / raw)
  To: mptcp; +Cc: Geliang Tang

This patch added the self tests for MP_FASTCLOSE. Added a new argment
fastclose for the function do_transfer(). Passed the extra argments '-I 2'
and '-I 3' to the mptcp_connect commands to disconnect the connections to
trigger the MP_FASTCLOSE sending and receiving. Used chk_fclose_nr to check
the MP_FASTCLOSE mibs and used chk_rst_nr to check the MP_RST mibs.

The output looks like this:

001 fastclose test 1              syn[ ok ] - synack[ ok ] - ack[ ok ]
                                  sum[ ok ] - csum  [ ok ]
                                  ftx[ ok ] - frx   [ ok ]
                                  rtx[ ok ] - rstrx [ ok ]
                                  itx[ ok ] - irx   [ ok ]
                                  ctx[ ok ] - fclzrx[ ok ]
                                  rtx[ ok ] - rstrx [ ok ] - invert

Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
 .../testing/selftests/net/mptcp/mptcp_join.sh | 37 +++++++++++++++++--
 1 file changed, 33 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index ee747f4a4c7d..2fc26fe68a9d 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -424,6 +424,7 @@ do_transfer()
 	addr_nr_ns2="$8"
 	speed="$9"
 	sflags="${10}"
+	fastclose="${11}"
 
 	port=$((10000+$TEST_COUNT))
 	TEST_COUNT=$((TEST_COUNT+1))
@@ -462,6 +463,13 @@ do_transfer()
 		extra_args="-r 10"
 	fi
 
+	if [ $fastclose -eq 2 ]; then
+		# disconnect
+		extra_args="$extra_args -I 2"
+	elif [ $fastclose -eq 3 ]; then
+		extra_args="$extra_args -I 3"
+	fi
+
 	local local_addr
 	if is_v6 "${connect_addr}"; then
 		local_addr="::"
@@ -607,7 +615,7 @@ do_transfer()
 		fi
 	fi
 
-	if [ ! -z $sflags ]; then
+	if [ $sflags != "null" ]; then
 		sleep 1
 		for netns in "$ns1" "$ns2"; do
 			pm_nl_show_endpoints $netns | while read line; do
@@ -698,7 +706,8 @@ run_tests()
 	addr_nr_ns1="${5:-0}"
 	addr_nr_ns2="${6:-0}"
 	speed="${7:-fast}"
-	sflags="${8:-""}"
+	sflags="${8:-null}"
+	fastclose="${9:-0}"
 
 	# create the input file for the failure test when
 	# the first failure test run
@@ -725,7 +734,7 @@ run_tests()
 	fi
 
 	do_transfer ${listener_ns} ${connector_ns} MPTCP MPTCP ${connect_addr} \
-		${test_linkfail} ${addr_nr_ns1} ${addr_nr_ns2} ${speed} ${sflags}
+		${test_linkfail} ${addr_nr_ns1} ${addr_nr_ns2} ${speed} ${sflags} ${fastclose}
 }
 
 dump_stats()
@@ -2285,6 +2294,21 @@ userspace_tests()
 	chk_rm_nr 0 0
 }
 
+fastclose_tests()
+{
+	reset
+	run_tests $ns1 $ns2 10.0.1.1 0 0 0 fast null 2
+	chk_join_nr "fastclose test 1" 0 0 0
+	chk_fclose_nr 1 1
+	chk_rst_nr 1 1 invert
+
+	reset
+	run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow null 3
+	chk_join_nr "fastclose test 2" 0 0 0
+	chk_fclose_nr 2 2
+	chk_rst_nr 2 2 invert
+}
+
 all_tests()
 {
 	subflows_tests
@@ -2303,6 +2327,7 @@ all_tests()
 	deny_join_id0_tests
 	fullmesh_tests
 	userspace_tests
+	fastclose_tests
 }
 
 # [$1: error message]
@@ -2330,6 +2355,7 @@ usage()
 	echo "  -d deny_join_id0_tests"
 	echo "  -m fullmesh_tests"
 	echo "  -u userspace_tests"
+	echo "  -z fastclose_tests"
 	echo "  -c capture pcap files"
 	echo "  -C enable data checksum"
 	echo "  -i use ip mptcp"
@@ -2361,7 +2387,7 @@ if [ $do_all_tests -eq 1 ]; then
 	exit $ret
 fi
 
-while getopts 'fesltra64bpkdmuchCSi' opt; do
+while getopts 'fesltra64bpkdmuchzCSi' opt; do
 	case $opt in
 		f)
 			subflows_tests
@@ -2411,6 +2437,9 @@ while getopts 'fesltra64bpkdmuchCSi' opt; do
 		u)
 			userspace_tests
 			;;
+		z)
+			fastclose_tests
+			;;
 		c)
 			;;
 		C)
-- 
2.34.1


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

end of thread, other threads:[~2022-02-13 14:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-13 14:50 [PATCH mptcp-next v2 0/6] add fastclose testcases Geliang Tang
2022-02-13 14:50 ` [PATCH mptcp-next v2 1/6] mptcp: add the mibs for MP_FASTCLOSE Geliang Tang
2022-02-13 14:50 ` [PATCH mptcp-next v2 2/6] selftests: mptcp: add the MP_FASTCLOSE mibs check Geliang Tang
2022-02-13 14:50 ` [PATCH mptcp-next v2 3/6] mptcp: add the mibs for MP_RST Geliang Tang
2022-02-13 14:50 ` [PATCH mptcp-next v2 4/6] selftests: mptcp: add the MP_RST mibs check Geliang Tang
2022-02-13 14:50 ` [PATCH mptcp-next v2 5/6] selftests: mptcp: add extra_args in do_transfer Geliang Tang
2022-02-13 14:50 ` [PATCH mptcp-next v2 6/6] selftests: mptcp: add fastclose testcases Geliang Tang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox