[RFC mptcp-next v4 05/10] tls: switch to mptcp_recv_skb

Geliang Tang
2025-12-12T02:27:35Z

To extend MPTCP support based on TCP TLS, corresponding MPTCP-specific
helper mptcp_recv_skb() has been exported into net/mptcp.h.

TLS implementation switches between the respective TCP and MPTCP helpers
based on the detected protocol.

Co-developed-by: Gang Yan <yangang@kylinos.cn>
Signed-off-by: Gang Yan <yangang@kylinos.cn>
Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
include/net/mptcp.h | 7 +++++++
net/mptcp/protocol.c | 2 +-
net/tls/tls_strp.c | 4 +++-
3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/include/net/mptcp.h b/include/net/mptcp.h
index cdb726865486..3fe60818cada 100644
--- a/include/net/mptcp.h
+++ b/include/net/mptcp.h
@@ -258,6 +258,8 @@ void mptcp_active_detect_blackhole(struct sock *sk, bool expired);
unsigned int mptcp_inq(const struct sock *sk);

int mptcp_sendmsg_locked(struct sock *sk, struct msghdr *msg, size_t len);
+
+struct sk_buff *mptcp_recv_skb(struct sock *sk, u32 *off);
#else

static inline void mptcp_init(void)
@@ -360,6 +362,11 @@ static inline int mptcp_sendmsg_locked(struct sock *sk, struct msghdr *msg,
{
return 0;
}
+
+static inline struct sk_buff *mptcp_recv_skb(struct sock *sk, u32 *off)
+{
+ return NULL;
+}
#endif /* CONFIG_MPTCP */

#if IS_ENABLED(CONFIG_MPTCP_IPV6)
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index feac59a92b32..92141e87ed25 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -4340,7 +4340,7 @@ static __poll_t mptcp_poll(struct file *file, struct socket *sock,
return mask;
}

-static struct sk_buff *mptcp_recv_skb(struct sock *sk, u32 *off)
+struct sk_buff *mptcp_recv_skb(struct sock *sk, u32 *off)
{
struct mptcp_sock *msk = mptcp_sk(sk);
struct sk_buff *skb;
diff --git a/net/tls/tls_strp.c b/net/tls/tls_strp.c
index 0639130b8d5e..3bddb871d90b 100644
--- a/net/tls/tls_strp.c
+++ b/net/tls/tls_strp.c
@@ -468,7 +468,9 @@ static void tls_strp_load_anchor_with_queue(struct tls_strparser *strp, int len)
struct sk_buff *first;
u32 offset;

- first = tcp_recv_skb(strp->sk, tp->copied_seq, &offset);
+ first = sk_is_msk(strp->sk) ?
+ mptcp_recv_skb(strp->sk, &offset) :
+ tcp_recv_skb(strp->sk, tp->copied_seq, &offset);
if (WARN_ON_ONCE(!first))
return;

--
2.51.0