Skip to contentSkip to conversation

mptcp: disable mptcp when md5sig is set

PATCH Superseded Paolo Abeni 3 participants 14 messages Nov 14, 2019 – Nov 21, 2019

Subsystems (2)
lore
Share & tools
lore

Paolo Abeni

author
#0 lore raw

v3 cover mptcp: disable mptcp when md5sig is set

As per last public mtg discussion, md5sig will cause TCP option space exaustion. Without md5sig we can't exhaust the TCP option space.

This series explcitly disable MPTCP when md5sig is set, and cleanup later option len checks with the assumption that TCP option space exhaustion is not expected - add a single WARN_ON() for that.

v2 -> v3
- rebased
- fix mptcp_established_options() retvalue in patch 3

Paolo Abeni (1):
mptcp: move mp_capable initialization at subflow_init_req() start
mptcp: disable on req sk if MD5SIG is enabled
mptcp: warn once if exceeding tcp opt space for dss/mp_capable
mptcp: remove unneeded check in mptcp_established_options_mp()

Signature · 1 line
2.21.0
author
#1 lore raw

PATCH v3 1/1 mptcp: move mp_capable initialization at subflow_init_req() start

This will avoid moving the code in later patch and makes disabling with md5 easier

Squash-to: "mptcp: Create SUBFLOW socket for incoming connections"
Signed-off-by: Paolo Abeni <pabeni(a)redhat.com>

---
 net/mptcp/subflow.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/mptcp/subflow.c +2 -2
index 4a440420d9f2..c21a12600ab7 100644
@@ -31,6 +31,8 @@ static void subflow_init_req(struct request_sock *req,
 	memset(&rx_opt.mptcp, 0, sizeof(rx_opt.mptcp));
 	mptcp_get_options(skb, &rx_opt);
 
+	subflow_req->mp_capable = 0;
+
 	if (rx_opt.mptcp.mp_capable && listener->request_mptcp) {
 		subflow_req->mp_capable = 1;
 		if (rx_opt.mptcp.version >= listener->request_version)
@@ -38,8 +40,6 @@ static void subflow_init_req(struct request_sock *req,
 		else
 			subflow_req->version = rx_opt.mptcp.version;
 		subflow_req->remote_key = rx_opt.mptcp.sndr_key;
-	} else {
-		subflow_req->mp_capable = 0;
 	}
 }
 
Signature · 1 line
2.21.0
author
#2 lore raw

PATCH v3 2/4 mptcp: disable on req sk if MD5SIG is enabled

In reply to Paolo Abeni

Squash-to: mptcp: Create SUBFLOW socket for incoming connections
Signed-off-by: Paolo Abeni <pabeni(a)redhat.com>
---
v1 -> v2
- fix comment typo

---
 net/mptcp/protocol.c | 8 ++++++++
 net/mptcp/subflow.c  | 8 ++++++++
 2 files changed, 16 insertions(+)
net/mptcp/protocol.c +8 -0
index 4d74cc601d35..b2d6555117de 100644
@@ -339,6 +339,14 @@ static int mptcp_stream_connect(struct socket *sock, struct sockaddr *uaddr,
 	if (IS_ERR(ssock))
 		return PTR_ERR(ssock);
 
+#ifdef CONFIG_TCP_MD5SIG
+	/* no MPTCP if MD5SIG is enabled on this socket or we may run out of
+	 * TCP option space.
+	 */
+	if (rcu_access_pointer(tcp_sk(ssock->sk)->md5sig_info))
+		mptcp_subflow_ctx(ssock->sk)->request_mptcp = 0;
+#endif
+
 	err = ssock->ops->connect(ssock, uaddr, addr_len, flags);
 	sock_put(ssock->sk);
 	return err;
net/mptcp/subflow.c +8 -0
index c21a12600ab7..c3aec2c003e5 100644
@@ -33,6 +33,14 @@ static void subflow_init_req(struct request_sock *req,
 
 	subflow_req->mp_capable = 0;
 
+#ifdef CONFIG_TCP_MD5SIG
+	/* no MPTCP if MD5SIG is enabled on this socket or we may run out of
+	 * TCP option space.
+	 */
+	if (rcu_access_pointer(tcp_sk(sk_listener)->md5sig_info))
+		return;
+#endif
+
 	if (rx_opt.mptcp.mp_capable && listener->request_mptcp) {
 		subflow_req->mp_capable = 1;
 		if (rx_opt.mptcp.version >= listener->request_version)
Signature · 1 line
2.21.0
author
#3 lore raw

PATCH v3 3/4 mptcp: warn once if exceeding tcp opt space for dss/mp_capable

In reply to Paolo Abeni

since such option will always fit the tcp header, modulo bugs

Squash-to: "mptcp: Write MPTCP DSS headers to outgoing data packets"
Signed-off-by: Paolo Abeni <pabeni(a)redhat.com>
---
v2 -> v3:
- fix mptcp_established_options() return value
v1 -> v2:
- fix typo in commit message

---
 net/mptcp/options.c | 71 ++++++++++++++++++++-------------------------
 1 file changed, 31 insertions(+), 40 deletions(-)
net/mptcp/options.c +31 -40
index fa10086b5b74..202514088067 100644
@@ -200,7 +200,7 @@ static bool mptcp_established_options_mp(struct sock *sk, unsigned int *size,
 {
 	struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
 
-	if (!subflow->fourth_ack && remaining >= TCPOLEN_MPTCP_MPC_ACK) {
+	if (!subflow->fourth_ack) {
 		opts->suboptions = OPTION_MPTCP_MPC_ACK;
 		opts->sndr_key = subflow->local_key;
 		opts->rcvr_key = subflow->remote_key;
@@ -220,6 +220,7 @@ static bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb,
 {
 	unsigned int dss_size = 0;
 	struct mptcp_ext *mpext;
+	struct mptcp_sock *msk;
 	unsigned int ack_size;
 
 	mpext = skb ? mptcp_get_ext(skb) : NULL;
@@ -229,15 +230,10 @@ static bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb,
 
 		map_size = TCPOLEN_MPTCP_DSS_BASE + TCPOLEN_MPTCP_DSS_MAP64;
 
-		if (map_size <= remaining) {
-			remaining -= map_size;
-			dss_size = map_size;
-			if (mpext)
-				opts->ext_copy = *mpext;
-		} else {
-			opts->ext_copy.use_map = 0;
-			WARN_ONCE(1, "MPTCP: Map dropped");
-		}
+		remaining -= map_size;
+		dss_size = map_size;
+		if (mpext)
+			opts->ext_copy = *mpext;
 	}
 
 	ack_size = TCPOLEN_MPTCP_DSS_ACK64;
@@ -246,29 +242,19 @@ static bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb,
 	if (dss_size == 0)
 		ack_size += TCPOLEN_MPTCP_DSS_BASE;
 
-	if (ack_size <= remaining) {
-		struct mptcp_sock *msk;
-
-		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_sha1(mptcp_subflow_ctx(sk)->remote_key,
-					      NULL, &opts->ext_copy.data_ack);
-			opts->ext_copy.data_ack++;
-		}
+	dss_size += ack_size;
 
-		opts->ext_copy.ack64 = 1;
-		opts->ext_copy.use_ack = 1;
+	msk = mptcp_sk(mptcp_subflow_ctx(sk)->conn);
+	if (msk) {
+		opts->ext_copy.data_ack = msk->ack_seq;
 	} else {
-		opts->ext_copy.use_ack = 0;
-		WARN(1, "MPTCP: Ack dropped");
+		mptcp_crypto_key_sha1(mptcp_subflow_ctx(sk)->remote_key,
+				      NULL, &opts->ext_copy.data_ack);
+		opts->ext_copy.data_ack++;
 	}
 
-	if (!dss_size)
-		return false;
+	opts->ext_copy.ack64 = 1;
+	opts->ext_copy.use_ack = 1;
 
 	*size = ALIGN(dss_size, 4);
 	return true;
@@ -279,22 +265,27 @@ bool mptcp_established_options(struct sock *sk, struct sk_buff *skb,
 			       struct mptcp_out_options *opts)
 {
 	unsigned int opt_size = 0;
+	bool ret = false;
 
 	if (!mptcp_subflow_ctx(sk)->mp_capable)
 		return false;
 
-	if (mptcp_established_options_mp(sk, &opt_size, remaining, opts)) {
-		*size += opt_size;
-		remaining -= opt_size;
-		return true;
-	} else if (mptcp_established_options_dss(sk, skb, &opt_size, remaining,
-						 opts)) {
-		*size += opt_size;
-		remaining -= opt_size;
-		return true;
-	}
+	if (mptcp_established_options_mp(sk, &opt_size, remaining, opts))
+		ret = true;
+	else if (mptcp_established_options_dss(sk, skb, &opt_size, remaining,
+						 opts))
+		ret = true;
 
-	return false;
+	/* we reserved enough space for the above options, and exceeding the
+	 * TCP option space would be fatal
+	 */
+	if (WARN_ON_ONCE(opt_size > remaining))
+		return false;
+
+	*size += opt_size;
+	remaining -= opt_size;
+
+	return ret;
 }
 
 bool mptcp_synack_options(const struct request_sock *req, unsigned int *size,
Signature · 1 line
2.21.0
#4 lore raw

[MPTCP] Re: [PATCH v3 3/4] mptcp: warn once if exceeding tcp opt space for dss/mp_capable

Hi Paolo -

Quoted 18 lines · Paolo Abeni

since such option will always fit the tcp header, modulo bugs

Squash-to: "mptcp: Write MPTCP DSS headers to outgoing data packets"
Signed-off-by: Paolo Abeni <pabeni(a)redhat.com>
---
v2 -> v3:
- fix mptcp_established_options() return value
v1 -> v2:
- fix typo in commit message

---
 net/mptcp/options.c | 71 ++++++++++++++++++++-------------------------
 1 file changed, 31 insertions(+), 40 deletions(-)
net/mptcp/options.c +0 -0
index fa10086b5b74..202514088067 100644

net/mptcp/options.c static bool mptcp_established_options_mp(struct sock *sk, unsigned int *size, · line 206

Quoted 8 lines
net/mptcp/options.c +1 -1
@@ -200,7 +200,7 @@ static bool mptcp_established_options_mp(struct sock *sk, unsigned int *size,
 {
 	struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
 
-	if (!subflow->fourth_ack && remaining >= TCPOLEN_MPTCP_MPC_ACK) {
+	if (!subflow->fourth_ack) {
 		opts->suboptions = OPTION_MPTCP_MPC_ACK;
 		opts->sndr_key = subflow->local_key;
 		opts->rcvr_key = subflow->remote_key;

Or add

	else  {
		WARN_ON_ONCE()
	}

here, see final comment below.

Quoted 88 lines
net/mptcp/options.c +17 -38
@@ -220,6 +220,7 @@ static bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb,
 {
 	unsigned int dss_size = 0;
 	struct mptcp_ext *mpext;
+	struct mptcp_sock *msk;
 	unsigned int ack_size;
 
 	mpext = skb ? mptcp_get_ext(skb) : NULL;
@@ -229,15 +230,10 @@ static bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb,
 
 		map_size = TCPOLEN_MPTCP_DSS_BASE + TCPOLEN_MPTCP_DSS_MAP64;
 
-		if (map_size <= remaining) {
-			remaining -= map_size;
-			dss_size = map_size;
-			if (mpext)
-				opts->ext_copy = *mpext;
-		} else {
-			opts->ext_copy.use_map = 0;
-			WARN_ONCE(1, "MPTCP: Map dropped");
-		}
+		remaining -= map_size;
+		dss_size = map_size;
+		if (mpext)
+			opts->ext_copy = *mpext;
 	}
 
 	ack_size = TCPOLEN_MPTCP_DSS_ACK64;
@@ -246,29 +242,19 @@ static bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb,
 	if (dss_size == 0)
 		ack_size += TCPOLEN_MPTCP_DSS_BASE;
 
-	if (ack_size <= remaining) {
-		struct mptcp_sock *msk;
-
-		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_sha1(mptcp_subflow_ctx(sk)->remote_key,
-					      NULL, &opts->ext_copy.data_ack);
-			opts->ext_copy.data_ack++;
-		}
+	dss_size += ack_size;
 
-		opts->ext_copy.ack64 = 1;
-		opts->ext_copy.use_ack = 1;
+	msk = mptcp_sk(mptcp_subflow_ctx(sk)->conn);
+	if (msk) {
+		opts->ext_copy.data_ack = msk->ack_seq;
 	} else {
-		opts->ext_copy.use_ack = 0;
-		WARN(1, "MPTCP: Ack dropped");
+		mptcp_crypto_key_sha1(mptcp_subflow_ctx(sk)->remote_key,
+				      NULL, &opts->ext_copy.data_ack);
+		opts->ext_copy.data_ack++;
 	}
 
-	if (!dss_size)
-		return false;
+	opts->ext_copy.ack64 = 1;
+	opts->ext_copy.use_ack = 1;
 
 	*size = ALIGN(dss_size, 4);
 	return true;
@@ -279,22 +265,27 @@ bool mptcp_established_options(struct sock *sk, struct sk_buff *skb,
 			       struct mptcp_out_options *opts)
 {
 	unsigned int opt_size = 0;
+	bool ret = false;
 
 	if (!mptcp_subflow_ctx(sk)->mp_capable)
 		return false;
 
-	if (mptcp_established_options_mp(sk, &opt_size, remaining, opts)) {
-		*size += opt_size;
-		remaining -= opt_size;
-		return true;
-	} else if (mptcp_established_options_dss(sk, skb, &opt_size, remaining,
-						 opts)) {
-		*size += opt_size;
-		remaining -= opt_size;
-		return true;
-	}
+	if (mptcp_established_options_mp(sk, &opt_size, remaining, opts))
+		ret = true;

net/mptcp/options.c bool mptcp_established_options(struct sock *sk, struct sk_buff *skb, · line 283

Quoted 10 lines
net/mptcp/options.c +8 -1
+	else if (mptcp_established_options_dss(sk, skb, &opt_size, remaining,
+						 opts))
+		ret = true;
 
-	return false;
+	/* we reserved enough space for the above options, and exceeding the
+	 * TCP option space would be fatal
+	 */
+	if (WARN_ON_ONCE(opt_size > remaining))
+		return false;

It seems to me, and maybe I am missing something, but all this change adds to existing functionality is showing this warning when mptcp_established_options_mp() fails due to lack of remaining option space. The small change I propose above does the same, yes?

I also think the logic here needs to be re-visited, since in both solutions if we want to send MP_CAPABLE and there isn't room we should fallback to TCP and not 'else if' the dss option.

Peter.

Quoted 7 lines
net/mptcp/options.c +4 -0
+	*size += opt_size;
+	remaining -= opt_size;
+
+	return ret;
 }
 
 bool mptcp_synack_options(const struct request_sock *req, unsigned int *size,
author
#5 lore raw

[MPTCP] Re: [PATCH v3 3/4] mptcp: warn once if exceeding tcp opt space for dss/mp_capable

Quoted 25 lines · Peter Krystad
Quoted 25 lines
net/mptcp/options.c +6 -10
@@ -279,22 +265,27 @@ bool mptcp_established_options(struct sock *sk, struct sk_buff *skb,
 			       struct mptcp_out_options *opts)
 {
 	unsigned int opt_size = 0;
+	bool ret = false;
 
 	if (!mptcp_subflow_ctx(sk)->mp_capable)
 		return false;
 
-	if (mptcp_established_options_mp(sk, &opt_size, remaining, opts)) {
-		*size += opt_size;
-		remaining -= opt_size;
-		return true;
-	} else if (mptcp_established_options_dss(sk, skb, &opt_size, remaining,
-						 opts)) {
-		*size += opt_size;
-		remaining -= opt_size;
-		return true;
-	}
+	if (mptcp_established_options_mp(sk, &opt_size, remaining, opts))
+		ret = true;
+	else if (mptcp_established_options_dss(sk, skb, &opt_size, remaining,
+						 opts))
+		ret = true;
 
Quoted 11 lines

net/mptcp/options.c bool mptcp_established_options(struct sock *sk, struct sk_buff *skb, · line 283

Quoted 6 lines
net/mptcp/options.c +5 -1
-	return false;
+	/* we reserved enough space for the above options, and exceeding the
+	 * TCP option space would be fatal
+	 */
+	if (WARN_ON_ONCE(opt_size > remaining))
+		return false;

It seems to me, and maybe I am missing something, but all this change adds to existing functionality is showing this warning when mptcp_established_options_mp() fails due to lack of remaining option space. The small change I propose above does the same, yes?

This change has a few goals:
- consolidating the check vs TCP option space exhaustion: there is a single warn_on(). Currently we have already one, and we need to add another one in mptcp_established_options_mp(), plus v1 support will require adding at least one more.
- documenting that we don't actually expect to exhaust TCP option space with MP_CAPABLE/MP_JOIN or DSS (as we don't send DSS and MP_CAPABLE together)
- the assumption that DSS will never exhaust TCP option space allow to simplify the code a bit.

yes, alternatively we can add more warn_on(). That will uglify a bit the v1 code.

Quoted 3 lines

I also think the logic here needs to be re-visited, since in both solutions if we want to send MP_CAPABLE and there isn't room we should fallback to TCP and not 'else if' the dss option.

TCP option exhaustion with MP_CAPABLE should only happen in case of bugs, I think WARN_ON() is enough.

Cheers,

Paolo

#6 lore raw

[MPTCP] Re: [PATCH v3 3/4] mptcp: warn once if exceeding tcp opt space for dss/mp_capable

Quoted 49 lines · Paolo Abeni
Quoted 25 lines · Peter Krystad
Quoted 25 lines
net/mptcp/options.c +6 -10
@@ -279,22 +265,27 @@ bool mptcp_established_options(struct sock *sk, struct sk_buff *skb,
 			       struct mptcp_out_options *opts)
 {
 	unsigned int opt_size = 0;
+	bool ret = false;
 
 	if (!mptcp_subflow_ctx(sk)->mp_capable)
 		return false;
 
-	if (mptcp_established_options_mp(sk, &opt_size, remaining, opts)) {
-		*size += opt_size;
-		remaining -= opt_size;
-		return true;
-	} else if (mptcp_established_options_dss(sk, skb, &opt_size, remaining,
-						 opts)) {
-		*size += opt_size;
-		remaining -= opt_size;
-		return true;
-	}
+	if (mptcp_established_options_mp(sk, &opt_size, remaining, opts))
+		ret = true;
+	else if (mptcp_established_options_dss(sk, skb, &opt_size, remaining,
+						 opts))
+		ret = true;
 
Quoted 11 lines

net/mptcp/options.c bool mptcp_established_options(struct sock *sk, struct sk_buff *skb, · line 283

Quoted 6 lines
net/mptcp/options.c +5 -1
-	return false;
+	/* we reserved enough space for the above options, and exceeding the
+	 * TCP option space would be fatal
+	 */
+	if (WARN_ON_ONCE(opt_size > remaining))
+		return false;

It seems to me, and maybe I am missing something, but all this change adds to existing functionality is showing this warning when mptcp_established_options_mp() fails due to lack of remaining option space. The small change I propose above does the same, yes?

This change has a few goals:
- consolidating the check vs TCP option space exhaustion: there is a single warn_on(). Currently we have already one, and we need to add another one in mptcp_established_options_mp(), plus v1 support will require adding at least one more.
- documenting that we don't actually expect to exhaust TCP option space with MP_CAPABLE/MP_JOIN or DSS (as we don't send DSS and MP_CAPABLE together)
- the assumption that DSS will never exhaust TCP option space allow to simplify the code a bit.

Quoted 2 lines

yes, alternatively we can add more warn_on(). That will uglify a bit the v1 code.

I guess I'm OK with a single WARN_ON. This patchset LGTM.

Peter.

Quoted 12 lines
Quoted 4 lines

I also think the logic here needs to be re-visited, since in both solutions if we want to send MP_CAPABLE and there isn't room we should fallback to TCP and not 'else if' the dss option.

TCP option exhaustion with MP_CAPABLE should only happen in case of bugs, I think WARN_ON() is enough.

Cheers,

Paolo

#7 lore raw

[MPTCP] Re: [PATCH v3 3/4] mptcp: warn once if exceeding tcp opt space for dss/mp_capable

Hi Paolo, Peter,

Quoted 50 lines · Peter Krystad
Quoted 49 lines · Paolo Abeni
Quoted 25 lines · Peter Krystad
Quoted 25 lines
net/mptcp/options.c +6 -10
@@ -279,22 +265,27 @@ bool mptcp_established_options(struct sock *sk, struct sk_buff *skb,
  			       struct mptcp_out_options *opts)
  {
  	unsigned int opt_size = 0;
+	bool ret = false;
 
  	if (!mptcp_subflow_ctx(sk)->mp_capable)
  		return false;
 
-	if (mptcp_established_options_mp(sk, &opt_size, remaining, opts)) {
-		*size += opt_size;
-		remaining -= opt_size;
-		return true;
-	} else if (mptcp_established_options_dss(sk, skb, &opt_size, remaining,
-						 opts)) {
-		*size += opt_size;
-		remaining -= opt_size;
-		return true;
-	}
+	if (mptcp_established_options_mp(sk, &opt_size, remaining, opts))
+		ret = true;
+	else if (mptcp_established_options_dss(sk, skb, &opt_size, remaining,
+						 opts))
+		ret = true;
 
Quoted 11 lines

net/mptcp/options.c bool mptcp_established_options(struct sock *sk, struct sk_buff *skb, · line 283

Quoted 6 lines
net/mptcp/options.c +5 -1
-	return false;
+	/* we reserved enough space for the above options, and exceeding the
+	 * TCP option space would be fatal
+	 */
+	if (WARN_ON_ONCE(opt_size > remaining))
+		return false;

It seems to me, and maybe I am missing something, but all this change adds to existing functionality is showing this warning when mptcp_established_options_mp() fails due to lack of remaining option space. The small change I propose above does the same, yes?

This change has a few goals:
- consolidating the check vs TCP option space exhaustion: there is a single warn_on(). Currently we have already one, and we need to add another one in mptcp_established_options_mp(), plus v1 support will require adding at least one more.
- documenting that we don't actually expect to exhaust TCP option space with MP_CAPABLE/MP_JOIN or DSS (as we don't send DSS and MP_CAPABLE together)
- the assumption that DSS will never exhaust TCP option space allow to simplify the code a bit.

Quoted 4 lines
Quoted 2 lines

yes, alternatively we can add more warn_on(). That will uglify a bit the v1 code.

I guess I'm OK with a single WARN_ON. This patchset LGTM.

Thank you for the patches and the reviews!

@Paolo: I *think* that the first patches of this series were not based at the end of the series but at the end of part 2 (kselftest introduction). I had to add some extra code and resolve some conflicts with what I hope would be what you had in mind :-)
Please see the different conflict resolution and the extra commit here below, especially 7d8b4fe573fb which I guess there are better ways to do but I hope the code is OK.

- 3ce88efe9902: "squashed" patch 1/4 (or 1/1 :) ) in "mptcp: Create SUBFLOW socket for incoming connections"
- 9c58989db059: "squashed" patch 2/4 in "mptcp: Create SUBFLOW socket for incoming connections"
- 946c99f17805: "squashed" patch 3/4 in "mptcp: Write MPTCP DSS headers to outgoing data packets"
- 27a10380b320: conflict in t/mptcp-Implement-MPTCP-receive-path
- a17134e4116a: conflict in t/mptcp-Add-ADD_ADDR-handling
- 7d8b4fe573fb: extra code: take extra established options into account
- 34c0738e7ed4: conflict in t/mptcp-Add-handling-of-incoming-MP_JOIN-requests
- 63e57f2facbc: conflict in t/mptcp-Add-handling-of-outgoing-MP_JOIN-requests
- 0f2c93ad449d: "squashed" patch 4/4 in "mptcp: Add handling of outgoing MP_JOIN requests"
- 84cd31e06aaa: "Signed-off-by" + "Co-developed-by"
- aad61f16b421: conflict in t/mptcp-increment-MIB-counters-in-a-few-places
- 84af4075aa4f..e73eef882a05: result

Tests are still all passing!

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
author
#8 lore raw

[MPTCP] Re: [PATCH v3 3/4] mptcp: warn once if exceeding tcp opt space for dss/mp_capable

Quoted 3 lines · Matthieu Baerts

@Paolo: I *think* that the first patches of this series were not based at the end of the series but at the end of part 2 (kselftest introduction).

Every patch was based/applied locally just after the related 'squash- to' patch, hoping to minimize the resulting conflicts, I see that did not work very well, sorry.

Quoted 25 lines

I had to add some extra code and resolve some conflicts
with what I hope would be what you had in mind :-)
Please see the different conflict resolution and the extra commit here below, especially 7d8b4fe573fb which I guess there are better ways to do but I hope the code is OK.

- 3ce88efe9902: "squashed" patch 1/4 (or 1/1 :) ) in "mptcp: Create SUBFLOW socket for incoming connections"
- 9c58989db059: "squashed" patch 2/4 in "mptcp: Create SUBFLOW socket for incoming connections"
- 946c99f17805: "squashed" patch 3/4 in "mptcp: Write MPTCP DSS headers to outgoing data packets"
- 27a10380b320: conflict in t/mptcp-Implement-MPTCP-receive-path
- a17134e4116a: conflict in t/mptcp-Add-ADD_ADDR-handling
- 7d8b4fe573fb: extra code: take extra established options into account
- 34c0738e7ed4: conflict in t/mptcp-Add-handling-of-incoming-MP_JOIN-requests
- 63e57f2facbc: conflict in t/mptcp-Add-handling-of-outgoing-MP_JOIN-requests
- 0f2c93ad449d: "squashed" patch 4/4 in "mptcp: Add handling of outgoing MP_JOIN requests"
- 84cd31e06aaa: "Signed-off-by" + "Co-developed-by"
- aad61f16b421: conflict in t/mptcp-increment-MIB-counters-in-a-few-places
- 84af4075aa4f..e73eef882a05: result

Quoted 1 line

Tests are still all passing!

Ok, will review and report here.

Thank you,

Paolo

author
#9 lore raw

[MPTCP] Re: [PATCH v3 3/4] mptcp: warn once if exceeding tcp opt space for dss/mp_capable

Quoted 34 lines · Paolo Abeni
Quoted 3 lines · Matthieu Baerts

@Paolo: I *think* that the first patches of this series were not based at the end of the series but at the end of part 2 (kselftest introduction).

Every patch was based/applied locally just after the related 'squash- to' patch, hoping to minimize the resulting conflicts, I see that did not work very well, sorry.

Quoted 25 lines

I had to add some extra code and resolve some conflicts
with what I hope would be what you had in mind :-)
Please see the different conflict resolution and the extra commit here below, especially 7d8b4fe573fb which I guess there are better ways to do but I hope the code is OK.

- 3ce88efe9902: "squashed" patch 1/4 (or 1/1 :) ) in "mptcp: Create SUBFLOW socket for incoming connections"
- 9c58989db059: "squashed" patch 2/4 in "mptcp: Create SUBFLOW socket for incoming connections"
- 946c99f17805: "squashed" patch 3/4 in "mptcp: Write MPTCP DSS headers to outgoing data packets"
- 27a10380b320: conflict in t/mptcp-Implement-MPTCP-receive-path
- a17134e4116a: conflict in t/mptcp-Add-ADD_ADDR-handling
- 7d8b4fe573fb: extra code: take extra established options into account
- 34c0738e7ed4: conflict in t/mptcp-Add-handling-of-incoming-MP_JOIN-requests
- 63e57f2facbc: conflict in t/mptcp-Add-handling-of-outgoing-MP_JOIN-requests
- 0f2c93ad449d: "squashed" patch 4/4 in "mptcp: Add handling of outgoing MP_JOIN requests"
- 84cd31e06aaa: "Signed-off-by" + "Co-developed-by"
- aad61f16b421: conflict in t/mptcp-increment-MIB-counters-in-a-few-places
- 84af4075aa4f..e73eef882a05: result

Quoted 3 lines
Quoted 1 line

Tests are still all passing!

Ok, will review and report here.

it looks like the extra code is not needed:
mptcp_established_options_addr() already check for tcp option space exhaustion. The pr_debug() should never be reached.

Could you please squash the following into "mptcp: Add ADD_ADDR handling"?

Thanks.

Paolo
---

net/mptcp/options.c +3 -9
index 38c0cbd4c77b..bf43d61f792b 100644
@@ -499,16 +499,10 @@ bool mptcp_established_options(struct sock *sk, struct sk_buff *skb,
 
        *size += opt_size;
        remaining -= opt_size;
-
        if (mptcp_established_options_addr(sk, &opt_size, remaining, opts)) {
-               if (opt_size > remaining) {
-                       pr_debug("est opt: not enough space for addr: %u > %u",
-                                opt_size, remaining);
-               } else {
-                       *size += opt_size;
-                       remaining -= opt_size;
-                       ret = true;
-               }
+               *size += opt_size;
+               remaining -= opt_size;
+               ret = true;
        }
 
        return ret;
#10 lore raw

[MPTCP] Re: [PATCH v3 3/4] mptcp: warn once if exceeding tcp opt space for dss/mp_capable

Hi Paolo,

Quoted 9 lines · Paolo Abeni
Quoted 8 lines · Paolo Abeni
Quoted 3 lines · Matthieu Baerts

@Paolo: I *think* that the first patches of this series were not based at the end of the series but at the end of part 2 (kselftest introduction).

Every patch was based/applied locally just after the related 'squash- to' patch, hoping to minimize the resulting conflicts, I see that did not work very well, sorry.

That's alright, thank you for the effort!

I think it is easier for me to "backport" patches. When I have conflicts, I can check the history and also verify at the end that I applied it correctly (at least at the end of the series).

Of course if the code we want to patch has been refactored after, it is easier (and maybe the only possibility) if the patches are based on previous commits. If you do that, please add a note in the commit message ;-)

Quoted 25 lines
Quoted 25 lines
Quoted 25 lines

I had to add some extra code and resolve some conflicts
with what I hope would be what you had in mind :-)
Please see the different conflict resolution and the extra commit here below, especially 7d8b4fe573fb which I guess there are better ways to do but I hope the code is OK.

- 3ce88efe9902: "squashed" patch 1/4 (or 1/1 :) ) in "mptcp: Create SUBFLOW socket for incoming connections"
- 9c58989db059: "squashed" patch 2/4 in "mptcp: Create SUBFLOW socket for incoming connections"
- 946c99f17805: "squashed" patch 3/4 in "mptcp: Write MPTCP DSS headers to outgoing data packets"
- 27a10380b320: conflict in t/mptcp-Implement-MPTCP-receive-path
- a17134e4116a: conflict in t/mptcp-Add-ADD_ADDR-handling
- 7d8b4fe573fb: extra code: take extra established options into account
- 34c0738e7ed4: conflict in t/mptcp-Add-handling-of-incoming-MP_JOIN-requests
- 63e57f2facbc: conflict in t/mptcp-Add-handling-of-outgoing-MP_JOIN-requests
- 0f2c93ad449d: "squashed" patch 4/4 in "mptcp: Add handling of outgoing MP_JOIN requests"
- 84cd31e06aaa: "Signed-off-by" + "Co-developed-by"
- aad61f16b421: conflict in t/mptcp-increment-MIB-counters-in-a-few-places
- 84af4075aa4f..e73eef882a05: result

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Tests are still all passing!

Ok, will review and report here.

it looks like the extra code is not needed:
mptcp_established_options_addr() already check for tcp option space exhaustion. The pr_debug() should never be reached.

Oh yes, sorry, I missed that piece. Thank you for the patch!

Quoted 12 lines

Could you please squash the following into "mptcp: Add ADD_ADDR handling"?

Thanks.

Paolo
---

net/mptcp/options.c +0 -0
index 38c0cbd4c77b..bf43d61f792b 100644

net/mptcp/options.c bool mptcp_established_options(struct sock *sk, struct sk_buff *skb, · line 502

Quoted 4 lines
net/mptcp/options.c +0 -1
@@ -499,16 +499,10 @@ bool mptcp_established_options(struct sock *sk, struct sk_buff *skb,
 
         *size += opt_size;
         remaining -= opt_size;
-

I had to manually apply the patch and I see I didn't remove this line. Do you want me to remove it?

Quoted 5 lines
net/mptcp/options.c +0 -4
         if (mptcp_established_options_addr(sk, &opt_size, remaining, opts)) {
-               if (opt_size > remaining) {
-                       pr_debug("est opt: not enough space for addr: %u > %u",
-                                opt_size, remaining);
-               } else {

net/mptcp/options.c bool mptcp_established_options(struct sock *sk, struct sk_buff *skb, · line 508

Quoted 10 lines
net/mptcp/options.c +3 -4
-                       *size += opt_size;
-                       remaining -= opt_size;
-                       ret = true;
-               }
+               *size += opt_size;
+               remaining -= opt_size;
+               ret = true;
         }
 
         return ret;

The rest is done in commit d66315ad0dff
- 82c94b8ce828..4566f787483d: result

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
author
#11 lore raw

[MPTCP] Re: [PATCH v3 3/4] mptcp: warn once if exceeding tcp opt space for dss/mp_capable

Quoted 6 lines · Matthieu Baerts
Quoted 6 lines
net/mptcp/options.c +0 -0
index 38c0cbd4c77b..bf43d61f792b 100644
@@ -499,16 +499,10 @@ bool mptcp_established_options(struct sock *sk, struct sk_buff *skb,
 
Quoted 6 lines

net/mptcp/options.c bool mptcp_established_options(struct sock *sk, struct sk_buff *skb, · line 502

Quoted 3 lines
net/mptcp/options.c +0 -1
         *size += opt_size;
         remaining -= opt_size;
-

I had to manually apply the patch and I see I didn't remove this line. Do you want me to remove it?

whoops... yes, it would be better, thanks1

#12 lore raw

[MPTCP] Re: [PATCH v3 3/4] mptcp: warn once if exceeding tcp opt space for dss/mp_capable

Hi Paolo,

Quoted 7 lines · Paolo Abeni
Quoted 6 lines · Matthieu Baerts
Quoted 6 lines
net/mptcp/options.c +0 -0
index 38c0cbd4c77b..bf43d61f792b 100644
@@ -499,16 +499,10 @@ bool mptcp_established_options(struct sock *sk, struct sk_buff *skb,
 
Quoted 9 lines
Quoted 6 lines

net/mptcp/options.c bool mptcp_established_options(struct sock *sk, struct sk_buff *skb, · line 502

Quoted 3 lines
net/mptcp/options.c +0 -1
          *size += opt_size;
          remaining -= opt_size;
-

I had to manually apply the patch and I see I didn't remove this line. Do you want me to remove it?

whoops... yes, it would be better, thanks1

I just removed this line:

- 1c9961c4aa88: line removed
- 32fda6a17c47..c35e69234be2: result

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
author
#13 lore raw

PATCH v3 4/4 mptcp: remove unneeded check in mptcp_established_options_mp()

In reply to Paolo Abeni

we now have centralized check in mptcp_established_options()

Squash-to: "mptcp: Add handling of outgoing MP_JOIN requests"
Signed-off-by: Paolo Abeni <pabeni(a)redhat.com>

---
 net/mptcp/options.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
net/mptcp/options.c +1 -2
index 80c0cff135c0..cde6ba918686 100644
@@ -371,8 +371,7 @@ static bool mptcp_established_options_mp(struct sock *sk, unsigned int *size,
 		pr_debug("subflow=%p, local_key=%llu, remote_key=%llu",
 			 subflow, subflow->local_key, subflow->remote_key);
 		return true;
-	} else if (subflow->mp_join && !subflow->fourth_ack &&
-		   remaining >= TCPOLEN_MPTCP_MPJ_ACK) {
+	} else if (subflow->mp_join && !subflow->fourth_ack) {
 		opts->suboptions = OPTION_MPTCP_MPJ_ACK;
 		memcpy(opts->hmac, subflow->hmac, MPTCPOPT_HMAC_LEN);
 		*size = TCPOLEN_MPTCP_MPJ_ACK;
Signature · 1 line
2.21.0