mptcp: generate subflow hmac after mptcp_finish_join()
Subsystems (2)
PATCH 1/1 mptcp: generate subflow hmac after mptcp_finish_join()
From: Jianguo Wu <[email protected]>
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().
--- net/mptcp/subflow.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/mptcp/subflow.c +3 -3
@@ -433,15 +433,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 );
Signature · 1 line
1.8.3.1
Quoted 7 lines · Jianguo Wu
From: Jianguo Wu <[email protected]>
For outgoing subflow join, when recv SYNACK, in
subflow_finish_connect(), themptcp_finish_join()may return false in some cases, and send a RESET to remote, and no local hmac is required.
So generate subflow hmac aftermptcp_finish_join().
Quoted 6 lines
Fixes ec3edaa7ca6c ("mptcp: Add handling of outgoing MP_JOIN requests").Signed-off-by Jianguo Wu <[email protected]>---
net/mptcp/subflow.c| 6 +++---1 file changed, 3 insertions(+), 3 deletions(-)
Hi Jianguo -
It looks like subflow->hmac is not accessed by any functions called from mptcp_finish_join(), and the selftests pass, so this looks ok for the export branch.
Mat
Quoted 28 lines
net/mptcp/subflow.c +3
-3@@ -433,15 +433,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 );Signature · 1 line
1.8.3.1
--
Mat Martineau
Intel
Hi Jianguo, Mat,
Quoted 6 lines · Jianguo Wu
From: Jianguo Wu <[email protected]>
For outgoing subflow join, when recv SYNACK, in
subflow_finish_connect(), themptcp_finish_join()may return false in some cases, and send a RESET to remote, and no local hmac is required.
So generate subflow hmac aftermptcp_finish_join().
Should we cover this case with a packetdrill test?
Quoted 2 lines
Fixes ec3edaa7ca6c ("mptcp: Add handling of outgoing MP_JOIN requests").Signed-off-by Jianguo Wu <[email protected]>
Thank you for the patch and the review!
Now in our tree, 'net' fix:
- cab4e45339c1: mptcp: generate subflow hmac after mptcp_finish_join()
- Results: 655ba588ab88..b8c6eee443a3
Builds and tests are now in progress:
https://cirrus-ci.com/github/multipath-tcp/mptcp_net-next/export/20210513T075025
https://github.com/multipath-tcp/mptcp_net-next/actions/workflows/build-validation.yml?query=branch:export/20210513T075025
Cheers,
Matt
Signature · 2 lines
Tessares | Belgium | Hybrid Access Solutions www.tessares.net