From nobody Thu Dec 26 12:51:17 2024 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2354DCA64 for ; Wed, 7 Feb 2024 01:56:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707270988; cv=none; b=VpORVxbtIGGoZ7svSXkbkqHbqOPWtWNYSXPA1moLeXw2sHAg8t7HxYgJq56GctCuaJcrdVDmGFXDwyYKCoznXXsegmCczH4RTVGzsQuEqYPjyB2ZkCkTJNJXd72Xd8seCroJrNqrX3xthCHUoilY8it3frPVLWe8hvidsiJvrZY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707270988; c=relaxed/simple; bh=hnYBjXXQwPOjX21cOo/GguoDq08ls1+BTYVpns+F5aY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=nJRSy4AVNe43Nhe2XlL5f8dlDaW1gsln3tmeaqZ6/eLySf7Qxam6GsqI28ZuON/ise/nbRFHH8TpBShZcCJtcxAEbCxZEi7pMC85CR3xwARYr7f9M9b1o37SQ0FrkIPKB+dQcw61D1uuDW4Bb/KH76axHo/ByB7WgcITIaHeyPE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WHEthR2+; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="WHEthR2+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 855D5C433F1; Wed, 7 Feb 2024 01:56:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707270987; bh=hnYBjXXQwPOjX21cOo/GguoDq08ls1+BTYVpns+F5aY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WHEthR2+/ikWy6Lx/+DF92XJ2XJAbOy7z0jZxyrx4/BH2+9JB7bxMQ+HcnJMvyE/+ 4BKM4mLb71z02496BUE4S7H0/An7B0Dr9SStMgpeoPGVn/nBRBFDmv0ezCS6+c2qCo mregEHBrVtN3QCuoNzxeEMo6H/p/K7Ns1AI/eOlrJLCfuMUTYh3oWTD0l6As1PBPE8 +VWNvhGUNFFf/M6Lih/HoY6HesKUw6yEGQmQEdWXGu6h3l5+VoPiASEQn8RVVf8dQH LW/W7wbocGPB/uF02ZkAtO6aYw55O4cwj3CBiePvQcL5/0pRkjKRFPsdVuBvETFe+S 8Jv3JaBIH35zQ== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v3 1/2] mptcp: map v4 address to v6 when destroying subflow Date: Wed, 7 Feb 2024 09:55:13 +0800 Message-Id: <1edc0fcbde128bb1b82892c0a335903c05a6f0ec.1707270765.git.tanggeliang@kylinos.cn> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Geliang Tang 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: https://github.com/multipath-tcp/mptcp_net-next/issues/387 Fixes: 702c2f646d42 ("mptcp: netlink: allow userspace-driven subflow establ= ishment") Signed-off-by: Geliang Tang Reviewed-by: Mat Martineau --- net/mptcp/pm_userspace.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index e582b3b2d174..b40a69649fe1 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -495,6 +495,16 @@ int mptcp_pm_nl_subflow_destroy_doit(struct sk_buff *s= kb, struct genl_info *info goto destroy_err; } =20 +#if IS_ENABLED(CONFIG_MPTCP_IPV6) + if (addr_l.family =3D=3D AF_INET && ipv6_addr_v4mapped(&addr_r.addr6)) { + ipv6_addr_set_v4mapped(addr_l.addr.s_addr, &addr_l.addr6); + addr_l.family =3D AF_INET6; + } + if (addr_r.family =3D=3D AF_INET && ipv6_addr_v4mapped(&addr_l.addr6)) { + ipv6_addr_set_v4mapped(addr_r.addr.s_addr, &addr_r.addr6); + addr_r.family =3D AF_INET6; + } +#endif if (addr_l.family !=3D addr_r.family) { GENL_SET_ERR_MSG(info, "address families do not match"); err =3D -EINVAL; --=20 2.40.1 From nobody Thu Dec 26 12:51:17 2024 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9D674D2FE for ; Wed, 7 Feb 2024 01:56:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707270989; cv=none; b=aH/26e/VT7eiiRXK1b1wqMhvvsN3K3E1wJoJ89F3oTWN6J+i2CzbXo5wz8DA0+8gthJzE1ayFkCX46Ms0tChj7ytNwcBQlFsabmIY50TMA4refI7LTbUsiGO6H9ccfoX5bYvVdQQAFZ5MkM+ldFsAJHZl6Ws++Frs7hZy18FSWE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707270989; c=relaxed/simple; bh=Z+Vtn8CNUb9VKj0QkqWbEeIE8gQVooWN6EUA96xWkv0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=L7xa0NOrxYmi7QgJKFTasZocZvshEKF3j9ciVmb5Bn+pALOG23c7a1UcV4OxombfKtPAk39TMAFLzkAOYJu+H17aURtvszrTe6eAOcW2UdQdkVOPZFGmSGvPdaIAJwBtxgLdGXF1slwLiM/XtL2cAOiTV27h3vbJELBWhh5xdxs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MQtPL9mk; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MQtPL9mk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45906C43390; Wed, 7 Feb 2024 01:56:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707270989; bh=Z+Vtn8CNUb9VKj0QkqWbEeIE8gQVooWN6EUA96xWkv0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MQtPL9mkGey2PIoSOtVbErIf+CB0ZlfwBErCIjzIZti2GnCSXdwFgPWAPIZqQhIXk eczfxcTF7SnP8maJlEdyoEH1EsGoGrk1kF6JvbCxxlTBd/wbW7e+J3MTLYm7nBTLbW x8ctmth1hVkTwIkygfqBIGjbeoawFyn/g5UmPwj6OAr3qiOpcCjbh338cnVkRq3QVS W95QRb4ZLZUyP2gsVILTTWEVh9jWhF3CnHx8imkaI6K/AcQ5oRu+2ZH+OXarJKxygY 6OPvAoLTis17Z1KrGV3OgXqeVRX6VefF12P/YEagYy39Q2UgptDA2SAlGBBNsQ83LE um4FssDvQys0Q== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v3 2/2] selftests: mptcp: rm subflow with v4/v4mapped addr Date: Wed, 7 Feb 2024 09:55:14 +0800 Message-Id: <0c91c59ef950d3e64237e8a667a244ef850d0981.1707270765.git.tanggeliang@kylinos.cn> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Geliang Tang Now both a v4 address and a v4-mapped address are supported when destroying a userspace pm subflow, this patch adds a second subflow to "userspace pm add & remove address" test, and two subflows could be removed two different ways, one with the v4mapped and one with v4. Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/387 Fixes: 48d73f609dcc ("selftests: mptcp: update userspace pm addr tests") Signed-off-by: Geliang Tang Reviewed-by: Mat Martineau --- .../testing/selftests/net/mptcp/mptcp_join.sh | 28 +++++++++++-------- .../testing/selftests/net/mptcp/mptcp_lib.sh | 7 +++-- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testin= g/selftests/net/mptcp/mptcp_join.sh index c07386e21e0a..e68b1bc2c2e4 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -3333,16 +3333,17 @@ userspace_pm_rm_sf() { local evts=3D$evts_ns1 local t=3D${3:-1} - local ip=3D4 + local ip local tk da dp sp local cnt =20 [ "$1" =3D=3D "$ns2" ] && evts=3D$evts_ns2 - if mptcp_lib_is_v6 $2; then ip=3D6; fi + [ -n "$(mptcp_lib_evts_get_info "saddr4" "$evts" $t)" ] && ip=3D4 + [ -n "$(mptcp_lib_evts_get_info "saddr6" "$evts" $t)" ] && ip=3D6 tk=3D$(mptcp_lib_evts_get_info token "$evts") - da=3D$(mptcp_lib_evts_get_info "daddr$ip" "$evts" $t) - dp=3D$(mptcp_lib_evts_get_info dport "$evts" $t) - sp=3D$(mptcp_lib_evts_get_info sport "$evts" $t) + da=3D$(mptcp_lib_evts_get_info "daddr$ip" "$evts" $t $2) + dp=3D$(mptcp_lib_evts_get_info dport "$evts" $t $2) + sp=3D$(mptcp_lib_evts_get_info sport "$evts" $t $2) =20 cnt=3D$(rm_sf_count ${1}) ip netns exec $1 ./pm_nl_ctl dsf lip $2 lport $sp \ @@ -3429,20 +3430,23 @@ userspace_tests() if reset_with_events "userspace pm add & remove address" && continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then set_userspace_pm $ns1 - pm_nl_set_limits $ns2 1 1 + pm_nl_set_limits $ns2 2 2 speed=3D5 \ run_tests $ns1 $ns2 10.0.1.1 & local tests_pid=3D$! wait_mpj $ns1 userspace_pm_add_addr $ns1 10.0.2.1 10 - chk_join_nr 1 1 1 - chk_add_nr 1 1 - chk_mptcp_info subflows 1 subflows 1 - chk_subflows_total 2 2 - chk_mptcp_info add_addr_signal 1 add_addr_accepted 1 + userspace_pm_add_addr $ns1 10.0.3.1 20 + chk_join_nr 2 2 2 + chk_add_nr 2 2 + chk_mptcp_info subflows 2 subflows 2 + chk_subflows_total 3 3 + chk_mptcp_info add_addr_signal 2 add_addr_accepted 2 userspace_pm_rm_addr $ns1 10 userspace_pm_rm_sf $ns1 "::ffff:10.0.2.1" $SUB_ESTABLISHED - chk_rm_nr 1 1 invert + userspace_pm_rm_addr $ns1 20 + userspace_pm_rm_sf $ns1 10.0.3.1 $SUB_ESTABLISHED + chk_rm_nr 2 2 invert chk_mptcp_info subflows 0 subflows 0 chk_subflows_total 1 1 kill_events_pids diff --git a/tools/testing/selftests/net/mptcp/mptcp_lib.sh b/tools/testing= /selftests/net/mptcp/mptcp_lib.sh index 3a2abae5993e..69001d2a8dab 100644 --- a/tools/testing/selftests/net/mptcp/mptcp_lib.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_lib.sh @@ -213,9 +213,12 @@ mptcp_lib_get_info_value() { grep "${2}" | sed -n 's/.*\('"${1}"':\)\([0-9a-f:.]*\).*$/\2/p;q' } =20 -# $1: info name ; $2: evts_ns ; $3: event type +# $1: info name ; $2: evts_ns ; $3: event type; $4: addr mptcp_lib_evts_get_info() { - mptcp_lib_get_info_value "${1}" "^type:${3:-1}," < "${2}" + local addr=3D${4:-""} + + cat "${2}" | grep "${addr}" | + mptcp_lib_get_info_value "${1}" "^type:${3:-1}," } =20 # $1: PID --=20 2.40.1