All of lore.kernel.org
 help / color / mirror / Atom feed
* [MPTCP] [RFC PATCH 1/4] Squash-to: "mptcp: Handle MP_CAPABLE options for outgoing connections"
@ 2019-12-20 18:45 Paolo Abeni
  0 siblings, 0 replies; only message in thread
From: Paolo Abeni @ 2019-12-20 18:45 UTC (permalink / raw)
  To: mptcp

[-- Attachment #1: Type: text/plain, Size: 1630 bytes --]

After upstream feedback, I just noticed that we actually
don't clear the is_mptcp field on clone allocation failure.

Do that and additionally don't allocate at all the subflow if MPC handshake
failed.

Note: we need to update accordingly accept on later patch

Signed-off-by: Paolo Abeni <pabeni(a)redhat.com>
---
 net/mptcp/subflow.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index b9aca17b0b91..7dd8733dc72a 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -262,23 +262,19 @@ static void subflow_ulp_clone(const struct request_sock *req,
 	struct mptcp_subflow_context *old_ctx = mptcp_subflow_ctx(newsk);
 	struct mptcp_subflow_context *new_ctx;
 
-	/* newsk->sk_socket is NULL at this point */
-	new_ctx = subflow_create_ctx(newsk, priority);
-	if (!new_ctx)
+	if (!subflow_req->mp_capable ||
+	    (new_ctx = subflow_create_ctx(newsk, priority)) == NULL) {
+		tcp_sk(newsk)->is_mptcp = 0;
 		return;
+	}
 
 	new_ctx->conn = NULL;
 	new_ctx->conn_finished = 1;
 	new_ctx->icsk_af_ops = old_ctx->icsk_af_ops;
-
-	if (subflow_req->mp_capable) {
-		new_ctx->mp_capable = 1;
-		new_ctx->fourth_ack = 1;
-		new_ctx->remote_key = subflow_req->remote_key;
-		new_ctx->local_key = subflow_req->local_key;
-	} else {
-		tcp_sk(newsk)->is_mptcp = 0;
-	}
+	new_ctx->mp_capable = 1;
+	new_ctx->fourth_ack = 1;
+	new_ctx->remote_key = subflow_req->remote_key;
+	new_ctx->local_key = subflow_req->local_key;
 }
 
 static struct tcp_ulp_ops subflow_ulp_ops __read_mostly = {
-- 
2.21.0

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-12-20 18:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-20 18:45 [MPTCP] [RFC PATCH 1/4] Squash-to: "mptcp: Handle MP_CAPABLE options for outgoing connections" Paolo Abeni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.