All of lore.kernel.org
 help / color / mirror / Atom feed
* [MPTCP] [PATCH] Handle subflow join failures
@ 2020-01-14 13:57 Florian Westphal
  0 siblings, 0 replies; only message in thread
From: Florian Westphal @ 2020-01-14 13:57 UTC (permalink / raw)
  To: mptcp 

[-- 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

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

only message in thread, other threads:[~2020-01-14 13:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-14 13:57 [MPTCP] [PATCH] Handle subflow join failures Florian Westphal

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.