mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matthieu Baerts <matttbe@kernel.org>
To: Pedro Falcato <pfalcato@suse.de>,
	Mat Martineau <martineau@kernel.org>,
	Geliang Tang <geliang@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: Simon Horman <horms@kernel.org>,
	netdev@vger.kernel.org, mptcp@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mptcp: Align mptcp_inet6_sk with other protocols
Date: Fri, 2 May 2025 19:00:15 +0200	[thread overview]
Message-ID: <32460611-f05e-43ea-a57c-494a29d85bb3@kernel.org> (raw)
In-Reply-To: <20250430154541.1038561-1-pfalcato@suse.de>

Hi Pedro,

On 30/04/2025 17:45, Pedro Falcato wrote:
> Ever since commit f5f80e32de12 ("ipv6: remove hard coded limitation on
> ipv6_pinfo") that protocols stopped using the old "obj_size -
> sizeof(struct ipv6_pinfo)" way of grabbing ipv6_pinfo, that severely
> restricted struct layout and caused fun, hard to see issues.
> 
> However, mptcp_inet6_sk wasn't fixed (unlike tcp_inet6_sk). Do so.
> The non-cloned sockets already do the right thing using
> ipv6_pinfo_offset + the generic IPv6 code.
> 
> Signed-off-by: Pedro Falcato <pfalcato@suse.de>
> ---
>  net/mptcp/protocol.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> index 26ffa06c21e8..c4fd558307f2 100644
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c
> @@ -3142,9 +3142,9 @@ static int mptcp_disconnect(struct sock *sk, int flags)
>  #if IS_ENABLED(CONFIG_MPTCP_IPV6)
>  static struct ipv6_pinfo *mptcp_inet6_sk(const struct sock *sk)
>  {
> -	unsigned int offset = sizeof(struct mptcp6_sock) - sizeof(struct ipv6_pinfo);
> +	struct mptcp6_sock *msk6 = container_of(mptcp_sk(sk), struct mptcp6_sock, msk);
>  
> -	return (struct ipv6_pinfo *)(((u8 *)sk) + offset);
> +	return &msk6->np;

Thank you for suggesting this! Good idea, that's clearer!

Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>

@Netdev maintainers: this can be applied in net-next directly.

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.


  reply	other threads:[~2025-05-02 17:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-30 15:45 Pedro Falcato
2025-05-02 17:00 ` Matthieu Baerts [this message]
2025-05-03  1:40 ` patchwork-bot+netdevbpf

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=32460611-f05e-43ea-a57c-494a29d85bb3@kernel.org \
    --to=matttbe@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=geliang@kernel.org \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martineau@kernel.org \
    --cc=mptcp@lists.linux.dev \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pfalcato@suse.de \
    /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

all inboxes | Powered by JetHome®