All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mptcp: Align mptcp_inet6_sk with other protocols
@ 2025-04-30 15:45 Pedro Falcato
  2025-04-30 17:08 ` MPTCP CI
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Pedro Falcato @ 2025-04-30 15:45 UTC (permalink / raw)
  To: Matthieu Baerts, Mat Martineau, Geliang Tang, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Simon Horman, netdev, mptcp, linux-kernel, Pedro Falcato

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;
 }
 
 static void mptcp_copy_ip6_options(struct sock *newsk, const struct sock *sk)
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mptcp: Align mptcp_inet6_sk with other protocols
  2025-04-30 15:45 [PATCH] mptcp: Align mptcp_inet6_sk with other protocols Pedro Falcato
@ 2025-04-30 17:08 ` MPTCP CI
  2025-05-02 17:00 ` Matthieu Baerts
  2025-05-03  1:40 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: MPTCP CI @ 2025-04-30 17:08 UTC (permalink / raw)
  To: Pedro Falcato; +Cc: mptcp

Hi Pedro,

Thank you for your modifications, that's great!

Our CI did some validations and here is its report:

- KVM Validation: normal: Success! ✅
- KVM Validation: debug: Success! ✅
- KVM Validation: btf-normal (only bpftest_all): Success! ✅
- KVM Validation: btf-debug (only bpftest_all): Success! ✅
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/14758969434

Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/0a4b887f44e6
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=958572


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] 4+ messages in thread

* Re: [PATCH] mptcp: Align mptcp_inet6_sk with other protocols
  2025-04-30 15:45 [PATCH] mptcp: Align mptcp_inet6_sk with other protocols Pedro Falcato
  2025-04-30 17:08 ` MPTCP CI
@ 2025-05-02 17:00 ` Matthieu Baerts
  2025-05-03  1:40 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Matthieu Baerts @ 2025-05-02 17:00 UTC (permalink / raw)
  To: Pedro Falcato, Mat Martineau, Geliang Tang, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Simon Horman, netdev, mptcp, linux-kernel

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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mptcp: Align mptcp_inet6_sk with other protocols
  2025-04-30 15:45 [PATCH] mptcp: Align mptcp_inet6_sk with other protocols Pedro Falcato
  2025-04-30 17:08 ` MPTCP CI
  2025-05-02 17:00 ` Matthieu Baerts
@ 2025-05-03  1:40 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-05-03  1:40 UTC (permalink / raw)
  To: Pedro Falcato
  Cc: matttbe, martineau, geliang, davem, edumazet, kuba, pabeni, horms,
	netdev, mptcp, linux-kernel

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 30 Apr 2025 16:45:41 +0100 you 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.
> 
> [...]

Here is the summary with links:
  - mptcp: Align mptcp_inet6_sk with other protocols
    https://git.kernel.org/netdev/net-next/c/a2f6476ed18a

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-05-03  1:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-30 15:45 [PATCH] mptcp: Align mptcp_inet6_sk with other protocols Pedro Falcato
2025-04-30 17:08 ` MPTCP CI
2025-05-02 17:00 ` Matthieu Baerts
2025-05-03  1:40 ` patchwork-bot+netdevbpf

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.