Skip to contentSkip to conversation

MP_FAIL support

PATCH Superseded Geliang Tang 3 participants 10 messages Jul 26, 2021 – Jul 28, 2021

Subsystems (3)

v5 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v5 cover MP_FAIL support

From: Geliang Tang <[email protected]>

v5:
- patch 1, change "ret = true;" to "return true;"
- patch 3, in the single-subflow case, send MP_FAIL and receive the echo, then temporarily handled by reset.

v4:
- just deal with the multiple subflows case, put the single subflow case into the new 'infinite mapping' part.

v3:
- respond with MP_FAIL
- add single subflow check
- add infinite mapping sending and receiving
- export/20210626T054902

v2:
- MP_FAIL logic:
* Peer B send a DSS to peer A, and the data has been modify by the
middleboxes, then peer A detects the bad checksum.
* In the multiple subflows case, peer A sends MP_FAIL+RST back to peer B,
and peer A discards the data following the bad data sequence number. Peer B receives this MP_FAIL+RST, and close this subflow.
* In the single subflow case, using the simple implementation, peer A
sends MP_FAIL back to peer B, and peer A fallback to a regular TCP. Peer B receives this MP_FAIL, and fallback to a regular TCP.

Geliang Tang (5):
mptcp: MP_FAIL suboption sending
mptcp: MP_FAIL suboption receiving
mptcp: send out MP_FAIL when data checksum fails
mptcp: add the mibs for MP_FAIL
selftests: mptcp: add MP_FAIL mibs check

 include/net/mptcp.h                           |  5 +-
 net/mptcp/mib.c                               |  2 +
 net/mptcp/mib.h                               |  2 +
 net/mptcp/options.c                           | 78 ++++++++++++++++++-
 net/mptcp/pm.c                                | 20 +++++
 net/mptcp/protocol.h                          | 20 +++++
 net/mptcp/subflow.c                           | 18 +++++
 .../testing/selftests/net/mptcp/mptcp_join.sh | 38 +++++++++
 8 files changed, 178 insertions(+), 5 deletions(-)
Signature · 1 line
2.31.1
#1 lore raw

PATCH v5 1/5 mptcp: MP_FAIL suboption sending

From: Geliang Tang <[email protected]>

This patch added the MP_FAIL suboption sending support.

Add a new flag named send_mp_fail in struct mptcp_subflow_context. If this flag is set, send out MP_FAIL suboption.

Add a new member fail_seq in struct mptcp_out_options to save the data sequence number to put into the MP_FAIL suboption.

An MP_FAIL option could be included in a RST or on the subflow-level ACK.

---
 include/net/mptcp.h  |  5 +++-
 net/mptcp/options.c  | 61 +++++++++++++++++++++++++++++++++++++++++---
 net/mptcp/protocol.h |  3 +++
 3 files changed, 64 insertions(+), 5 deletions(-)
include/net/mptcp.h +4 -1
index d0b9e4a7121f..6c8c8592153d 100644
@@ -60,7 +60,10 @@ struct mptcp_out_options {
 	u16 suboptions;
 	u64 sndr_key;
 	u64 rcvr_key;
-	u64 ahmac;
+	union {
+		u64 ahmac;
+		u64 fail_seq;
+	};
 	struct mptcp_addr_info local;
 	struct mptcp_addr_info remote;
 	struct mptcp_rm_list rm_list;
net/mptcp/options.c +57 -4

97 lines not on this page · raw message

net/mptcp/protocol.h +3 -0
index 34ad1c4bc29f..ea4ab9b9d6db 100644
@@ -26,6 +26,7 @@
 #define OPTION_MPTCP_FASTCLOSE	BIT(8)
 #define OPTION_MPTCP_PRIO	BIT(9)
 #define OPTION_MPTCP_RST	BIT(10)
+#define OPTION_MPTCP_FAIL	BIT(11)
 
 /* MPTCP option subtypes */
 #define MPTCPOPT_MP_CAPABLE	0
@@ -67,6 +68,7 @@
 #define TCPOLEN_MPTCP_PRIO_ALIGN	4
 #define TCPOLEN_MPTCP_FASTCLOSE		12
 #define TCPOLEN_MPTCP_RST		4
+#define TCPOLEN_MPTCP_FAIL		12
 
 #define TCPOLEN_MPTCP_MPC_ACK_DATA_CSUM	(TCPOLEN_MPTCP_DSS_CHECKSUM + TCPOLEN_MPTCP_MPC_ACK_DATA)
 
@@ -428,6 +430,7 @@ struct mptcp_subflow_context {
 		mpc_map : 1,
 		backup : 1,
 		send_mp_prio : 1,
+		send_mp_fail : 1,
 		rx_eof : 1,
 		can_ack : 1,        /* only after processing the remote a key */
 		disposable : 1,	    /* ctx can be free at ulp release time */
Signature · 1 line
2.31.1
#2 lore raw

PATCH v5 2/5 mptcp: MP_FAIL suboption receiving

From: Geliang Tang <[email protected]>

This patch added handling for receiving MP_FAIL suboption.

Add a new members mp_fail and fail_seq in struct mptcp_options_received. When MP_FAIL suboption is received, set mp_fail to 1 and save the sequence number to fail_seq.

Then invoke mptcp_pm_mp_fail_received to deal with the MP_FAIL suboption.

---
 net/mptcp/options.c  | 16 ++++++++++++++++
 net/mptcp/pm.c       |  5 +++++
 net/mptcp/protocol.h |  3 +++
 3 files changed, 24 insertions(+)
net/mptcp/options.c +16 -0
index a7365379096d..62085834782d 100644
@@ -336,6 +336,16 @@ static void mptcp_parse_option(const struct sk_buff *skb,
 		mp_opt->reset_reason = *ptr;
 		break;
 
+	case MPTCPOPT_MP_FAIL:
+		if (opsize != TCPOLEN_MPTCP_FAIL)
+			break;
+
+		ptr += 2;
+		mp_opt->mp_fail = 1;
+		mp_opt->fail_seq = get_unaligned_be64(ptr);
+		pr_debug("MP_FAIL: data_seq=%llu", mp_opt->fail_seq);
+		break;
+
 	default:
 		break;
 	}
@@ -364,6 +374,7 @@ void mptcp_get_options(const struct sock *sk,
 	mp_opt->reset = 0;
 	mp_opt->csum_reqd = READ_ONCE(msk->csum_enabled);
 	mp_opt->deny_join_id0 = 0;
+	mp_opt->mp_fail = 0;
 
 	length = (th->doff * 4) - sizeof(struct tcphdr);
 	ptr = (const unsigned char *)(th + 1);
@@ -1138,6 +1149,11 @@ bool mptcp_incoming_options(struct sock *sk, struct sk_buff *skb)
 		mp_opt.mp_prio = 0;
 	}
 
+	if (mp_opt.mp_fail) {
+		mptcp_pm_mp_fail_received(sk, mp_opt.fail_seq);
+		mp_opt.mp_fail = 0;
+	}
+
 	if (mp_opt.reset) {
 		subflow->reset_seen = 1;
 		subflow->reset_reason = mp_opt.reset_reason;
net/mptcp/pm.c +5 -0
index 692614c1f552..f37a014b4875 100644
@@ -249,6 +249,11 @@ void mptcp_pm_mp_prio_received(struct sock *sk, u8 bkup)
 	mptcp_event(MPTCP_EVENT_SUB_PRIORITY, mptcp_sk(subflow->conn), sk, GFP_ATOMIC);
 }
 
+void mptcp_pm_mp_fail_received(struct sock *sk, u64 fail_seq)
+{
+	pr_debug("fail_seq=%llu", fail_seq);
+}
+
 /* path manager helpers */
 
 bool mptcp_pm_add_addr_signal(struct mptcp_sock *msk, struct sk_buff *skb,
net/mptcp/protocol.h +3 -0
index ea4ab9b9d6db..19533e5778a6 100644
@@ -139,6 +139,7 @@ struct mptcp_options_received {
 		add_addr : 1,
 		rm_addr : 1,
 		mp_prio : 1,
+		mp_fail : 1,
 		echo : 1,
 		csum_reqd : 1,
 		backup : 1,
@@ -160,6 +161,7 @@ struct mptcp_options_received {
 	u64	ahmac;
 	u8	reset_reason:4;
 	u8	reset_transient:1;
+	u64	fail_seq;
 };
 
 static inline __be32 mptcp_option(u8 subopt, u8 len, u8 nib, u8 field)
@@ -726,6 +728,7 @@ void mptcp_pm_mp_prio_received(struct sock *sk, u8 bkup);
 int mptcp_pm_nl_mp_prio_send_ack(struct mptcp_sock *msk,
 				 struct mptcp_addr_info *addr,
 				 u8 bkup);
+void mptcp_pm_mp_fail_received(struct sock *sk, u64 fail_seq);
 void mptcp_pm_free_anno_list(struct mptcp_sock *msk);
 bool mptcp_pm_sport_in_anno_list(struct mptcp_sock *msk, const struct sock *sk);
 struct mptcp_pm_add_entry *
Signature · 1 line
2.31.1
#3 lore raw

PATCH v5 3/5 mptcp: send out MP_FAIL when data checksum fails

From: Geliang Tang <[email protected]>

When a bad checksum is detected, set the send_mp_fail flag to send out the MP_FAIL option.

Add a new function mptcp_has_another_subflow() to check whether there's only a single subflow.

When multiple subflows are in use, close the affected subflow with a RST that includes an MP_FAIL option and discard the data with the bad checksum.

Set the sk_state of the subsocket to TCP_CLOSE, then the flag MPTCP_WORK_CLOSE_SUBFLOW will be set in subflow_sched_work_if_closed, and the subflow will be closed.

When a single subfow is in use, send back an MP_FAIL option on the subflow-level ACK. And the receiver of this MP_FAIL respond with an MP_FAIL in the reverse direction.

---
 net/mptcp/pm.c       | 14 ++++++++++++++
 net/mptcp/protocol.h | 14 ++++++++++++++
 net/mptcp/subflow.c  | 17 +++++++++++++++++
 3 files changed, 45 insertions(+)
net/mptcp/pm.c +14 -0
index f37a014b4875..4a5cf1261ee0 100644
@@ -251,7 +251,21 @@ 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);
+
 	pr_debug("fail_seq=%llu", fail_seq);
+
+	if (!mptcp_has_another_subflow(sk)) {
+		if (!subflow->mp_fail_expect_echo) {
+			subflow->send_mp_fail = 1;
+		} else {
+			subflow->mp_fail_expect_echo = 0;
+			/* TODO the single-subflow case is temporarily
+			 * handled by reset.
+			 */
+			mptcp_subflow_reset(sk);
+		}
+	}
 }
 
 /* path manager helpers */
net/mptcp/protocol.h +14 -0
index 19533e5778a6..1622d6434785 100644
@@ -433,6 +433,7 @@ struct mptcp_subflow_context {
 		backup : 1,
 		send_mp_prio : 1,
 		send_mp_fail : 1,
+		mp_fail_expect_echo : 1,
 		rx_eof : 1,
 		can_ack : 1,        /* only after processing the remote a key */
 		disposable : 1,	    /* ctx can be free at ulp release time */
@@ -614,6 +615,19 @@ static inline void mptcp_subflow_tcp_fallback(struct sock *sk,
 	inet_csk(sk)->icsk_af_ops = ctx->icsk_af_ops;
 }
 
+static inline bool mptcp_has_another_subflow(struct sock *ssk)
+{
+	struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk), *tmp;
+	struct mptcp_sock *msk = mptcp_sk(subflow->conn);
+
+	mptcp_for_each_subflow(msk, tmp) {
+		if (tmp != subflow)
+			return true;
+	}
+
+	return false;
+}
+
 void __init mptcp_proto_init(void);
 #if IS_ENABLED(CONFIG_MPTCP_IPV6)
 int __init mptcp_proto_v6_init(void);
net/mptcp/subflow.c +17 -0
index 1151926d335b..a69839520472 100644
@@ -910,6 +910,7 @@ static enum mapping_status validate_data_csum(struct sock *ssk, struct sk_buff *
 	csum = csum_partial(&header, sizeof(header), subflow->map_data_csum);
 	if (unlikely(csum_fold(csum))) {
 		MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_DATACSUMERR);
+		subflow->send_mp_fail = 1;
 		return subflow->mp_join ? MAPPING_INVALID : MAPPING_DUMMY;
 	}
 
@@ -1157,6 +1158,22 @@ static bool subflow_check_data_avail(struct sock *ssk)
 
 fallback:
 	/* 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);
+		} else {
+			subflow->mp_fail_expect_echo = 1;
+		}
+		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
Signature · 1 line
2.31.1
#4 lore raw

PATCH v5 4/5 mptcp: add the mibs for MP_FAIL

From: Geliang Tang <[email protected]>

This patch added the mibs for MP_FAIL: MPTCP_MIB_MPFAILTX and MPTCP_MIB_MPFAILRX.

---
 net/mptcp/mib.c     | 2 ++
 net/mptcp/mib.h     | 2 ++
 net/mptcp/options.c | 1 +
 net/mptcp/pm.c      | 1 +
 net/mptcp/subflow.c | 1 +
 5 files changed, 7 insertions(+)
net/mptcp/mib.c +2 -0
index 3a7c4e7b2d79..b21ff9be04c6 100644
@@ -44,6 +44,8 @@ static const struct snmp_mib mptcp_snmp_list[] = {
 	SNMP_MIB_ITEM("RmSubflow", MPTCP_MIB_RMSUBFLOW),
 	SNMP_MIB_ITEM("MPPrioTx", MPTCP_MIB_MPPRIOTX),
 	SNMP_MIB_ITEM("MPPrioRx", MPTCP_MIB_MPPRIORX),
+	SNMP_MIB_ITEM("MPFailTx", MPTCP_MIB_MPFAILTX),
+	SNMP_MIB_ITEM("MPFailRx", MPTCP_MIB_MPFAILRX),
 	SNMP_MIB_ITEM("RcvPruned", MPTCP_MIB_RCVPRUNED),
 	SNMP_MIB_ITEM("SubflowStale", MPTCP_MIB_SUBFLOWSTALE),
 	SNMP_MIB_ITEM("SubflowRecover", MPTCP_MIB_SUBFLOWRECOVER),
net/mptcp/mib.h +2 -0
index 8ec16c991aac..ecd3d8b117e0 100644
@@ -37,6 +37,8 @@ enum linux_mptcp_mib_field {
 	MPTCP_MIB_RMSUBFLOW,		/* Remove a subflow */
 	MPTCP_MIB_MPPRIOTX,		/* Transmit a MP_PRIO */
 	MPTCP_MIB_MPPRIORX,		/* Received a MP_PRIO */
+	MPTCP_MIB_MPFAILTX,		/* Transmit a MP_FAIL */
+	MPTCP_MIB_MPFAILRX,		/* Received a MP_FAIL */
 	MPTCP_MIB_RCVPRUNED,		/* Incoming packet dropped due to memory limit */
 	MPTCP_MIB_SUBFLOWSTALE,		/* Subflows entered 'stale' status */
 	MPTCP_MIB_SUBFLOWRECOVER,	/* Subflows returned to active status after being stale */
net/mptcp/options.c +1 -0
index 62085834782d..c915cc144d75 100644
@@ -1151,6 +1151,7 @@ bool mptcp_incoming_options(struct sock *sk, struct sk_buff *skb)
 
 	if (mp_opt.mp_fail) {
 		mptcp_pm_mp_fail_received(sk, mp_opt.fail_seq);
+		MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPFAILRX);
 		mp_opt.mp_fail = 0;
 	}
 
net/mptcp/pm.c +1 -0
index 4a5cf1261ee0..3509345774a5 100644
@@ -258,6 +258,7 @@ void mptcp_pm_mp_fail_received(struct sock *sk, u64 fail_seq)
 	if (!mptcp_has_another_subflow(sk)) {
 		if (!subflow->mp_fail_expect_echo) {
 			subflow->send_mp_fail = 1;
+			MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPFAILTX);
 		} else {
 			subflow->mp_fail_expect_echo = 0;
 			/* TODO the single-subflow case is temporarily
net/mptcp/subflow.c +1 -0
index a69839520472..c25b1d961206 100644
@@ -911,6 +911,7 @@ static enum mapping_status validate_data_csum(struct sock *ssk, struct sk_buff *
 	if (unlikely(csum_fold(csum))) {
 		MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_DATACSUMERR);
 		subflow->send_mp_fail = 1;
+		MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_MPFAILTX);
 		return subflow->mp_join ? MAPPING_INVALID : MAPPING_DUMMY;
 	}
 
Signature · 1 line
2.31.1
#5 lore raw

PATCH v5 5/5 selftests: mptcp: add MP_FAIL mibs check

From: Geliang Tang <[email protected]>

This patch added a function chk_fail_nr to check the mibs for MP_FAIL.

---
 .../testing/selftests/net/mptcp/mptcp_join.sh | 38 +++++++++++++++++++
 1 file changed, 38 insertions(+)
tools/testing/selftests/net/mptcp/mptcp_join.sh +38 -0
index 937e861e9490..551fcce7c2f2 100755
@@ -566,6 +566,43 @@ chk_csum_nr()
 	fi
 }
 
+chk_fail_nr()
+{
+	local mp_fail_nr_tx=$1
+	local mp_fail_nr_rx=$2
+	local count
+	local dump_stats
+
+	printf "%-39s %s" " " "ftx"
+	count=`ip netns exec $ns1 nstat -as | grep MPTcpExtMPFailTx | awk '{print $2}'`
+	[ -z "$count" ] && count=0
+	if [ "$count" != "$mp_fail_nr_tx" ]; then
+		echo "[fail] got $count MP_FAIL[s] TX expected $mp_fail_nr_tx"
+		ret=1
+		dump_stats=1
+	else
+		echo -n "[ ok ]"
+	fi
+
+	echo -n " - frx   "
+	count=`ip netns exec $ns2 nstat -as | grep MPTcpExtMPFailRx | awk '{print $2}'`
+	[ -z "$count" ] && count=0
+	if [ "$count" != "$mp_fail_nr_rx" ]; then
+		echo "[fail] got $count MP_FAIL[s] RX expected $mp_fail_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"
@@ -615,6 +652,7 @@ chk_join_nr()
 	fi
 	if [ $checksum -eq 1 ]; then
 		chk_csum_nr
+		chk_fail_nr 0 0
 	fi
 }
 
Signature · 1 line
2.31.1
maintainer
#6 lore raw

Re: [MPTCP][PATCH v5 mptcp-next 1/5] mptcp: MP_FAIL suboption sending

In reply to Geliang Tang
Quoted 26 lines · Geliang Tang

From: Geliang Tang <[email protected]>

This patch added the MP_FAIL suboption sending support.

Add a new flag named send_mp_fail in struct mptcp_subflow_context. If this flag is set, send out MP_FAIL suboption.

Add a new member fail_seq in struct mptcp_out_options to save the data sequence number to put into the MP_FAIL suboption.

An MP_FAIL option could be included in a RST or on the subflow-level ACK.

---
 include/net/mptcp.h  |  5 +++-
 net/mptcp/options.c  | 61 +++++++++++++++++++++++++++++++++++++++++---
 net/mptcp/protocol.h |  3 +++
 3 files changed, 64 insertions(+), 5 deletions(-)
include/net/mptcp.h +0 -0
index d0b9e4a7121f..6c8c8592153d 100644
@@ -60,7 +60,10 @@ struct mptcp_out_options {
 	u16 suboptions;

include/net/mptcp.h struct mptcp_out_options { · line 69

Quoted 10 lines
include/net/mptcp.h +4 -1
 	u64 sndr_key;
 	u64 rcvr_key;
-	u64 ahmac;
+	union {
+		u64 ahmac;
+		u64 fail_seq;
+	};
 	struct mptcp_addr_info local;
 	struct mptcp_addr_info remote;
 	struct mptcp_rm_list rm_list;

This will conflict with: "mptcp: shrink mptcp_out_options struct". If this series is merged before the "mptcp: shrink mptcp_out_options struct" series, I think we can just add the new field here without any union and do the aliasing the the shirnk' patch.

Otherwise ("mptcp: shrink mptcp_out_options struct" merged first), I think:

		struct mptcp_ext ext_copy;

should be replace with:

		struct {
			struct mptcp_ext ext_copy;
			u64 ahmac;
		};

mptcp_out_options should not change size that way.

Cheers

Paolo

#7 lore raw

Re: [MPTCP][PATCH v5 mptcp-next 1/5] mptcp: MP_FAIL suboption sending

Hi Paolo,

Quoted 47 lines · Paolo Abeni <[email protected]> 于2021年7月26日周一 下午7:10写道:
Quoted 26 lines · Geliang Tang

From: Geliang Tang <[email protected]>

This patch added the MP_FAIL suboption sending support.

Add a new flag named send_mp_fail in struct mptcp_subflow_context. If this flag is set, send out MP_FAIL suboption.

Add a new member fail_seq in struct mptcp_out_options to save the data sequence number to put into the MP_FAIL suboption.

An MP_FAIL option could be included in a RST or on the subflow-level ACK.

---
 include/net/mptcp.h  |  5 +++-
 net/mptcp/options.c  | 61 +++++++++++++++++++++++++++++++++++++++++---
 net/mptcp/protocol.h |  3 +++
 3 files changed, 64 insertions(+), 5 deletions(-)
include/net/mptcp.h +0 -0
index d0b9e4a7121f..6c8c8592153d 100644
@@ -60,7 +60,10 @@ struct mptcp_out_options {
      u16 suboptions;

include/net/mptcp.h struct mptcp_out_options { · line 69

Quoted 10 lines
include/net/mptcp.h +4 -1
      u64 sndr_key;
      u64 rcvr_key;
-     u64 ahmac;
+     union {
+             u64 ahmac;
+             u64 fail_seq;
+     };
      struct mptcp_addr_info local;
      struct mptcp_addr_info remote;
      struct mptcp_rm_list rm_list;

This will conflict with: "mptcp: shrink mptcp_out_options struct". If this series is merged before the "mptcp: shrink mptcp_out_options struct" series, I think we can just add the new field here without any union and do the aliasing the the shirnk' patch.

Otherwise ("mptcp: shrink mptcp_out_options struct" merged first), I think:

Quoted 7 lines
                struct mptcp_ext ext_copy;

should be replace with:

                struct {
                        struct mptcp_ext ext_copy;
                        u64 ahmac;
                };

Do you mean that:

                struct mptcp_ext ext_copy;
should be replaced with:
                 struct {
                         struct mptcp_ext ext_copy;
                         u64 fail_seq;
                 };

?

Then the whole union is like this:

       union {
               struct {
                       u64 sndr_key;
                       u64 rcvr_key;
               };
               struct {
                       struct mptcp_addr_info addr;
                       u64 ahmac;
               };
               struct {
                       struct mptcp_ext ext_copy;
                       u64 fail_seq;
               };
               struct {
                       u32 nonce;
                       u32 token;
                       u64 thmac;
                       u8 hmac[20];
               };
       };

Do I understand correctly?

Thanks,
-Geliang

Quoted 7 lines

mptcp_out_options should not change size that way.

Cheers

Paolo

#8 lore raw
In reply to Geliang Tang
Quoted 7 lines · Geliang Tang

From: Geliang Tang <[email protected]>

v5:
- patch 1, change "ret = true;" to "return true;"
- patch 3, in the single-subflow case, send MP_FAIL and receive the echo, then temporarily handled by reset.

Hi Geliang -

Thanks for the v5 changes. The changes are looking good in terms of manual code review. Since the selftest changes in patch 5 only confirm that MP_FAIL was not sent, I'm going to do some testing tomorrow to force checksum failures in single and multiple subflow cases so I can check some packet traces. It would be good to have some packetdrill checksum test cases to cover that, but we don't yet.

- Mat

Quoted 30 lines

v4:
- just deal with the multiple subflows case, put the single subflow case into the new 'infinite mapping' part.

v3:
- respond with MP_FAIL
- add single subflow check
- add infinite mapping sending and receiving
- export/20210626T054902

v2:
- MP_FAIL logic:
* Peer B send a DSS to peer A, and the data has been modify by the
middleboxes, then peer A detects the bad checksum.
* In the multiple subflows case, peer A sends MP_FAIL+RST back to peer B,
and peer A discards the data following the bad data sequence number. Peer B receives this MP_FAIL+RST, and close this subflow.
* In the single subflow case, using the simple implementation, peer A
sends MP_FAIL back to peer B, and peer A fallback to a regular TCP. Peer B receives this MP_FAIL, and fallback to a regular TCP.

Geliang Tang (5):
mptcp: MP_FAIL suboption sending
mptcp: MP_FAIL suboption receiving
mptcp: send out MP_FAIL when data checksum fails
mptcp: add the mibs for MP_FAIL
selftests: mptcp: add MP_FAIL mibs check

Quoted 15 lines
include/net/mptcp.h                           |  5 +-
net/mptcp/mib.c                               |  2 +
net/mptcp/mib.h                               |  2 +
net/mptcp/options.c                           | 78 ++++++++++++++++++-
net/mptcp/pm.c                                | 20 +++++
net/mptcp/protocol.h                          | 20 +++++
net/mptcp/subflow.c                           | 18 +++++
.../testing/selftests/net/mptcp/mptcp_join.sh | 38 +++++++++
8 files changed, 178 insertions(+), 5 deletions(-)
Signature · 1 line
2.31.1

--
Mat Martineau
Intel

#9 lore raw

Hi Mat,

Quoted 11 lines · Mat Martineau <[email protected]> 于2021年7月28日周三 上午8:27写道:
Quoted 7 lines · Geliang Tang

From: Geliang Tang <[email protected]>

v5:
- patch 1, change "ret = true;" to "return true;"
- patch 3, in the single-subflow case, send MP_FAIL and receive the echo, then temporarily handled by reset.

Quoted 8 lines

Hi Geliang -

Thanks for the v5 changes. The changes are looking good in terms of manual code review. Since the selftest changes in patch 5 only confirm that MP_FAIL was not sent, I'm going to do some testing tomorrow to force checksum failures in single and multiple subflow cases so I can check some packet traces. It would be good to have some packetdrill checksum test cases to cover that, but we don't yet.

I use a similar test for MP_FAIL to force checksum failures. I have put it in the attachment.

Thanks,
-Geliang

Quoted 51 lines

- Mat

Quoted 40 lines

v4:
- just deal with the multiple subflows case, put the single subflow case into the new 'infinite mapping' part.

v3:
- respond with MP_FAIL
- add single subflow check
- add infinite mapping sending and receiving
- export/20210626T054902

v2:
- MP_FAIL logic:
* Peer B send a DSS to peer A, and the data has been modify by the
middleboxes, then peer A detects the bad checksum.
* In the multiple subflows case, peer A sends MP_FAIL+RST back to peer B,
and peer A discards the data following the bad data sequence number. Peer B receives this MP_FAIL+RST, and close this subflow.
* In the single subflow case, using the simple implementation, peer A
sends MP_FAIL back to peer B, and peer A fallback to a regular TCP. Peer B receives this MP_FAIL, and fallback to a regular TCP.

Geliang Tang (5):
mptcp: MP_FAIL suboption sending
mptcp: MP_FAIL suboption receiving
mptcp: send out MP_FAIL when data checksum fails
mptcp: add the mibs for MP_FAIL
selftests: mptcp: add MP_FAIL mibs check

include/net/mptcp.h                           |  5 +-
net/mptcp/mib.c                               |  2 +
net/mptcp/mib.h                               |  2 +
net/mptcp/options.c                           | 78 ++++++++++++++++++-
net/mptcp/pm.c                                | 20 +++++
net/mptcp/protocol.h                          | 20 +++++
net/mptcp/subflow.c                           | 18 +++++
.../testing/selftests/net/mptcp/mptcp_join.sh | 38 +++++++++
8 files changed, 178 insertions(+), 5 deletions(-)
Quoted 5 lines

--
2.31.1

Quoted 3 lines

--
Mat Martineau
Intel

From 0bd5d26b8cdeb296de3fdf93bd4f08781e02a853 Mon Sep 17 00:00:00 2001
From: Geliang Tang <[email protected]>
Date: Wed, 14 Jul 2021 15:25:28 +0800
Subject: [PATCH] mptcp: mp_fail test

---
 net/mptcp/protocol.c                           |  9 +++++++++
 .../testing/selftests/net/mptcp/mptcp_join.sh  | 18 ++++++++++++++++++
 2 files changed, 27 insertions(+)
net/mptcp/protocol.c +9 -0
index 8eb2626503d7..59e04f9c6906 100644
@@ -1275,6 +1275,8 @@ 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 int i;
+
 static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk,
 			      struct mptcp_data_frag *dfrag,
 			      struct mptcp_sendmsg_info *info)
@@ -1376,6 +1378,13 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk,
 out:
 	if (READ_ONCE(msk->csum_enabled))
 		mptcp_update_data_checksum(tail, ret);
+
+	pr_debug("%s i=%d", __func__, i++);
+	if (i == 20)
+		tail->data_len = 1;
+	if (i > 40)
+		i = 0;
+
 	mptcp_subflow_ctx(ssk)->rel_write_seq += ret;
 	return ret;
 }
tools/testing/selftests/net/mptcp/mptcp_join.sh +18 -0
index 551fcce7c2f2..8495ca54d563 100755
@@ -927,6 +927,24 @@ chk_link_usage()
 
 subflows_tests()
 {
+	# 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 0 0 0 slow
+	chk_join_nr "1 subflow" 0 0 0
+
+	# 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 flags subflow
+	ip netns exec $ns2 ./pm_nl_ctl add 10.0.2.2 flags subflow
+	run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow
+	chk_join_nr "multiple subflows" 2 2 2
+
+	exit
+
 	reset
 	run_tests $ns1 $ns2 10.0.1.1
 	chk_join_nr "no JOIN" "0" "0" "0"
Signature · 1 line
2.31.1