Skip to contentSkip to conversation

The infinite mapping support

PATCH In review Geliang Tang 4 participants 22 messages Oct 29, 2021 – Nov 5, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v8 cover The infinite mapping support

v8:
- Patches 1-6 are unchanged, only updated the selftests scripts.
- The patch (Squash to "mptcp: infinite mapping receiving" for v7) is
dropped too. Since this series only implemented MP_FAIL in one direction. The TODO items, "MP_FAIL echo" and "MP_FAIL retrans", will implement later as new patches.

v7:
- drop the patch "mptcp: add last_ack_dss_start in the msk" in v6
- set allow_infinite_fallback to false in __mptcp_subflow_connect and mptcp_finish_join.

v6:
- use allow_infinite_fallback instead of last_retrans_seq.
- rename mptcp_is_data_contiguous to mptcp_allow_infinite_fallback.
- rename last_fully_acked_dss_start_seq to last_ack_dss_start.

v5:
- move last_retrans_seq from msk to mptcp_subflow_context

v4:
- update patch 1 and patch 2

v3:
- drop MPTCP_INFINITE_DONE flag
- drop MAPPING_INFINITE
- add mptcp_is_data_contiguous helper
- add the fallback check
- The u32 target testcase has not been completed yet.

v2:
- add MPTCP_INFINITE_DONE flag
- add MAPPING_INFINITE mapping status
- add start_seq in the msk

v1:
- add noncontiguous flag
- add the mibs check
- tag: export/20210904T080009

Geliang Tang (8):
mptcp: don't send RST for single subflow
mptcp: add the fallback check
mptcp: track and update contiguous data status
mptcp: infinite mapping sending
mptcp: infinite mapping receiving
mptcp: add mib for infinite map sending
selftests: mptcp: add infinite map mibs check
selftests: mptcp: add mp_fail testcases

 include/net/mptcp.h                           |   3 +-
 net/mptcp/mib.c                               |   1 +
 net/mptcp/mib.h                               |   1 +
 net/mptcp/options.c                           |   2 +-
 net/mptcp/pm.c                                |   6 +
 net/mptcp/protocol.c                          |  22 ++++
 net/mptcp/protocol.h                          |  13 ++
 net/mptcp/subflow.c                           |  56 +++++----
 tools/testing/selftests/net/mptcp/config      |   5 +
 .../testing/selftests/net/mptcp/mptcp_join.sh | 111 ++++++++++++++++--
 10 files changed, 186 insertions(+), 34 deletions(-)
Signature · 1 line
2.26.2
#1 lore raw

PATCH v8 1/8 mptcp: don't send RST for single subflow

When a bad checksum is detected and a single subflow is in use, don't send RST + MP_FAIL, send data_ack + MP_FAIL instead.

---
 net/mptcp/subflow.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
net/mptcp/subflow.c +5 -5
index 6172f380dfb7..92b45a7c997e 100644
@@ -1167,14 +1167,14 @@ static bool subflow_check_data_avail(struct sock *ssk)
 	/* RFC 8684 section 3.7. */
 	if (subflow->send_mp_fail) {
 		if (mptcp_has_another_subflow(ssk)) {
+			ssk->sk_err = EBADMSG;
+			tcp_set_state(ssk, TCP_CLOSE);
+			subflow->reset_transient = 0;
+			subflow->reset_reason = MPTCP_RST_EMIDDLEBOX;
+			tcp_send_active_reset(ssk, GFP_ATOMIC);
 			while ((skb = skb_peek(&ssk->sk_receive_queue)))
 				sk_eat_skb(ssk, skb);
 		}
-		ssk->sk_err = EBADMSG;
-		tcp_set_state(ssk, TCP_CLOSE);
-		subflow->reset_transient = 0;
-		subflow->reset_reason = MPTCP_RST_EMIDDLEBOX;
-		tcp_send_active_reset(ssk, GFP_ATOMIC);
 		WRITE_ONCE(subflow->data_avail, 0);
 		return true;
 	}
Signature · 1 line
2.26.2
#2 lore raw

PATCH v8 2/8 mptcp: add the fallback check

In reply to Geliang Tang

This patch added the fallback check in subflow_check_data_avail(). Only do the fallback when the msk isn't fallen back yet.

---
 net/mptcp/subflow.c | 45 ++++++++++++++++++++++++---------------------
 1 file changed, 24 insertions(+), 21 deletions(-)
net/mptcp/subflow.c +24 -21
index 92b45a7c997e..87a9ffebcc42 100644
@@ -1164,35 +1164,38 @@ static bool subflow_check_data_avail(struct sock *ssk)
 	return false;
 
 fallback:
-	/* RFC 8684 section 3.7. */
-	if (subflow->send_mp_fail) {
-		if (mptcp_has_another_subflow(ssk)) {
+	if (!__mptcp_check_fallback(msk)) {
+		/* RFC 8684 section 3.7. */
+		if (subflow->send_mp_fail) {
+			if (mptcp_has_another_subflow(ssk)) {
+				ssk->sk_err = EBADMSG;
+				tcp_set_state(ssk, TCP_CLOSE);
+				subflow->reset_transient = 0;
+				subflow->reset_reason = MPTCP_RST_EMIDDLEBOX;
+				tcp_send_active_reset(ssk, GFP_ATOMIC);
+				while ((skb = skb_peek(&ssk->sk_receive_queue)))
+					sk_eat_skb(ssk, skb);
+			}
+			WRITE_ONCE(subflow->data_avail, 0);
+			return true;
+		}
+
+		if (subflow->mp_join || subflow->fully_established) {
+			/* fatal protocol error, close the socket.
+			 * subflow_error_report() will introduce the appropriate barriers
+			 */
 			ssk->sk_err = EBADMSG;
 			tcp_set_state(ssk, TCP_CLOSE);
 			subflow->reset_transient = 0;
-			subflow->reset_reason = MPTCP_RST_EMIDDLEBOX;
+			subflow->reset_reason = MPTCP_RST_EMPTCP;
 			tcp_send_active_reset(ssk, GFP_ATOMIC);
-			while ((skb = skb_peek(&ssk->sk_receive_queue)))
-				sk_eat_skb(ssk, skb);
+			WRITE_ONCE(subflow->data_avail, 0);
+			return false;
 		}
-		WRITE_ONCE(subflow->data_avail, 0);
-		return true;
-	}
 
-	if (subflow->mp_join || subflow->fully_established) {
-		/* fatal protocol error, close the socket.
-		 * subflow_error_report() will introduce the appropriate barriers
-		 */
-		ssk->sk_err = EBADMSG;
-		tcp_set_state(ssk, TCP_CLOSE);
-		subflow->reset_transient = 0;
-		subflow->reset_reason = MPTCP_RST_EMPTCP;
-		tcp_send_active_reset(ssk, GFP_ATOMIC);
-		WRITE_ONCE(subflow->data_avail, 0);
-		return false;
+		__mptcp_do_fallback(msk);
 	}
 
-	__mptcp_do_fallback(msk);
 	skb = skb_peek(&ssk->sk_receive_queue);
 	subflow->map_valid = 1;
 	subflow->map_seq = READ_ONCE(msk->ack_seq);
Signature · 1 line
2.26.2
#3 lore raw

PATCH v8 3/8 mptcp: track and update contiguous data status

In reply to Geliang Tang

This patch added a new member allow_infinite_fallback in mptcp_sock, which gets initialized to 'true' when the connection begins and is set to 'false' on any retransmit or successful MP_JOIN. Only do infinite mapping fallback if there is a single subflow AND there have been no retransmissions AND there have never been any MP_JOINs.

---
 net/mptcp/protocol.c | 3 +++
 net/mptcp/protocol.h | 1 +
 net/mptcp/subflow.c  | 4 +++-
 3 files changed, 7 insertions(+), 1 deletion(-)
net/mptcp/protocol.c +3 -0
index 7803b0dbb1be..f3163647c501 100644
@@ -2387,6 +2387,7 @@ static void __mptcp_retrans(struct sock *sk)
 		dfrag->already_sent = max(dfrag->already_sent, info.sent);
 		tcp_push(ssk, 0, info.mss_now, tcp_sk(ssk)->nonagle,
 			 info.size_goal);
+		WRITE_ONCE(msk->allow_infinite_fallback, false);
 	}
 
 	release_sock(ssk);
@@ -2465,6 +2466,7 @@ static int __mptcp_init_sock(struct sock *sk)
 	msk->first = NULL;
 	inet_csk(sk)->icsk_sync_mss = mptcp_sync_mss;
 	WRITE_ONCE(msk->csum_enabled, mptcp_is_checksum_enabled(sock_net(sk)));
+	WRITE_ONCE(msk->allow_infinite_fallback, true);
 	msk->recovery = false;
 
 	mptcp_pm_data_init(msk);
@@ -3133,6 +3135,7 @@ bool mptcp_finish_join(struct sock *ssk)
 	if (parent_sock && !ssk->sk_socket)
 		mptcp_sock_graft(ssk, parent_sock);
 	subflow->map_seq = READ_ONCE(msk->ack_seq);
+	WRITE_ONCE(msk->allow_infinite_fallback, false);
 out:
 	mptcp_event(MPTCP_EVENT_SUB_ESTABLISHED, msk, ssk, GFP_ATOMIC);
 	return true;
net/mptcp/protocol.h +1 -0
index 67a61ac48b20..4b9fe56bd572 100644
@@ -249,6 +249,7 @@ struct mptcp_sock {
 	bool		rcv_fastclose;
 	bool		use_64bit_ack; /* Set when we received a 64-bit DSN */
 	bool		csum_enabled;
+	bool		allow_infinite_fallback;
 	spinlock_t	join_list_lock;
 	struct work_struct work;
 	struct sk_buff  *ooo_last_skb;
net/mptcp/subflow.c +3 -1
index 87a9ffebcc42..93bc298bd41d 100644
@@ -1167,7 +1167,8 @@ static bool subflow_check_data_avail(struct sock *ssk)
 	if (!__mptcp_check_fallback(msk)) {
 		/* RFC 8684 section 3.7. */
 		if (subflow->send_mp_fail) {
-			if (mptcp_has_another_subflow(ssk)) {
+			if (mptcp_has_another_subflow(ssk) ||
+			    !READ_ONCE(msk->allow_infinite_fallback)) {
 				ssk->sk_err = EBADMSG;
 				tcp_set_state(ssk, TCP_CLOSE);
 				subflow->reset_transient = 0;
@@ -1452,6 +1453,7 @@ int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc,
 	/* discard the subflow socket */
 	mptcp_sock_graft(ssk, sk->sk_socket);
 	iput(SOCK_INODE(sf));
+	WRITE_ONCE(msk->allow_infinite_fallback, false);
 	return err;
 
 failed_unlink:
Signature · 1 line
2.26.2
#4 lore raw

PATCH v8 4/8 mptcp: infinite mapping sending

In reply to Geliang Tang

This patch added the infinite mapping sending logic.

Added a new flag send_infinite_map in struct mptcp_subflow_context. Set it true when a single contiguous subflow is in use and the allow_infinite_fallback flag is true in mptcp_pm_mp_fail_received().

In mptcp_sendmsg_frag(), if this flag is true, call the new function mptcp_update_infinite_map() to set the infinite mapping.

Added a new flag infinite_map in struct mptcp_ext, set it true in mptcp_update_infinite_map(), and check this flag in a new helper mptcp_check_infinite_map().

In mptcp_update_infinite_map(), set data_len and csum to 0, and clear the send_infinite_map flag, then do fallback.

In mptcp_established_options(), use the helper mptcp_check_infinite_map() to let the infinite mapping DSS can be sent out in the fallback mode.

---
 include/net/mptcp.h  |  3 ++-
 net/mptcp/options.c  |  2 +-
 net/mptcp/pm.c       |  6 ++++++
 net/mptcp/protocol.c | 18 ++++++++++++++++++
 net/mptcp/protocol.h | 12 ++++++++++++
 5 files changed, 39 insertions(+), 2 deletions(-)
include/net/mptcp.h +2 -1
index a925349b4b89..04f53352a1c9 100644
@@ -35,7 +35,8 @@ struct mptcp_ext {
 			frozen:1,
 			reset_transient:1;
 	u8		reset_reason:4,
-			csum_reqd:1;
+			csum_reqd:1,
+			infinite_map:1;
 };
 
 #define MPTCP_RM_IDS_MAX	8
net/mptcp/options.c +1 -1
index 7c3420afb1a0..932e19645910 100644
@@ -816,7 +816,7 @@ bool mptcp_established_options(struct sock *sk, struct sk_buff *skb,
 
 	opts->suboptions = 0;
 
-	if (unlikely(__mptcp_check_fallback(msk)))
+	if (unlikely(__mptcp_check_fallback(msk) && !mptcp_check_infinite_map(skb)))
 		return false;
 
 	if (unlikely(skb && TCP_SKB_CB(skb)->tcp_flags & TCPHDR_RST)) {
net/mptcp/pm.c +6 -0
index 6ab386ff3294..86b38a830b4c 100644
@@ -251,7 +251,13 @@ void mptcp_pm_mp_prio_received(struct sock *sk, u8 bkup)
 
 void mptcp_pm_mp_fail_received(struct sock *sk, u64 fail_seq)
 {
+	struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
+	struct mptcp_sock *msk = mptcp_sk(subflow->conn);
+
 	pr_debug("fail_seq=%llu", fail_seq);
+
+	if (!mptcp_has_another_subflow(sk) && READ_ONCE(msk->allow_infinite_fallback))
+		subflow->send_infinite_map = 1;
 }
 
 /* path manager helpers */
net/mptcp/protocol.c +18 -0
index f3163647c501..70f2e0e212fa 100644
@@ -1226,6 +1226,22 @@ static void mptcp_update_data_checksum(struct sk_buff *skb, int added)
 	mpext->csum = csum_fold(csum_block_add(csum, skb_checksum(skb, offset, added, 0), offset));
 }
 
+static void mptcp_update_infinite_map(struct mptcp_sock *msk,
+				      struct sock *ssk,
+				      struct mptcp_ext *mpext)
+{
+	if (!mpext)
+		return;
+
+	mpext->infinite_map = 1;
+	mpext->data_len = 0;
+	mpext->csum = 0;
+
+	mptcp_subflow_ctx(ssk)->send_infinite_map = 0;
+	pr_fallback(msk);
+	__mptcp_do_fallback(msk);
+}
+
 static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk,
 			      struct mptcp_data_frag *dfrag,
 			      struct mptcp_sendmsg_info *info)
@@ -1358,6 +1374,8 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk,
 out:
 	if (READ_ONCE(msk->csum_enabled))
 		mptcp_update_data_checksum(skb, copy);
+	if (mptcp_subflow_ctx(ssk)->send_infinite_map)
+		mptcp_update_infinite_map(msk, ssk, mpext);
 	mptcp_subflow_ctx(ssk)->rel_write_seq += copy;
 	return copy;
 }
net/mptcp/protocol.h +12 -0
index 4b9fe56bd572..906c65fca04f 100644
@@ -419,6 +419,7 @@ struct mptcp_subflow_context {
 		backup : 1,
 		send_mp_prio : 1,
 		send_mp_fail : 1,
+		send_infinite_map : 1,
 		rx_eof : 1,
 		can_ack : 1,        /* only after processing the remote a key */
 		disposable : 1,	    /* ctx can be free at ulp release time */
@@ -852,6 +853,17 @@ static inline void mptcp_do_fallback(struct sock *sk)
 
 #define pr_fallback(a) pr_debug("%s:fallback to TCP (msk=%p)", __func__, a)
 
+static inline bool mptcp_check_infinite_map(struct sk_buff *skb)
+{
+	struct mptcp_ext *mpext;
+
+	mpext = skb ? mptcp_get_ext(skb) : NULL;
+	if (mpext && mpext->infinite_map)
+		return true;
+
+	return false;
+}
+
 static inline bool subflow_simultaneous_connect(struct sock *sk)
 {
 	struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
Signature · 1 line
2.26.2
#5 lore raw

PATCH v8 5/8 mptcp: infinite mapping receiving

In reply to Geliang Tang

This patch added the infinite mapping receiving logic. When the infinite mapping is received, set the map_data_len of the subflow to 0.

In subflow_check_data_avail(), only reset the subflow when the map_data_len of the subflow is non-zero.

---
 net/mptcp/subflow.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/mptcp/subflow.c +2 -1
index 93bc298bd41d..9e54122f18f4 100644
@@ -968,6 +968,7 @@ static enum mapping_status get_mapping_status(struct sock *ssk,
 	data_len = mpext->data_len;
 	if (data_len == 0) {
 		MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_INFINITEMAPRX);
+		subflow->map_data_len = 0;
 		return MAPPING_INVALID;
 	}
 
@@ -1181,7 +1182,7 @@ static bool subflow_check_data_avail(struct sock *ssk)
 			return true;
 		}
 
-		if (subflow->mp_join || subflow->fully_established) {
+		if ((subflow->mp_join || subflow->fully_established) && subflow->map_data_len) {
 			/* fatal protocol error, close the socket.
 			 * subflow_error_report() will introduce the appropriate barriers
 			 */
Signature · 1 line
2.26.2
#6 lore raw

PATCH v8 6/8 mptcp: add mib for infinite map sending

In reply to Geliang Tang

This patch added a new mib named MPTCP_MIB_INFINITEMAPTX, increase it when a infinite mapping has been sent out.

---
 net/mptcp/mib.c      | 1 +
 net/mptcp/mib.h      | 1 +
 net/mptcp/protocol.c | 1 +
 3 files changed, 3 insertions(+)
net/mptcp/mib.c +1 -0
index 3240b72271a7..c12251cb0d44 100644
@@ -24,6 +24,7 @@ static const struct snmp_mib mptcp_snmp_list[] = {
 	SNMP_MIB_ITEM("MPJoinAckRx", MPTCP_MIB_JOINACKRX),
 	SNMP_MIB_ITEM("MPJoinAckHMacFailure", MPTCP_MIB_JOINACKMAC),
 	SNMP_MIB_ITEM("DSSNotMatching", MPTCP_MIB_DSSNOMATCH),
+	SNMP_MIB_ITEM("InfiniteMapTx", MPTCP_MIB_INFINITEMAPTX),
 	SNMP_MIB_ITEM("InfiniteMapRx", MPTCP_MIB_INFINITEMAPRX),
 	SNMP_MIB_ITEM("DSSNoMatchTCP", MPTCP_MIB_DSSTCPMISMATCH),
 	SNMP_MIB_ITEM("DataCsumErr", MPTCP_MIB_DATACSUMERR),
net/mptcp/mib.h +1 -0
index ecd3d8b117e0..7901f1338d15 100644
@@ -17,6 +17,7 @@ enum linux_mptcp_mib_field {
 	MPTCP_MIB_JOINACKRX,		/* Received an ACK + MP_JOIN */
 	MPTCP_MIB_JOINACKMAC,		/* HMAC was wrong on ACK + 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 */
 	MPTCP_MIB_DSSTCPMISMATCH,	/* DSS-mapping did not map with TCP's sequence numbers */
 	MPTCP_MIB_DATACSUMERR,		/* The data checksum fail */
net/mptcp/protocol.c +1 -0
index 70f2e0e212fa..2283efda1bc9 100644
@@ -1237,6 +1237,7 @@ static void mptcp_update_infinite_map(struct mptcp_sock *msk,
 	mpext->data_len = 0;
 	mpext->csum = 0;
 
+	MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_INFINITEMAPTX);
 	mptcp_subflow_ctx(ssk)->send_infinite_map = 0;
 	pr_fallback(msk);
 	__mptcp_do_fallback(msk);
Signature · 1 line
2.26.2
#7 lore raw

PATCH v8 7/8 selftests: mptcp: add infinite map mibs check

In reply to Geliang Tang

This patch added a function chk_infi_nr() to check the mibs for the infinite mapping.

---
 .../testing/selftests/net/mptcp/mptcp_join.sh | 38 +++++++++++++++++++
 1 file changed, 38 insertions(+)
tools/testing/selftests/net/mptcp/mptcp_join.sh +38 -0
index 7ef639a9d4a6..2684ef9c0d42 100755
@@ -615,6 +615,43 @@ chk_fail_nr()
 	fi
 }
 
+chk_infi_nr()
+{
+	local mp_infi_nr_tx=$1
+	local mp_infi_nr_rx=$2
+	local count
+	local dump_stats
+
+	printf "%-39s %s" " " "itx"
+	count=`ip netns exec $ns2 nstat -as | grep InfiniteMapTx | awk '{print $2}'`
+	[ -z "$count" ] && count=0
+	if [ "$count" != "$mp_infi_nr_tx" ]; then
+		echo "[fail] got $count infinite map[s] TX expected $mp_infi_nr_tx"
+		ret=1
+		dump_stats=1
+	else
+		echo -n "[ ok ]"
+	fi
+
+	echo -n " - irx   "
+	count=`ip netns exec $ns1 nstat -as | grep InfiniteMapRx | awk '{print $2}'`
+	[ -z "$count" ] && count=0
+	if [ "$count" != "$mp_infi_nr_rx" ]; then
+		echo "[fail] got $count infinite map[s] RX expected $mp_infi_nr_rx"
+		ret=1
+		dump_stats=1
+	else
+		echo "[ ok ]"
+	fi
+
+	if [ "${dump_stats}" = 1 ]; then
+		echo Server ns stats
+		ip netns exec $ns1 nstat -as | grep MPTcp
+		echo Client ns stats
+		ip netns exec $ns2 nstat -as | grep MPTcp
+	fi
+}
+
 chk_join_nr()
 {
 	local msg="$1"
@@ -665,6 +702,7 @@ chk_join_nr()
 	if [ $checksum -eq 1 ]; then
 		chk_csum_nr
 		chk_fail_nr 0 0
+		chk_infi_nr 0 0
 	fi
 }
 
Signature · 1 line
2.26.2
#8 lore raw

PATCH v8 8/8 selftests: mptcp: add mp_fail testcases

In reply to Geliang Tang

Added the test cases for MP_FAIL, use 'tc' command to trigger the checksum failure.

---
 tools/testing/selftests/net/mptcp/config      |  5 ++
 .../testing/selftests/net/mptcp/mptcp_join.sh | 75 +++++++++++++++++--
 2 files changed, 72 insertions(+), 8 deletions(-)
tools/testing/selftests/net/mptcp/config +5 -0
index 0faaccd21447..f522288b2204 100644
@@ -15,3 +15,8 @@ CONFIG_NETFILTER_XTABLES=m
 CONFIG_NETFILTER_XT_MATCH_BPF=m
 CONFIG_NF_TABLES_IPV4=y
 CONFIG_NF_TABLES_IPV6=y
+CONFIG_NET_ACT_CSUM=m
+CONFIG_NET_ACT_PEDIT=m
+CONFIG_NET_CLS_ACT=m
+CONFIG_NET_CLS_FLOWER=m
+CONFIG_NET_SCH_INGRESS=m
tools/testing/selftests/net/mptcp/mptcp_join.sh +67 -8

153 lines not on this page · raw message

Signature · 1 line
2.26.2
maintainer
#19 lore raw
In reply to Geliang Tang
Quoted 52 lines · Geliang Tang

v8:
- Patches 1-6 are unchanged, only updated the selftests scripts.
- The patch (Squash to "mptcp: infinite mapping receiving" for v7) is
dropped too. Since this series only implemented MP_FAIL in one direction. The TODO items, "MP_FAIL echo" and "MP_FAIL retrans", will implement later as new patches.

v7:
- drop the patch "mptcp: add last_ack_dss_start in the msk" in v6
- set allow_infinite_fallback to false in __mptcp_subflow_connect and mptcp_finish_join.

v6:
- use allow_infinite_fallback instead of last_retrans_seq.
- rename mptcp_is_data_contiguous to mptcp_allow_infinite_fallback.
- rename last_fully_acked_dss_start_seq to last_ack_dss_start.

v5:
- move last_retrans_seq from msk to mptcp_subflow_context

v4:
- update patch 1 and patch 2

v3:
- drop MPTCP_INFINITE_DONE flag
- drop MAPPING_INFINITE
- add mptcp_is_data_contiguous helper
- add the fallback check
- The u32 target testcase has not been completed yet.

v2:
- add MPTCP_INFINITE_DONE flag
- add MAPPING_INFINITE mapping status
- add start_seq in the msk

v1:
- add noncontiguous flag
- add the mibs check
- tag: export/20210904T080009

Geliang Tang (8):
mptcp: don't send RST for single subflow
mptcp: add the fallback check
mptcp: track and update contiguous data status
mptcp: infinite mapping sending
mptcp: infinite mapping receiving
mptcp: add mib for infinite map sending
selftests: mptcp: add infinite map mibs check
selftests: mptcp: add mp_fail testcases

Quoted 11 lines
 include/net/mptcp.h                           |   3 +-
 net/mptcp/mib.c                               |   1 +
 net/mptcp/mib.h                               |   1 +
 net/mptcp/options.c                           |   2 +-
 net/mptcp/pm.c                                |   6 +
 net/mptcp/protocol.c                          |  22 ++++
 net/mptcp/protocol.h                          |  13 ++
 net/mptcp/subflow.c                           |  56 +++++----
 tools/testing/selftests/net/mptcp/config      |   5 +
 .../testing/selftests/net/mptcp/mptcp_join.sh | 111 ++++++++++++++++--
 10 files changed, 186 insertions(+), 34 deletions(-)

I haven't reviewed the patch yet, but I have to say: nice new email address :)

/P

#9 lore raw

Re: [PATCH mptcp-next v8 8/8] selftests: mptcp: add mp_fail testcases

In reply to Geliang Tang

Hi Geliang,

Thank you for the new version.

Quoted 51 lines · Geliang Tang

Added the test cases for MP_FAIL, use 'tc' command to trigger the checksum failure.

---
 tools/testing/selftests/net/mptcp/config      |  5 ++
 .../testing/selftests/net/mptcp/mptcp_join.sh | 75 +++++++++++++++++--
 2 files changed, 72 insertions(+), 8 deletions(-)
tools/testing/selftests/net/mptcp/config +5 -0
index 0faaccd21447..f522288b2204 100644
@@ -15,3 +15,8 @@ CONFIG_NETFILTER_XTABLES=m
 CONFIG_NETFILTER_XT_MATCH_BPF=m
 CONFIG_NF_TABLES_IPV4=y
 CONFIG_NF_TABLES_IPV6=y
+CONFIG_NET_ACT_CSUM=m
+CONFIG_NET_ACT_PEDIT=m
+CONFIG_NET_CLS_ACT=m
+CONFIG_NET_CLS_FLOWER=m
+CONFIG_NET_SCH_INGRESS=m
tools/testing/selftests/net/mptcp/mptcp_join.sh +12 -0
index 2684ef9c0d42..d33cb5ce0ff3 100755
@@ -178,6 +178,12 @@ if [ $? -ne 0 ];then
 	exit $ksft_skip
 fi
 
+jq -V > /dev/null 2>&1
+if [ $? -ne 0 ];then
+	echo "SKIP: Could not run all tests without jq tool"
+	exit $ksft_skip
+fi
+
 print_file_err()
 {
 	ls -l "$1" 1>&2
@@ -232,6 +238,28 @@ link_failure()
 	done
 }
 
+checksum_failure()
+{
+	i="$1"
+
+	tc -n $ns2 qdisc add dev ns2eth$i clsact
+	tc -n $ns2 filter add dev ns2eth$i egress \

tools/testing/selftests/net/mptcp/mptcp_join.sh link_failure() · line 256

Quoted 10 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +10 -0
+		protocol ip prio 1000 \
+		flower ip_proto tcp \
+		action pedit munge offset 148 u32 invert \
+		pipe csum tcp \
+		index 100
+
+	while true; do
+		local pkt=$(tc -n $ns2 -j -s action show action csum index 100 |
+				jq '.[1].actions[0].stats.packets')
+		if [ $pkt -gt 0 ]; then

The CI [1] is complaining about that line:

[09:34:44.063] # RTNETLINK answers: Operation not supported [09:34:44.107] # ./mptcp_join.sh: line 256: [: null: integer expression expected
[09:34:44.267] # RTNETLINK answers: Operation not supported [09:34:44.332] # ./mptcp_join.sh: line 256: [: null: integer expression expected
(...)

This is displayed in a loop as it is a "while true".

But just before the first one, we had this:

[09:34:43.859] # Error: Cannot find ingress queue for specified device. [09:34:43.955] # Error: Parent Qdisc doesn't exists. [09:34:43.959] # We have an error talking to the kernel

I guess the previous "tc" command failed and I also guess you don't have that on your side, right?

Maybe a missing kconfig?

I guess it is "safer" to abort if one of the tc command fails.

Cheers,
Matt

[1] https://cirrus-ci.com/task/6502115922149376

Signature · 2 lines
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net
#10 lore raw

Re: [PATCH mptcp-next v8 8/8] selftests: mptcp: add mp_fail testcases

Hi Matt,

Quoted 78 lines · Matthieu Baerts

Hi Geliang,

Thank you for the new version.

Quoted 51 lines · Geliang Tang

Added the test cases for MP_FAIL, use 'tc' command to trigger the checksum failure.

---
 tools/testing/selftests/net/mptcp/config      |  5 ++
 .../testing/selftests/net/mptcp/mptcp_join.sh | 75 +++++++++++++++++--
 2 files changed, 72 insertions(+), 8 deletions(-)
tools/testing/selftests/net/mptcp/config +5 -0
index 0faaccd21447..f522288b2204 100644
@@ -15,3 +15,8 @@ CONFIG_NETFILTER_XTABLES=m
 CONFIG_NETFILTER_XT_MATCH_BPF=m
 CONFIG_NF_TABLES_IPV4=y
 CONFIG_NF_TABLES_IPV6=y
+CONFIG_NET_ACT_CSUM=m
+CONFIG_NET_ACT_PEDIT=m
+CONFIG_NET_CLS_ACT=m
+CONFIG_NET_CLS_FLOWER=m
+CONFIG_NET_SCH_INGRESS=m
tools/testing/selftests/net/mptcp/mptcp_join.sh +12 -0
index 2684ef9c0d42..d33cb5ce0ff3 100755
@@ -178,6 +178,12 @@ if [ $? -ne 0 ];then
 	exit $ksft_skip
 fi
 
+jq -V > /dev/null 2>&1
+if [ $? -ne 0 ];then
+	echo "SKIP: Could not run all tests without jq tool"
+	exit $ksft_skip
+fi
+
 print_file_err()
 {
 	ls -l "$1" 1>&2
@@ -232,6 +238,28 @@ link_failure()
 	done
 }
 
+checksum_failure()
+{
+	i="$1"
+
+	tc -n $ns2 qdisc add dev ns2eth$i clsact
+	tc -n $ns2 filter add dev ns2eth$i egress \

tools/testing/selftests/net/mptcp/mptcp_join.sh link_failure() · line 256

Quoted 10 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +10 -0
+		protocol ip prio 1000 \
+		flower ip_proto tcp \
+		action pedit munge offset 148 u32 invert \
+		pipe csum tcp \
+		index 100
+
+	while true; do
+		local pkt=$(tc -n $ns2 -j -s action show action csum index 100 |
+				jq '.[1].actions[0].stats.packets')
+		if [ $pkt -gt 0 ]; then

The CI [1] is complaining about that line:

[09:34:44.063] # RTNETLINK answers: Operation not supported [09:34:44.107] # ./mptcp_join.sh: line 256: [: null: integer expression expected
[09:34:44.267] # RTNETLINK answers: Operation not supported [09:34:44.332] # ./mptcp_join.sh: line 256: [: null: integer expression expected
(...)

This is displayed in a loop as it is a "while true".

Quoted 8 lines

But just before the first one, we had this:

[09:34:43.859] # Error: Cannot find ingress queue for specified device. [09:34:43.955] # Error: Parent Qdisc doesn't exists. [09:34:43.959] # We have an error talking to the kernel

I guess the previous "tc" command failed and I also guess you don't have that on your side, right?

Yes, it works on my side.

Quoted 2 lines

Maybe a missing kconfig?

I think so. How can I get the kconfig of the CI?

Quoted 2 lines

I guess it is "safer" to abort if one of the tc command fails.

I just sent a squash-to patch to fix this.

Thanks,
-Geliang

Quoted 9 lines

Cheers,
Matt

[1] https://cirrus-ci.com/task/6502115922149376

Signature · 2 lines
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net
#20 lore raw
In reply to Paolo Abeni
Quoted 65 lines · Paolo Abeni
Quoted 52 lines · Geliang Tang

v8:
- Patches 1-6 are unchanged, only updated the selftests scripts.
- The patch (Squash to "mptcp: infinite mapping receiving" for v7) is
dropped too. Since this series only implemented MP_FAIL in one direction. The TODO items, "MP_FAIL echo" and "MP_FAIL retrans", will implement later as new patches.

v7:
- drop the patch "mptcp: add last_ack_dss_start in the msk" in v6
- set allow_infinite_fallback to false in __mptcp_subflow_connect and mptcp_finish_join.

v6:
- use allow_infinite_fallback instead of last_retrans_seq.
- rename mptcp_is_data_contiguous to mptcp_allow_infinite_fallback.
- rename last_fully_acked_dss_start_seq to last_ack_dss_start.

v5:
- move last_retrans_seq from msk to mptcp_subflow_context

v4:
- update patch 1 and patch 2

v3:
- drop MPTCP_INFINITE_DONE flag
- drop MAPPING_INFINITE
- add mptcp_is_data_contiguous helper
- add the fallback check
- The u32 target testcase has not been completed yet.

v2:
- add MPTCP_INFINITE_DONE flag
- add MAPPING_INFINITE mapping status
- add start_seq in the msk

v1:
- add noncontiguous flag
- add the mibs check
- tag: export/20210904T080009

Geliang Tang (8):
mptcp: don't send RST for single subflow
mptcp: add the fallback check
mptcp: track and update contiguous data status
mptcp: infinite mapping sending
mptcp: infinite mapping receiving
mptcp: add mib for infinite map sending
selftests: mptcp: add infinite map mibs check
selftests: mptcp: add mp_fail testcases

Quoted 11 lines
 include/net/mptcp.h                           |   3 +-
 net/mptcp/mib.c                               |   1 +
 net/mptcp/mib.h                               |   1 +
 net/mptcp/options.c                           |   2 +-
 net/mptcp/pm.c                                |   6 +
 net/mptcp/protocol.c                          |  22 ++++
 net/mptcp/protocol.h                          |  13 ++
 net/mptcp/subflow.c                           |  56 +++++----
 tools/testing/selftests/net/mptcp/config      |   5 +
 .../testing/selftests/net/mptcp/mptcp_join.sh | 111 ++++++++++++++++--
 10 files changed, 186 insertions(+), 34 deletions(-)
Quoted 2 lines

I haven't reviewed the patch yet, but I have to say: nice new email address :)

Thanks :)

-Geliang

Quoted 3 lines

/P

maintainer
#11 lore raw

Re: [PATCH mptcp-next v8 8/8] selftests: mptcp: add mp_fail testcases

In reply to Geliang Tang
Quoted 87 lines · Geliang Tang

Hi Matt,

Quoted 84 lines · Matthieu Baerts

Hi Geliang,

Thank you for the new version.

Quoted 51 lines · Geliang Tang

Added the test cases for MP_FAIL, use 'tc' command to trigger the checksum failure.

---
 tools/testing/selftests/net/mptcp/config      |  5 ++
 .../testing/selftests/net/mptcp/mptcp_join.sh | 75 +++++++++++++++++--
 2 files changed, 72 insertions(+), 8 deletions(-)
tools/testing/selftests/net/mptcp/config +5 -0
index 0faaccd21447..f522288b2204 100644
@@ -15,3 +15,8 @@ CONFIG_NETFILTER_XTABLES=m
 CONFIG_NETFILTER_XT_MATCH_BPF=m
 CONFIG_NF_TABLES_IPV4=y
 CONFIG_NF_TABLES_IPV6=y
+CONFIG_NET_ACT_CSUM=m
+CONFIG_NET_ACT_PEDIT=m
+CONFIG_NET_CLS_ACT=m
+CONFIG_NET_CLS_FLOWER=m
+CONFIG_NET_SCH_INGRESS=m
tools/testing/selftests/net/mptcp/mptcp_join.sh +12 -0
index 2684ef9c0d42..d33cb5ce0ff3 100755
@@ -178,6 +178,12 @@ if [ $? -ne 0 ];then
 	exit $ksft_skip
 fi
 
+jq -V > /dev/null 2>&1
+if [ $? -ne 0 ];then
+	echo "SKIP: Could not run all tests without jq tool"
+	exit $ksft_skip
+fi
+
 print_file_err()
 {
 	ls -l "$1" 1>&2
@@ -232,6 +238,28 @@ link_failure()
 	done
 }
 
+checksum_failure()
+{
+	i="$1"
+
+	tc -n $ns2 qdisc add dev ns2eth$i clsact
+	tc -n $ns2 filter add dev ns2eth$i egress \

tools/testing/selftests/net/mptcp/mptcp_join.sh link_failure() · line 256

Quoted 10 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +10 -0
+		protocol ip prio 1000 \
+		flower ip_proto tcp \
+		action pedit munge offset 148 u32 invert \
+		pipe csum tcp \
+		index 100
+
+	while true; do
+		local pkt=$(tc -n $ns2 -j -s action show action csum index 100 |
+				jq '.[1].actions[0].stats.packets')
+		if [ $pkt -gt 0 ]; then

The CI [1] is complaining about that line:

[09:34:44.063] # RTNETLINK answers: Operation not supported [09:34:44.107] # ./mptcp_join.sh: line 256: [: null: integer expression expected
[09:34:44.267] # RTNETLINK answers: Operation not supported [09:34:44.332] # ./mptcp_join.sh: line 256: [: null: integer expression expected
(...)

This is displayed in a loop as it is a "while true".

But just before the first one, we had this:

[09:34:43.859] # Error: Cannot find ingress queue for specified device. [09:34:43.955] # Error: Parent Qdisc doesn't exists. [09:34:43.959] # We have an error talking to the kernel

Quoted 8 lines
Quoted 2 lines

I guess the previous "tc" command failed and I also guess you don't have that on your side, right?

Yes, it works on my side.

Quoted 1 line

Maybe a missing kconfig?

I think so. How can I get the kconfig of the CI?

The need kernel config flags are correctly specified into:

tools/testing/selftests/net/mptcp/config

In this case it looks like the CI is missing/not applying:

CONFIG_NET_SCH_INGRESS=y

@Mat, does the CI take properly in account the self-tests config?

I guess:

make kselftest-merge

would fix, but could also be overkill (pulling a lot of config for other, non mptcp self-tests)

Paolo

#12 lore raw

Re: [PATCH mptcp-next v8 8/8] selftests: mptcp: add mp_fail testcases

Hi Paolo, Geliang,

Quoted 105 lines · Paolo Abeni
Quoted 87 lines · Geliang Tang

Hi Matt,

Quoted 84 lines · Matthieu Baerts

Hi Geliang,

Thank you for the new version.

Quoted 51 lines · Geliang Tang

Added the test cases for MP_FAIL, use 'tc' command to trigger the checksum failure.

---
 tools/testing/selftests/net/mptcp/config      |  5 ++
 .../testing/selftests/net/mptcp/mptcp_join.sh | 75 +++++++++++++++++--
 2 files changed, 72 insertions(+), 8 deletions(-)
tools/testing/selftests/net/mptcp/config +5 -0
index 0faaccd21447..f522288b2204 100644
@@ -15,3 +15,8 @@ CONFIG_NETFILTER_XTABLES=m
 CONFIG_NETFILTER_XT_MATCH_BPF=m
 CONFIG_NF_TABLES_IPV4=y
 CONFIG_NF_TABLES_IPV6=y
+CONFIG_NET_ACT_CSUM=m
+CONFIG_NET_ACT_PEDIT=m
+CONFIG_NET_CLS_ACT=m
+CONFIG_NET_CLS_FLOWER=m
+CONFIG_NET_SCH_INGRESS=m
tools/testing/selftests/net/mptcp/mptcp_join.sh +12 -0
index 2684ef9c0d42..d33cb5ce0ff3 100755
@@ -178,6 +178,12 @@ if [ $? -ne 0 ];then
 	exit $ksft_skip
 fi
 
+jq -V > /dev/null 2>&1
+if [ $? -ne 0 ];then
+	echo "SKIP: Could not run all tests without jq tool"
+	exit $ksft_skip
+fi
+
 print_file_err()
 {
 	ls -l "$1" 1>&2
@@ -232,6 +238,28 @@ link_failure()
 	done
 }
 
+checksum_failure()
+{
+	i="$1"
+
+	tc -n $ns2 qdisc add dev ns2eth$i clsact
+	tc -n $ns2 filter add dev ns2eth$i egress \

tools/testing/selftests/net/mptcp/mptcp_join.sh link_failure() · line 256

Quoted 10 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +10 -0
+		protocol ip prio 1000 \
+		flower ip_proto tcp \
+		action pedit munge offset 148 u32 invert \
+		pipe csum tcp \
+		index 100
+
+	while true; do
+		local pkt=$(tc -n $ns2 -j -s action show action csum index 100 |
+				jq '.[1].actions[0].stats.packets')
+		if [ $pkt -gt 0 ]; then

The CI [1] is complaining about that line:

[09:34:44.063] # RTNETLINK answers: Operation not supported [09:34:44.107] # ./mptcp_join.sh: line 256: [: null: integer expression expected
[09:34:44.267] # RTNETLINK answers: Operation not supported [09:34:44.332] # ./mptcp_join.sh: line 256: [: null: integer expression expected
(...)

This is displayed in a loop as it is a "while true".

But just before the first one, we had this:

[09:34:43.859] # Error: Cannot find ingress queue for specified device. [09:34:43.955] # Error: Parent Qdisc doesn't exists. [09:34:43.959] # We have an error talking to the kernel

Quoted 8 lines
Quoted 2 lines

I guess the previous "tc" command failed and I also guess you don't have that on your side, right?

Yes, it works on my side.

Quoted 1 line

Maybe a missing kconfig?

I think so. How can I get the kconfig of the CI?

The need kernel config flags are correctly specified into:

tools/testing/selftests/net/mptcp/config

In this case it looks like the CI is missing/not applying:

CONFIG_NET_SCH_INGRESS=y

Quoted 8 lines

@Mat, does the CI take properly in account the self-tests config?

I guess:

make kselftest-merge

would fix, but could also be overkill (pulling a lot of config for other, non mptcp self-tests)

I'm using something like:

  ./scripts/kconfig/merge_config.sh -m (...)/.config \
     tools/testing/selftests/net/mptcp/config

But I guess the issue is in the config we give:

.config:5004:warning: symbol value 'm' invalid for NET_CLS_ACT

It should then be set to =y. Sorry, I didn't see that before. I can also change that when applying the patch if no other modifications are needed. (and if I don't forget :) )

Cheers,
Matt

Signature · 2 lines
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net
#13 lore raw

Re: [PATCH mptcp-next v8 8/8] selftests: mptcp: add mp_fail testcases

In reply to Geliang Tang
Quoted 46 lines · Geliang Tang

Added the test cases for MP_FAIL, use 'tc' command to trigger the checksum failure.

---
tools/testing/selftests/net/mptcp/config | 5 ++
.../testing/selftests/net/mptcp/mptcp_join.sh | 75 +++++++++++++++++--

2 files changed, 72 insertions(+), 8 deletions(-)
tools/testing/selftests/net/mptcp/config +0 -0
index 0faaccd21447..f522288b2204 100644
@@ -15,3 +15,8 @@ CONFIG_NETFILTER_XTABLES=m

CONFIG_NETFILTER_XT_MATCH_BPF=m
CONFIG_NF_TABLES_IPV4=y
CONFIG_NF_TABLES_IPV6=y

tools/testing/selftests/net/mptcp/config +5 -0
+CONFIG_NET_ACT_CSUM=m
+CONFIG_NET_ACT_PEDIT=m
+CONFIG_NET_CLS_ACT=m
+CONFIG_NET_CLS_FLOWER=m
+CONFIG_NET_SCH_INGRESS=m
tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
index 2684ef9c0d42..d33cb5ce0ff3 100755
@@ -178,6 +178,12 @@ if [ $? -ne 0 ];then
 	exit $ksft_skip

fi

tools/testing/selftests/net/mptcp/mptcp_join.sh +6 -0
+jq -V > /dev/null 2>&1
+if [ $? -ne 0 ];then
+	echo "SKIP: Could not run all tests without jq tool"
+	exit $ksft_skip
+fi
+

print_file_err()

{
	ls -l "$1" 1>&2
tools/testing/selftests/net/mptcp/mptcp_join.sh +1 -0
@@ -232,6 +238,28 @@ link_failure()
 	done
 }
 
+checksum_failure()

tools/testing/selftests/net/mptcp/mptcp_join.sh link_failure() · line 251

Quoted 10 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +10 -0
+{
+	i="$1"
+
+	tc -n $ns2 qdisc add dev ns2eth$i clsact
+	tc -n $ns2 filter add dev ns2eth$i egress \
+		protocol ip prio 1000 \
+		flower ip_proto tcp \
+		action pedit munge offset 148 u32 invert \
+		pipe csum tcp \
+		index 100

Could you add a comment explaining what the filter is doing? While it looks like the idea is to invert the 32-bit word at byte offset 148, I'm not tc-literate enough to know if there are other effects (and I didn't watch the email threads closely on this).

Quoted 78 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +25 -7
+
+	while true; do
+		local pkt=$(tc -n $ns2 -j -s action show action csum index 100 |
+				jq '.[1].actions[0].stats.packets')
+		if [ $pkt -gt 0 ]; then
+			tc -n $ns2 qdisc del dev ns2eth$i clsact
+			break
+		fi
+	done
+}
+
 # $1: IP address
 is_v6()
 {
@@ -371,6 +399,9 @@ do_transfer()
 	if [[ "${addr_nr_ns2}" = "fullmesh_"* ]]; then
 		flags="${flags},fullmesh"
 		addr_nr_ns2=${addr_nr_ns2:9}
+	elif [[ "${addr_nr_ns2}" = "fail_"* ]]; then
+		checksum_failure ${addr_nr_ns2:5}
+		addr_nr_ns2=0
 	fi
 
 	if [ $addr_nr_ns2 -gt 0 ]; then
@@ -542,6 +573,8 @@ run_tests()
 chk_csum_nr()
 {
 	local msg=${1:-""}
+	local csum_ns1=${2:-0}
+	local csum_ns2=${3:-0}
 	local count
 	local dump_stats
 
@@ -553,8 +586,8 @@ chk_csum_nr()
 	printf " %-36s %s" "$msg" "sum"
 	count=`ip netns exec $ns1 nstat -as | grep MPTcpExtDataCsumErr | awk '{print $2}'`
 	[ -z "$count" ] && count=0
-	if [ "$count" != 0 ]; then
-		echo "[fail] got $count data checksum error[s] expected 0"
+	if [ "$count" != $csum_ns1 ]; then
+		echo "[fail] got $count data checksum error[s] expected $csum_ns1"
 		ret=1
 		dump_stats=1
 	else
@@ -563,8 +596,8 @@ chk_csum_nr()
 	echo -n " - csum  "
 	count=`ip netns exec $ns2 nstat -as | grep MPTcpExtDataCsumErr | awk '{print $2}'`
 	[ -z "$count" ] && count=0
-	if [ "$count" != 0 ]; then
-		echo "[fail] got $count data checksum error[s] expected 0"
+	if [ "$count" != $csum_ns2 ]; then
+		echo "[fail] got $count data checksum error[s] expected $csum_ns2"
 		ret=1
 		dump_stats=1
 	else
@@ -658,6 +691,8 @@ chk_join_nr()
 	local syn_nr=$2
 	local syn_ack_nr=$3
 	local ack_nr=$4
+	local fail_nr=${5:-0}
+	local infi_nr=${6:-0}
 	local count
 	local dump_stats
 
@@ -700,9 +735,9 @@ chk_join_nr()
 		ip netns exec $ns2 nstat -as | grep MPTcp
 	fi
 	if [ $checksum -eq 1 ]; then
-		chk_csum_nr
-		chk_fail_nr 0 0
-		chk_infi_nr 0 0
+		chk_csum_nr "" $fail_nr
+		chk_fail_nr $fail_nr $fail_nr
+		chk_infi_nr $infi_nr $infi_nr
 	fi
 }
 

tools/testing/selftests/net/mptcp/mptcp_join.sh fullmesh_tests() · line 1876

Quoted 5 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +2 -0
@@ -1837,6 +1872,25 @@ fullmesh_tests()
 	chk_add_nr 1 1
 }
 
+fail_tests()
+{

Since MP_FAIL is only relevent with checksums enabled, I think it would be good to set $checksum=1 here and restore its previous value before returning (in case other tests run after this).

Quoted 57 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +19 -0
+	# 1 subflow
+	reset
+	ip netns exec $ns1 ./pm_nl_ctl limits 0 2
+	ip netns exec $ns2 ./pm_nl_ctl limits 0 2
+	run_tests $ns1 $ns2 10.0.1.1 2 0 "fail_1" fast
+	chk_join_nr "MP_FAIL test, 1 subflow" 0 0 0 1 1
+
+	# multiple subflows
+	reset
+	ip netns exec $ns1 ./pm_nl_ctl limits 0 2
+	ip netns exec $ns2 ./pm_nl_ctl limits 0 2
+	ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 dev ns2eth3 flags subflow
+	ip netns exec $ns2 ./pm_nl_ctl add 10.0.2.2 dev ns2eth2 flags subflow
+	run_tests $ns1 $ns2 10.0.1.1 2 0 "fail_2" fast
+	chk_join_nr "MP_FAIL test, multiple subflows" 2 2 2 1
+}
+
 all_tests()
 {
 	subflows_tests
@@ -1853,6 +1907,7 @@ all_tests()
 	checksum_tests
 	deny_join_id0_tests
 	fullmesh_tests
+	fail_tests
 }
 
 usage()
@@ -1872,6 +1927,7 @@ usage()
 	echo "  -S checksum_tests"
 	echo "  -d deny_join_id0_tests"
 	echo "  -m fullmesh_tests"
+	echo "  -F fail_tests"
 	echo "  -c capture pcap files"
 	echo "  -C enable data checksum"
 	echo "  -h help"
@@ -1907,7 +1963,7 @@ if [ $do_all_tests -eq 1 ]; then
 	exit $ret

fi

tools/testing/selftests/net/mptcp/mptcp_join.sh +1 -1
-while getopts 'fsltra64bpkdmchCS' opt; do
+while getopts 'fsltra64bpkdmchCSF' opt; do
	case $opt in
		f)
			subflows_tests
tools/testing/selftests/net/mptcp/mptcp_join.sh +3 -0
@@ -1951,6 +2007,9 @@ while getopts 'fsltra64bpkdmchCS' opt; do
 		m)
 			fullmesh_tests
 			;;
+		F)
+			fail_tests
+			;;
 		c)
 			;;
 		C)
Signature · 1 line
2.26.2

When I run:

$ sudo ./mptcp_join.sh -FC

I get:

"""
Created /tmp/tmp.UTIlkuhfRW (size 1 KB) containing data sent by client Created /tmp/tmp.pMPhJddNfQ (size 1 KB) containing data sent by server Created /tmp/tmp.OEx5cmVqbp (size 10075 KB) containing data sent by client Created /tmp/tmp.RAtBQXOXtR (size 6144 KB) containing data sent by server [ FAIL ] file received by server does not match (in, out):
-rw-------. 1 root root 20633656 Nov 3 17:32 /tmp/tmp.HtyoJjpCOe Trailing bytes are:
MPTCP_TEST_FILE_END_MARKER
-rw-------. 1 root root 20633656 Nov 3 17:32 /tmp/tmp.j8HYN1PUVh Trailing bytes are:
MPTCP_TEST_FILE_END_MARKER
01 MP_FAIL test, 1 subflow syn[ ok ] - synack[ ok ] - ack[ ok ]

                                        sum[ ok ] - csum  [ ok ]
                                        ftx[ ok ] - frx   [ ok ]
                                        itx[ ok ] - irx   [ ok ]

[ FAIL ] file received by server does not match (in, out):
-rw-------. 1 root root 20633656 Nov 3 17:32 /tmp/tmp.HtyoJjpCOe Trailing bytes are:
MPTCP_TEST_FILE_END_MARKER
-rw-------. 1 root root 20633656 Nov 3 17:32 /tmp/tmp.j8HYN1PUVh Trailing bytes are:
MPTCP_TEST_FILE_END_MARKER
02 MP_FAIL test, multiple subflows syn[ ok ] - synack[ ok ] - ack[ ok ]

                                        sum[ ok ] - csum  [ ok ]
                                        ftx[ ok ] - frx   [ ok ]
                                        itx[ ok ] - irx   [ ok ]

"""

The chk_join_nr output shows all [ ok ], which is good. But the file mismatches (I assume due to the inverted data) are failures because the checksums are intended to reject the bad data. Am I understanding the file mismatches correctly?

If MP_FAIL is working, the files should match.

Thanks,

--
Mat Martineau
Intel

#14 lore raw

Re: [PATCH mptcp-next v8 8/8] selftests: mptcp: add mp_fail testcases

Hi Geliang,

Quoted 49 lines · Mat Martineau
Quoted 47 lines · Geliang Tang

Added the test cases for MP_FAIL, use 'tc' command to trigger the checksum failure.

---
tools/testing/selftests/net/mptcp/config      |  5 ++ .../testing/selftests/net/mptcp/mptcp_join.sh | 75 +++++++++++++++++--

2 files changed, 72 insertions(+), 8 deletions(-)
tools/testing/selftests/net/mptcp/config +0 -0
index 0faaccd21447..f522288b2204 100644
@@ -15,3 +15,8 @@ CONFIG_NETFILTER_XTABLES=m

CONFIG_NETFILTER_XT_MATCH_BPF=m
CONFIG_NF_TABLES_IPV4=y
CONFIG_NF_TABLES_IPV6=y

tools/testing/selftests/net/mptcp/config +5 -0
+CONFIG_NET_ACT_CSUM=m
+CONFIG_NET_ACT_PEDIT=m
+CONFIG_NET_CLS_ACT=m
+CONFIG_NET_CLS_FLOWER=m
+CONFIG_NET_SCH_INGRESS=m
tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
index 2684ef9c0d42..d33cb5ce0ff3 100755
@@ -178,6 +178,12 @@ if [ $? -ne 0 ];then

    exit $ksft_skip
fi

tools/testing/selftests/net/mptcp/mptcp_join.sh +6 -0
+jq -V > /dev/null 2>&1
+if [ $? -ne 0 ];then
+    echo "SKIP: Could not run all tests without jq tool"
+    exit $ksft_skip
+fi
+

print_file_err()
{
    ls -l "$1" 1>&2

tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -232,6 +238,28 @@ link_failure()

    done
}

Quoted 16 lines

tools/testing/selftests/net/mptcp/mptcp_join.sh link_failure() · line 251

Quoted 11 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +11 -0
+checksum_failure()
+{
+    i="$1"
+
+    tc -n $ns2 qdisc add dev ns2eth$i clsact
+    tc -n $ns2 filter add dev ns2eth$i egress \
+        protocol ip prio 1000 \
+        flower ip_proto tcp \
+        action pedit munge offset 148 u32 invert \
+        pipe csum tcp \
+        index 100

Could you add a comment explaining what the filter is doing? While it looks like the idea is to invert the 32-bit word at byte offset 148, I'm not tc-literate enough to know if there are other effects (and I didn't watch the email threads closely on this).

Yes that's correct. It takes only TCP packets on the egress side that are big enough but print a message in dmesg if not. After the modification, the TCP checksum is recomputed so the packet is valid.

Quoted 9 lines
Quoted 9 lines

+
+    while true; do
+        local pkt=$(tc -n $ns2 -j -s action show action csum index 100 | +                jq '.[1].actions[0].stats.packets')
+        if [ $pkt -gt 0 ]; then
+            tc -n $ns2 qdisc del dev ns2eth$i clsact
+            break
+        fi

On my side, I had to add a "sleep .1" to slow things down and have the tests a bit more stable.

I also used "flower ip_proto tcp tcp_flags 0x10/0xff" and it seems working fine.

But still and probably caused by the "sleep .1" that seems needed, I have many messages in dmesg:

tc action pedit offset 162 out of bounds

Because everything is shown on the serial, it is a bit annoying.

Do you think it would be possible to limit to TCP ACK and also make sure data are only sent in one direction or limit incoming traffic to 1 byte if it is easier? With this, we should then have a very few pure ACKs packets on the egress side and avoid most of the TC warning messages printed by the kernel, no?

Quoted 181 lines
Quoted 77 lines

+    done

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

# $1: IP address
is_v6()
{

tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -371,6 +399,9 @@ do_transfer()

    if [[ "${addr_nr_ns2}" = "fullmesh_"* ]]; then flags="${flags},fullmesh" addr_nr_ns2=${addr_nr_ns2:9}
+    elif [[ "${addr_nr_ns2}" = "fail_"* ]]; then +        checksum_failure ${addr_nr_ns2:5} +        addr_nr_ns2=0
    fi

    if [ $addr_nr_ns2 -gt 0 ]; then

tools/testing/selftests/net/mptcp/mptcp_join.sh +2 -0
@@ -542,6 +573,8 @@ run_tests()
 chk_csum_nr()
 {
     local msg=${1:-""}
+    local csum_ns1=${2:-0}
+    local csum_ns2=${3:-0}

    local count
    local dump_stats

tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -553,8 +586,8 @@ chk_csum_nr()

    printf " %-36s %s" "$msg" "sum"
    count=ip netns exec $ns1 nstat -as | grep MPTcpExtDataCsumErr | awk '{print $2}'
    [ -z "$count" ] && count=0
-    if [ "$count" != 0 ]; then
-        echo "[fail] got $count data checksum error[s] expected 0" +    if [ "$count" != $csum_ns1 ]; then
+        echo "[fail] got $count data checksum error[s] expected $csum_ns1"
        ret=1
        dump_stats=1
    else

tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -563,8 +596,8 @@ chk_csum_nr()

    echo -n " - csum  "
    count=ip netns exec $ns2 nstat -as | grep MPTcpExtDataCsumErr | awk '{print $2}'
    [ -z "$count" ] && count=0
-    if [ "$count" != 0 ]; then
-        echo "[fail] got $count data checksum error[s] expected 0" +    if [ "$count" != $csum_ns2 ]; then
+        echo "[fail] got $count data checksum error[s] expected $csum_ns2"
        ret=1
        dump_stats=1
    else

tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -658,6 +691,8 @@ chk_join_nr()

    local syn_nr=$2
    local syn_ack_nr=$3
    local ack_nr=$4
+    local fail_nr=${5:-0}
+    local infi_nr=${6:-0}
    local count
    local dump_stats

tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -700,9 +735,9 @@ chk_join_nr()

        ip netns exec $ns2 nstat -as | grep MPTcp
    fi
    if [ $checksum -eq 1 ]; then
-        chk_csum_nr
-        chk_fail_nr 0 0
-        chk_infi_nr 0 0
+        chk_csum_nr "" $fail_nr
+        chk_fail_nr $fail_nr $fail_nr
+        chk_infi_nr $infi_nr $infi_nr
    fi
}

tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -1837,6 +1872,25 @@ fullmesh_tests()

    chk_add_nr 1 1
}

tools/testing/selftests/net/mptcp/mptcp_join.sh fullmesh_tests() · line 1876

Quoted 2 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +2 -0
+fail_tests()
+{

Since MP_FAIL is only relevent with checksums enabled, I think it would be good to set $checksum=1 here and restore its previous value before returning (in case other tests run after this).

Quoted 51 lines

+    # 1 subflow
+    reset
+    ip netns exec $ns1 ./pm_nl_ctl limits 0 2
+    ip netns exec $ns2 ./pm_nl_ctl limits 0 2
+    run_tests $ns1 $ns2 10.0.1.1 2 0 "fail_1" fast
+    chk_join_nr "MP_FAIL test, 1 subflow" 0 0 0 1 1
+
+    # multiple subflows
+    reset
+    ip netns exec $ns1 ./pm_nl_ctl limits 0 2
+    ip netns exec $ns2 ./pm_nl_ctl limits 0 2
+    ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 dev ns2eth3 flags subflow
+    ip netns exec $ns2 ./pm_nl_ctl add 10.0.2.2 dev ns2eth2 flags subflow
+    run_tests $ns1 $ns2 10.0.1.1 2 0 "fail_2" fast
+    chk_join_nr "MP_FAIL test, multiple subflows" 2 2 2 1

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

all_tests()
{
    subflows_tests

tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -1853,6 +1907,7 @@ all_tests()

    checksum_tests
    deny_join_id0_tests
    fullmesh_tests
+    fail_tests
}

usage()

tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -1872,6 +1927,7 @@ usage()

    echo "  -S checksum_tests"
    echo "  -d deny_join_id0_tests"
    echo "  -m fullmesh_tests"
+    echo "  -F fail_tests"
    echo "  -c capture pcap files"
    echo "  -C enable data checksum"
    echo "  -h help"

tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -1907,7 +1963,7 @@ if [ $do_all_tests -eq 1 ]; then

    exit $ret
fi

tools/testing/selftests/net/mptcp/mptcp_join.sh +1 -1
-while getopts 'fsltra64bpkdmchCS' opt; do
+while getopts 'fsltra64bpkdmchCSF' opt; do

    case $opt in
        f)
            subflows_tests

tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -1951,6 +2007,9 @@ while getopts 'fsltra64bpkdmchCS' opt; do
         m)

            fullmesh_tests
            ;;

Quoted 8 lines

+        F)
+            fail_tests
+            ;;
        c)
            ;;
        C)
--
2.26.2

When I run:

$ sudo ./mptcp_join.sh -FC

I get:

"""
Created /tmp/tmp.UTIlkuhfRW (size 1 KB) containing data sent by client Created /tmp/tmp.pMPhJddNfQ (size 1 KB) containing data sent by server Created /tmp/tmp.OEx5cmVqbp (size 10075 KB) containing data sent by client Created /tmp/tmp.RAtBQXOXtR (size 6144 KB) containing data sent by server [ FAIL ] file received by server does not match (in, out):
-rw-------. 1 root root 20633656 Nov  3 17:32 /tmp/tmp.HtyoJjpCOe Trailing bytes are:
MPTCP_TEST_FILE_END_MARKER
-rw-------. 1 root root 20633656 Nov  3 17:32 /tmp/tmp.j8HYN1PUVh Trailing bytes are:
MPTCP_TEST_FILE_END_MARKER
01 MP_FAIL test, 1 subflow              syn[ ok ] - synack[ ok ] - ack[ ok ]
                                        sum[ ok ] - csum  [ ok ] ftx[ ok ] - frx   [ ok ] itx[ ok ] - irx   [ ok ] [ FAIL ] file received by server does not match (in, out):
-rw-------. 1 root root 20633656 Nov  3 17:32 /tmp/tmp.HtyoJjpCOe Trailing bytes are:
MPTCP_TEST_FILE_END_MARKER
-rw-------. 1 root root 20633656 Nov  3 17:32 /tmp/tmp.j8HYN1PUVh Trailing bytes are:
MPTCP_TEST_FILE_END_MARKER
02 MP_FAIL test, multiple subflows      syn[ ok ] - synack[ ok ] - ack[ ok ]
                                        sum[ ok ] - csum  [ ok ] ftx[ ok ] - frx   [ ok ] itx[ ok ] - irx   [ ok ] """

Quoted 6 lines

The chk_join_nr output shows all [ ok ], which is good. But the file mismatches (I assume due to the inverted data) are failures because the checksums are intended to reject the bad data. Am I understanding the file mismatches correctly?

If MP_FAIL is working, the files should match.

I also have the same error on my side but not all the time.

Cheers,
Matt

Signature · 2 lines
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net
#15 lore raw

Re: [PATCH mptcp-next v8 8/8] selftests: mptcp: add mp_fail testcases

Hi Matt, Davide,

Quoted 68 lines · Matthieu Baerts

Hi Geliang,

Quoted 65 lines · Mat Martineau
Quoted 48 lines · Geliang Tang

Added the test cases for MP_FAIL, use 'tc' command to trigger the checksum failure.

---
tools/testing/selftests/net/mptcp/config      |  5 ++ .../testing/selftests/net/mptcp/mptcp_join.sh | 75 +++++++++++++++++--

2 files changed, 72 insertions(+), 8 deletions(-)
tools/testing/selftests/net/mptcp/config +0 -0
index 0faaccd21447..f522288b2204 100644
@@ -15,3 +15,8 @@ CONFIG_NETFILTER_XTABLES=m

CONFIG_NETFILTER_XT_MATCH_BPF=m
CONFIG_NF_TABLES_IPV4=y
CONFIG_NF_TABLES_IPV6=y

tools/testing/selftests/net/mptcp/config +5 -0
+CONFIG_NET_ACT_CSUM=m
+CONFIG_NET_ACT_PEDIT=m
+CONFIG_NET_CLS_ACT=m
+CONFIG_NET_CLS_FLOWER=m
+CONFIG_NET_SCH_INGRESS=m
tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
index 2684ef9c0d42..d33cb5ce0ff3 100755
@@ -178,6 +178,12 @@ if [ $? -ne 0 ];then

    exit $ksft_skip
fi

tools/testing/selftests/net/mptcp/mptcp_join.sh +6 -0
+jq -V > /dev/null 2>&1
+if [ $? -ne 0 ];then
+    echo "SKIP: Could not run all tests without jq tool"
+    exit $ksft_skip
+fi
+

print_file_err()
{
    ls -l "$1" 1>&2

tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -232,6 +238,28 @@ link_failure()

    done
}

tools/testing/selftests/net/mptcp/mptcp_join.sh +1 -0
+checksum_failure()

tools/testing/selftests/net/mptcp/mptcp_join.sh link_failure() · line 251

Quoted 10 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +10 -0
+{
+    i="$1"
+
+    tc -n $ns2 qdisc add dev ns2eth$i clsact
+    tc -n $ns2 filter add dev ns2eth$i egress \
+        protocol ip prio 1000 \
+        flower ip_proto tcp \
+        action pedit munge offset 148 u32 invert \
+        pipe csum tcp \
+        index 100

Could you add a comment explaining what the filter is doing? While it looks like the idea is to invert the 32-bit word at byte offset 148, I'm not tc-literate enough to know if there are other effects (and I didn't watch the email threads closely on this).

Matt, could you please add this comment for me? I didn't understand these tc commands very well, and I can't explain them very clearly in English.

Quoted 10 lines

Yes that's correct. It takes only TCP packets on the egress side that are big enough but print a message in dmesg if not. After the modification, the TCP checksum is recomputed so the packet is valid.

Quoted 5 lines
Quoted 5 lines

+
+    while true; do
+        local pkt=$(tc -n $ns2 -j -s action show action csum index 100 | +                jq '.[1].actions[0].stats.packets')

Should we show the action 'pedit' here, instead of 'csum'?

The action 'csum' output is like this:

# tc -n $ns2 -j -s action show action csum index 100

[{"total acts":1},{"actions":[{"order":0,"kind":"csum","csum":"tcp","control_action":{"type":"pass"},"index":100,"ref":1,"bind":1,"installed":29,"last_used":2,"stats":{"bytes":11576,"packets":42,"drops":0,"overlimits":0,"requeues":0,"backlog":0,"qlen":0}}]}]

"overlimits" is always 0 in 'csum'.

But the action 'pedit' output is like this:

# tc -n $ns2 -j -s action show action pedit index 100

[{"total acts":1},{"actions":[{"order":0 pedit ,"control_action":{"type":"pipe"}keys 1
index 1 ref 1 bind 1,"installed":29,"last_used":2
key #0 at 148: val ffffffff mask ffffffff
,"stats":{"bytes":11576,"packets":42,"drops":0,"overlimits":36,"requeues":0,"backlog":0,"qlen":0}}]}]

"overlimits" values are all right here, but this output can't be parsed by 'jq'. It looks like something wrong to show 'pedit'.

Is this a bug in act_pedit, or we use pedit incorrectly? How can I fix this?

Quoted 10 lines
Quoted 4 lines
Quoted 4 lines

+        if [ $pkt -gt 0 ]; then
+            tc -n $ns2 qdisc del dev ns2eth$i clsact +            break
+        fi

On my side, I had to add a "sleep .1" to slow things down and have the tests a bit more stable.

I also used "flower ip_proto tcp tcp_flags 0x10/0xff" and it seems working fine.

Could you please share your checksum_failure function here, I'll test it on my side?

Quoted 6 lines

But still and probably caused by the "sleep .1" that seems needed, I have many messages in dmesg:

tc action pedit offset 162 out of bounds

Quoted 97 lines

Because everything is shown on the serial, it is a bit annoying.

Do you think it would be possible to limit to TCP ACK and also make sure data are only sent in one direction or limit incoming traffic to 1 byte if it is easier? With this, we should then have a very few pure ACKs packets on the egress side and avoid most of the TC warning messages printed by the kernel, no?

Quoted 89 lines
Quoted 77 lines

+    done

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

# $1: IP address
is_v6()
{

tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -371,6 +399,9 @@ do_transfer()

    if [[ "${addr_nr_ns2}" = "fullmesh_"* ]]; then flags="${flags},fullmesh" addr_nr_ns2=${addr_nr_ns2:9}
+    elif [[ "${addr_nr_ns2}" = "fail_"* ]]; then +        checksum_failure ${addr_nr_ns2:5} +        addr_nr_ns2=0
    fi

    if [ $addr_nr_ns2 -gt 0 ]; then

tools/testing/selftests/net/mptcp/mptcp_join.sh +2 -0
@@ -542,6 +573,8 @@ run_tests()
 chk_csum_nr()
 {
     local msg=${1:-""}
+    local csum_ns1=${2:-0}
+    local csum_ns2=${3:-0}

    local count
    local dump_stats

tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -553,8 +586,8 @@ chk_csum_nr()

    printf " %-36s %s" "$msg" "sum"
    count=ip netns exec $ns1 nstat -as | grep MPTcpExtDataCsumErr | awk '{print $2}'
    [ -z "$count" ] && count=0
-    if [ "$count" != 0 ]; then
-        echo "[fail] got $count data checksum error[s] expected 0" +    if [ "$count" != $csum_ns1 ]; then
+        echo "[fail] got $count data checksum error[s] expected $csum_ns1"
        ret=1
        dump_stats=1
    else

tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -563,8 +596,8 @@ chk_csum_nr()

    echo -n " - csum  "
    count=ip netns exec $ns2 nstat -as | grep MPTcpExtDataCsumErr | awk '{print $2}'
    [ -z "$count" ] && count=0
-    if [ "$count" != 0 ]; then
-        echo "[fail] got $count data checksum error[s] expected 0" +    if [ "$count" != $csum_ns2 ]; then
+        echo "[fail] got $count data checksum error[s] expected $csum_ns2"
        ret=1
        dump_stats=1
    else

tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -658,6 +691,8 @@ chk_join_nr()

    local syn_nr=$2
    local syn_ack_nr=$3
    local ack_nr=$4
+    local fail_nr=${5:-0}
+    local infi_nr=${6:-0}
    local count
    local dump_stats

tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -700,9 +735,9 @@ chk_join_nr()

        ip netns exec $ns2 nstat -as | grep MPTcp
    fi
    if [ $checksum -eq 1 ]; then
-        chk_csum_nr
-        chk_fail_nr 0 0
-        chk_infi_nr 0 0
+        chk_csum_nr "" $fail_nr
+        chk_fail_nr $fail_nr $fail_nr
+        chk_infi_nr $infi_nr $infi_nr
    fi
}

tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -1837,6 +1872,25 @@ fullmesh_tests()

    chk_add_nr 1 1
}

tools/testing/selftests/net/mptcp/mptcp_join.sh fullmesh_tests() · line 1876

Quoted 2 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +2 -0
+fail_tests()
+{

Since MP_FAIL is only relevent with checksums enabled, I think it would be good to set $checksum=1 here and restore its previous value before returning (in case other tests run after this).

Quoted 5 lines

+    # 1 subflow
+    reset
+    ip netns exec $ns1 ./pm_nl_ctl limits 0 2 +    ip netns exec $ns2 ./pm_nl_ctl limits 0 2 +    run_tests $ns1 $ns2 10.0.1.1 2 0 "fail_1" fast

Here I passed 2 as the 4th argument of run_tests like the link_failure tests to create the bigger data files. I don't know why it dosen't work when passing 0 as the argument?

Quoted 92 lines
Quoted 92 lines
Quoted 46 lines

+    chk_join_nr "MP_FAIL test, 1 subflow" 0 0 0 1 1
+
+    # multiple subflows
+    reset
+    ip netns exec $ns1 ./pm_nl_ctl limits 0 2
+    ip netns exec $ns2 ./pm_nl_ctl limits 0 2
+    ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 dev ns2eth3 flags subflow
+    ip netns exec $ns2 ./pm_nl_ctl add 10.0.2.2 dev ns2eth2 flags subflow
+    run_tests $ns1 $ns2 10.0.1.1 2 0 "fail_2" fast
+    chk_join_nr "MP_FAIL test, multiple subflows" 2 2 2 1

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

all_tests()
{
    subflows_tests

tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -1853,6 +1907,7 @@ all_tests()

    checksum_tests
    deny_join_id0_tests
    fullmesh_tests
+    fail_tests
}

usage()

tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -1872,6 +1927,7 @@ usage()

    echo "  -S checksum_tests"
    echo "  -d deny_join_id0_tests"
    echo "  -m fullmesh_tests"
+    echo "  -F fail_tests"
    echo "  -c capture pcap files"
    echo "  -C enable data checksum"
    echo "  -h help"

tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -1907,7 +1963,7 @@ if [ $do_all_tests -eq 1 ]; then

    exit $ret
fi

tools/testing/selftests/net/mptcp/mptcp_join.sh +1 -1
-while getopts 'fsltra64bpkdmchCS' opt; do
+while getopts 'fsltra64bpkdmchCSF' opt; do

    case $opt in
        f)
            subflows_tests

tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -1951,6 +2007,9 @@ while getopts 'fsltra64bpkdmchCS' opt; do
         m)

            fullmesh_tests
            ;;

Quoted 8 lines

+        F)
+            fail_tests
+            ;;
        c)
            ;;
        C)
--
2.26.2

When I run:

$ sudo ./mptcp_join.sh -FC

I get:

"""
Created /tmp/tmp.UTIlkuhfRW (size 1 KB) containing data sent by client Created /tmp/tmp.pMPhJddNfQ (size 1 KB) containing data sent by server Created /tmp/tmp.OEx5cmVqbp (size 10075 KB) containing data sent by client Created /tmp/tmp.RAtBQXOXtR (size 6144 KB) containing data sent by server [ FAIL ] file received by server does not match (in, out):
-rw-------. 1 root root 20633656 Nov  3 17:32 /tmp/tmp.HtyoJjpCOe Trailing bytes are:
MPTCP_TEST_FILE_END_MARKER
-rw-------. 1 root root 20633656 Nov  3 17:32 /tmp/tmp.j8HYN1PUVh Trailing bytes are:
MPTCP_TEST_FILE_END_MARKER
01 MP_FAIL test, 1 subflow              syn[ ok ] - synack[ ok ] - ack[ ok ]
                                        sum[ ok ] - csum  [ ok ] ftx[ ok ] - frx   [ ok ] itx[ ok ] - irx   [ ok ] [ FAIL ] file received by server does not match (in, out):
-rw-------. 1 root root 20633656 Nov  3 17:32 /tmp/tmp.HtyoJjpCOe Trailing bytes are:
MPTCP_TEST_FILE_END_MARKER
-rw-------. 1 root root 20633656 Nov  3 17:32 /tmp/tmp.j8HYN1PUVh Trailing bytes are:
MPTCP_TEST_FILE_END_MARKER
02 MP_FAIL test, multiple subflows      syn[ ok ] - synack[ ok ] - ack[ ok ]
                                        sum[ ok ] - csum  [ ok ] ftx[ ok ] - frx   [ ok ] itx[ ok ] - irx   [ ok ] """

Quoted 8 lines
Quoted 6 lines

The chk_join_nr output shows all [ ok ], which is good. But the file mismatches (I assume due to the inverted data) are failures because the checksums are intended to reject the bad data. Am I understanding the file mismatches correctly?

If MP_FAIL is working, the files should match.

I also have the same error on my side but not all the time.

I got these file mismatches errors all the time. Could you please share your test script and the logs when you get the right output?

The first test "01 MP_FAIL test, 1 subflow" will get the file mismatches all the time, since the checksum error data can't be retransmitted in the current codes.

But the second test "02 MP_FAIL test, multiple subflows" shouldn't get the file mismatches. RST is sent on the checksum error subflow, so this subflow is closed. The data will be retransmitted on the other subflow. It works by using the old test case "[PATCH mptcp-next v7 8/8]
DO-NOT-MERGE: mptcp: mp_fail test". Data will be retransmitted, and no the file mismatches. I don't know why it dosen't work by this new test case. In this test case, I saw the error data has been dropped, and the new data has been retransmitted in the log. I'll try to fix this.

Thanks,
-Geliang

Quoted 7 lines

Cheers,
Matt

Signature · 2 lines
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net
#16 lore raw

Re: [PATCH mptcp-next v8 8/8] selftests: mptcp: add mp_fail testcases

Hi Geliang,

Quoted 72 lines · Geliang Tang

Hi Matt, Davide,

Quoted 68 lines · Matthieu Baerts

Hi Geliang,

Quoted 65 lines · Mat Martineau
Quoted 48 lines · Geliang Tang

Added the test cases for MP_FAIL, use 'tc' command to trigger the checksum failure.

---
tools/testing/selftests/net/mptcp/config      |  5 ++ .../testing/selftests/net/mptcp/mptcp_join.sh | 75 +++++++++++++++++--

2 files changed, 72 insertions(+), 8 deletions(-)
tools/testing/selftests/net/mptcp/config +0 -0
index 0faaccd21447..f522288b2204 100644
@@ -15,3 +15,8 @@ CONFIG_NETFILTER_XTABLES=m

CONFIG_NETFILTER_XT_MATCH_BPF=m
CONFIG_NF_TABLES_IPV4=y
CONFIG_NF_TABLES_IPV6=y

tools/testing/selftests/net/mptcp/config +5 -0
+CONFIG_NET_ACT_CSUM=m
+CONFIG_NET_ACT_PEDIT=m
+CONFIG_NET_CLS_ACT=m
+CONFIG_NET_CLS_FLOWER=m
+CONFIG_NET_SCH_INGRESS=m
tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
index 2684ef9c0d42..d33cb5ce0ff3 100755
@@ -178,6 +178,12 @@ if [ $? -ne 0 ];then

    exit $ksft_skip
fi

tools/testing/selftests/net/mptcp/mptcp_join.sh +6 -0
+jq -V > /dev/null 2>&1
+if [ $? -ne 0 ];then
+    echo "SKIP: Could not run all tests without jq tool"
+    exit $ksft_skip
+fi
+

print_file_err()
{
    ls -l "$1" 1>&2

tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -232,6 +238,28 @@ link_failure()

    done
}

tools/testing/selftests/net/mptcp/mptcp_join.sh +1 -0
+checksum_failure()

tools/testing/selftests/net/mptcp/mptcp_join.sh

Quoted 10 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +10 -0
+{
+    i="$1"
+
+    tc -n $ns2 qdisc add dev ns2eth$i clsact
+    tc -n $ns2 filter add dev ns2eth$i egress \
+        protocol ip prio 1000 \
+        flower ip_proto tcp \
+        action pedit munge offset 148 u32 invert \
+        pipe csum tcp \
+        index 100

Could you add a comment explaining what the filter is doing? While it looks like the idea is to invert the 32-bit word at byte offset 148, I'm not tc-literate enough to know if there are other effects (and I didn't watch the email threads closely on this).

Quoted 3 lines

Matt, could you please add this comment for me? I didn't understand these tc commands very well, and I can't explain them very clearly in English.

Sure. Here is my proposition:

# Modify TCP payload without corrupting the TCP packet
#
# This rule inverts a 32-bit word at byte offset 148 for all TCP ACK # packets carrying enough data.
# Once it is done, the TCP Checksum field is updated so the packet # is still considered as valid at the TCP level.
# But because the MPTCP checksum, covering the TCP options and data, # has not been updated, we will detect the modification and emit an # MP_FAIL: what we want to validate here.
#
# Please note that this rule will produce this pr_info() message for # each TCP ACK packets not carrying enough data:
#
# tc action pedit offset 162 out of bounds
#
# But this should be limited to a very few numbers of packets as we # restrict this rule to outgoing TCP traffic with only the ACK flag # + except the 3rd ACK, only packets carrying data should be seen in # this direction.

This comment makes sense if you use "flower ip_proto tcp tcp_flags 0x10/0xff" and reduce incoming traffic. Otherwise, we need to remove "ACK" and/or the last sentence but I don't think we should make this test printing a lot of pr_info().

Quoted 14 lines
Quoted 11 lines

Yes that's correct. It takes only TCP packets on the egress side that are big enough but print a message in dmesg if not. After the modification, the TCP checksum is recomputed so the packet is valid.

Quoted 5 lines
Quoted 5 lines

+
+    while true; do
+        local pkt=$(tc -n $ns2 -j -s action show action csum index 100 | +                jq '.[1].actions[0].stats.packets')

Should we show the action 'pedit' here, instead of 'csum'?

Quoted 7 lines

The action 'csum' output is like this:

# tc -n $ns2 -j -s action show action csum index 100

[{"total acts":1},{"actions":[{"order":0,"kind":"csum","csum":"tcp","control_action":{"type":"pass"},"index":100,"ref":1,"bind":1,"installed":29,"last_used":2,"stats":{"bytes":11576,"packets":42,"drops":0,"overlimits":0,"requeues":0,"backlog":0,"qlen":0}}]}]

"overlimits" is always 0 in 'csum'.

Good point. I thought 'pedit' would not let the packet passing to csum if it was over the limits but I guess it does if we see the same values for packets/bytes counters in 'csum' and 'pedit' actions.

Quoted 8 lines

But the action 'pedit' output is like this:

# tc -n $ns2 -j -s action show action pedit index 100

[{"total acts":1},{"actions":[{"order":0 pedit ,"control_action":{"type":"pipe"}keys 1
index 1 ref 1 bind 1,"installed":29,"last_used":2
key #0 at 148: val ffffffff mask ffffffff
,"stats":{"bytes":11576,"packets":42,"drops":0,"overlimits":36,"requeues":0,"backlog":0,"qlen":0}}]}]

(When you will get the right output, may you add this in a comment in the script as an example to explain what you have and what you try to parse please?)

Quoted 2 lines

"overlimits" values are all right here

From what I see in the code, if the packet was not carrying enough data 'act_pedit' will increase the 'overlimits' counter and the other ones -- bytes and packets I guess -- as well:

https://elixir.bootlin.com/linux/latest/source/net/sched/act_pedit.c#L368

So good point, we should look at 'pedit' counters and more precisely at:

"packets" - "overlimits" > 0

here.

Quoted 3 lines

but this output can't be parsed by
'jq'. It looks like something wrong to show 'pedit'.

Quoted 1 line

Is this a bug in act_pedit, or we use pedit incorrectly? How can I fix

this?

Do you mean you have this error?

parse error: Invalid numeric literal at line 1, column 47

To me, it looks like a bug on printing data, so on 'tc' side. Which version of 'tc' are you using? May you try to upgrade to a more recent one? e.g. IPRoute2 5.15.0? Maybe it has already been fixed.

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines

+        if [ $pkt -gt 0 ]; then
+            tc -n $ns2 qdisc del dev ns2eth$i clsact +            break
+        fi

Quoted 8 lines
Quoted 5 lines

On my side, I had to add a "sleep .1" to slow things down and have the tests a bit more stable.

I also used "flower ip_proto tcp tcp_flags 0x10/0xff" and it seems working fine.

Could you please share your checksum_failure function here, I'll test it on my side?

I did that to have the test finishing on my side:

--------------- 8< ---------------

(quoted diff) +0 -0

b/tools/testing/selftests/net/mptcp/config
index f522288b2204..2aff41754c8f 100644

tools/testing/selftests/net/mptcp/config +1 -1
@@ -17,6 +17,6 @@ CONFIG_NF_TABLES_IPV4=y
 CONFIG_NF_TABLES_IPV6=y
 CONFIG_NET_ACT_CSUM=m
 CONFIG_NET_ACT_PEDIT=m
-CONFIG_NET_CLS_ACT=m
+CONFIG_NET_CLS_ACT=y
 CONFIG_NET_CLS_FLOWER=m
 CONFIG_NET_SCH_INGRESS=m
(quoted diff) +0 -0

b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index d33cb5ce0ff3..8dcd445b1532 100755

tools/testing/selftests/net/mptcp/mptcp_join.sh +2 -1
@@ -245,7 +245,7 @@ checksum_failure()
        tc -n $ns2 qdisc add dev ns2eth$i clsact
        tc -n $ns2 filter add dev ns2eth$i egress \
                protocol ip prio 1000 \
-               flower ip_proto tcp \
+               flower ip_proto tcp tcp_flags 0x10/0xff \
                action pedit munge offset 148 u32 invert \
                pipe csum tcp \
                index 100
@@ -257,6 +257,7 @@ checksum_failure()
                        tc -n $ns2 qdisc del dev ns2eth$i clsact
                        break
                fi
+               sleep .1
        done
 }
 

--------------- 8< ---------------

Quoted 105 lines
Quoted 7 lines

But still and probably caused by the "sleep .1" that seems needed, I have many messages in dmesg:

tc action pedit offset 162 out of bounds

Quoted 97 lines

Because everything is shown on the serial, it is a bit annoying.

Do you think it would be possible to limit to TCP ACK and also make sure data are only sent in one direction or limit incoming traffic to 1 byte if it is easier? With this, we should then have a very few pure ACKs packets on the egress side and avoid most of the TC warning messages printed by the kernel, no?

Quoted 89 lines
Quoted 77 lines

+    done

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

# $1: IP address
is_v6()
{

tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -371,6 +399,9 @@ do_transfer()

    if [[ "${addr_nr_ns2}" = "fullmesh_"* ]]; then flags="${flags},fullmesh" addr_nr_ns2=${addr_nr_ns2:9}
+    elif [[ "${addr_nr_ns2}" = "fail_"* ]]; then +        checksum_failure ${addr_nr_ns2:5} +        addr_nr_ns2=0
    fi

    if [ $addr_nr_ns2 -gt 0 ]; then

tools/testing/selftests/net/mptcp/mptcp_join.sh +2 -0
@@ -542,6 +573,8 @@ run_tests()
 chk_csum_nr()
 {
     local msg=${1:-""}
+    local csum_ns1=${2:-0}
+    local csum_ns2=${3:-0}

    local count
    local dump_stats

tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -553,8 +586,8 @@ chk_csum_nr()

    printf " %-36s %s" "$msg" "sum"
    count=ip netns exec $ns1 nstat -as | grep MPTcpExtDataCsumErr | awk '{print $2}'
    [ -z "$count" ] && count=0
-    if [ "$count" != 0 ]; then
-        echo "[fail] got $count data checksum error[s] expected 0" +    if [ "$count" != $csum_ns1 ]; then
+        echo "[fail] got $count data checksum error[s] expected $csum_ns1"
        ret=1
        dump_stats=1
    else

tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -563,8 +596,8 @@ chk_csum_nr()

    echo -n " - csum  "
    count=ip netns exec $ns2 nstat -as | grep MPTcpExtDataCsumErr | awk '{print $2}'
    [ -z "$count" ] && count=0
-    if [ "$count" != 0 ]; then
-        echo "[fail] got $count data checksum error[s] expected 0" +    if [ "$count" != $csum_ns2 ]; then
+        echo "[fail] got $count data checksum error[s] expected $csum_ns2"
        ret=1
        dump_stats=1
    else

tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -658,6 +691,8 @@ chk_join_nr()

    local syn_nr=$2
    local syn_ack_nr=$3
    local ack_nr=$4
+    local fail_nr=${5:-0}
+    local infi_nr=${6:-0}
    local count
    local dump_stats

tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -700,9 +735,9 @@ chk_join_nr()

        ip netns exec $ns2 nstat -as | grep MPTcp
    fi
    if [ $checksum -eq 1 ]; then
-        chk_csum_nr
-        chk_fail_nr 0 0
-        chk_infi_nr 0 0
+        chk_csum_nr "" $fail_nr
+        chk_fail_nr $fail_nr $fail_nr
+        chk_infi_nr $infi_nr $infi_nr
    fi
}

tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -1837,6 +1872,25 @@ fullmesh_tests()

    chk_add_nr 1 1
}

tools/testing/selftests/net/mptcp/mptcp_join.sh

Quoted 2 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +2 -0
+fail_tests()
+{

Since MP_FAIL is only relevent with checksums enabled, I think it would be good to set $checksum=1 here and restore its previous value before returning (in case other tests run after this).

Quoted 5 lines

+    # 1 subflow
+    reset
+    ip netns exec $ns1 ./pm_nl_ctl limits 0 2 +    ip netns exec $ns2 ./pm_nl_ctl limits 0 2 +    run_tests $ns1 $ns2 10.0.1.1 2 0 "fail_1" fast

Quoted 3 lines

Here I passed 2 as the 4th argument of run_tests like the link_failure tests to create the bigger data files. I don't know why it dosen't work when passing 0 as the argument?

Should we first insert the TC rule, then start the test, then look at counters?
It would be "safer" because we would not need need to make sure we have enough data to transfer. WDYT?

Quoted 97 lines
Quoted 97 lines
Quoted 97 lines
Quoted 46 lines

+    chk_join_nr "MP_FAIL test, 1 subflow" 0 0 0 1 1
+
+    # multiple subflows
+    reset
+    ip netns exec $ns1 ./pm_nl_ctl limits 0 2
+    ip netns exec $ns2 ./pm_nl_ctl limits 0 2
+    ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 dev ns2eth3 flags subflow
+    ip netns exec $ns2 ./pm_nl_ctl add 10.0.2.2 dev ns2eth2 flags subflow
+    run_tests $ns1 $ns2 10.0.1.1 2 0 "fail_2" fast
+    chk_join_nr "MP_FAIL test, multiple subflows" 2 2 2 1

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

all_tests()
{
    subflows_tests

tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -1853,6 +1907,7 @@ all_tests()

    checksum_tests
    deny_join_id0_tests
    fullmesh_tests
+    fail_tests
}

usage()

tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -1872,6 +1927,7 @@ usage()

    echo "  -S checksum_tests"
    echo "  -d deny_join_id0_tests"
    echo "  -m fullmesh_tests"
+    echo "  -F fail_tests"
    echo "  -c capture pcap files"
    echo "  -C enable data checksum"
    echo "  -h help"

tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -1907,7 +1963,7 @@ if [ $do_all_tests -eq 1 ]; then

    exit $ret
fi

tools/testing/selftests/net/mptcp/mptcp_join.sh +1 -1
-while getopts 'fsltra64bpkdmchCS' opt; do
+while getopts 'fsltra64bpkdmchCSF' opt; do

    case $opt in
        f)
            subflows_tests

tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -1951,6 +2007,9 @@ while getopts 'fsltra64bpkdmchCS' opt; do
         m)

            fullmesh_tests
            ;;

Quoted 8 lines

+        F)
+            fail_tests
+            ;;
        c)
            ;;
        C)
--
2.26.2

When I run:

$ sudo ./mptcp_join.sh -FC

I get:

"""
Created /tmp/tmp.UTIlkuhfRW (size 1 KB) containing data sent by client Created /tmp/tmp.pMPhJddNfQ (size 1 KB) containing data sent by server Created /tmp/tmp.OEx5cmVqbp (size 10075 KB) containing data sent by client Created /tmp/tmp.RAtBQXOXtR (size 6144 KB) containing data sent by server [ FAIL ] file received by server does not match (in, out):
-rw-------. 1 root root 20633656 Nov  3 17:32 /tmp/tmp.HtyoJjpCOe Trailing bytes are:
MPTCP_TEST_FILE_END_MARKER
-rw-------. 1 root root 20633656 Nov  3 17:32 /tmp/tmp.j8HYN1PUVh Trailing bytes are:
MPTCP_TEST_FILE_END_MARKER
01 MP_FAIL test, 1 subflow              syn[ ok ] - synack[ ok ] - ack[ ok ]
                                        sum[ ok ] - csum  [ ok ] ftx[ ok ] - frx   [ ok ] itx[ ok ] - irx   [ ok ] [ FAIL ] file received by server does not match (in, out):
-rw-------. 1 root root 20633656 Nov  3 17:32 /tmp/tmp.HtyoJjpCOe Trailing bytes are:
MPTCP_TEST_FILE_END_MARKER
-rw-------. 1 root root 20633656 Nov  3 17:32 /tmp/tmp.j8HYN1PUVh Trailing bytes are:
MPTCP_TEST_FILE_END_MARKER
02 MP_FAIL test, multiple subflows      syn[ ok ] - synack[ ok ] - ack[ ok ]
                                        sum[ ok ] - csum  [ ok ] ftx[ ok ] - frx   [ ok ] itx[ ok ] - irx   [ ok ] """

The chk_join_nr output shows all [ ok ], which is good. But the file mismatches (I assume due to the inverted data) are failures because the checksums are intended to reject the bad data. Am I understanding the file mismatches correctly?

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

If MP_FAIL is working, the files should match.

I also have the same error on my side but not all the time.

I got these file mismatches errors all the time. Could you please share your test script and the logs when you get the right output?

I don't think I saw them for both tests all the time but it is possible it was always there for the 1st one and not for the second one. I will look at that next time.

Quoted 3 lines

The first test "01 MP_FAIL test, 1 subflow" will get the file mismatches all the time, since the checksum error data can't be retransmitted in the current codes.

Should we disable this test then?

Quoted 8 lines

But the second test "02 MP_FAIL test, multiple subflows" shouldn't get the file mismatches. RST is sent on the checksum error subflow, so this subflow is closed. The data will be retransmitted on the other subflow. It works by using the old test case "[PATCH mptcp-next v7 8/8]
DO-NOT-MERGE: mptcp: mp_fail test". Data will be retransmitted, and no the file mismatches. I don't know why it dosen't work by this new test case. In this test case, I saw the error data has been dropped, and the new data has been retransmitted in the log. I'll try to fix this.

Thanks!

Cheers,
Matt

Signature · 2 lines
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net
#17 lore raw

Re: [PATCH mptcp-next v8 8/8] selftests: mptcp: add mp_fail testcases

Hi Matt,

Quoted 101 lines · Matthieu Baerts

Hi Geliang,

Quoted 72 lines · Geliang Tang

Hi Matt, Davide,

Quoted 68 lines · Matthieu Baerts

Hi Geliang,

Quoted 65 lines · Mat Martineau
Quoted 48 lines · Geliang Tang

Added the test cases for MP_FAIL, use 'tc' command to trigger the checksum failure.

---
tools/testing/selftests/net/mptcp/config      |  5 ++ .../testing/selftests/net/mptcp/mptcp_join.sh | 75 +++++++++++++++++--

2 files changed, 72 insertions(+), 8 deletions(-)
tools/testing/selftests/net/mptcp/config +0 -0
index 0faaccd21447..f522288b2204 100644
@@ -15,3 +15,8 @@ CONFIG_NETFILTER_XTABLES=m

CONFIG_NETFILTER_XT_MATCH_BPF=m
CONFIG_NF_TABLES_IPV4=y
CONFIG_NF_TABLES_IPV6=y

tools/testing/selftests/net/mptcp/config +5 -0
+CONFIG_NET_ACT_CSUM=m
+CONFIG_NET_ACT_PEDIT=m
+CONFIG_NET_CLS_ACT=m
+CONFIG_NET_CLS_FLOWER=m
+CONFIG_NET_SCH_INGRESS=m
tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
index 2684ef9c0d42..d33cb5ce0ff3 100755
@@ -178,6 +178,12 @@ if [ $? -ne 0 ];then

    exit $ksft_skip
fi

tools/testing/selftests/net/mptcp/mptcp_join.sh +6 -0
+jq -V > /dev/null 2>&1
+if [ $? -ne 0 ];then
+    echo "SKIP: Could not run all tests without jq tool"
+    exit $ksft_skip
+fi
+

print_file_err()
{
    ls -l "$1" 1>&2

tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -232,6 +238,28 @@ link_failure()

    done
}

tools/testing/selftests/net/mptcp/mptcp_join.sh +1 -0
+checksum_failure()

tools/testing/selftests/net/mptcp/mptcp_join.sh

Quoted 10 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +10 -0
+{
+    i="$1"
+
+    tc -n $ns2 qdisc add dev ns2eth$i clsact
+    tc -n $ns2 filter add dev ns2eth$i egress \
+        protocol ip prio 1000 \
+        flower ip_proto tcp \
+        action pedit munge offset 148 u32 invert \
+        pipe csum tcp \
+        index 100

Could you add a comment explaining what the filter is doing? While it looks like the idea is to invert the 32-bit word at byte offset 148, I'm not tc-literate enough to know if there are other effects (and I didn't watch the email threads closely on this).

Quoted 3 lines

Matt, could you please add this comment for me? I didn't understand these tc commands very well, and I can't explain them very clearly in English.

Sure. Here is my proposition:

# Modify TCP payload without corrupting the TCP packet
#
# This rule inverts a 32-bit word at byte offset 148 for all TCP ACK # packets carrying enough data.
# Once it is done, the TCP Checksum field is updated so the packet # is still considered as valid at the TCP level.
# But because the MPTCP checksum, covering the TCP options and data, # has not been updated, we will detect the modification and emit an # MP_FAIL: what we want to validate here.
#
# Please note that this rule will produce this pr_info() message for # each TCP ACK packets not carrying enough data:
#
# tc action pedit offset 162 out of bounds
#
# But this should be limited to a very few numbers of packets as we # restrict this rule to outgoing TCP traffic with only the ACK flag # + except the 3rd ACK, only packets carrying data should be seen in # this direction.

Quoted 4 lines

This comment makes sense if you use "flower ip_proto tcp tcp_flags 0x10/0xff" and reduce incoming traffic. Otherwise, we need to remove "ACK" and/or the last sentence but I don't think we should make this test printing a lot of pr_info().

Thanks very much, I'll add this comment in the next version and your Co-developed-by tag.

Quoted 48 lines
Quoted 15 lines
Quoted 12 lines

Yes that's correct. It takes only TCP packets on the egress side that are big enough but print a message in dmesg if not. After the modification, the TCP checksum is recomputed so the packet is valid.

Quoted 5 lines
Quoted 5 lines

+
+    while true; do
+        local pkt=$(tc -n $ns2 -j -s action show action csum index 100 | +                jq '.[1].actions[0].stats.packets')

Should we show the action 'pedit' here, instead of 'csum'?

Quoted 7 lines

The action 'csum' output is like this:

# tc -n $ns2 -j -s action show action csum index 100

[{"total acts":1},{"actions":[{"order":0,"kind":"csum","csum":"tcp","control_action":{"type":"pass"},"index":100,"ref":1,"bind":1,"installed":29,"last_used":2,"stats":{"bytes":11576,"packets":42,"drops":0,"overlimits":0,"requeues":0,"backlog":0,"qlen":0}}]}]

"overlimits" is always 0 in 'csum'.

Good point. I thought 'pedit' would not let the packet passing to csum if it was over the limits but I guess it does if we see the same values for packets/bytes counters in 'csum' and 'pedit' actions.

Quoted 8 lines

But the action 'pedit' output is like this:

# tc -n $ns2 -j -s action show action pedit index 100

[{"total acts":1},{"actions":[{"order":0 pedit ,"control_action":{"type":"pipe"}keys 1
index 1 ref 1 bind 1,"installed":29,"last_used":2
key #0 at 148: val ffffffff mask ffffffff
,"stats":{"bytes":11576,"packets":42,"drops":0,"overlimits":36,"requeues":0,"backlog":0,"qlen":0}}]}]

(When you will get the right output, may you add this in a comment in the script as an example to explain what you have and what you try to parse please?)

Quoted 2 lines

"overlimits" values are all right here

From what I see in the code, if the packet was not carrying enough data 'act_pedit' will increase the 'overlimits' counter and the other ones -- bytes and packets I guess -- as well:

Quoted 5 lines

https://elixir.bootlin.com/linux/latest/source/net/sched/act_pedit.c#L368

So good point, we should look at 'pedit' counters and more precisely at:

"packets" - "overlimits" > 0

Exactly!

Quoted 8 lines

here.

Quoted 3 lines

but this output can't be parsed by
'jq'. It looks like something wrong to show 'pedit'.

Quoted 1 line

Is this a bug in act_pedit, or we use pedit incorrectly? How can I fix

this?

Quoted 7 lines

Do you mean you have this error?

parse error: Invalid numeric literal at line 1, column 47

To me, it looks like a bug on printing data, so on 'tc' side. Which version of 'tc' are you using? May you try to upgrade to a more recent one? e.g. IPRoute2 5.15.0? Maybe it has already been fixed.

You're right, it's a tc bug. And fixed already in IPRoute2 5.15.0.

Quoted 46 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 5 lines

+        if [ $pkt -gt 0 ]; then
+            tc -n $ns2 qdisc del dev ns2eth$i clsact +            break
+        fi

Quoted 8 lines
Quoted 5 lines

On my side, I had to add a "sleep .1" to slow things down and have the tests a bit more stable.

I also used "flower ip_proto tcp tcp_flags 0x10/0xff" and it seems working fine.

Could you please share your checksum_failure function here, I'll test it on my side?

I did that to have the test finishing on my side:

--------------- 8< ---------------

tools/testing/selftests/net/mptcp/config +1 -1
index f522288b2204..2aff41754c8f 100644
@@ -17,6 +17,6 @@ CONFIG_NF_TABLES_IPV4=y
 CONFIG_NF_TABLES_IPV6=y
 CONFIG_NET_ACT_CSUM=m
 CONFIG_NET_ACT_PEDIT=m
-CONFIG_NET_CLS_ACT=m
+CONFIG_NET_CLS_ACT=y
 CONFIG_NET_CLS_FLOWER=m
 CONFIG_NET_SCH_INGRESS=m
tools/testing/selftests/net/mptcp/mptcp_join.sh +1 -1
index d33cb5ce0ff3..8dcd445b1532 100755
@@ -245,7 +245,7 @@ checksum_failure()
        tc -n $ns2 qdisc add dev ns2eth$i clsact
        tc -n $ns2 filter add dev ns2eth$i egress \
                protocol ip prio 1000 \
-               flower ip_proto tcp \
+               flower ip_proto tcp tcp_flags 0x10/0xff \
                action pedit munge offset 148 u32 invert \
                pipe csum tcp \
                index 100

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

Quoted 8 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +1 -1
@@ -257,6 +257,7 @@ checksum_failure()
                        tc -n $ns2 qdisc del dev ns2eth$i clsact
                        break
                fi
+               sleep .1
        done
 }
 
--------------- 8< ---------------

Thanks, this works on my side too. I'll add this 'tcp_flags 0x10/0xff' in the next version.

Quoted 106 lines
Quoted 106 lines
Quoted 105 lines

But still and probably caused by the "sleep .1" that seems needed, I have many messages in dmesg:

tc action pedit offset 162 out of bounds

Because everything is shown on the serial, it is a bit annoying.

Do you think it would be possible to limit to TCP ACK and also make sure data are only sent in one direction or limit incoming traffic to 1 byte if it is easier? With this, we should then have a very few pure ACKs packets on the egress side and avoid most of the TC warning messages printed by the kernel, no?

Quoted 89 lines
Quoted 77 lines

+    done

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

# $1: IP address
is_v6()
{

tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -371,6 +399,9 @@ do_transfer()

    if [[ "${addr_nr_ns2}" = "fullmesh_"* ]]; then flags="${flags},fullmesh" addr_nr_ns2=${addr_nr_ns2:9}
+    elif [[ "${addr_nr_ns2}" = "fail_"* ]]; then +        checksum_failure ${addr_nr_ns2:5} +        addr_nr_ns2=0
    fi

    if [ $addr_nr_ns2 -gt 0 ]; then

tools/testing/selftests/net/mptcp/mptcp_join.sh +2 -0
@@ -542,6 +573,8 @@ run_tests()
 chk_csum_nr()
 {
     local msg=${1:-""}
+    local csum_ns1=${2:-0}
+    local csum_ns2=${3:-0}

    local count
    local dump_stats

tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -553,8 +586,8 @@ chk_csum_nr()

    printf " %-36s %s" "$msg" "sum"
    count=ip netns exec $ns1 nstat -as | grep MPTcpExtDataCsumErr | awk '{print $2}'
    [ -z "$count" ] && count=0
-    if [ "$count" != 0 ]; then
-        echo "[fail] got $count data checksum error[s] expected 0" +    if [ "$count" != $csum_ns1 ]; then
+        echo "[fail] got $count data checksum error[s] expected $csum_ns1"
        ret=1
        dump_stats=1
    else

tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -563,8 +596,8 @@ chk_csum_nr()

    echo -n " - csum  "
    count=ip netns exec $ns2 nstat -as | grep MPTcpExtDataCsumErr | awk '{print $2}'
    [ -z "$count" ] && count=0
-    if [ "$count" != 0 ]; then
-        echo "[fail] got $count data checksum error[s] expected 0" +    if [ "$count" != $csum_ns2 ]; then
+        echo "[fail] got $count data checksum error[s] expected $csum_ns2"
        ret=1
        dump_stats=1
    else

tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -658,6 +691,8 @@ chk_join_nr()

    local syn_nr=$2
    local syn_ack_nr=$3
    local ack_nr=$4
+    local fail_nr=${5:-0}
+    local infi_nr=${6:-0}
    local count
    local dump_stats

tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -700,9 +735,9 @@ chk_join_nr()

        ip netns exec $ns2 nstat -as | grep MPTcp
    fi
    if [ $checksum -eq 1 ]; then
-        chk_csum_nr
-        chk_fail_nr 0 0
-        chk_infi_nr 0 0
+        chk_csum_nr "" $fail_nr
+        chk_fail_nr $fail_nr $fail_nr
+        chk_infi_nr $infi_nr $infi_nr
    fi
}

tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -1837,6 +1872,25 @@ fullmesh_tests()

    chk_add_nr 1 1
}

tools/testing/selftests/net/mptcp/mptcp_join.sh

Quoted 2 lines
tools/testing/selftests/net/mptcp/mptcp_join.sh +2 -0
+fail_tests()
+{

Since MP_FAIL is only relevent with checksums enabled, I think it would be good to set $checksum=1 here and restore its previous value before returning (in case other tests run after this).

Quoted 5 lines

+    # 1 subflow
+    reset
+    ip netns exec $ns1 ./pm_nl_ctl limits 0 2 +    ip netns exec $ns2 ./pm_nl_ctl limits 0 2 +    run_tests $ns1 $ns2 10.0.1.1 2 0 "fail_1" fast

Quoted 8 lines
Quoted 3 lines

Here I passed 2 as the 4th argument of run_tests like the link_failure tests to create the bigger data files. I don't know why it dosen't work when passing 0 as the argument?

Should we first insert the TC rule, then start the test, then look at counters?
It would be "safer" because we would not need need to make sure we have enough data to transfer. WDYT?

Good point, I'll try it.

Quoted 109 lines
Quoted 98 lines
Quoted 98 lines
Quoted 98 lines
Quoted 47 lines

+    chk_join_nr "MP_FAIL test, 1 subflow" 0 0 0 1 1
+
+    # multiple subflows
+    reset
+    ip netns exec $ns1 ./pm_nl_ctl limits 0 2
+    ip netns exec $ns2 ./pm_nl_ctl limits 0 2
+    ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 dev ns2eth3 flags subflow
+    ip netns exec $ns2 ./pm_nl_ctl add 10.0.2.2 dev ns2eth2 flags subflow
+    run_tests $ns1 $ns2 10.0.1.1 2 0 "fail_2" fast
+    chk_join_nr "MP_FAIL test, multiple subflows" 2 2 2 1

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

all_tests()
{
    subflows_tests

tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -1853,6 +1907,7 @@ all_tests()

    checksum_tests
    deny_join_id0_tests
    fullmesh_tests
+    fail_tests
}

usage()

tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -1872,6 +1927,7 @@ usage()

    echo "  -S checksum_tests"
    echo "  -d deny_join_id0_tests"
    echo "  -m fullmesh_tests"
+    echo "  -F fail_tests"
    echo "  -c capture pcap files"
    echo "  -C enable data checksum"
    echo "  -h help"

tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -1907,7 +1963,7 @@ if [ $do_all_tests -eq 1 ]; then

    exit $ret
fi

tools/testing/selftests/net/mptcp/mptcp_join.sh +1 -1
-while getopts 'fsltra64bpkdmchCS' opt; do
+while getopts 'fsltra64bpkdmchCSF' opt; do

    case $opt in
        f)
            subflows_tests

tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -0
@@ -1951,6 +2007,9 @@ while getopts 'fsltra64bpkdmchCS' opt; do
         m)

            fullmesh_tests
            ;;

Quoted 8 lines

+        F)
+            fail_tests
+            ;;
        c)
            ;;
        C)
--
2.26.2

When I run:

$ sudo ./mptcp_join.sh -FC

I get:

"""
Created /tmp/tmp.UTIlkuhfRW (size 1 KB) containing data sent by client Created /tmp/tmp.pMPhJddNfQ (size 1 KB) containing data sent by server Created /tmp/tmp.OEx5cmVqbp (size 10075 KB) containing data sent by client Created /tmp/tmp.RAtBQXOXtR (size 6144 KB) containing data sent by server [ FAIL ] file received by server does not match (in, out):
-rw-------. 1 root root 20633656 Nov  3 17:32 /tmp/tmp.HtyoJjpCOe Trailing bytes are:
MPTCP_TEST_FILE_END_MARKER
-rw-------. 1 root root 20633656 Nov  3 17:32 /tmp/tmp.j8HYN1PUVh Trailing bytes are:
MPTCP_TEST_FILE_END_MARKER
01 MP_FAIL test, 1 subflow              syn[ ok ] - synack[ ok ] - ack[ ok ]
                                        sum[ ok ] - csum  [ ok ] ftx[ ok ] - frx   [ ok ] itx[ ok ] - irx   [ ok ] [ FAIL ] file received by server does not match (in, out):
-rw-------. 1 root root 20633656 Nov  3 17:32 /tmp/tmp.HtyoJjpCOe Trailing bytes are:
MPTCP_TEST_FILE_END_MARKER
-rw-------. 1 root root 20633656 Nov  3 17:32 /tmp/tmp.j8HYN1PUVh Trailing bytes are:
MPTCP_TEST_FILE_END_MARKER
02 MP_FAIL test, multiple subflows      syn[ ok ] - synack[ ok ] - ack[ ok ]
                                        sum[ ok ] - csum  [ ok ] ftx[ ok ] - frx   [ ok ] itx[ ok ] - irx   [ ok ] """

The chk_join_nr output shows all [ ok ], which is good. But the file mismatches (I assume due to the inverted data) are failures because the checksums are intended to reject the bad data. Am I understanding the file mismatches correctly?

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

If MP_FAIL is working, the files should match.

I also have the same error on my side but not all the time.

I got these file mismatches errors all the time. Could you please share your test script and the logs when you get the right output?

I don't think I saw them for both tests all the time but it is possible it was always there for the 1st one and not for the second one. I will look at that next time.

Quoted 5 lines
Quoted 3 lines

The first test "01 MP_FAIL test, 1 subflow" will get the file mismatches all the time, since the checksum error data can't be retransmitted in the current codes.

Should we disable this test then?

We should keep this test. It's useful for testing sending and receiving of the infinite mapping. The infinite mapping is only sent in this single subflow case.

Quoted 10 lines
Quoted 9 lines

But the second test "02 MP_FAIL test, multiple subflows" shouldn't get the file mismatches. RST is sent on the checksum error subflow, so this subflow is closed. The data will be retransmitted on the other subflow. It works by using the old test case "[PATCH mptcp-next v7 8/8]
DO-NOT-MERGE: mptcp: mp_fail test". Data will be retransmitted, and no the file mismatches. I don't know why it dosen't work by this new test case. In this test case, I saw the error data has been dropped, and the new data has been retransmitted in the log. I'll try to fix this.

Could we merge patches 1-7 of this patchset into the export branch? Then I'll just iterate a new version of this test case patch. And if there's something I need to fix next week, I'll send the squash-to patch. Please discuss this with Mat in today's weekly meeting.

Thanks,
-Geliang

Quoted 8 lines

Thanks!

Cheers,
Matt

Signature · 2 lines
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net
#18 lore raw

Re: [PATCH mptcp-next v8 8/8] selftests: mptcp: add mp_fail testcases

Hi Geliang,

Quoted 7 lines · Geliang Tang
Quoted 6 lines · Matthieu Baerts
Quoted 2 lines · Geliang Tang

Is this a bug in act_pedit, or we use pedit incorrectly? How can I fix this?

Do you mean you have this error?

Quoted 7 lines
Quoted 5 lines

parse error: Invalid numeric literal at line 1, column 47

To me, it looks like a bug on printing data, so on 'tc' side. Which version of 'tc' are you using? May you try to upgrade to a more recent one? e.g. IPRoute2 5.15.0? Maybe it has already been fixed.

You're right, it's a tc bug. And fixed already in IPRoute2 5.15.0.

Which version were you using before?
I guess we need at least the 5.8.0 to have this commit:

https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/tc/m_pedit.c?id=081d6c310d3a6e0412431a9652f641dff3f72aee

If yes, we should probably skip/abort the test if we cannot parse the json.

(...)

Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

+    # 1 subflow
+    reset
+    ip netns exec $ns1 ./pm_nl_ctl limits 0 2 +    ip netns exec $ns2 ./pm_nl_ctl limits 0 2 +    run_tests $ns1 $ns2 10.0.1.1 2 0 "fail_1" fast

Here I passed 2 as the 4th argument of run_tests like the link_failure tests to create the bigger data files. I don't know why it dosen't work when passing 0 as the argument?

Quoted 6 lines
Quoted 4 lines

Should we first insert the TC rule, then start the test, then look at counters?
It would be "safer" because we would not need need to make sure we have enough data to transfer. WDYT?

Good point, I'll try it.

Thanks!

May you also make sure that for this test, we transfer data only in one direction? I don't know if for the other direction, we could not give /dev/null or generate a 1 byte file.

Quoted 112 lines
Quoted 112 lines
Quoted 97 lines
Quoted 97 lines
Quoted 97 lines
Quoted 46 lines

+    chk_join_nr "MP_FAIL test, 1 subflow" 0 0 0 1 1
+
+    # multiple subflows
+    reset
+    ip netns exec $ns1 ./pm_nl_ctl limits 0 2
+    ip netns exec $ns2 ./pm_nl_ctl limits 0 2
+    ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 dev ns2eth3 flags subflow
+    ip netns exec $ns2 ./pm_nl_ctl add 10.0.2.2 dev ns2eth2 flags subflow
+    run_tests $ns1 $ns2 10.0.1.1 2 0 "fail_2" fast
+    chk_join_nr "MP_FAIL test, multiple subflows" 2 2 2 1

(quoted diff) +2 -0
+}
+

all_tests()
{
    subflows_tests

(quoted diff) +0 -0
@@ -1853,6 +1907,7 @@ all_tests()

    checksum_tests
    deny_join_id0_tests
    fullmesh_tests
+    fail_tests
}

usage()

(quoted diff) +0 -0
@@ -1872,6 +1927,7 @@ usage()

    echo "  -S checksum_tests"
    echo "  -d deny_join_id0_tests"
    echo "  -m fullmesh_tests"
+    echo "  -F fail_tests"
    echo "  -c capture pcap files"
    echo "  -C enable data checksum"
    echo "  -h help"

(quoted diff) +0 -0
@@ -1907,7 +1963,7 @@ if [ $do_all_tests -eq 1 ]; then

    exit $ret
fi

(quoted diff) +1 -1
-while getopts 'fsltra64bpkdmchCS' opt; do
+while getopts 'fsltra64bpkdmchCSF' opt; do

    case $opt in
        f)
            subflows_tests

(quoted diff) +0 -0
@@ -1951,6 +2007,9 @@ while getopts 'fsltra64bpkdmchCS' opt; do
         m)

            fullmesh_tests
            ;;

Quoted 8 lines

+        F)
+            fail_tests
+            ;;
        c)
            ;;
        C)
--
2.26.2

When I run:

$ sudo ./mptcp_join.sh -FC

I get:

"""
Created /tmp/tmp.UTIlkuhfRW (size 1 KB) containing data sent by client Created /tmp/tmp.pMPhJddNfQ (size 1 KB) containing data sent by server Created /tmp/tmp.OEx5cmVqbp (size 10075 KB) containing data sent by client Created /tmp/tmp.RAtBQXOXtR (size 6144 KB) containing data sent by server [ FAIL ] file received by server does not match (in, out):
-rw-------. 1 root root 20633656 Nov  3 17:32 /tmp/tmp.HtyoJjpCOe Trailing bytes are:
MPTCP_TEST_FILE_END_MARKER
-rw-------. 1 root root 20633656 Nov  3 17:32 /tmp/tmp.j8HYN1PUVh Trailing bytes are:
MPTCP_TEST_FILE_END_MARKER
01 MP_FAIL test, 1 subflow              syn[ ok ] - synack[ ok ] - ack[ ok ]
                                        sum[ ok ] - csum  [ ok ] ftx[ ok ] - frx   [ ok ] itx[ ok ] - irx   [ ok ] [ FAIL ] file received by server does not match (in, out):
-rw-------. 1 root root 20633656 Nov  3 17:32 /tmp/tmp.HtyoJjpCOe Trailing bytes are:
MPTCP_TEST_FILE_END_MARKER
-rw-------. 1 root root 20633656 Nov  3 17:32 /tmp/tmp.j8HYN1PUVh Trailing bytes are:
MPTCP_TEST_FILE_END_MARKER
02 MP_FAIL test, multiple subflows      syn[ ok ] - synack[ ok ] - ack[ ok ]
                                        sum[ ok ] - csum  [ ok ] ftx[ ok ] - frx   [ ok ] itx[ ok ] - irx   [ ok ] """

The chk_join_nr output shows all [ ok ], which is good. But the file mismatches (I assume due to the inverted data) are failures because the checksums are intended to reject the bad data. Am I understanding the file mismatches correctly?

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

If MP_FAIL is working, the files should match.

I also have the same error on my side but not all the time.

I got these file mismatches errors all the time. Could you please share your test script and the logs when you get the right output?

I don't think I saw them for both tests all the time but it is possible it was always there for the 1st one and not for the second one. I will look at that next time.

Quoted 3 lines

The first test "01 MP_FAIL test, 1 subflow" will get the file mismatches all the time, since the checksum error data can't be retransmitted in the current codes.

Quoted 5 lines
Quoted 1 line

Should we disable this test then?

We should keep this test. It's useful for testing sending and receiving of the infinite mapping. The infinite mapping is only sent in this single subflow case.

We should then not check the output files if we expect not to receive the full file. Or we should compare files up to the size of the smallest. Because what has been given to the app should not be "corrupted".

Quoted 10 lines
Quoted 9 lines
Quoted 8 lines

But the second test "02 MP_FAIL test, multiple subflows" shouldn't get the file mismatches. RST is sent on the checksum error subflow, so this subflow is closed. The data will be retransmitted on the other subflow. It works by using the old test case "[PATCH mptcp-next v7 8/8]
DO-NOT-MERGE: mptcp: mp_fail test". Data will be retransmitted, and no the file mismatches. I don't know why it dosen't work by this new test case. In this test case, I saw the error data has been dropped, and the new data has been retransmitted in the log. I'll try to fix this.

Quoted 4 lines

Could we merge patches 1-7 of this patchset into the export branch? Then I'll just iterate a new version of this test case patch. And if there's something I need to fix next week, I'll send the squash-to patch. Please discuss this with Mat in today's weekly meeting.

Sounds like a good point to me. I will wait for Mat's ACK about that! I can raise the point at today's weekly meeting.

Cheers,
Matt

Signature · 2 lines
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net
#21 lore raw
In reply to Geliang Tang

Hi Geliang, Mat,

Quoted 6 lines · Geliang Tang

v8:
- Patches 1-6 are unchanged, only updated the selftests scripts.
- The patch (Squash to "mptcp: infinite mapping receiving" for v7) is
dropped too. Since this series only implemented MP_FAIL in one direction. The TODO items, "MP_FAIL echo" and "MP_FAIL retrans", will implement later as new patches.

(...)

Thank you for the patches and the reviews!

As discussed at the meeting yesterday, to help you moving forward, I applied the first seven patches (without Mat's RvB tag for the moment).

What is then left to do if I'm not mistaken:

- drop more data from the receive queue c.f. discussions with Mat and Christoph on the ML on v7

- Improvements around the tests for patch 8/8:
- Comment around the TC command
- Add 'tcp_flags 0x10/0xff'
- Comment around the parsing (example of what you are parsing)
- Break if jq returns 'null' or nothing.
- Sleep in the while loop for "tc show"
- Look for "pedit" counter ("packets" - "overlimits")
- Not compare the output file if it is normal they are different
- Remove/Reduce data sent by the host not having the tc command (send
only in one direction)
- Insert the TC rules, then start the test, then look at counters
- Force checksum=1 for "fail_tests()"

And for later:

- "MP_FAIL echo"

- "MP_FAIL retrans"

Did I miss anything?

The first patches are now in our tree (features for net-next):

- 19ca240f0cdf: mptcp: don't send RST for single subflow
- 89de2a435c1e: mptcp: add the fallback check
- df3d448153f1: mptcp: track and update contiguous data status
- 44b73ea648cc: mptcp: infinite mapping sending
- e35a1a951132: mptcp: infinite mapping receiving
- 9feb4bc20bf6: mptcp: add mib for infinite map sending
- ac67c5b1d612: selftests: mptcp: add infinite map mibs check
- Results: c1d29ad013b4..0fad1b3cf9ef

Builds and tests are now in progress:

https://cirrus-ci.com/github/multipath-tcp/mptcp_net-next/export/20211105T130530
https://github.com/multipath-tcp/mptcp_net-next/actions/workflows/build-validation.yml?query=branch:export

Quoted 1 line

Because there are still stuff to implement, this ticket has not been closed.

Cheers,
Matt

Signature · 2 lines
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net