OSDN Git Service

mptcp: establish subflows from either end of connection
authorKishen Maloor <kishen.maloor@intel.com>
Mon, 2 May 2022 20:52:35 +0000 (13:52 -0700)
committerJakub Kicinski <kuba@kernel.org>
Tue, 3 May 2022 23:54:55 +0000 (16:54 -0700)
This change updates internal logic to permit subflows to be
established from either the client or server ends of MPTCP
connections. This symmetry and added flexibility may be
harnessed by PM implementations running on either end in
creating new subflows.

The essence of this change lies in not relying on the
"server_side" flag (which continues to be available if needed).

Acked-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Kishen Maloor <kishen.maloor@intel.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/mptcp/options.c
net/mptcp/protocol.c
net/mptcp/protocol.h

index c9625fe..e05d945 100644 (file)
@@ -931,7 +931,7 @@ static bool check_fully_established(struct mptcp_sock *msk, struct sock *ssk,
                if (TCP_SKB_CB(skb)->seq == subflow->ssn_offset + 1 &&
                    TCP_SKB_CB(skb)->end_seq == TCP_SKB_CB(skb)->seq &&
                    subflow->mp_join && (mp_opt->suboptions & OPTIONS_MPTCP_MPJ) &&
-                   READ_ONCE(msk->pm.server_side))
+                   !subflow->request_join)
                        tcp_send_ack(ssk);
                goto fully_established;
        }
index a5d466e..5d52914 100644 (file)
@@ -3321,15 +3321,12 @@ bool mptcp_finish_join(struct sock *ssk)
                return false;
        }
 
-       if (!msk->pm.server_side)
+       if (!list_empty(&subflow->node))
                goto out;
 
        if (!mptcp_pm_allow_new_subflow(msk))
                goto err_prohibited;
 
-       if (WARN_ON_ONCE(!list_empty(&subflow->node)))
-               goto err_prohibited;
-
        /* active connections are already on conn_list.
         * If we can't acquire msk socket lock here, let the release callback
         * handle it
index a762b78..187c932 100644 (file)
@@ -911,13 +911,17 @@ static inline bool mptcp_check_infinite_map(struct sk_buff *skb)
        return false;
 }
 
+static inline bool is_active_ssk(struct mptcp_subflow_context *subflow)
+{
+       return (subflow->request_mptcp || subflow->request_join);
+}
+
 static inline bool subflow_simultaneous_connect(struct sock *sk)
 {
        struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
-       struct sock *parent = subflow->conn;
 
        return sk->sk_state == TCP_ESTABLISHED &&
-              !mptcp_sk(parent)->pm.server_side &&
+              is_active_ssk(subflow) &&
               !subflow->conn_finished;
 }