fallback to TCP on ulp clone failure
Subsystems (2)
Paolo Abeni
cover fallback to TCP on ulp clone failure
This series do real TCP fallback for passive MPTCP connection when ULP clone
fails: clear the 'is_mptcp' flag, reset overridden callback, icsk ops and clear the ULP ctx.
Additionally uses the 'is_mptcp' flag to check for fallback in more places, as suggested by Mat (patches 2, 4), cope with NULL ctx in subflow_syn_recv_sock() (patches 3, 7), and restore TCP callback on later fallback, too (patch 6) for consistency.
This still uses function pointers to store all the overriden TCP callbacks, is simpler then other alternatives but waste some space inside the subflow struct.
The rebased tree is available at:
https://github.com/pabeni/mptcp/tree/mptcp_net-next_export_v6.2
options.c | 6 ----- protocol.c | 16 ++++++-------- protocol.h | 15 ++++++++++++- subflow.c | 67 ++++++++++++++++++++++++++++++++++++++++--------------------- 4 files changed, 67 insertions(+), 37 deletions(-)
Paolo Abeni
PATCH 1/7 Squash-to: "mptcp: Handle MP_CAPABLE options for outgoing connections"
After upstream feedback, I just noticed that we actually don't clear the is_mptcp field on clone allocation failure.
Do that and additionally don't allocate at all the subflow if MPC handshake failed.
Note: we need to update accordingly accept on later patch
RFC -> v1:
- avoid assign statement inside the if statement (Florian)
- avoid rendundant conn = NULL (Mat)
- clear ulp data on fallback, or to avoid double free at close time
--- net/mptcp/subflow.c | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-)
net/mptcp/subflow.c +21 -12
@@ -254,6 +254,15 @@ static void subflow_ulp_release(struct sock *sk)kfree_rcu (ctx, rcu); } +static void subflow_ulp_fallback (struct sock *sk) +{ +struct inet_connection_sock *icsk =inet_csk (sk); + + icsk->icsk_ulp_ops =NULL ; +rcu_assign_pointer (icsk->icsk_ulp_data,NULL ); +tcp_sk (sk)->is_mptcp =0 ; +} +static void subflow_ulp_clone (const struct request_sock *req,struct sock *newsk,const gfp_t priority)
@@ -262,23 +271,23 @@ static void subflow_ulp_clone(const struct request_sock *req,struct mptcp_subflow_context *old_ctx =mptcp_subflow_ctx (newsk);struct mptcp_subflow_context *new_ctx; -/* newsk->sk_socket is NULL at this point */ +if (!subflow_req->mp_capable) { +subflow_ulp_fallback (newsk); +return ; + } + new_ctx =subflow_create_ctx (newsk, priority); -if (!new_ctx) +if (new_ctx ==NULL ) { +subflow_ulp_fallback (newsk);return ; + } - new_ctx->conn =NULL ; new_ctx->conn_finished =1 ; new_ctx->icsk_af_ops = old_ctx->icsk_af_ops; - -if (subflow_req->mp_capable) { - new_ctx->mp_capable =1 ; - new_ctx->fourth_ack =1 ; - new_ctx->remote_key = subflow_req->remote_key; - new_ctx->local_key = subflow_req->local_key; - }else { -tcp_sk (newsk)->is_mptcp =0 ; - } + new_ctx->mp_capable =1 ; + new_ctx->fourth_ack =1 ; + new_ctx->remote_key = subflow_req->remote_key; + new_ctx->local_key = subflow_req->local_key; }static struct tcp_ulp_ops subflow_ulp_ops__read_mostly = {
Signature · 1 line
2.21.0
Paolo Abeni
PATCH 2/7 Squash-to "mptcp: Create SUBFLOW socket for incoming connection"
In reply to Paolo Abeniuse is_mptcp instead of 'subflow->mp_capable'
--- net/mptcp/protocol.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
net/mptcp/protocol.c +4 -6
@@ -243,7 +243,6 @@ static struct sock *mptcp_accept(struct sock *sk, int flags, int *err, bool kern) {struct mptcp_sock *msk =mptcp_sk (sk); -struct mptcp_subflow_context *subflow;struct socket *listener;struct sock *newsk;
@@ -258,13 +257,14 @@ static struct sock *mptcp_accept(struct sock *sk, int flags, int *err,if (!newsk)return NULL ; - subflow =mptcp_subflow_ctx (newsk); -pr_debug ("msk=%p, new subflow=%p, " , msk, subflow); +pr_debug ("msk=%p, subflow is mptcp=%d" , msk,tcp_sk (newsk)->is_mptcp); -if (subflow->mp_capable) { +if (tcp_sk (newsk)->is_mptcp) { +struct mptcp_subflow_context *subflow;struct sock *new_mptcp_sock;struct sock *ssk = newsk; + subflow =mptcp_subflow_ctx (newsk);lock_sock (sk);local_bh_disable ();
@@ -295,8 +295,6 @@ static struct sock *mptcp_accept(struct sock *sk, int flags, int *err,bh_unlock_sock (new_mptcp_sock);local_bh_enable ();release_sock (sk); - }else { -tcp_sk (newsk)->is_mptcp =0 ; }return newsk;
Signature · 1 line
2.21.0
Paolo Abeni
PATCH 3/7 Squash-to: "mptcp: Add key generation and token tree"
In reply to Paolo Abeni--- net/mptcp/subflow.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/mptcp/subflow.c +4 -1
@@ -160,8 +160,11 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,if (child && *own_req) {struct mptcp_subflow_context *ctx =mptcp_subflow_ctx (child); +/* we have null ctx on TCP fallback, not fatal on MPC +* handshake +*/ if (!ctx) - goto close_child; +return child;if (ctx->mp_capable) {if (mptcp_token_new_accept (ctx->token))
Signature · 1 line
2.21.0
Paolo Abeni
PATCH 4/7 Squash-to: "mptcp: Write MPTCP DSS headers to outgoing data packets"
In reply to Paolo Abeniuse 'is_tcp' to check for TCP fallback instead of mp_capable (and later mp_join).
--- net/mptcp/options.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mptcp/options.c +1 -1
@@ -303,7 +303,7 @@ bool mptcp_established_options(struct sock *sk, struct sk_buff *skb,unsigned int opt_size =0 ;bool ret = false; -if (!mptcp_subflow_ctx (sk)->mp_capable) +if (!tcp_sk (sk)->is_mptcp)return false;if (mptcp_established_options_mp (sk, &opt_size, remaining, opts))
Signature · 1 line
2.21.0
Mat Martineau
[MPTCP] Re: [PATCH v1 4/7] Squash-to: "mptcp: Write MPTCP DSS headers to outgoing data packets"
Quoted 14 lines · Paolo Abeni
use '
is_tcp' to check for TCP fallback instead ofmp_capable(and latermp_join).Suggested-by Mat Martineau <mathew.j.martineau(a)linux.intel.com>Signed-off-by Paolo Abeni <pabeni(a)redhat.com>---
net/mptcp/options.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)net/mptcp/options.c +0
-0
net/mptcp/options.c bool mptcp_established_options(struct sock *sk, struct sk_buff *skb, · line 307
Quoted 6 lines
net/mptcp/options.c +1
-1@@ -303,7 +303,7 @@ bool mptcp_established_options(struct sock *sk, struct sk_buff *skb,unsigned int opt_size =0 ;bool ret = false; -if (!mptcp_subflow_ctx (sk)->mp_capable) +if (!tcp_sk (sk)->is_mptcp)return false;
is_mptcp is already checked by the caller (tcp_established_options()) - maybe better to just delete this check?
Quoted 4 lines
net/mptcp/options.c +0
-0if (mptcp_established_options_mp (sk, &opt_size, remaining, opts))Signature · 1 line
2.21.0
--
Mat Martineau
Intel
Paolo Abeni
[MPTCP] Re: [PATCH v1 4/7] Squash-to: "mptcp: Write MPTCP DSS headers to outgoing data packets"
Quoted 19 lines · Mat Martineau
Quoted 17 lines · Paolo Abeni
use '
is_tcp' to check for TCP fallback instead ofmp_capable(and latermp_join).Suggested-by Mat Martineau <mathew.j.martineau(a)linux.intel.com>Signed-off-by Paolo Abeni <pabeni(a)redhat.com>---
net/mptcp/options.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)net/mptcp/options.c +0
-0@@ -303,7 +303,7 @@ bool mptcp_established_options(struct sock *sk, struct sk_buff *skb,unsigned int opt_size =0 ;bool ret = false;
Quoted 6 lines
net/mptcp/options.c bool mptcp_established_options(struct sock *sk, struct sk_buff *skb, · line 307
Quoted 3 lines
net/mptcp/options.c +1
-1-if (!mptcp_subflow_ctx (sk)->mp_capable) +if (!tcp_sk (sk)->is_mptcp)return false;
is_mptcpis already checked by the caller (tcp_established_options()) - maybe better to just delete this check?
Indeed! I missed that, thanks! Will do in the next iteration.
Thanks,
Paolo
Paolo Abeni
PATCH 5/7 Squash-to: "mptcp: Implement MPTCP receive path"
In reply to Paolo Abenideal with fallback: we must reset sk callback to the TCP one. Use the cached ptr in the old ctx.
RFC -> v1:
- since mptcp_incoming_options() callers check for is_mptcp and the latter is always cleared on fallback, we can drop any additional check in mptcp_incoming_options()
--- net/mptcp/options.c | 4 ---- net/mptcp/protocol.h | 15 ++++++++++++++- net/mptcp/subflow.c | 18 ++++++++++++------ 3 files changed, 26 insertions(+), 11 deletions(-)
net/mptcp/options.c +0 -4
@@ -416,13 +416,9 @@ bool mptcp_synack_options(const struct request_sock *req, unsigned int *size,void mptcp_incoming_options (struct sock *sk,struct sk_buff *skb,struct tcp_options_received *opt_rx) { -struct mptcp_subflow_context *subflow =mptcp_subflow_ctx (sk);struct mptcp_options_received *mp_opt;struct mptcp_ext *mpext; -if (!subflow->mp_capable) -return ; - mp_opt = &opt_rx->mptcp;if (!mp_opt->dss)
net/mptcp/protocol.h +14 -1
@@ -121,7 +121,10 @@ struct mptcp_subflow_context {struct sock *tcp_sock;/* tcp sk backpointer */ struct sock *conn;/* parent mptcp_sock */ const struct inet_connection_sock_af_ops *icsk_af_ops; -void (*tcp_sk_data_ready)(struct sock *sk); +void (*tcp_data_ready)(struct sock *sk); +void (*tcp_state_change)(struct sock *sk); +void (*tcp_write_space)(struct sock *sk); +struct rcu_head rcu; };
@@ -159,6 +162,16 @@ bool mptcp_subflow_data_available(struct sock *sk);void mptcp_subflow_init (void );int mptcp_subflow_create_socket (struct sock *sk,struct socket **new_sock); +static inline void mptcp_subflow_tcp_fallback (struct sock *sk, +struct mptcp_subflow_context *ctx) +{ + sk->sk_data_ready = ctx->tcp_data_ready; + sk->sk_state_change = ctx->tcp_state_change; + sk->sk_write_space = ctx->tcp_write_space; + +inet_csk (sk)->icsk_af_ops = ctx->icsk_af_ops; +} +extern const struct inet_connection_sock_af_ops ipv4_specific;#if IS_ENABLED (CONFIG_MPTCP_IPV6 )extern const struct inet_connection_sock_af_ops ipv6_specific;
net/mptcp/subflow.c +12 -6
@@ -507,7 +507,7 @@ static void subflow_data_ready(struct sock *sk)struct sock *parent = subflow->conn;if (!parent || !subflow->mp_capable) { - subflow->tcp_sk_data_ready (sk); + subflow->tcp_data_ready (sk);if (parent) parent->sk_data_ready (parent);
@@ -655,7 +655,9 @@ static int subflow_ulp_init(struct sock *sk)if (sk->sk_family ==AF_INET6 ) icsk->icsk_af_ops = &subflow_v6_specific;#endif - ctx->tcp_sk_data_ready = sk->sk_data_ready; + ctx->tcp_data_ready = sk->sk_data_ready; + ctx->tcp_state_change = sk->sk_state_change; + ctx->tcp_write_space = sk->sk_write_space; sk->sk_data_ready = subflow_data_ready; sk->sk_write_space = subflow_write_space; sk->sk_state_change = subflow_state_change;
@@ -676,10 +678,12 @@ static void subflow_ulp_release(struct sock *sk)kfree_rcu (ctx, rcu); } -static void subflow_ulp_fallback (struct sock *sk) +static void subflow_ulp_fallback (struct sock *sk, +struct mptcp_subflow_context *old_ctx) {struct inet_connection_sock *icsk =inet_csk (sk); +mptcp_subflow_tcp_fallback (sk, old_ctx); icsk->icsk_ulp_ops =NULL ;rcu_assign_pointer (icsk->icsk_ulp_data,NULL );tcp_sk (sk)->is_mptcp =0 ;
@@ -694,19 +698,21 @@ static void subflow_ulp_clone(const struct request_sock *req,struct mptcp_subflow_context *new_ctx;if (!subflow_req->mp_capable) { -subflow_ulp_fallback (newsk); +subflow_ulp_fallback (newsk, old_ctx);return ; } new_ctx =subflow_create_ctx (newsk, priority);if (new_ctx ==NULL ) { -subflow_ulp_fallback (newsk); +subflow_ulp_fallback (newsk, old_ctx);return ; } new_ctx->conn_finished =1 ; new_ctx->icsk_af_ops = old_ctx->icsk_af_ops; - new_ctx->tcp_sk_data_ready = old_ctx->tcp_sk_data_ready; + new_ctx->tcp_data_ready = old_ctx->tcp_data_ready; + new_ctx->tcp_state_change = old_ctx->tcp_state_change; + new_ctx->tcp_write_space = old_ctx->tcp_write_space; new_ctx->mp_capable =1 ; new_ctx->fourth_ack =1 ; new_ctx->remote_key = subflow_req->remote_key;
Signature · 1 line
2.21.0
Mat Martineau
[MPTCP] Re: [PATCH v1 5/7] Squash-to: "mptcp: Implement MPTCP receive path"
Quoted 38 lines · Paolo Abeni
deal with fallback: we must reset sk callback to the TCP one. Use the cached ptr in the old ctx.
RFC -> v1:
- sincemptcp_incoming_options()callers check foris_mptcpand the latter is always cleared on fallback, we can drop any additional check inmptcp_incoming_options()Signed-off-by Paolo Abeni <pabeni(a)redhat.com>---
net/mptcp/options.c | 4 ---- net/mptcp/protocol.h | 15 ++++++++++++++- net/mptcp/subflow.c | 18 ++++++++++++------ 3 files changed, 26 insertions(+), 11 deletions(-)net/mptcp/options.c +0
-4@@ -416,13 +416,9 @@ bool mptcp_synack_options(const struct request_sock *req, unsigned int *size,void mptcp_incoming_options (struct sock *sk,struct sk_buff *skb,struct tcp_options_received *opt_rx) { -struct mptcp_subflow_context *subflow =mptcp_subflow_ctx (sk);struct mptcp_options_received *mp_opt;struct mptcp_ext *mpext; -if (!subflow->mp_capable) -return ; - mp_opt = &opt_rx->mptcp;if (!mp_opt->dss)net/mptcp/protocol.h +0
-0
net/mptcp/protocol.h struct mptcp_subflow_context { · line 126
Quoted 7 lines
net/mptcp/protocol.h +3
-1@@ -121,7 +121,10 @@ struct mptcp_subflow_context {struct sock *tcp_sock;/* tcp sk backpointer */ struct sock *conn;/* parent mptcp_sock */ const struct inet_connection_sock_af_ops *icsk_af_ops; -void (*tcp_sk_data_ready)(struct sock *sk); +void (*tcp_data_ready)(struct sock *sk); +void (*tcp_state_change)(struct sock *sk); +void (*tcp_write_space)(struct sock *sk);
subflow_write_space() ends up with some direct calls to sk_stream_write_space() and sk_stream_is_writeable() - would it be better to use these new pointers for tcp_state_change/tcp_write_space or leave the direct calls?
Quoted 6 lines
net/mptcp/protocol.h +1
-0+struct rcu_head rcu; };@@ -159,6 +162,16 @@ bool mptcp_subflow_data_available(struct sock *sk);void mptcp_subflow_init (void );
net/mptcp/protocol.h bool mptcp_subflow_data_available(struct sock *sk); · line 172
Quoted 10 lines
net/mptcp/protocol.h +8
-0int mptcp_subflow_create_socket (struct sock *sk,struct socket **new_sock); +static inline void mptcp_subflow_tcp_fallback (struct sock *sk, +struct mptcp_subflow_context *ctx) +{ + sk->sk_data_ready = ctx->tcp_data_ready; + sk->sk_state_change = ctx->tcp_state_change; + sk->sk_write_space = ctx->tcp_write_space; + +inet_csk (sk)->icsk_af_ops = ctx->icsk_af_ops;
I'm a little paranoid about changing these back, but if ULP can change the pointers on an existing socket then I guess it should be safe to change them again if the subflow socket is locked.
I think the subflow callbacks to have the logic to handle fallback when is_mptcp is false, but it's less efficient to do so.
Mat
Quoted 74 lines
net/mptcp/protocol.h +2
-0+} +extern const struct inet_connection_sock_af_ops ipv4_specific;#if IS_ENABLED (CONFIG_MPTCP_IPV6 )extern const struct inet_connection_sock_af_ops ipv6_specific;net/mptcp/subflow.c +12
-6@@ -507,7 +507,7 @@ static void subflow_data_ready(struct sock *sk)struct sock *parent = subflow->conn;if (!parent || !subflow->mp_capable) { - subflow->tcp_sk_data_ready (sk); + subflow->tcp_data_ready (sk);if (parent) parent->sk_data_ready (parent);@@ -655,7 +655,9 @@ static int subflow_ulp_init(struct sock *sk)if (sk->sk_family ==AF_INET6 ) icsk->icsk_af_ops = &subflow_v6_specific;#endif - ctx->tcp_sk_data_ready = sk->sk_data_ready; + ctx->tcp_data_ready = sk->sk_data_ready; + ctx->tcp_state_change = sk->sk_state_change; + ctx->tcp_write_space = sk->sk_write_space; sk->sk_data_ready = subflow_data_ready; sk->sk_write_space = subflow_write_space; sk->sk_state_change = subflow_state_change;@@ -676,10 +678,12 @@ static void subflow_ulp_release(struct sock *sk)kfree_rcu (ctx, rcu); } -static void subflow_ulp_fallback (struct sock *sk) +static void subflow_ulp_fallback (struct sock *sk, +struct mptcp_subflow_context *old_ctx) {struct inet_connection_sock *icsk =inet_csk (sk); +mptcp_subflow_tcp_fallback (sk, old_ctx); icsk->icsk_ulp_ops =NULL ;rcu_assign_pointer (icsk->icsk_ulp_data,NULL );tcp_sk (sk)->is_mptcp =0 ;@@ -694,19 +698,21 @@ static void subflow_ulp_clone(const struct request_sock *req,struct mptcp_subflow_context *new_ctx;if (!subflow_req->mp_capable) { -subflow_ulp_fallback (newsk); +subflow_ulp_fallback (newsk, old_ctx);return ; } new_ctx =subflow_create_ctx (newsk, priority);if (new_ctx ==NULL ) { -subflow_ulp_fallback (newsk); +subflow_ulp_fallback (newsk, old_ctx);return ; } new_ctx->conn_finished =1 ; new_ctx->icsk_af_ops = old_ctx->icsk_af_ops; - new_ctx->tcp_sk_data_ready = old_ctx->tcp_sk_data_ready; + new_ctx->tcp_data_ready = old_ctx->tcp_data_ready; + new_ctx->tcp_state_change = old_ctx->tcp_state_change; + new_ctx->tcp_write_space = old_ctx->tcp_write_space; new_ctx->mp_capable =1 ; new_ctx->fourth_ack =1 ; new_ctx->remote_key = subflow_req->remote_key;Signature · 4 lines
2.21.0 _______________________________________________ mptcp mailing list -- mptcp(a)lists.01.org To unsubscribe send an email to mptcp-leave(a)lists.01.org
--
Mat Martineau
Intel
Paolo Abeni
[MPTCP] Re: [PATCH v1 5/7] Squash-to: "mptcp: Implement MPTCP receive path"
Quoted 44 lines · Mat Martineau
Quoted 42 lines · Paolo Abeni
deal with fallback: we must reset sk callback to the TCP one. Use the cached ptr in the old ctx.
RFC -> v1:
- sincemptcp_incoming_options()callers check foris_mptcpand the latter is always cleared on fallback, we can drop any additional check inmptcp_incoming_options()Signed-off-by Paolo Abeni <pabeni(a)redhat.com>---
net/mptcp/options.c | 4 ---- net/mptcp/protocol.h | 15 ++++++++++++++- net/mptcp/subflow.c | 18 ++++++++++++------ 3 files changed, 26 insertions(+), 11 deletions(-)net/mptcp/options.c +0
-4@@ -416,13 +416,9 @@ bool mptcp_synack_options(const struct request_sock *req, unsigned int *size,void mptcp_incoming_options (struct sock *sk,struct sk_buff *skb,struct tcp_options_received *opt_rx) { -struct mptcp_subflow_context *subflow =mptcp_subflow_ctx (sk);struct mptcp_options_received *mp_opt;struct mptcp_ext *mpext; -if (!subflow->mp_capable) -return ; - mp_opt = &opt_rx->mptcp;if (!mp_opt->dss)net/mptcp/protocol.h +0
-1@@ -121,7 +121,10 @@ struct mptcp_subflow_context {struct sock *tcp_sock;/* tcp sk backpointer */ struct sock *conn;/* parent mptcp_sock */ const struct inet_connection_sock_af_ops *icsk_af_ops; -void (*tcp_sk_data_ready)(struct sock *sk);
Quoted 8 lines
net/mptcp/protocol.h struct mptcp_subflow_context { · line 126
Quoted 3 lines
net/mptcp/protocol.h +3
-0+void (*tcp_data_ready)(struct sock *sk); +void (*tcp_state_change)(struct sock *sk); +void (*tcp_write_space)(struct sock *sk);
subflow_write_space()ends up with some direct calls tosk_stream_write_space()andsk_stream_is_writeable()- would it be better to use these new pointers for tcp_state_change/tcp_write_space or leave the direct calls?
yep, possibly. I opeted for the simpler change, and to avoid the indirect call. Perhaps we could use the indirect call wrappers here?
Quoted 21 lines
Quoted 6 lines
net/mptcp/protocol.h +1
-0+struct rcu_head rcu; };@@ -159,6 +162,16 @@ bool mptcp_subflow_data_available(struct sock *sk);void mptcp_subflow_init (void );net/mptcp/protocol.h bool mptcp_subflow_data_available(struct sock *sk); · line 172
Quoted 10 lines
net/mptcp/protocol.h +8
-0int mptcp_subflow_create_socket (struct sock *sk,struct socket **new_sock); +static inline void mptcp_subflow_tcp_fallback (struct sock *sk, +struct mptcp_subflow_context *ctx) +{ + sk->sk_data_ready = ctx->tcp_data_ready; + sk->sk_state_change = ctx->tcp_state_change; + sk->sk_write_space = ctx->tcp_write_space; + +inet_csk (sk)->icsk_af_ops = ctx->icsk_af_ops;I'm a little paranoid about changing these back, but if ULP can change the pointers on an existing socket then I guess it should be safe to change them again if the subflow socket is locked.
Quoted 2 lines
I think the subflow callbacks to have the logic to handle fallback when
is_mptcpis false, but it's less efficient to do so.
Yes, the subflow callbacks can handle the fallback logic, but they require a not-NULL subflow ctx. If the ULP clone operation fails, we will not have one.
We could handle that, checking for NULL ctx in the subflow specific icsk_af_ops, but I thought it simpler to just restore the TCP ones.
The TCP_ULP sockopt() already switches the socket icsk_af_ops keeping the socket lock held, as we do here, so I think it should be safe.
Cheers,
Paolo
Paolo Abeni
PATCH 6/7 Squash-to: "mptcp: cope with later TCP fallback"
In reply to Paolo AbeniNow we can fully restore the subflow status on late tcp fallback
--- net/mptcp/protocol.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/mptcp/protocol.c +3 -3
@@ -52,10 +52,10 @@ static struct socket *__mptcp_fallback_to_tcp(struct mptcp_sock *msk,lock_sock (ssk);sock_graft (ssk, sock);if (subflow->conn) { -/* Clearing the 'conn' field will make the ULP-overriden -* ops behaving like plain TCP ones. -* Note: we can't release the ULP data on a live socket. +/* We can't release the ULP data on a live socket, +* restore the tcp callback */ +mptcp_subflow_tcp_fallback (ssk, subflow);sock_put (subflow->conn); subflow->conn =NULL ; }
Signature · 1 line
2.21.0
Paolo Abeni
PATCH 7/7 Squash-to: "mptcp: Add handling of incoming MP_JOIN requests"
In reply to Paolo Abeniensure fallback is fatal for MP_JOIN, copying with changes introduced by previous squash-to patches
--- net/mptcp/subflow.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
net/mptcp/subflow.c +8 -3
@@ -256,6 +256,7 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,struct mptcp_subflow_context *listener =mptcp_subflow_ctx (sk);struct mptcp_subflow_request_sock *subflow_req;struct tcp_options_received opt_rx; +bool fallback_is_fatal = false;struct sock *child;pr_debug ("listener=%p, req=%p, conn=%p" , listener, req, listener->conn);
@@ -280,6 +281,7 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk, subflow_req->mp_capable =0 ; } }else if (subflow_req->mp_join) { + fallback_is_fatal = true; opt_rx.mptcp.mp_join =0 ;mptcp_get_options (skb, &opt_rx); if (!opt_rx.mptcp.mp_join ||
@@ -294,11 +296,14 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,if (child && *own_req) {struct mptcp_subflow_context *ctx =mptcp_subflow_ctx (child); -/* we have null ctx on TCP fallback, not fatal on MPC -* handshake +/* we have null ctx on TCP fallback, which is fatal on +* MPJ handshake */ -if (!ctx) +if (!ctx) { +if (fallback_is_fatal) + goto close_child;return child; + }if (ctx->mp_capable) {if (mptcp_token_new_accept (ctx->token))
Signature · 1 line
2.21.0
Mat Martineau
Quoted 15 lines · Paolo Abeni
This series do real TCP fallback for passive MPTCP connection when ULP clone
fails: clear the 'is_mptcp' flag, reset overridden callback, icsk ops and clear the ULP ctx.Additionally uses the '
is_mptcp' flag to check for fallback in more places, as suggested by Mat (patches 2, 4), cope with NULL ctx insubflow_syn_recv_sock()(patches 3, 7), and restore TCP callback on later fallback, too (patch 6) for consistency.This still uses function pointers to store all the overriden TCP callbacks, is simpler then other alternatives but waste some space inside the subflow struct.
The rebased tree is available at:
Quoted 7 lines
https://github.com/pabeni/mptcp/tree/mptcp_net-next_export_v6.2
options.c | 6 ----- protocol.c | 16 ++++++-------- protocol.h | 15 ++++++++++++- subflow.c | 67 ++++++++++++++++++++++++++++++++++++++++--------------------- 4 files changed, 67 insertions(+), 37 deletions(-)
I have one overall question about the series: do you want to use the sk_is_mptcp() helper throughout? The added is_mptcp checks mostly do so directly (tcp_sk(sk)->is_mptcp).
I sent some feedback for patches 4 & 5, the others looked ok other than the sk_is_mptcp() question.
--
Mat Martineau
Intel
Paolo Abeni
Quoted 25 lines · Mat Martineau
Quoted 15 lines · Paolo Abeni
This series do real TCP fallback for passive MPTCP connection when ULP clone
fails: clear the 'is_mptcp' flag, reset overridden callback, icsk ops and clear the ULP ctx.Additionally uses the '
is_mptcp' flag to check for fallback in more places, as suggested by Mat (patches 2, 4), cope with NULL ctx insubflow_syn_recv_sock()(patches 3, 7), and restore TCP callback on later fallback, too (patch 6) for consistency.This still uses function pointers to store all the overriden TCP callbacks, is simpler then other alternatives but waste some space inside the subflow struct.
The rebased tree is available at:
Quoted 7 lines
https://github.com/pabeni/mptcp/tree/mptcp_net-next_export_v6.2
options.c | 6 ----- protocol.c | 16 ++++++-------- protocol.h | 15 ++++++++++++- subflow.c | 67 ++++++++++++++++++++++++++++++++++++++++--------------------- 4 files changed, 67 insertions(+), 37 deletions(-)
Quoted 3 lines
I have one overall question about the series: do you want to use the
sk_is_mptcp()helper throughout? The addedis_mptcpchecks mostly do so directly (tcp_sk(sk)->is_mptcp).
Agreed, will do in the next iteration.
Thanks,
Paolo