From: "Günther Noack" <gnoack3000@gmail.com>
To: Geliang Tang <geliang@kernel.org>
Cc: mptcp@lists.linux.dev, "Geliang Tang" <tanggeliang@kylinos.cn>,
linux-security-module@vger.kernel.org,
"Mickaël Salaün" <mic@digikod.net>
Subject: Re: [PATCH mptcp-next 1/2] mptcp: add msk_is_mptcp() helper
Date: Wed, 14 Oct 2026 07:13:36 +0200 [thread overview]
Message-ID: <20261014.8253317f0919@gnoack.org> (raw)
In-Reply-To: <1b21558a40905ae312d2ac987de4db0a04db3c02.1791873760.git.tanggeliang@kylinos.cn>
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
parent reply other threads:[~2026-10-14 5:13 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <1b21558a40905ae312d2ac987de4db0a04db3c02.1791873760.git.tanggeliang@kylinos.cn>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261014.8253317f0919@gnoack.org \
--to=gnoack3000@gmail.com \
--cc=geliang@kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=mic@digikod.net \
--cc=mptcp@lists.linux.dev \
--cc=tanggeliang@kylinos.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox