[PATCH mptcp-net] mptcp: fix for setting remote ipv4mapped address

Geliang Tang posted 1 patch 3 weeks, 5 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/multipath-tcp/mptcp_net-next tags/patchew/35436a387650236cce065f198b89bb5afb23f708.1735205514.git.tanggeliang@kylinos.cn
There is a newer version of this series
net/mptcp/pm_userspace.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH mptcp-net] mptcp: fix for setting remote ipv4mapped address
Posted by Geliang Tang 3 weeks, 5 days ago
From: Geliang Tang <tanggeliang@kylinos.cn>

Commit 1c670b39cec7 ("mptcp: change local addr type of subflow_destroy")
introduced a bug in mptcp_pm_nl_subflow_destroy_doit().

ipv6_addr_set_v4mapped() should be called to set the remote ipv4 address
'addr_r.addr.s_addr' to the remote ipv6 address 'addr_r.addr6', not
'addr_l.addr.addr6', which is the local ipv6 address.

Fixes: 1c670b39cec7 ("mptcp: change local addr type of subflow_destroy")
Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
 net/mptcp/pm_userspace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c
index 740a10d669f8..a3d477059b11 100644
--- a/net/mptcp/pm_userspace.c
+++ b/net/mptcp/pm_userspace.c
@@ -520,7 +520,7 @@ int mptcp_pm_nl_subflow_destroy_doit(struct sk_buff *skb, struct genl_info *info
 		addr_l.addr.family = AF_INET6;
 	}
 	if (addr_r.family == AF_INET && ipv6_addr_v4mapped(&addr_l.addr.addr6)) {
-		ipv6_addr_set_v4mapped(addr_r.addr.s_addr, &addr_l.addr.addr6);
+		ipv6_addr_set_v4mapped(addr_r.addr.s_addr, &addr_r.addr6);
 		addr_r.family = AF_INET6;
 	}
 #endif
-- 
2.45.2
Re: [PATCH mptcp-net] mptcp: fix for setting remote ipv4mapped address
Posted by Matthieu Baerts 3 weeks, 3 days ago
Hi Geliang,

(-cc Jakub)

On 26/12/2024 10:33, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
> 
> Commit 1c670b39cec7 ("mptcp: change local addr type of subflow_destroy")
> introduced a bug in mptcp_pm_nl_subflow_destroy_doit().
> 
> ipv6_addr_set_v4mapped() should be called to set the remote ipv4 address
> 'addr_r.addr.s_addr' to the remote ipv6 address 'addr_r.addr6', not
> 'addr_l.addr.addr6', which is the local ipv6 address.
> 
> Fixes: 1c670b39cec7 ("mptcp: change local addr type of subflow_destroy")

Now in our tree (fixes for next):

New patches for t/upstream:
- 9da48b72c233: mptcp: fix for setting remote ipv4mapped address
- Results: 472bd4bb9bf0..f770d70d123d (export)

Tests are now in progress:

- export:
https://github.com/multipath-tcp/mptcp_net-next/commit/280f4e69601cbcb770ac1095b6e3c968de2de6a3/checks

I will send it later, when net-next will re-open.

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.
Re: [PATCH mptcp-net] mptcp: fix for setting remote ipv4mapped address
Posted by Matthieu Baerts 3 weeks, 3 days ago
Hi Geliang,

No need to cc Jakub for patches that are in review only on MPTCP side.
Please remove his address from the Cc list for the next replies.

On 26/12/2024 10:33, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
> 
> Commit 1c670b39cec7 ("mptcp: change local addr type of subflow_destroy")
> introduced a bug in mptcp_pm_nl_subflow_destroy_doit().
> 
> ipv6_addr_set_v4mapped() should be called to set the remote ipv4 address
> 'addr_r.addr.s_addr' to the remote ipv6 address 'addr_r.addr6', not
> 'addr_l.addr.addr6', which is the local ipv6 address.

Good catch! How did you notice that? It looks like we are currently not
validating this part:

https://ci-results.mptcp.dev/lcov/export/mptcp/pm_userspace.c.gcov.html#L519

Is it because you are looking at adding tests covering this?

> Fixes: 1c670b39cec7 ("mptcp: change local addr type of subflow_destroy")

This commit is only in net-next, not in -net. So I'm going to apply it
in "Fixes for net-next" ("mptcp-next" then).

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

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