send MP_FAIL with MP_RST and others
Subsystems (2)
v4 cover send MP_FAIL with MP_RST and others
v4:
- add Matt's patch, fix the missing ";" in it, dropped two empty lines
and added my Tested-by tag.
v3:
- update patch 1 as Matt suggested.
- do more cleanups in patch 1.
v2:
- rename patch 1 as a squash-to patch.
- print out reset_transient in patch 2 too. Please keep patch 2 as a
standalone patch, not a squash-to patch.
Two small patches about sending MP_FAIL with MP_RST.
Geliang Tang (1):
mptcp: print out reset infos of MP_RST
Matthieu Baerts (1):
Squash to "mptcp: implement fastclose xmit path"
net/mptcp/options.c | 62 +++++++++++++++++++++++++++------------------ 1 file changed, 37 insertions(+), 25 deletions(-)
Signature · 1 line
2.31.1
PATCH v4 1/2 Squash to "mptcp: implement fastclose xmit path"
From: Matthieu Baerts <[email protected]>
This is linked to Geliang's patch with the same title.
If I understand the RFC properly, we can use MP_RST with an MP_FASTCLOSE and an MP_FAIL (or none of them) but we cannot use MP_FASTCLOSE and MP_FAIL together.
This patch implements this logic in both mptcp_established_options() and mptcp_write_options(). Before this patch, the first function was not allowing any of these 3 options to be used at the same time while the second one was allowing MP_FAIL to be used with either MP_FASTCLOSE or MP_RST.
Small note: I tried to keep Paolo's idea of reducing conditions for "normal" options by moving MP_RST at the end and allow to jump there from MP_FAIL and MP_FASTCLOSE but I'm not sure it makes it easy to read and really improves perfs. We can also move MP_RST check at the beginning.
--- net/mptcp/options.c | 60 ++++++++++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 25 deletions(-)
net/mptcp/options.c +35 -25
@@ -829,8 +829,12 @@ bool mptcp_established_options(struct sock *sk, struct sk_buff *skb,if (unlikely (skb &&TCP_SKB_CB (skb)->tcp_flags &TCPHDR_RST )) {if (mptcp_established_options_fastclose (sk, &opt_size, remaining, opts) || -mptcp_established_options_mp_fail (sk, &opt_size, remaining, opts) || -mptcp_established_options_rst (sk, skb, &opt_size, remaining, opts)) { +mptcp_established_options_mp_fail (sk, &opt_size, remaining, opts)) { + *size += opt_size; + remaining -= opt_size; + } +/* MP_RST can be used with MP_FASTCLOSE and MP_FAIL if there is room */ +if (mptcp_established_options_rst (sk, skb, &opt_size, remaining, opts)) { *size += opt_size; remaining -= opt_size; }
@@ -1257,21 +1261,7 @@ static u16 mptcp_make_csum(const struct mptcp_ext *mpext)void mptcp_write_options (__be32 *ptr,const struct tcp_sock *tp,struct mptcp_out_options *opts) { -if (unlikely (OPTION_MPTCP_FAIL & opts->suboptions)) { -const struct sock *ssk = (const struct sock *)tp; -struct mptcp_subflow_context *subflow; - - subflow =mptcp_subflow_ctx (ssk); - subflow->send_mp_fail =0 ; - - *ptr++ =mptcp_option (MPTCPOPT_MP_FAIL , -TCPOLEN_MPTCP_FAIL , -0 ,0 ); -put_unaligned_be64 (opts->fail_seq, ptr); - ptr +=2 ; - } - -/* DSS, MPC, MPJ, ADD_ADDR, FASTCLOSE and RST are mutually exclusive, +/* DSS, MPC, MPJ, ADD_ADDR, FASTCLOSE and FAIL are mutually exclusive, * see mptcp_established_options*() */ if (likely (OPTION_MPTCP_DSS & opts->suboptions)) {
@@ -1458,19 +1448,39 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp, ptr +=1 ; } } - }else if (unlikely (OPTION_MPTCP_RST & opts->suboptions)) { -/* RST is mutually exclusive with everything else */ - *ptr++ =mptcp_option (MPTCPOPT_RST , -TCPOLEN_MPTCP_RST , - opts->reset_transient, - opts->reset_reason); -return ; }else if (unlikely (OPTION_MPTCP_FASTCLOSE & opts->suboptions)) { -/* FASTCLOSE is mutually exclusive with everything else */ +/* FASTCLOSE is mutually exclusive with others except RST */ *ptr++ =mptcp_option (MPTCPOPT_MP_FASTCLOSE ,TCPOLEN_MPTCP_FASTCLOSE ,0 ,0 );put_unaligned_be64 (opts->rcvr_key, ptr); + +if (OPTION_MPTCP_RST & opts->suboptions) + goto mp_rst; +return ; + }else if (unlikely (OPTION_MPTCP_FAIL & opts->suboptions)) { +/* MP_FAIL is mutually exclusive with others except RST */ +const struct sock *ssk = (const struct sock *)tp; +struct mptcp_subflow_context *subflow; + + subflow =mptcp_subflow_ctx (ssk); + subflow->send_mp_fail =0 ; + + *ptr++ =mptcp_option (MPTCPOPT_MP_FAIL , +TCPOLEN_MPTCP_FAIL , +0 ,0 ); +put_unaligned_be64 (opts->fail_seq, ptr); + ptr +=2 ; + +if (OPTION_MPTCP_RST & opts->suboptions) + goto mp_rst; +return ; + }else if (unlikely (OPTION_MPTCP_RST & opts->suboptions)) { +mp_rst: + *ptr++ =mptcp_option (MPTCPOPT_RST , +TCPOLEN_MPTCP_RST , + opts->reset_transient, + opts->reset_reason);return ; }
Signature · 1 line
2.31.1
PATCH v4 2/2 mptcp: print out reset infos of MP_RST
In reply to Geliang TangThis patch printed out the reset infos, reset_transient and reset_reason, of MP_RST in mptcp_parse_option() to show that MP_RST is received.
--- net/mptcp/options.c | 2 ++ 1 file changed, 2 insertions(+)
net/mptcp/options.c +2 -0
@@ -336,6 +336,8 @@ static void mptcp_parse_option(const struct sk_buff *skb, flags = *ptr++; mp_opt->reset_transient = flags &MPTCP_RST_TRANSIENT ; mp_opt->reset_reason = *ptr; +pr_debug ("MP_RST: transient=%u reason=%u" , + mp_opt->reset_transient, mp_opt->reset_reason);break ;case MPTCPOPT_MP_FAIL :
Signature · 1 line
2.31.1
Re: [PATCH mptcp-next v4 1/2] Squash to "mptcp: implement fastclose xmit path"
In reply to Geliang TangSorry, this patch still needs to be improved.
I just notice that MP_FAIL will be sent with DSS too.
In the multiple subflow case, MP_FAIL will be sent with MP_RST, But in the single subflow case, MP_FAIL will be sent with DSS.
I'll sent a new version of this squash-to patch later.
Thanks,
-Geliang
Quoted 123 lines · Geliang Tang <[email protected]> 于2021年12月2日周四 12:26写道:
From: Matthieu Baerts <[email protected]>
This is linked to Geliang's patch with the same title.
If I understand the RFC properly, we can use
MP_RSTwith anMP_FASTCLOSEand anMP_FAIL(or none of them) but we cannot useMP_FASTCLOSEandMP_FAILtogether.This patch implements this logic in both
mptcp_established_options()andmptcp_write_options(). Before this patch, the first function was not allowing any of these 3 options to be used at the same time while the second one was allowingMP_FAILto be used with eitherMP_FASTCLOSEorMP_RST.Small note: I tried to keep Paolo's idea of reducing conditions for "normal" options by moving
MP_RSTat the end and allow to jump there fromMP_FAILandMP_FASTCLOSEbut I'm not sure it makes it easy to read and really improves perfs. We can also moveMP_RSTcheck at the beginning.Cc Paolo Abeni <[email protected]>Cc Geliang Tang <[email protected]>Tested-by Geliang Tang <[email protected]>Signed-off-by Matthieu Baerts <[email protected]>--- net/mptcp/options.c | 60 ++++++++++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 25 deletions(-)net/mptcp/options.c +35
-26@@ -829,8 +829,12 @@ bool mptcp_established_options(struct sock *sk, struct sk_buff *skb,if (unlikely (skb &&TCP_SKB_CB (skb)->tcp_flags &TCPHDR_RST )) {if (mptcp_established_options_fastclose (sk, &opt_size, remaining, opts) || -mptcp_established_options_mp_fail (sk, &opt_size, remaining, opts) || -mptcp_established_options_rst (sk, skb, &opt_size, remaining, opts)) { +mptcp_established_options_mp_fail (sk, &opt_size, remaining, opts)) { + *size += opt_size; + remaining -= opt_size; + } +/* MP_RST can be used with MP_FASTCLOSE and MP_FAIL if there is room */ +if (mptcp_established_options_rst (sk, skb, &opt_size, remaining, opts)) { *size += opt_size; remaining -= opt_size; }@@ -1257,21 +1261,7 @@ static u16 mptcp_make_csum(const struct mptcp_ext *mpext)void mptcp_write_options (__be32 *ptr,const struct tcp_sock *tp,struct mptcp_out_options *opts) { -if (unlikely (OPTION_MPTCP_FAIL & opts->suboptions)) { -const struct sock *ssk = (const struct sock *)tp; -struct mptcp_subflow_context *subflow; - - subflow =mptcp_subflow_ctx (ssk); - subflow->send_mp_fail =0 ; - - *ptr++ =mptcp_option (MPTCPOPT_MP_FAIL , -TCPOLEN_MPTCP_FAIL , -0 ,0 ); -put_unaligned_be64 (opts->fail_seq, ptr); - ptr +=2 ; - } - -/* DSS, MPC, MPJ, ADD_ADDR, FASTCLOSE and RST are mutually exclusive, +/* DSS, MPC, MPJ, ADD_ADDR, FASTCLOSE and FAIL are mutually exclusive, * see mptcp_established_options*() */ if (likely (OPTION_MPTCP_DSS & opts->suboptions)) {@@ -1458,19 +1448,39 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp, ptr +=1 ; } } - }else if (unlikely (OPTION_MPTCP_RST & opts->suboptions)) { -/* RST is mutually exclusive with everything else */ - *ptr++ =mptcp_option (MPTCPOPT_RST , -TCPOLEN_MPTCP_RST , - opts->reset_transient, - opts->reset_reason); -return ; }else if (unlikely (OPTION_MPTCP_FASTCLOSE & opts->suboptions)) { -/* FASTCLOSE is mutually exclusive with everything else */ +/* FASTCLOSE is mutually exclusive with others except RST */ *ptr++ =mptcp_option (MPTCPOPT_MP_FASTCLOSE ,TCPOLEN_MPTCP_FASTCLOSE ,0 ,0 );put_unaligned_be64 (opts->rcvr_key, ptr); + +if (OPTION_MPTCP_RST & opts->suboptions) + goto mp_rst; +return ; + }else if (unlikely (OPTION_MPTCP_FAIL & opts->suboptions)) { +/* MP_FAIL is mutually exclusive with others except RST */ +const struct sock *ssk = (const struct sock *)tp; +struct mptcp_subflow_context *subflow; + + subflow =mptcp_subflow_ctx (ssk); + subflow->send_mp_fail =0 ; + + *ptr++ =mptcp_option (MPTCPOPT_MP_FAIL , +TCPOLEN_MPTCP_FAIL , +0 ,0 ); +put_unaligned_be64 (opts->fail_seq, ptr); + ptr +=2 ; + +if (OPTION_MPTCP_RST & opts->suboptions) + goto mp_rst; +return ; + }else if (unlikely (OPTION_MPTCP_RST & opts->suboptions)) { +mp_rst: + *ptr++ =mptcp_option (MPTCPOPT_RST , +TCPOLEN_MPTCP_RST , + opts->reset_transient, + opts->reset_reason);return ; } --2.31.1