From nobody Sat May 11 23:24:28 2024 Received: from out-195.mta0.migadu.com (out-195.mta0.migadu.com [91.218.175.195]) (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 76299747B for ; Tue, 17 Oct 2023 03:02:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="jXlgsVlR" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1697511769; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8Osw9UotfpMBlpg6t5VW1NEgwTH21MdOPVzK3N7JlGk=; b=jXlgsVlRb2GYoh64qxP6pzFvYleR7ETw7vr6D3HcjikxbKzcX+juQH/aQrCJe2SpOzSheu qfTANWeqvV5JUpylEwi0O2VA0+mPfIm45+xGyy4sueUO51RZrC8LKBycehVBXjINqbbH1O 1MWtWNPE6Wec/U5P0+Mfsy0WBornzXs= From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v17 1/9] selftests: mptcp: run userspace pm tests slower Date: Tue, 17 Oct 2023 11:00:20 +0800 Message-Id: <6b2345f9959ecc477c6ab9495a6ec645c160cd5c.1697511436.git.geliang.tang@suse.com> 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 X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" From: Geliang Tang Some userspace pm tests failed are reported by CI: 112 userspace pm add & remove address syn [ ok ] synack [ ok ] ack [ ok ] add [ ok ] echo [ ok ] mptcp_info subflows=3D1:1 [ ok ] subflows_total 2:2 [ ok ] mptcp_info add_addr_signal=3D1:1 [ ok ] rm [ ok ] rmsf [ ok ] Info: invert mptcp_info subflows=3D0:0 [ ok ] subflows_total 1:1 [fail] got subflows 0:0 expected 1:1 Server ns stats TcpPassiveOpens 2 0.0 TcpInSegs 118 0.0 This patch fixes them by change 'speed' to 5 to run the tests much more slower. Fixes: 4369c198e599 ("selftests: mptcp: test userspace pm out of transfer") Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testin= g/selftests/net/mptcp/mptcp_join.sh index 07b2c4bfa183..2269dc986d78 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -3448,7 +3448,7 @@ userspace_tests() continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then set_userspace_pm $ns1 pm_nl_set_limits $ns2 1 1 - speed=3D10 \ + speed=3D5 \ run_tests $ns1 $ns2 10.0.1.1 & local tests_pid=3D$! wait_mpj $ns1 @@ -3472,7 +3472,7 @@ userspace_tests() continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then set_userspace_pm $ns2 pm_nl_set_limits $ns1 0 1 - speed=3D10 \ + speed=3D5 \ run_tests $ns1 $ns2 10.0.1.1 & local tests_pid=3D$! wait_mpj $ns2 --=20 2.35.3 From nobody Sat May 11 23:24:28 2024 Received: from out-192.mta0.migadu.com (out-192.mta0.migadu.com [91.218.175.192]) (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 1B948747B for ; Tue, 17 Oct 2023 03:02:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="KWT2Vrg0" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1697511770; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=D77JK1qlNbqzPSvYFGx3pucj8R9RSlkCdgwZC1mcg8M=; b=KWT2Vrg0EuZWPIBGt9nPvceZqvc+hZFvYjOjG5EufJPabRwu3esfOD7FPcBLmQDmo6APhj VGWp2uhup8nsSKSGnxj5dWSsFpu17bWPqA/+N8BmXw1LG0wZZiSZs+lVCwI2Zaodh7RJOs Q9VUSoaUeNw8yyDl6NzXU8KOdCY1+6Q= From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v17 2/9] selftests: mptcp: fix wait_rm_addr/sf parameters Date: Tue, 17 Oct 2023 11:00:21 +0800 Message-Id: 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 X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" From: Geliang Tang The second input parameter of 'wait_rm_addr/sf $1 1' is misused. If it's 1, wait_rm_addr/sf will never break, and will loop ten times, then 'wait_rm_addr/sf' equals to 'sleep 1'. This delay time is too long, which can sometimes make the tests failures. A better way to use wait_rm_addr/sf is to use rm_addr/sf_count to obtain the current value, and then pass into wait_rm_addr/sf. Fixes: 4369c198e599 ("selftests: mptcp: test userspace pm out of transfer") Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testin= g/selftests/net/mptcp/mptcp_join.sh index 2269dc986d78..186f5933a096 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -3324,12 +3324,14 @@ userspace_pm_rm_addr() { local evts=3D$evts_ns1 local tk + local cnt =20 [ "$1" =3D=3D "$ns2" ] && evts=3D$evts_ns2 tk=3D$(mptcp_lib_evts_get_info token "$evts") =20 + cnt=3D$(rm_addr_count ${1}) ip netns exec $1 ./pm_nl_ctl rem token $tk id $2 - wait_rm_addr $1 1 + wait_rm_addr $1 "${cnt}" } =20 # $1: ns ; $2: addr ; $3: id @@ -3355,6 +3357,7 @@ userspace_pm_rm_sf() local t=3D${3:-1} local ip=3D4 local tk da dp sp + local cnt =20 [ "$1" =3D=3D "$ns2" ] && evts=3D$evts_ns2 if is_v6 $2; then ip=3D6; fi @@ -3363,9 +3366,10 @@ userspace_pm_rm_sf() dp=3D$(mptcp_lib_evts_get_info dport "$evts" $t) sp=3D$(mptcp_lib_evts_get_info sport "$evts" $t) =20 + cnt=3D$(rm_sf_count ${1}) ip netns exec $1 ./pm_nl_ctl dsf lip $2 lport $sp \ rip $da rport $dp token $tk - wait_rm_sf $1 1 + wait_rm_sf $1 "${cnt}" } =20 userspace_tests() --=20 2.35.3 From nobody Sat May 11 23:24:28 2024 Received: from out-193.mta0.migadu.com (out-193.mta0.migadu.com [91.218.175.193]) (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 1D90B63D1 for ; Tue, 17 Oct 2023 03:02:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="FVImo1EC" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1697511772; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QdmB6uKYKa0EPNrPe+/RAxw06AF/GBGOhgOZdjyFuL8=; b=FVImo1EC6nvz3JEZvt2K48zlX+5ETJUEqucJJ9RLxQQSB4DHJAc/IttkA+N1A0xQV8BuIY ofCotip7bbQo4QCOGxFGYXr/xqWinkXY4pdfPBY0r1IjuJQhkOIN3f+rUKwGUdkxc+GQ/y hGFBMRo6nS8RdRwUG2YjXkm6RpBC++E= From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v17 3/9] Squash to "selftests: mptcp: userspace pm create id 0 subflow" Date: Tue, 17 Oct 2023 11:00:22 +0800 Message-Id: <019317a261d0de1c39be7954e34e2a111f685dc7.1697511436.git.geliang.tang@suse.com> 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 X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" From: Geliang Tang Change speed to 5 too. Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testin= g/selftests/net/mptcp/mptcp_join.sh index 186f5933a096..c5e30f4bfcda 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -3498,7 +3498,7 @@ userspace_tests() continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then set_userspace_pm $ns2 pm_nl_set_limits $ns1 0 1 - speed=3D10 \ + speed=3D5 \ run_tests $ns1 $ns2 10.0.1.1 & local tests_pid=3D$! wait_mpj $ns2 --=20 2.35.3 From nobody Sat May 11 23:24:28 2024 Received: from out-208.mta0.migadu.com (out-208.mta0.migadu.com [91.218.175.208]) (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 5B38C7481 for ; Tue, 17 Oct 2023 03:02:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="j3WgxmrR" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1697511773; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nSIFXRsF8qRcq/a0S9tpNnUasQ+RgZz2oFDd1s4sWkY=; b=j3WgxmrR0nd6fkWFyeEZovpTh/ZvbSAIhkMDpB3Jl10pkOezFYi7219cBIcGPAxi3j8XB+ QooeGhMlnbIV2Ex0O07IN4Wb4BEH7ZI6uxUzZGXGFFBaOW9n+nkXqVLarNW6fjkxJh8YRi TPymj677mGSzVDBZWm8TRFHWEa3y1RI= From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v17 4/9] Squash to "mptcp: add mptcpi_subflows_total counter" Date: Tue, 17 Oct 2023 11:00:23 +0800 Message-Id: <6aeaa1589a57314e65b92b8ebc349af5d2e099a6.1697511436.git.geliang.tang@suse.com> 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 X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" From: Geliang Tang Update __mptcp_has_initial_subflow(). Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts --- net/mptcp/protocol.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 6508179e94a6..8529b3ae55e9 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -1081,7 +1081,9 @@ static inline bool __mptcp_has_initial_subflow(const = struct mptcp_sock *msk) { struct sock *ssk =3D READ_ONCE(msk->first); =20 - return ssk && inet_sk_state_load(ssk) !=3D TCP_CLOSE; + return ssk && ((1 << inet_sk_state_load(ssk)) & + (TCPF_ESTABLISHED | TCPF_SYN_SENT | + TCPF_SYN_RECV | TCPF_LISTEN)); } =20 static inline void mptcp_do_fallback(struct sock *ssk) --=20 2.35.3 From nobody Sat May 11 23:24:28 2024 Received: from out-196.mta0.migadu.com (out-196.mta0.migadu.com [91.218.175.196]) (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 6B6C17488 for ; Tue, 17 Oct 2023 03:02:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="FcFQBw1/" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1697511774; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VYUsvWzO+8bD9hK+IH0MqCAE/E/HFN1tKDnag3i6Rm0=; b=FcFQBw1/vwc/GySUfasQMp/3WkK8OTpsbhoeeAbJPzpiJU57kIsE+DKMaEim5O4ZepQDfm 4SNgzHixDuMERbSlvf02tizvIbAnTptfbAVbcHtfIdYMPeyulXizWuWHrdEGjTtxxAl761 ib6e0g/eNuEYTFaHm0avlHEprebrioY= From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v17 5/9] Squash to "selftests: mptcp: add chk_subflows_total helper" Date: Tue, 17 Oct 2023 11:00:24 +0800 Message-Id: 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 X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" From: Geliang Tang Please update the commit log too: ''' ss -ti | grep -c tcp-ulp-mptcp. ''' -> ''' ss -ti state state established state syn-sent state syn-recv | grep -c tcp-ulp-mptcp. ''' Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testin= g/selftests/net/mptcp/mptcp_join.sh index c5e30f4bfcda..6c2c47ce11ad 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -1905,8 +1905,10 @@ chk_subflows_total() print_check "$info $1:$2" =20 # if not, count the TCP connections that are in fact MPTCP subflows - cnt1=3D$(ss -N $ns1 -ti | grep -c tcp-ulp-mptcp) - cnt2=3D$(ss -N $ns2 -ti | grep -c tcp-ulp-mptcp) + cnt1=3D$(ss -N $ns1 -ti state established state syn-sent state syn-recv | + grep -c tcp-ulp-mptcp) + cnt2=3D$(ss -N $ns2 -ti state established state syn-sent state syn-recv | + grep -c tcp-ulp-mptcp) =20 if [ "$1" !=3D "$cnt1" ] || [ "$2" !=3D "$cnt2" ]; then fail_test "got subflows $cnt1:$cnt2 expected $1:$2" --=20 2.35.3 From nobody Sat May 11 23:24:28 2024 Received: from out-208.mta0.migadu.com (out-208.mta0.migadu.com [91.218.175.208]) (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 D242A747B for ; Tue, 17 Oct 2023 03:02:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="HiaMuVi7" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1697511775; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hruKWFCuorRBxKiqSVsrMYwzR8lWujoEH52eawy1Alo=; b=HiaMuVi77ti3CGs2Rv4og/0NTas8PQ2cIdLK8Y8xPNHBXNEE+rlGkXQH+Rqda3oJRR0uzh cz+sslrl48Q2Wbx951Cx41bqB1J7LEq/RQEa0gYPQ/91opwLq0zdVBJ4z54E2jIFzD/COt hd6FPjvVg2pGJnWnmF+u40jru60PQ+I= From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v17 6/9] selftests: mptcp: userspace pm remove initial subflow Date: Tue, 17 Oct 2023 11:00:25 +0800 Message-Id: <483be63536ffbc7821666c17b1f627c2a4742bf8.1697511436.git.geliang.tang@suse.com> 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 X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" From: Geliang Tang This patch adds a selftest for userpsace PM to remove the initial subflow. Use userspace_pm_add_sf() to add a subflow, and pass initial ip address to userspace_pm_rm_sf() to remove the initial subflow. Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts --- .../testing/selftests/net/mptcp/mptcp_join.sh | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testin= g/selftests/net/mptcp/mptcp_join.sh index 6c2c47ce11ad..68fb7aa12fef 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -3513,6 +3513,30 @@ userspace_tests() kill_events_pids wait $tests_pid fi + + # userspace pm remove initial subflow + if reset_with_events "userspace pm remove initial subflow" && + continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then + set_userspace_pm $ns2 + pm_nl_set_limits $ns1 0 1 + speed=3D5 \ + run_tests $ns1 $ns2 10.0.1.1 & + local tests_pid=3D$! + wait_mpj $ns2 + userspace_pm_add_sf $ns2 10.0.3.2 20 + chk_join_nr 1 1 1 + chk_mptcp_info subflows 1 subflows 1 + chk_subflows_total 2 2 + userspace_pm_rm_sf $ns2 10.0.1.2 + # we don't look at the counter linked to the RM_ADDR but + # to the one linked to the subflows that have been removed + chk_rm_nr 0 1 + chk_rst_nr 0 0 invert + chk_mptcp_info subflows 1 subflows 1 + chk_subflows_total 1 1 + kill_events_pids + wait $tests_pid + fi } =20 endpoint_tests() --=20 2.35.3 From nobody Sat May 11 23:24:28 2024 Received: from out-203.mta0.migadu.com (out-203.mta0.migadu.com [91.218.175.203]) (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 463807481 for ; Tue, 17 Oct 2023 03:02:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="WOSnVqLw" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1697511777; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=i/3vUxr1J2aq5pv+HHKWWqG1NBDvCyErjmH6SiUBc5k=; b=WOSnVqLwz86/Pi6PiQBHAdvqCXGuTre3VC+t7aIzIuCBuxf4CPJTdvcPhx9gmt6myHhMQl w82c8ScX6SpFgL9b3bAYGKxZGFq/lrM58cdz2OcACOd36idLEYlL8iLAMzOxWFdefWSCV4 ms5WtdYUnjIcpj/7UX4UZ79eFrY62P8= From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v17 7/9] mptcp: userspace pm send RM_ADDR for ID 0 Date: Tue, 17 Oct 2023 11:00:26 +0800 Message-Id: <9b271203764b94eebc7d9c412d4949e7ce1dc208.1697511436.git.geliang.tang@suse.com> 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 X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" From: Geliang Tang This patch adds the ability to send RM_ADDR for local ID 0. Check whether id 0 address is removed, if not, put id 0 into a removing list, pass it to mptcp_pm_remove_addr() to remove id 0 address. There is no reason not to allow the userspace to remove the initial address (ID 0). This special case was not taken into account not letting the userspace to delete all addresses as announced. Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/379 Fixes: d9a4594edabf ("mptcp: netlink: Add MPTCP_PM_CMD_REMOVE") Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts --- net/mptcp/pm_userspace.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index 6b8083650bc1..ea50e694125d 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -211,6 +211,40 @@ int mptcp_pm_nl_announce_doit(struct sk_buff *skb, str= uct genl_info *info) return err; } =20 +static int mptcp_userspace_remove_id_zero_address(struct mptcp_sock *msk, + struct genl_info *info) +{ + struct mptcp_rm_list list =3D { .nr =3D 0 }; + struct mptcp_subflow_context *subflow; + struct sock *sk =3D (struct sock *)msk; + bool has_id_0 =3D false; + int err =3D -EINVAL; + + lock_sock(sk); + mptcp_for_each_subflow(msk, subflow) { + if (subflow->local_id =3D=3D 0) { + has_id_0 =3D true; + break; + } + } + if (!has_id_0) { + GENL_SET_ERR_MSG(info, "address with id 0 not found"); + goto remove_err; + } + + list.ids[list.nr++] =3D 0; + + spin_lock_bh(&msk->pm.lock); + mptcp_pm_remove_addr(msk, &list); + spin_unlock_bh(&msk->pm.lock); + + err =3D 0; + +remove_err: + release_sock(sk); + return err; +} + int mptcp_pm_nl_remove_doit(struct sk_buff *skb, struct genl_info *info) { struct nlattr *token =3D info->attrs[MPTCP_PM_ATTR_TOKEN]; @@ -245,6 +279,11 @@ int mptcp_pm_nl_remove_doit(struct sk_buff *skb, struc= t genl_info *info) goto remove_err; } =20 + if (id_val =3D=3D 0) { + err =3D mptcp_userspace_remove_id_zero_address(msk, info); + goto remove_err; + } + lock_sock(sk); =20 list_for_each_entry(entry, &msk->pm.userspace_pm_local_addr_list, list) { --=20 2.35.3 From nobody Sat May 11 23:24:28 2024 Received: from out-208.mta0.migadu.com (out-208.mta0.migadu.com [91.218.175.208]) (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 3088363D1 for ; Tue, 17 Oct 2023 03:03:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="R99+Nrzd" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1697511778; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=thUBdzNohzDR3dgJ+Zx9OiaooRVCe0fJn/cTf0rh1Gk=; b=R99+NrzdaKsrVE8ECGknQC+c3rUymZY0xarGZLuhw6JkGKl4Pq8QthjYfak0USzdGUltd4 Dm82jV7Mpq6wE5R0lcISv0zCNw4Z03zHjiRtlWjQo5DOl/yiYuk9ZdDk3QU1LQqdov9g4c vRa/WmOcqxBhhlDgZQIyRq8433Uv02w= From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang , Matthieu Baerts Subject: [PATCH mptcp-next v17 8/9] mptcp: userspace pm rename remove_err to out Date: Tue, 17 Oct 2023 11:00:27 +0800 Message-Id: <31fc480c03c7106543e2a9c38f48eb1b5d836a0b.1697511436.git.geliang.tang@suse.com> 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 X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" From: Geliang Tang The value of 'err' will be not only '-EINVAL', but alse '0' most of the time. So it's better to rename the lable 'remove_err' to 'out'. Suggested-by: Matthieu Baerts Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts --- net/mptcp/pm_userspace.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index ea50e694125d..cdff3e631d2d 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -276,12 +276,12 @@ int mptcp_pm_nl_remove_doit(struct sk_buff *skb, stru= ct genl_info *info) =20 if (!mptcp_pm_is_userspace(msk)) { GENL_SET_ERR_MSG(info, "invalid request; userspace PM not selected"); - goto remove_err; + goto out; } =20 if (id_val =3D=3D 0) { err =3D mptcp_userspace_remove_id_zero_address(msk, info); - goto remove_err; + goto out; } =20 lock_sock(sk); @@ -296,7 +296,7 @@ int mptcp_pm_nl_remove_doit(struct sk_buff *skb, struct= genl_info *info) if (!match) { GENL_SET_ERR_MSG(info, "address with specified id not found"); release_sock(sk); - goto remove_err; + goto out; } =20 list_move(&match->list, &free_list); @@ -310,7 +310,7 @@ int mptcp_pm_nl_remove_doit(struct sk_buff *skb, struct= genl_info *info) } =20 err =3D 0; - remove_err: +out: sock_put(sk); return err; } --=20 2.35.3 From nobody Sat May 11 23:24:28 2024 Received: from out-203.mta0.migadu.com (out-203.mta0.migadu.com [91.218.175.203]) (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 68F4C747E for ; Tue, 17 Oct 2023 03:03:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="XyOwWs5u" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1697511779; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fLPg19f2Kvo/jbFlN5vd8KgfNHluVtYZMAwMuo0TMBk=; b=XyOwWs5uNbAMDHRWThXC7J+RUDzY1EsJsBv0UEt6OwJ8VfdANP0N6vy3eNtWkag9a4I038 wSyZxW80FiH/miMvkeOC9wJXTmq6l0Q+ftxiJRmv9sBcIZdGwc396RPbrm732Sf2f5qehj 7j/8hcPSOMek5BLk/PdZkUC+5udAxL0= From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v17 9/9] selftests: mptcp: userspace pm send RM_ADDR for ID 0 Date: Tue, 17 Oct 2023 11:00:28 +0800 Message-Id: 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 X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" From: Geliang Tang This patch adds a selftest for userpsace PM to remove id 0 address. Use userspace_pm_add_addr() helper to add a id 10 address, then use userspace_pm_rm_addr() helper to remove id 0 address. Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts --- .../testing/selftests/net/mptcp/mptcp_join.sh | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testin= g/selftests/net/mptcp/mptcp_join.sh index 68fb7aa12fef..a2b58cf71bef 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -3537,6 +3537,32 @@ userspace_tests() kill_events_pids wait $tests_pid fi + + # userspace pm send RM_ADDR for ID 0 + if reset_with_events "userspace pm send RM_ADDR for ID 0" && + continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then + set_userspace_pm $ns1 + pm_nl_set_limits $ns2 1 1 + 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_rm_addr $ns1 0 + # we don't look at the counter linked to the subflows that + # have been removed but to the one linked to the RM_ADDR + chk_rm_nr 1 0 invert + chk_rst_nr 0 0 invert + chk_mptcp_info subflows 1 subflows 1 + chk_subflows_total 1 1 + kill_events_pids + wait $tests_pid + fi } =20 endpoint_tests() --=20 2.35.3