summaryrefslogtreecommitdiffstats
path: root/net/mptcp/subflow.c
diff options
context:
space:
mode:
authorJianguo Wu <wujianguo@chinatelecom.cn>2021-05-28 01:54:26 +0200
committerJakub Kicinski <kuba@kernel.org>2021-05-28 22:59:16 +0200
commit0a4d8e96e4fd687af92b961d5cdcea0fdbde05fe (patch)
tree826d11db36b67d2809a500877e712d8a281b973b /net/mptcp/subflow.c
parentmptcp: using TOKEN_MAX_RETRIES instead of magic number (diff)
downloadlinux-0a4d8e96e4fd687af92b961d5cdcea0fdbde05fe.tar.xz
linux-0a4d8e96e4fd687af92b961d5cdcea0fdbde05fe.zip
mptcp: generate subflow hmac after mptcp_finish_join()
For outgoing subflow join, when recv SYNACK, in subflow_finish_connect(), the mptcp_finish_join() may return false in some cases, and send a RESET to remote, and no local hmac is required. So generate subflow hmac after mptcp_finish_join(). Fixes: ec3edaa7ca6c ("mptcp: Add handling of outgoing MP_JOIN requests") Signed-off-by: Jianguo Wu <wujianguo@chinatelecom.cn> Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/mptcp/subflow.c')
-rw-r--r--net/mptcp/subflow.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index a50a97908866..2a58503e55bd 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -430,15 +430,15 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb)
goto do_reset;
}
+ if (!mptcp_finish_join(sk))
+ goto do_reset;
+
subflow_generate_hmac(subflow->local_key, subflow->remote_key,
subflow->local_nonce,
subflow->remote_nonce,
hmac);
memcpy(subflow->hmac, hmac, MPTCPOPT_HMAC_LEN);
- if (!mptcp_finish_join(sk))
- goto do_reset;
-
subflow->mp_join = 1;
MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNACKRX);