* [PATCH mptcp-next 0/2] introduce msk_is_mptcp() helper
@ 2026-10-13 6:56 Geliang Tang
2026-10-13 6:56 ` [PATCH mptcp-next 1/2] mptcp: add " Geliang Tang
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Geliang Tang @ 2026-10-13 6:56 UTC (permalink / raw)
To: mptcp; +Cc: Geliang Tang, Günther Noack
From: Geliang Tang <tanggeliang@kylinos.cn>
This series introduces the msk_is_mptcp() helper function to check
whether a socket is an MPTCP parent socket (IPPROTO_MPTCP on SOCK_STREAM).
This helper is useful for adding MPTCP support in various subsystems,
such as MPTCP sockmap support [1] and landlock MPTCP access rights [2].
Naming rationale:
- Initially considered "sk_is_msk", but as Günther pointed out, "msk"
is already used as an abbreviation in net/mctp, which could cause
confusion
- "sk_is_mptcp()" is already taken and used to check whether a socket
is an MPTCP subflow (tcp_sk(sk)->is_mptcp)
- Following the convention of rsk_is_mptcp(), settled on msk_is_mptcp()
to clearly distinguish MPTCP parent socket checks from subflow checks
[1] mptcp: add sk_is_msk() helper and use it in sockmap
https://patchwork.kernel.org/project/mptcp/patch/29ec7b3fc7febc1c8946add34f859c8253d9714f.1789294365.git.tanggeliang@kylinos.cn/
[2] landlock: Add MPTCP bind and connect access rights
https://patchwork.kernel.org/project/mptcp/patch/20260830201650.67050-4-gnoack3000@gmail.com/
Geliang Tang (2):
mptcp: add msk_is_mptcp() helper
Squash to "bpf: Add mptcp_subflow bpf_iter"
include/net/mptcp.h | 12 ++++++++++++
net/mptcp/bpf.c | 9 +--------
2 files changed, 13 insertions(+), 8 deletions(-)
--
2.55.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH mptcp-next 1/2] mptcp: add msk_is_mptcp() helper
2026-10-13 6:56 [PATCH mptcp-next 0/2] introduce msk_is_mptcp() helper Geliang Tang
@ 2026-10-13 6:56 ` Geliang Tang
2026-10-14 5:13 ` Günther Noack
2026-10-13 6:56 ` [PATCH mptcp-next 2/2] Squash to "bpf: Add mptcp_subflow bpf_iter" Geliang Tang
2026-10-13 8:08 ` [PATCH mptcp-next 0/2] introduce msk_is_mptcp() helper MPTCP CI
2 siblings, 1 reply; 5+ messages in thread
From: Geliang Tang @ 2026-10-13 6:56 UTC (permalink / raw)
To: mptcp; +Cc: Geliang Tang, Günther Noack
From: Geliang Tang <tanggeliang@kylinos.cn>
Introduce msk_is_mptcp() to check whether a socket is an MPTCP socket
(IPPROTO_MPTCP on SOCK_STREAM), modeled after sk_is_tcp(). Unlike
sk_is_mptcp() which tests a subflow socket, this helper takes an
MPTCP parent socket directly.
The naming follows the convention of rsk_is_mptcp() to distinguish it
from sk_is_mptcp(). This helper will be used in net/core/sock_map.c
alongside sk_is_tcp() to add MPTCP support for BPF sockmap, and in
other places where MPTCP parent socket type checking is needed.
Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
include/net/mptcp.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/include/net/mptcp.h b/include/net/mptcp.h
index 30f0e8ba88a8..8943d9f2b48b 100644
--- a/include/net/mptcp.h
+++ b/include/net/mptcp.h
@@ -150,6 +150,13 @@ static inline bool rsk_drop_req(const struct request_sock *req)
return tcp_rsk(req)->is_mptcp && tcp_rsk(req)->drop_req;
}
+static inline bool msk_is_mptcp(const struct sock *sk)
+{
+ return sk_is_inet(sk) &&
+ sk->sk_type == SOCK_STREAM &&
+ sk->sk_protocol == IPPROTO_MPTCP;
+}
+
void mptcp_space(const struct sock *ssk, int *space, int *full_space);
bool mptcp_syn_options(struct sock *sk, const struct sk_buff *skb,
unsigned int *size, struct mptcp_out_options *opts);
@@ -261,6 +268,11 @@ static inline bool rsk_drop_req(const struct request_sock *req)
return false;
}
+static inline bool msk_is_mptcp(const struct sock *sk)
+{
+ return false;
+}
+
static inline bool mptcp_syn_options(struct sock *sk, const struct sk_buff *skb,
unsigned int *size,
struct mptcp_out_options *opts)
--
2.55.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH mptcp-next 2/2] Squash to "bpf: Add mptcp_subflow bpf_iter"
2026-10-13 6:56 [PATCH mptcp-next 0/2] introduce msk_is_mptcp() helper Geliang Tang
2026-10-13 6:56 ` [PATCH mptcp-next 1/2] mptcp: add " Geliang Tang
@ 2026-10-13 6:56 ` Geliang Tang
2026-10-13 8:08 ` [PATCH mptcp-next 0/2] introduce msk_is_mptcp() helper MPTCP CI
2 siblings, 0 replies; 5+ messages in thread
From: Geliang Tang @ 2026-10-13 6:56 UTC (permalink / raw)
To: mptcp; +Cc: Geliang Tang, Günther Noack
From: Geliang Tang <tanggeliang@kylinos.cn>
Use the new msk_is_mptcp() helper to replace the open-coded check for
sk_type and sk_protocol in bpf_iter_mptcp_subflow_new(). This makes
the code cleaner and consistent with other MPTCP socket type checks.
Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
net/mptcp/bpf.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/net/mptcp/bpf.c b/net/mptcp/bpf.c
index 82b0ad25f700..53111d7a9eee 100644
--- a/net/mptcp/bpf.c
+++ b/net/mptcp/bpf.c
@@ -250,14 +250,7 @@ bpf_iter_mptcp_subflow_new(struct bpf_iter_mptcp_subflow *it,
BUILD_BUG_ON(__alignof__(struct bpf_iter_mptcp_subflow_kern) !=
__alignof__(struct bpf_iter_mptcp_subflow));
- if (unlikely(!sk || !sk_fullsock(sk))) {
- kit->msk = NULL;
- kit->pos = NULL;
- return -EINVAL;
- }
-
- if (sk->sk_type != SOCK_STREAM ||
- sk->sk_protocol != IPPROTO_MPTCP) {
+ if (unlikely(!sk || !sk_fullsock(sk) || !msk_is_mptcp(sk))) {
kit->msk = NULL;
kit->pos = NULL;
return -EINVAL;
--
2.55.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH mptcp-next 0/2] introduce msk_is_mptcp() helper
2026-10-13 6:56 [PATCH mptcp-next 0/2] introduce msk_is_mptcp() helper Geliang Tang
2026-10-13 6:56 ` [PATCH mptcp-next 1/2] mptcp: add " Geliang Tang
2026-10-13 6:56 ` [PATCH mptcp-next 2/2] Squash to "bpf: Add mptcp_subflow bpf_iter" Geliang Tang
@ 2026-10-13 8:08 ` MPTCP CI
2 siblings, 0 replies; 5+ messages in thread
From: MPTCP CI @ 2026-10-13 8:08 UTC (permalink / raw)
To: Geliang Tang; +Cc: mptcp
Hi Geliang,
Thank you for your modifications, that's great!
Our CI did some validations and here is its report:
- KVM Validation: normal (except selftest_mptcp_join): Success! ✅
- KVM Validation: normal (only selftest_mptcp_join): Success! ✅
- KVM Validation: debug (except selftest_mptcp_join): Success! ✅
- KVM Validation: debug (only selftest_mptcp_join): Success! ✅
- KVM Validation: btf-normal (only bpftest_all): Success! ✅
- KVM Validation: btf-debug (only bpftest_all): Success! ✅
- Perf: Success! ✅
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/38361897543
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/b39a692c5e0f
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=1184430
If there are some issues, you can reproduce them using the same environment as
the one used by the CI thanks to a docker image, e.g.:
$ cd [kernel source code]
$ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
--pull always mptcp/mptcp-upstream-virtme-docker:latest \
auto-normal
For more details:
https://github.com/multipath-tcp/mptcp-upstream-virtme-docker
Please note that despite all the efforts that have been already done to have a
stable tests suite when executed on a public CI like here, it is possible some
reported issues are not due to your modifications. Still, do not hesitate to
help us improve that ;-)
Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (NGI0 Core)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH mptcp-next 1/2] mptcp: add msk_is_mptcp() helper
2026-10-13 6:56 ` [PATCH mptcp-next 1/2] mptcp: add " Geliang Tang
@ 2026-10-14 5:13 ` Günther Noack
0 siblings, 0 replies; 5+ messages in thread
From: Günther Noack @ 2026-10-14 5:13 UTC (permalink / raw)
To: Geliang Tang
Cc: mptcp, Geliang Tang, linux-security-module,
Mickaël Salaün
On Tue, Oct 13, 2026 at 02:56:46PM +0800, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
>
> Introduce msk_is_mptcp() to check whether a socket is an MPTCP socket
> (IPPROTO_MPTCP on SOCK_STREAM), modeled after sk_is_tcp(). Unlike
> sk_is_mptcp() which tests a subflow socket, this helper takes an
> MPTCP parent socket directly.
>
> The naming follows the convention of rsk_is_mptcp() to distinguish it
> from sk_is_mptcp(). This helper will be used in net/core/sock_map.c
> alongside sk_is_tcp() to add MPTCP support for BPF sockmap, and in
> other places where MPTCP parent socket type checking is needed.
>
> Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> ---
> include/net/mptcp.h | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/include/net/mptcp.h b/include/net/mptcp.h
> index 30f0e8ba88a8..8943d9f2b48b 100644
> --- a/include/net/mptcp.h
> +++ b/include/net/mptcp.h
> @@ -150,6 +150,13 @@ static inline bool rsk_drop_req(const struct request_sock *req)
> return tcp_rsk(req)->is_mptcp && tcp_rsk(req)->drop_req;
> }
>
> +static inline bool msk_is_mptcp(const struct sock *sk)
> +{
> + return sk_is_inet(sk) &&
> + sk->sk_type == SOCK_STREAM &&
> + sk->sk_protocol == IPPROTO_MPTCP;
> +}
> +
> void mptcp_space(const struct sock *ssk, int *space, int *full_space);
> bool mptcp_syn_options(struct sock *sk, const struct sk_buff *skb,
> unsigned int *size, struct mptcp_out_options *opts);
> @@ -261,6 +268,11 @@ static inline bool rsk_drop_req(const struct request_sock *req)
> return false;
> }
>
> +static inline bool msk_is_mptcp(const struct sock *sk)
> +{
> + return false;
> +}
> +
> static inline bool mptcp_syn_options(struct sock *sk, const struct sk_buff *skb,
> unsigned int *size,
> struct mptcp_out_options *opts)
> --
> 2.55.0
>
Reviewed-by: Günther Noack <gnoack3000@gmail.com>
Thank you Geliang! This is exactly the helper we'd need for the
Landlock MPTCP patch as well, and I'll happily rebase my patch set on
that and use this more central helper!
(Landlock is currently a bit bottlenecked on code reviews, so that
review is moving a bit slower, but we'll get to it.)
–Günther
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-10-14 5:13 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-13 6:56 [PATCH mptcp-next 0/2] introduce msk_is_mptcp() helper Geliang Tang
2026-10-13 6:56 ` [PATCH mptcp-next 1/2] mptcp: add " Geliang Tang
2026-10-14 5:13 ` Günther Noack
2026-10-13 6:56 ` [PATCH mptcp-next 2/2] Squash to "bpf: Add mptcp_subflow bpf_iter" Geliang Tang
2026-10-13 8:08 ` [PATCH mptcp-next 0/2] introduce msk_is_mptcp() helper MPTCP CI
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.