All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Westphal <fw at strlen.de>
To: mptcp at lists.01.org
Subject: [MPTCP] [PATCH] Handle subflow join failures
Date: Tue, 14 Jan 2020 14:57:05 +0100	[thread overview]
Message-ID: <20200114135705.4019-1-fw@strlen.de> (raw)

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

squashto: mptcp: Add handling of outgoing MP_JOIN requests

When the join request fails we should send a reset and also
close the socket, we can't do anything useful with such a
connection.

Signed-off-by: Florian Westphal <fw(a)strlen.de>

---
 net/mptcp/subflow.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index f69a75f6bd6e..03f4604e2cb7 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -187,10 +187,13 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb)
 
 	subflow->icsk_af_ops->sk_rx_dst_set(sk, skb);
 
-	if (!subflow->conn)
+	if (subflow->conn_finished || !tcp_sk(sk)->is_mptcp)
 		return;
 
-	if (subflow->mp_capable && !subflow->conn_finished) {
+	if (!subflow->conn)
+		goto do_reset;
+
+	if (subflow->mp_capable) {
 		pr_debug("subflow=%p, remote_key=%llu", mptcp_subflow_ctx(sk),
 			 subflow->remote_key);
 		mptcp_finish_connect(sk);
@@ -200,14 +203,13 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb)
 			pr_debug("synack seq=%u", TCP_SKB_CB(skb)->seq);
 			subflow->ssn_offset = TCP_SKB_CB(skb)->seq;
 		}
-	} else if (subflow->mp_join && !subflow->conn_finished) {
+	} else if (subflow->mp_join) {
 		pr_debug("subflow=%p, thmac=%llu, remote_nonce=%u",
 			 subflow, subflow->thmac,
 			 subflow->remote_nonce);
 		if (!subflow_thmac_valid(subflow)) {
 			subflow->mp_join = 0;
-			// @@ need to trigger RST
-			return;
+			goto do_reset;
 		}
 
 		mptcp_crypto_hmac_sha(subflow->local_key, subflow->remote_key,
@@ -218,8 +220,14 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb)
 		if (skb)
 			subflow->ssn_offset = TCP_SKB_CB(skb)->seq;
 
-		if (mptcp_finish_join(sk))
-			subflow->conn_finished = 1;
+		if (!mptcp_finish_join(sk))
+			goto do_reset;
+
+		subflow->conn_finished = 1;
+	} else {
+do_reset:
+		tcp_send_active_reset(sk, GFP_ATOMIC);
+		tcp_done(sk);
 	}
 }
 
-- 
2.24.1

                 reply	other threads:[~2020-01-14 13:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200114135705.4019-1-fw@strlen.de \
    --to=unknown@example.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.