From patchwork Tue Jan 14 13:57:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Westphal X-Patchwork-Id: 1222807 X-Patchwork-Delegate: matthieu.baerts@tessares.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.01.org (client-ip=2001:19d0:306:5::1; helo=ml01.01.org; envelope-from=mptcp-bounces@lists.01.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=strlen.de Received: from ml01.01.org (ml01.01.org [IPv6:2001:19d0:306:5::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47xsTc4T1Fz9sP6 for ; Wed, 15 Jan 2020 00:57:23 +1100 (AEDT) Received: from ml01.vlan13.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id BA01210097E14; Tue, 14 Jan 2020 06:00:37 -0800 (PST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a0a:51c0:0:12e:520::1; helo=chamillionaire.breakpoint.cc; envelope-from=fw@breakpoint.cc; receiver= Received: from Chamillionaire.breakpoint.cc (Chamillionaire.breakpoint.cc [IPv6:2a0a:51c0:0:12e:520::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 5BD3910097E0C for ; Tue, 14 Jan 2020 06:00:35 -0800 (PST) Received: from fw by Chamillionaire.breakpoint.cc with local (Exim 4.92) (envelope-from ) id 1irMgz-0005rO-UF; Tue, 14 Jan 2020 14:57:13 +0100 From: Florian Westphal To: Cc: Florian Westphal Date: Tue, 14 Jan 2020 14:57:05 +0100 Message-Id: <20200114135705.4019-1-fw@strlen.de> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Message-ID-Hash: N7TUOPQ5U22BKG2GXZ37KOXZBE7RYEFZ X-Message-ID-Hash: N7TUOPQ5U22BKG2GXZ37KOXZBE7RYEFZ X-MailFrom: fw@breakpoint.cc X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.1.1 Precedence: list Subject: [MPTCP] [PATCH] Handle subflow join failures List-Id: Discussions regarding MPTCP upstreaming Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 --- 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); } }