Skip to contentSkip to conversation

mptcp: support for rfc6824 MP CAPABLE hanshake

PATCH In review Christoph Paasch 3 participants 6 messages Dec 5, 2019 – Dec 6, 2019

Subsystems (3)
lore
Share & tools
lore

Christoph Paasch

author
#0 lore raw

v3 cover mptcp: support for rfc6824 MP CAPABLE hanshake

Third iteration of the v1 MP_CAPABLE handshake, incorporating the feedback we got from Peter & Matt.

The patches apply just before "mptcp: add basic kselftest for mptcp".

Christoph Paasch (2):
mptcp: parse and emit MP_CAPABLE option according to v1 spec.
mptcp: process MP_CAPABLE data option.

Paolo Abeni (1):
mptcp: move from sha1 (v0) to sha256 (v1)

 include/linux/tcp.h   |   3 +-
 include/net/mptcp.h   |  11 +-
 net/ipv4/tcp_input.c  |   2 +-
 net/ipv4/tcp_output.c |   2 +-
 net/mptcp/Kconfig     |  10 ++
 net/mptcp/crypto.c    | 139 +++++++++++++++----------
 net/mptcp/options.c   | 232 ++++++++++++++++++++++++++++++++----------
 net/mptcp/protocol.c  |  22 ++--
 net/mptcp/protocol.h  |  20 ++--
 net/mptcp/subflow.c   |  43 +++++++-
 10 files changed, 354 insertions(+), 130 deletions(-)
Signature · 1 line
2.23.0
author
#1 lore raw

PATCH v3 1/3 mptcp: move from sha1 (v0) to sha256 (v1)

From: Paolo Abeni <pabeni(a)redhat.com>

For simplicity's sake use directly sha256 primitives (and pull them as a required build dep).
Add optional, boot-time self-tests for the hmac function.

Signed-off-by Paolo Abeni <pabeni(a)redhat.com>
---
 net/mptcp/Kconfig    |  10 ++++
 net/mptcp/crypto.c   | 139 ++++++++++++++++++++++++++-----------------
 net/mptcp/options.c  |   9 ++-
 net/mptcp/protocol.h |   4 +-
 4 files changed, 103 insertions(+), 59 deletions(-)
net/mptcp/Kconfig +10 -0
index c1a99f07a4cd..5db56d2218c5 100644
@@ -3,6 +3,7 @@ config MPTCP
 	bool "MPTCP: Multipath TCP"
 	depends on INET
 	select SKB_EXTENSIONS
+	select CRYPTO_LIB_SHA256
 	help
 	  Multipath TCP (MPTCP) connections send and receive data over multiple
 	  subflows in order to utilize multiple network paths. Each subflow
@@ -14,3 +15,12 @@ config MPTCP_IPV6
 	depends on MPTCP
 	select IPV6
 	default y
+
+config MPTCP_HMAC_TEST
+	bool "Tests for MPTCP HMAC implementation"
+	default n
+	help
+	  This option enable boot time self-test for the HMAC implementation
+	  used by the MPTCP code
+
+	  Say N if you are unsure.
net/mptcp/crypto.c +84 -55

176 lines not on this page · raw message

net/mptcp/options.c +7 -2
index b832be01de6a..497fba88ed52 100644
@@ -9,6 +9,11 @@
 #include <net/mptcp.h>
 #include "protocol.h"
 
+static bool mptcp_cap_flag_sha256(u8 flags)
+{
+	return (flags & MPTCP_CAP_FLAG_MASK) == MPTCP_CAP_HMAC_SHA256;
+}
+
 void mptcp_parse_option(const unsigned char *ptr, int opsize,
 			struct tcp_options_received *opt_rx)
 {
@@ -33,7 +38,7 @@ void mptcp_parse_option(const unsigned char *ptr, int opsize,
 			break;
 
 		mp_opt->flags = *ptr++;
-		if (!((mp_opt->flags & MPTCP_CAP_FLAG_MASK) == MPTCP_CAP_HMAC_SHA1) ||
+		if (!mptcp_cap_flag_sha256(mp_opt->flags) ||
 		    (mp_opt->flags & MPTCP_CAP_EXTENSIBILITY))
 			break;
 
@@ -468,7 +473,7 @@ void mptcp_write_options(__be32 *ptr, struct mptcp_out_options *opts)
 		*ptr++ = htonl((TCPOPT_MPTCP << 24) | (len << 16) |
 			       (MPTCPOPT_MP_CAPABLE << 12) |
 			       ((MPTCP_VERSION_MASK & 0) << 8) |
-			       MPTCP_CAP_HMAC_SHA1);
+			       MPTCP_CAP_HMAC_SHA256);
 		put_unaligned_be64(opts->sndr_key, ptr);
 		ptr += 2;
 		if ((OPTION_MPTCP_MPC_SYNACK |
net/mptcp/protocol.h +2 -2
index 542aa9b67a60..dcdd3dcd19c6 100644
@@ -41,7 +41,7 @@
 #define MPTCP_VERSION_MASK	(0x0F)
 #define MPTCP_CAP_CHECKSUM_REQD	BIT(7)
 #define MPTCP_CAP_EXTENSIBILITY	BIT(6)
-#define MPTCP_CAP_HMAC_SHA1	BIT(0)
+#define MPTCP_CAP_HMAC_SHA256	BIT(0)
 #define MPTCP_CAP_FLAG_MASK	(0x3F)
 
 /* MPTCP DSS flags */
@@ -201,7 +201,7 @@ static inline void mptcp_crypto_key_gen_sha(u64 *key, u32 *token, u64 *idsn)
 }
 
 void mptcp_crypto_hmac_sha(u64 key1, u64 key2, u32 nonce1, u32 nonce2,
-			   u32 *hash_out);
+			   void *hash_out);
 
 static inline struct mptcp_ext *mptcp_get_ext(struct sk_buff *skb)
 {
Signature · 1 line
2.23.0
author
#2 lore raw

PATCH v3 2/3 mptcp: parse and emit MP_CAPABLE option according to v1 spec.

In reply to Christoph Paasch

This implements MP_CAPABLE options parsing and writing according to the RFC 6824 bis - MPTCP v1.
Local key is sent on syn/ack, and both keys are sent on 3rd ack. MP_CAPABLE messages len are updated accordingly.
We need the skbuff to emit correctly the above, so we push the skbuff struct as an argument all the way from tcp code to the relevant mptcp callbacks.

When processing incoming MP_CAPABLE + data, build a full blown DSS-like map info, to simplify later processing.
On child socket creation, we need to record the remote key, if available.

Signed-off-by Christoph Paasch <cpaasch(a)apple.com>
---
 include/linux/tcp.h   |   3 +-
 include/net/mptcp.h   |  11 +--
 net/ipv4/tcp_input.c  |   2 +-
 net/ipv4/tcp_output.c |   2 +-
 net/mptcp/options.c   | 176 ++++++++++++++++++++++++++++++++----------
 net/mptcp/protocol.c  |   2 +-
 net/mptcp/protocol.h  |   8 +-
 net/mptcp/subflow.c   |  14 +++-
 8 files changed, 165 insertions(+), 53 deletions(-)
include/linux/tcp.h +2 -1
index 4b3ab4226ba8..d03d3fbd6a01 100644
@@ -114,7 +114,8 @@ struct tcp_options_received {
 			data_fin:1,
 			use_ack:1,
 			ack64:1,
-			__unused:3;
+			mpc_map:1,
+			__unused:2;
 	} mptcp;
 #endif
 };
include/net/mptcp.h +6 -5
index 6349c68e380b..0367580c2698 100644
@@ -23,7 +23,8 @@ struct mptcp_ext {
 			data_fin:1,
 			use_ack:1,
 			ack64:1,
-			__unused:2;
+			mpc_map:1,
+			__unused:1;
 };
 
 struct mptcp_out_options {
@@ -49,10 +50,10 @@ static inline bool rsk_is_mptcp(const struct request_sock *req)
 	return tcp_rsk(req)->is_mptcp;
 }
 
-void mptcp_parse_option(const unsigned char *ptr, int opsize,
-			struct tcp_options_received *opt_rx);
-bool mptcp_syn_options(struct sock *sk, unsigned int *size,
-		       struct mptcp_out_options *opts);
+void mptcp_parse_option(const struct sk_buff *skb, const unsigned char *ptr,
+			int opsize, struct tcp_options_received *opt_rx);
+bool mptcp_syn_options(struct sock *sk, const struct sk_buff *skb,
+		       unsigned int *size, struct mptcp_out_options *opts);
 void mptcp_rcv_synsent(struct sock *sk);
 bool mptcp_synack_options(const struct request_sock *req, unsigned int *size,
 			  struct mptcp_out_options *opts);
net/ipv4/tcp_input.c +1 -1
index d1ab9edfb764..16bd46a097d5 100644
@@ -3922,7 +3922,7 @@ void tcp_parse_options(const struct net *net,
 				break;
 #endif
 			case TCPOPT_MPTCP:
-				mptcp_parse_option(ptr, opsize, opt_rx);
+				mptcp_parse_option(skb, ptr, opsize, opt_rx);
 				break;
 
 			case TCPOPT_FASTOPEN:
net/ipv4/tcp_output.c +1 -1
index 8b2f2a8b9a23..82ebb1a4d669 100644
@@ -682,7 +682,7 @@ static unsigned int tcp_syn_options(struct sock *sk, struct sk_buff *skb,
 	if (sk_is_mptcp(sk)) {
 		unsigned int size;
 
-		if (mptcp_syn_options(sk, &size, &opts->mptcp)) {
+		if (mptcp_syn_options(sk, skb, &size, &opts->mptcp)) {
 			opts->options |= OPTION_MPTCP;
 			remaining -= size;
 		}
net/mptcp/options.c +136 -40

279 lines not on this page · raw message

net/mptcp/protocol.c +1 -1
index bef21be6600f..a34cb2773d95 100644
@@ -707,7 +707,7 @@ static struct socket *mptcp_socket_create_get(struct mptcp_sock *msk)
 	msk->subflow = ssock;
 	subflow = mptcp_subflow_ctx(msk->subflow->sk);
 	subflow->request_mptcp = 1; /* @@ if MPTCP enabled */
-	subflow->request_version = 0; /* currently only v0 supported */
+	subflow->request_version = 1; /* only v1 supported */
 
 	sock_hold(ssock->sk);
 
net/mptcp/protocol.h +6 -2
index dcdd3dcd19c6..d1eb086e75bf 100644
@@ -11,6 +11,8 @@
 #include <linux/tcp.h>
 #include <net/inet_connection_sock.h>
 
+#define MPTCP_SUPPORTED_VERSION	1
+
 /* MPTCP option bits */
 #define OPTION_MPTCP_MPC_SYN	BIT(0)
 #define OPTION_MPTCP_MPC_SYNACK	BIT(1)
@@ -27,9 +29,10 @@
 #define MPTCPOPT_MP_FASTCLOSE	7
 
 /* MPTCP suboption lengths */
-#define TCPOLEN_MPTCP_MPC_SYN		12
-#define TCPOLEN_MPTCP_MPC_SYNACK	20
+#define TCPOLEN_MPTCP_MPC_SYN		4
+#define TCPOLEN_MPTCP_MPC_SYNACK	12
 #define TCPOLEN_MPTCP_MPC_ACK		20
+#define TCPOLEN_MPTCP_MPC_ACK_DATA	22
 #define TCPOLEN_MPTCP_DSS_BASE		4
 #define TCPOLEN_MPTCP_DSS_ACK32		4
 #define TCPOLEN_MPTCP_DSS_ACK64		8
@@ -103,6 +106,7 @@ struct mptcp_subflow_context {
 	u64	remote_key;
 	u64	idsn;
 	u64	map_seq;
+	u32	snd_isn;
 	u32	token;
 	u32	rel_write_seq;
 	u32	map_subflow_seq;
net/mptcp/subflow.c +12 -2
index b08d42d65ea0..59235f940b46 100644
@@ -81,7 +81,6 @@ static void subflow_init_req(struct request_sock *req,
 			subflow_req->version = listener->request_version;
 		else
 			subflow_req->version = rx_opt.mptcp.version;
-		subflow_req->remote_key = rx_opt.mptcp.sndr_key;
 		subflow_req->ssn_offset = TCP_SKB_CB(skb)->seq;
 	}
 }
@@ -183,11 +182,22 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,
 					  bool *own_req)
 {
 	struct mptcp_subflow_context *listener = mptcp_subflow_ctx(sk);
+	struct mptcp_subflow_request_sock *subflow_req;
+	struct tcp_options_received opt_rx;
 	struct sock *child;
 
 	pr_debug("listener=%p, req=%p, conn=%p", listener, req, listener->conn);
 
-	/* if the sk is MP_CAPABLE, we already received the client key */
+	/* if the sk is MP_CAPABLE, we need to fetch the client key */
+	subflow_req = mptcp_subflow_rsk(req);
+	if (subflow_req->mp_capable) {
+		opt_rx.mptcp.mp_capable = 0;
+		mptcp_get_options(skb, &opt_rx);
+		if (!opt_rx.mptcp.mp_capable)
+			subflow_req->mp_capable = 0;
+		else
+			subflow_req->remote_key = opt_rx.mptcp.sndr_key;
+	}
 
 	child = listener->icsk_af_ops->syn_recv_sock(sk, skb, req, dst,
 						     req_unhash, own_req);
Signature · 1 line
2.23.0
author
#3 lore raw

PATCH v3 3/3 mptcp: process MP_CAPABLE data option.

In reply to Christoph Paasch

This patch implement the handling of MP_CAPABLE + data option, as per RFC 6824 bis - MPTCP v1.

On the server side we can receive the remote key after that the connection is established. We need to explicitly track the 'missing remote key' status and avoid emtting mptcp ack till we get such info.

When a late/retransmitted/OoO pkt carrying MP_CAPABLE[+data] option is received, we have to propagate the mptcp seq number info to the msk socket. To avoid ABBA locking issue, explicitly check for that in recvmsg(), where we own msk and subflow sock locks.

The above also means that an established mp_capable subflow - still waiting for the remote key - can be 'downgraded' to plain TCP.

Such change could potentially block forever reader waiting for new data - as they hook to msk, while later wake-up after the downgrade will be on subflow only.

The above issue is not handled here, we likely have to get rid of msk->fallback to handle that cleanly.

v1 -> v2:
- mp_capable_map -> mpc_map
- comment fix

Signed-off-by Christoph Paasch <cpaasch(a)apple.com>
---
 net/mptcp/options.c  | 47 +++++++++++++++++++++++++++++++++++---------
 net/mptcp/protocol.c | 20 +++++++++++++------
 net/mptcp/protocol.h |  8 ++++++--
 net/mptcp/subflow.c  | 37 +++++++++++++++++++++++++++++-----
 4 files changed, 90 insertions(+), 22 deletions(-)
net/mptcp/options.c +38 -9
index def1f4e6b0b0..bc3352af6c15 100644
@@ -303,6 +303,7 @@ void mptcp_rcv_synsent(struct sock *sk)
 	pr_debug("subflow=%p", subflow);
 	if (subflow->request_mptcp && tp->rx_opt.mptcp.mp_capable) {
 		subflow->mp_capable = 1;
+		subflow->can_ack = 1;
 		subflow->remote_key = tp->rx_opt.mptcp.sndr_key;
 	}
 }
@@ -421,6 +422,11 @@ static bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb,
 			mptcp_write_data_fin(subflow, &opts->ext_copy);
 	}
 
+	opts->ext_copy.use_ack = 0;
+	msk = mptcp_sk(subflow->conn);
+	if (!msk || !READ_ONCE(msk->can_ack))
+		return false;
+
 	ack_size = TCPOLEN_MPTCP_DSS_ACK64;
 
 	/* Add kind/length/subtype/flag overhead if mapping is not populated */
@@ -429,15 +435,7 @@ static bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb,
 
 	dss_size += ack_size;
 
-	msk = mptcp_sk(mptcp_subflow_ctx(sk)->conn);
-	if (msk) {
-		opts->ext_copy.data_ack = msk->ack_seq;
-	} else {
-		mptcp_crypto_key_sha(mptcp_subflow_ctx(sk)->remote_key,
-				     NULL, &opts->ext_copy.data_ack);
-		opts->ext_copy.data_ack++;
-	}
-
+	opts->ext_copy.data_ack = msk->ack_seq;
 	opts->ext_copy.ack64 = 1;
 	opts->ext_copy.use_ack = 1;
 
@@ -489,6 +487,35 @@ bool mptcp_synack_options(const struct request_sock *req, unsigned int *size,
 	return false;
 }
 
+static bool check_fourth_ack(struct mptcp_subflow_context *subflow,
+			     struct sk_buff *skb,
+			     struct mptcp_options_received *mp_opt)
+{
+	/* here we can process OoO, in-window pkts, only in-sequence 4th ack
+	 * are relevant
+	 */
+	if (likely(subflow->fourth_ack ||
+		   TCP_SKB_CB(skb)->seq != subflow->ssn_offset + 1))
+		return true;
+
+	if (mp_opt->use_ack)
+		subflow->fourth_ack = 1;
+
+	if (subflow->can_ack)
+		return true;
+
+	/* If the first established packet does not contain MP_CAPABLE + data
+	 * then fallback to TCP
+	 */
+	if (!mp_opt->mp_capable) {
+		subflow->mp_capable = 0;
+		return false;
+	}
+	subflow->remote_key = mp_opt->sndr_key;
+	subflow->can_ack = 1;
+	return true;
+}
+
 void mptcp_incoming_options(struct sock *sk, struct sk_buff *skb,
 			    struct tcp_options_received *opt_rx)
 {
@@ -500,6 +527,8 @@ void mptcp_incoming_options(struct sock *sk, struct sk_buff *skb,
 		return;
 
 	mp_opt = &opt_rx->mptcp;
+	if (!check_fourth_ack(subflow, skb, mp_opt))
+		return;
 
 	if (!mp_opt->dss)
 		return;
net/mptcp/protocol.c +14 -6
index a34cb2773d95..2c64d9414f23 100644
@@ -347,6 +347,12 @@ static int mptcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
 
 		lock_sock(ssk);
 		while (mptcp_subflow_data_available(ssk) && !done) {
+			if (unlikely(!msk->can_ack)) {
+				msk->remote_key = subflow->remote_key;
+				msk->ack_seq = subflow->map_seq;
+				msk->can_ack = true;
+			}
+
 			/* try to read as much data as available */
 			map_remaining = subflow->map_data_len -
 					mptcp_subflow_get_map_offset(subflow);
@@ -505,17 +511,20 @@ static struct sock *mptcp_accept(struct sock *sk, int flags, int *err,
 		__mptcp_init_sock(new_mptcp_sock);
 
 		msk = mptcp_sk(new_mptcp_sock);
-		msk->remote_key = subflow->remote_key;
 		msk->local_key = subflow->local_key;
 		msk->token = subflow->token;
 
 		mptcp_token_update_accept(new_sock->sk, new_mptcp_sock);
 		msk->subflow = NULL;
 
-		mptcp_crypto_key_sha(msk->remote_key, NULL, &ack_seq);
 		msk->write_seq = subflow->idsn + 1;
-		ack_seq++;
-		msk->ack_seq = ack_seq;
+		if (subflow->can_ack) {
+			msk->can_ack = true;
+			msk->remote_key = subflow->remote_key;
+			mptcp_crypto_key_sha(msk->remote_key, NULL, &ack_seq);
+			ack_seq++;
+			msk->ack_seq = ack_seq;
+		}
 		newsk = new_mptcp_sock;
 		list_add(&subflow->node, &msk->conn_list);
 		bh_unlock_sock(new_mptcp_sock);
@@ -527,8 +536,6 @@ static struct sock *mptcp_accept(struct sock *sk, int flags, int *err,
 		 * the receive path and process the pending ones
 		 */
 		lock_sock(new_sock->sk);
-		subflow->map_seq = ack_seq;
-		subflow->map_subflow_seq = 1;
 		subflow->rel_write_seq = 1;
 		subflow->tcp_sock = new_sock;
 		subflow->conn = new_mptcp_sock;
@@ -656,6 +663,7 @@ void mptcp_finish_connect(struct sock *sk, int mp_capable)
 		msk->write_seq = subflow->idsn + 1;
 		ack_seq++;
 		msk->ack_seq = ack_seq;
+		msk->can_ack = 1;
 		subflow->map_seq = ack_seq;
 		subflow->map_subflow_seq = 1;
 		subflow->rel_write_seq = 1;
net/mptcp/protocol.h +6 -2
index d1eb086e75bf..010056a436f3 100644
@@ -68,6 +68,7 @@ struct mptcp_sock {
 	u64		ack_seq;
 	u32		token;
 	unsigned long	flags;
+	bool		can_ack;
 	struct list_head conn_list;
 	struct socket	*subflow; /* outgoing connect/listener/!mp_capable */
 };
@@ -82,9 +83,10 @@ static inline struct mptcp_sock *mptcp_sk(const struct sock *sk)
 
 struct mptcp_subflow_request_sock {
 	struct	tcp_request_sock sk;
-	u8	mp_capable : 1,
+	u16	mp_capable : 1,
 		mp_join : 1,
 		backup : 1,
+		remote_key_valid : 1,
 		version : 4;
 	u64	local_key;
 	u64	remote_key;
@@ -118,8 +120,10 @@ struct mptcp_subflow_context {
 		fourth_ack : 1,	    /* send initial DSS */
 		conn_finished : 1,
 		map_valid : 1,
+		mpc_map : 1,
 		data_avail : 1,
-		rx_eof : 1;
+		rx_eof : 1,
+		can_ack : 1;	    /* only after processing the remote a key */
 
 	struct	socket *tcp_sock;   /* underlying tcp_sock */
 	struct	sock *conn;	    /* parent mptcp_sock */
net/mptcp/subflow.c +32 -5
index 59235f940b46..f4370764013d 100644
@@ -61,6 +61,7 @@ static void subflow_init_req(struct request_sock *req,
 	mptcp_get_options(skb, &rx_opt);
 
 	subflow_req->mp_capable = 0;
+	subflow_req->remote_key_valid = 0;
 
 #ifdef CONFIG_TCP_MD5SIG
 	/* no MPTCP if MD5SIG is enabled on this socket or we may run out of
@@ -188,17 +189,28 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,
 
 	pr_debug("listener=%p, req=%p, conn=%p", listener, req, listener->conn);
 
-	/* if the sk is MP_CAPABLE, we need to fetch the client key */
+	/* if the sk is MP_CAPABLE, we try to fetch the client key */
 	subflow_req = mptcp_subflow_rsk(req);
 	if (subflow_req->mp_capable) {
+		if (TCP_SKB_CB(skb)->seq != subflow_req->ssn_offset + 1) {
+			/* here we can receive and accept an in-window,
+			 * out-of-order pkt, which will not carry the MP_CAPABLE
+			 * opt even on mptcp enabled paths
+			 */
+			goto create_child;
+		}
+
 		opt_rx.mptcp.mp_capable = 0;
 		mptcp_get_options(skb, &opt_rx);
-		if (!opt_rx.mptcp.mp_capable)
-			subflow_req->mp_capable = 0;
-		else
+		if (opt_rx.mptcp.mp_capable) {
 			subflow_req->remote_key = opt_rx.mptcp.sndr_key;
+			subflow_req->remote_key_valid = 1;
+		} else {
+			subflow_req->mp_capable = 0;
+		}
 	}
 
+create_child:
 	child = listener->icsk_af_ops->syn_recv_sock(sk, skb, req, dst,
 						     req_unhash, own_req);
 
@@ -377,6 +389,7 @@ static enum mapping_status get_mapping_status(struct sock *ssk)
 	subflow->map_subflow_seq = mpext->subflow_seq;
 	subflow->map_data_len = data_len;
 	subflow->map_valid = 1;
+	subflow->mpc_map = mpext->mpc_map;
 	pr_debug("new map seq=%llu subflow_seq=%u data_len=%u",
 		 subflow->map_seq, subflow->map_subflow_seq,
 		 subflow->map_data_len);
@@ -428,6 +441,16 @@ static bool subflow_check_data_avail(struct sock *ssk)
 		if (WARN_ON_ONCE(!skb))
 			return false;
 
+		/* if msk lacks the remote key, this subflow must provide an
+		 * MP_CAPABLE-based mapping
+		 */
+		if (unlikely(!READ_ONCE(msk->ack_seq))) {
+			if (subflow->mpc_map)
+				break;
+			ssk->sk_err = EBADMSG;
+			goto fatal;
+		}
+
 		old_ack = READ_ONCE(msk->ack_seq);
 		ack_seq = mptcp_subflow_get_mapped_dsn(subflow);
 		pr_debug("msk ack_seq=%llx subflow ack_seq=%llx", old_ack,
@@ -665,8 +688,12 @@ static void subflow_ulp_clone(const struct request_sock *req,
 	new_ctx->tcp_sk_data_ready = old_ctx->tcp_sk_data_ready;
 
 	if (subflow_req->mp_capable) {
+		/* see comments in subflow_syn_recv_sock(), MPTCP connection
+		 * is fully established only after we receive the remote key
+		 */
 		new_ctx->mp_capable = 1;
-		new_ctx->fourth_ack = 1;
+		new_ctx->fourth_ack = subflow_req->remote_key_valid;
+		new_ctx->can_ack = subflow_req->remote_key_valid;
 		new_ctx->remote_key = subflow_req->remote_key;
 		new_ctx->local_key = subflow_req->local_key;
 		new_ctx->token = subflow_req->token;
Signature · 1 line
2.23.0
#4 lore raw
In reply to Christoph Paasch

Hi Christoph, Paolo, Peter,

Quoted 4 lines · Christoph Paasch

Third iteration of the v1 MP_CAPABLE handshake, incorporating the feedback we got from Peter & Matt.

The patches apply just before "mptcp: add basic kselftest for mptcp".

Thank you for the patches, reviews and support!

As discussed yesterday, I applied the 3 new patches just *after* "mptcp:
add basic kselftest for mptcp".

- eb5a8192c95b: conflict in t/mptcp-Add-path-manager-interface
- 275bbf5f90ad: conflict in t/mptcp-Add-ADD_ADDR-handling
- 0bc741b10045: conflict in t/mptcp-Add-handling-of-incoming-MP_JOIN-requests
- 6b6db9f31531: conflict in t/mptcp-Add-handling-of-outgoing-MP_JOIN-requests
- bf2741a34a46: conflict in t/mptcp-update-per-unacked-sequence-on-pkt-reception
- 66f4bf4e2ebd: conflict in t/recv-make-DATA_READY-reflect-ssk-in-sequence-state
- b887804d061e..219f243dcb66: result
- 84384f90c00d: small fix suggested by Paolo, saw when doing the rebase, "squashed" in "mptcp: parse and emit MP_CAPABLE option according to v1 spec."
- 219f243dcb66..f254fde6968b: 2nd result (empty, normal)
- ba5637b5c223: fix compilation error without CONFIG_MPTCP, "squashed" in "mptcp: parse and emit MP_CAPABLE option according to v1 spec."
- f254fde6968b..048a73890db7: 3rd result
- 09dc9b79c639: avoid code duplication when validating MPC. After the small fix from above, we had a value potentially set two times.
- 048a73890db7..343c06fe2029: result

I just checked the compilations with and without MPTCP, selftests at the end of part 2 and at the end of the series. I didn't check that each commit compiles. Will do that when I have applied everything.

Cheers,
Matt

Signature · 5 lines
Matthieu Baerts | R&D Engineer
matthieu.baerts(a)tessares.net
Tessares SA | Hybrid Access Solutions
www.tessares.net
1 Avenue Jean Monnet, 1348 Louvain-la-Neuve, Belgium
#5 lore raw
Quoted 26 lines · Matthieu Baerts

Hi Christoph, Paolo, Peter,

Quoted 4 lines · Christoph Paasch

Third iteration of the v1 MP_CAPABLE handshake, incorporating the feedback we got from Peter & Matt.

The patches apply just before "mptcp: add basic kselftest for mptcp".

Thank you for the patches, reviews and support!

As discussed yesterday, I applied the 3 new patches just *after* "mptcp:
add basic kselftest for mptcp".

- eb5a8192c95b: conflict in t/mptcp-Add-path-manager-interface
- 275bbf5f90ad: conflict in t/mptcp-Add-ADD_ADDR-handling
- 0bc741b10045: conflict in t/mptcp-Add-handling-of-incoming-MP_JOIN-requests
- 6b6db9f31531: conflict in t/mptcp-Add-handling-of-outgoing-MP_JOIN-requests
- bf2741a34a46: conflict in t/mptcp-update-per-unacked-sequence-on-pkt-reception
- 66f4bf4e2ebd: conflict in t/recv-make-DATA_READY-reflect-ssk-in-sequence-state
- b887804d061e..219f243dcb66: result
- 84384f90c00d: small fix suggested by Paolo, saw when doing the rebase, "squashed" in "mptcp: parse and emit MP_CAPABLE option according to v1

Quoted 8 lines

spec."
- 219f243dcb66..f254fde6968b: 2nd result (empty, normal)
- ba5637b5c223: fix compilation error without CONFIG_MPTCP, "squashed" in "mptcp: parse and emit MP_CAPABLE option according to v1 spec."
- f254fde6968b..048a73890db7: 3rd result
- 09dc9b79c639: avoid code duplication when validating MPC. After the small fix from above, we had a value potentially set two times.
- 048a73890db7..343c06fe2029: result

Thank you for the great effort! conflict resolution LGTM!

I like quite a bit 09dc9b79c639!

Quoted 3 lines

I just checked the compilations with and without MPTCP, selftests at the end of part 2 and at the end of the series. I didn't check that each commit compiles. Will do that when I have applied everything.

I just tested rebuilding net/mptcp/ on every commit and that works fine.

Cheers,

Paolo