Skip to content

Commit 535d620

Browse files
Geliang Tangkuba-moo
authored andcommitted
mptcp: map v4 address to v6 when destroying subflow
Address family of server side mismatches with that of client side, like in "userspace pm add & remove address" test: userspace_pm_add_addr $ns1 10.0.2.1 10 userspace_pm_rm_sf $ns1 "::ffff:10.0.2.1" $SUB_ESTABLISHED That's because on the server side, the family is set to AF_INET6 and the v4 address is mapped in a v6 one. This patch fixes this issue. In mptcp_pm_nl_subflow_destroy_doit(), before checking local address family with remote address family, map an IPv4 address to an IPv6 address if the pair is a v4-mapped address. Closes: multipath-tcp/mptcp_net-next#387 Fixes: 702c2f6 ("mptcp: netlink: allow userspace-driven subflow establishment") Cc: [email protected] Signed-off-by: Geliang Tang <[email protected]> Reviewed-by: Mat Martineau <[email protected]> Reviewed-by: Matthieu Baerts (NGI0) <[email protected]> Signed-off-by: Matthieu Baerts (NGI0) <[email protected]> Link: https://lore.kernel.org/r/20240223-upstream-net-20240223-misc-fixes-v1-1-162e87e48497@kernel.org Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 0d60d8d commit 535d620

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

net/mptcp/pm_userspace.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,16 @@ int mptcp_pm_nl_subflow_destroy_doit(struct sk_buff *skb, struct genl_info *info
495495
goto destroy_err;
496496
}
497497

498+
#if IS_ENABLED(CONFIG_MPTCP_IPV6)
499+
if (addr_l.family == AF_INET && ipv6_addr_v4mapped(&addr_r.addr6)) {
500+
ipv6_addr_set_v4mapped(addr_l.addr.s_addr, &addr_l.addr6);
501+
addr_l.family = AF_INET6;
502+
}
503+
if (addr_r.family == AF_INET && ipv6_addr_v4mapped(&addr_l.addr6)) {
504+
ipv6_addr_set_v4mapped(addr_r.addr.s_addr, &addr_r.addr6);
505+
addr_r.family = AF_INET6;
506+
}
507+
#endif
498508
if (addr_l.family != addr_r.family) {
499509
GENL_SET_ERR_MSG(info, "address families do not match");
500510
err = -EINVAL;

0 commit comments

Comments
 (0)