From nobody Wed Oct 30 22:16:22 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 86891143737 for ; Mon, 29 Jul 2024 10:18:53 +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=1722248333; cv=none; b=dfTXukFVwzxEDy80tOZskJl/nMhJd2LUrvm2e0803hQcIrJkImQCJqVc3uzeokdoU+wTAVyupSvu/1JvbEUSz2GutDPhzqDYHCfq4MHmFwgdm4f1fS2Xl1x78RZvu/8YTT2HiU27d4NyJTV50qPv5ogDp9Za7a/PhU4ZYrbTu8A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722248333; c=relaxed/simple; bh=Q3+iiY7gXh8yHRuDuntbwDd4aIrm8TvSaXMs/OJ5nZE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dccsanw0QoHPaM9+9fFmjVx45nJ34g44HodEWPQsDZyjHbCQ1h3MOkJKZZ2fw3YOQfyy/GGDIIBAlkbYi2kesYj/UYCu6WzYUAUtc2D2sqCeIeilbO/vlqsaOI/L0a3qsNpi12VaiatV4ZwBsLHf5JzClxrO1uMBmdv2RUXeYwk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Wm6tMuVC; 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="Wm6tMuVC" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CCC39C32786; Mon, 29 Jul 2024 10:18:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722248333; bh=Q3+iiY7gXh8yHRuDuntbwDd4aIrm8TvSaXMs/OJ5nZE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Wm6tMuVCVKDwoDC+AKBho3vAZrAAMZhjbGFyFMewOyJX9Qe2ve6ZSSw2UlfUr4gIl VzMOrxrRvZqW/zd/t3juLGc4kmurdSb1rRCGqcNxcVlHOb1zdDBT3fx76gBPSDkyIL +pNRbqp21vKKg/PrcidP/ufSyle8Ov05dz8q0pTIngRJhm8aVzGGQTIfUKREHjLVWj F1vjEUGLra7Q9NYL9WJVbBEcFyYXGfkxSJ6aGS1x6j8Gi59pISiFZ6EvFH+kDnFRYC 5tf4iEeqrKSq+OBrjNS2c5jUWpR/3WzmJBSWbqUyNG0eFvGQxW17Rh2eApD1SZBsMD pmQBzRhEthY+A== From: "Matthieu Baerts (NGI0)" Date: Mon, 29 Jul 2024 12:18:43 +0200 Subject: [PATCH mptcp-next v2 1/2] mptcp: MIB counters for sent MP_JOIN Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240729-mptcp-join-tx-mib-v2-1-8ace70fd407a@kernel.org> References: <20240729-mptcp-join-tx-mib-v2-0-8ace70fd407a@kernel.org> In-Reply-To: <20240729-mptcp-join-tx-mib-v2-0-8ace70fd407a@kernel.org> To: mptcp@lists.linux.dev Cc: "Matthieu Baerts (NGI0)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=4823; i=matttbe@kernel.org; h=from:subject:message-id; bh=Q3+iiY7gXh8yHRuDuntbwDd4aIrm8TvSaXMs/OJ5nZE=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmp2yLljNHp4rhrslW4dOZzMPqkQIzvOwSnhVmO Uhxi04ZQSuJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZqdsiwAKCRD2t4JPQmmg c3aZEADbqQrBf8pI/t74EptUiL5X/3QkhitFuvcjcbCH0ubbkxQlNCpnqABVuyanqFq+GImMdiz 7Q6wYDy5hSLn5IpThzrjpxDoNmlUHtvsuRqh0pE9rgsqGCGf7QPPacBWbMR0HGbrYhjZLrZ0/rv ZM6q81epSHB1t4n26tm9bYlCQQWZsUrVPFs2/o2QpdgiPcx05SGtB2neN6/819boA4+1rYwuEO/ B3cpTmDQSwHs+W6UUYq4uLmdpKSK1pJJ7kYotXu1VzjqhZlsZ5k5jsUOE4iFptKZrBJls5IMBUe kBNnuRbkfX0jp78A+dmfBRNzHKK9m0roR7rsj85tmUBcB3soUtKqUQyfsSps9d12rOE5LcQ6Qo7 V+4t+82FW0uSZ9tBO1vl6KJd2FNz5nqrkM6ioMqCoxlPJWdHPC3CI4Yh2FDNJ7cq51WSH2d9iVm m/H81ZVDxVBpo9QMG+rN+whWEHW2BRGQI9SndQilQ4tMwxXB9IAIYD3EjVElofVrhGpubtJtR+5 MkXFOn2W97EHpmsRsjPO8hljTFcAZv+lSGWu8p6/pXi6N09iGSdjFv+ip+1adGZyJVKZDYlR24w lJP5WbFVWopdBFDteF0jUdblcXCVGPeLMo+//fAN0XcsT7k1W7QVqcQW7iBsKyqha1+4K7Uf5EK 0hTD8qWPe+5IpQA== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 Recently, a few issues have been discovered around the creation of additional subflows. Without these counters, it was difficult to point out the reason why some subflows were not created as expected. These counters should have been added earlier, because there is no other simple ways to extract such information from the kernel, and understand why subflows have not been created. While at it, some pr_debug() have been added, just in case the errno needs to be printed. Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/509 Signed-off-by: Matthieu Baerts (NGI0) --- Notes: - v2: - Add "ERR" suffix in variable names. (Geliang) --- net/mptcp/mib.c | 5 +++++ net/mptcp/mib.h | 5 +++++ net/mptcp/subflow.c | 24 ++++++++++++++++++++---- 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/net/mptcp/mib.c b/net/mptcp/mib.c index 7884217f33eb..36edef1e6861 100644 --- a/net/mptcp/mib.c +++ b/net/mptcp/mib.c @@ -25,6 +25,11 @@ static const struct snmp_mib mptcp_snmp_list[] =3D { SNMP_MIB_ITEM("MPJoinSynAckHMacFailure", MPTCP_MIB_JOINSYNACKMAC), SNMP_MIB_ITEM("MPJoinAckRx", MPTCP_MIB_JOINACKRX), SNMP_MIB_ITEM("MPJoinAckHMacFailure", MPTCP_MIB_JOINACKMAC), + SNMP_MIB_ITEM("MPJoinSynTx", MPTCP_MIB_JOINSYNTX), + SNMP_MIB_ITEM("MPJoinSynTxFEstabErr", MPTCP_MIB_JOINSYNTXFESTABERR), + SNMP_MIB_ITEM("MPJoinSynTxCreatSkErr", MPTCP_MIB_JOINSYNTXCREATSKERR), + SNMP_MIB_ITEM("MPJoinSynTxBindErr", MPTCP_MIB_JOINSYNTXBINDERR), + SNMP_MIB_ITEM("MPJoinSynTxConnectErr", MPTCP_MIB_JOINSYNTXCONNECTERR), SNMP_MIB_ITEM("DSSNotMatching", MPTCP_MIB_DSSNOMATCH), SNMP_MIB_ITEM("InfiniteMapTx", MPTCP_MIB_INFINITEMAPTX), SNMP_MIB_ITEM("InfiniteMapRx", MPTCP_MIB_INFINITEMAPRX), diff --git a/net/mptcp/mib.h b/net/mptcp/mib.h index 66aa67f49d03..6f2e1ef1dce9 100644 --- a/net/mptcp/mib.h +++ b/net/mptcp/mib.h @@ -20,6 +20,11 @@ enum linux_mptcp_mib_field { MPTCP_MIB_JOINSYNACKMAC, /* HMAC was wrong on SYN/ACK + MP_JOIN */ MPTCP_MIB_JOINACKRX, /* Received an ACK + MP_JOIN */ MPTCP_MIB_JOINACKMAC, /* HMAC was wrong on ACK + MP_JOIN */ + MPTCP_MIB_JOINSYNTX, /* Sending a SYN + MP_JOIN */ + MPTCP_MIB_JOINSYNTXFESTABERR, /* Not in fully established when sending a = SYN + MP_JOIN */ + MPTCP_MIB_JOINSYNTXCREATSKERR, /* Not able to create a socket when sendin= g a SYN + MP_JOIN */ + MPTCP_MIB_JOINSYNTXBINDERR, /* Not able to bind() the address when sendin= g a SYN + MP_JOIN */ + MPTCP_MIB_JOINSYNTXCONNECTERR, /* Not able to connect() when sending a SY= N + MP_JOIN */ MPTCP_MIB_DSSNOMATCH, /* Received a new mapping that did not match the p= revious one */ MPTCP_MIB_INFINITEMAPTX, /* Sent an infinite mapping */ MPTCP_MIB_INFINITEMAPRX, /* Received an infinite mapping */ diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index a21c712350c3..69568d928b35 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -1577,12 +1577,18 @@ int __mptcp_subflow_connect(struct sock *sk, const = struct mptcp_addr_info *loc, int ifindex; u8 flags; =20 - if (!mptcp_is_fully_established(sk)) + if (!mptcp_is_fully_established(sk)) { + MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNTXFESTABERR); goto err_out; + } =20 err =3D mptcp_subflow_create_socket(sk, loc->family, &sf); - if (err) + if (err) { + MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNTXCREATSKERR); + pr_debug("msk=3D%p local=3D%d remote:%d create sock error: %d\n", + msk, local_id, remote_id, err); goto err_out; + } =20 ssk =3D sf->sk; subflow =3D mptcp_subflow_ctx(ssk); @@ -1608,8 +1614,12 @@ int __mptcp_subflow_connect(struct sock *sk, const s= truct mptcp_addr_info *loc, #endif ssk->sk_bound_dev_if =3D ifindex; err =3D kernel_bind(sf, (struct sockaddr *)&addr, addrlen); - if (err) + if (err) { + MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNTXBINDERR); + pr_debug("msk=3D%p local=3D%d remote:%d bind error: %d\n", + msk, local_id, remote_id, err); goto failed; + } =20 mptcp_crypto_key_sha(subflow->remote_key, &remote_token, NULL); pr_debug("msk=3D%p remote_token=3D%u local_id=3D%d remote_id=3D%d", msk, @@ -1624,8 +1634,14 @@ int __mptcp_subflow_connect(struct sock *sk, const s= truct mptcp_addr_info *loc, sock_hold(ssk); list_add_tail(&subflow->node, &msk->conn_list); err =3D kernel_connect(sf, (struct sockaddr *)&addr, addrlen, O_NONBLOCK); - if (err && err !=3D -EINPROGRESS) + if (err && err !=3D -EINPROGRESS) { + MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNTXCONNECTERR); + pr_debug("msk=3D%p local=3D%d remote:%d connect error: %d\n", + msk, local_id, remote_id, err); goto failed_unlink; + } + + MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNTX); =20 /* discard the subflow socket */ mptcp_sock_graft(ssk, sk->sk_socket); --=20 2.45.2 From nobody Wed Oct 30 22:16:22 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 B933313B290 for ; Mon, 29 Jul 2024 10:18:54 +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=1722248334; cv=none; b=LFUxt0eekQV0xUV7gTBSUZ1ezmmAP2W9FrXqzZianE1DmuSq0zsInTRgpLyZmgLl/+HVizpZx8lJKLpjQx+fDBuUxg7toDam/t7acWoS0aiVe/KxZu/ktEbtEYwd62yjpU0X8Bgm26A1N9viKxHPz4aaz5Zt20oSwjxcrH1GO9o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722248334; c=relaxed/simple; bh=txWGadEsrmhQCY+1OCs5bFpGkDlrfCce55DOhsaXkMI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uXVIT8csvoUiVInPSj17BVaEB1KjD4BUCC00e4ELN7FBHnBBWC6NJ9KyPHQLeAXGvPdQ15IDRydA6HfwkayA7wrJzT1HDPt0mBKW38Hnqp4/R5vnmszWg4URP2aZYbKTfyyrBGqmMrUUMNbcm7pTqWXrA66FYzKvPBdAsATeAZw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QYDuA4am; 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="QYDuA4am" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF47DC4AF0E; Mon, 29 Jul 2024 10:18:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722248334; bh=txWGadEsrmhQCY+1OCs5bFpGkDlrfCce55DOhsaXkMI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=QYDuA4amwClKWAkZhb9YQn+ZxIUGszIMy/sFXt87Tpk3h/MQ3fpfY6DuGBKT/rwR8 m/b8b73KSIYl5rhiUs29J/buFcfUV89BL6XpCe8PPhUqppCuse0Si0HQFsCW1MxejE tcR1MitSEWi9GaoiYHw6NWHHqI8kQ/jSG01bK6CaDBR6smEDAm7GUOgUD28vhkWh+r 8uKAFtjgeWzcvQjf0Xwk2PCFIWCy4H9pDowvKzZZgXd7YH9DiJ9QA2UpTPEEI1WO59 vgR5aFz5654xqjdy1jZhv/IDCnNYxuLlN5By7NTcnqJmpf4g9HO4GttJ/jgl1Xt/Hf cWPjAp7mLuQqQ== From: "Matthieu Baerts (NGI0)" Date: Mon, 29 Jul 2024 12:18:44 +0200 Subject: [PATCH mptcp-next v2 2/2] selftests: mptcp: join: validate MPJ SYN TX MIB counters Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240729-mptcp-join-tx-mib-v2-2-8ace70fd407a@kernel.org> References: <20240729-mptcp-join-tx-mib-v2-0-8ace70fd407a@kernel.org> In-Reply-To: <20240729-mptcp-join-tx-mib-v2-0-8ace70fd407a@kernel.org> To: mptcp@lists.linux.dev Cc: "Matthieu Baerts (NGI0)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=3198; i=matttbe@kernel.org; h=from:subject:message-id; bh=txWGadEsrmhQCY+1OCs5bFpGkDlrfCce55DOhsaXkMI=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmp2yLUCG2f//86FNiuz5jwB4J2B/13Y/GjdBDZ ssMPguYUIaJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZqdsiwAKCRD2t4JPQmmg c+bCEACWX7SLVzHUrkGAP4DzbhNZx3bg67RuNg0tLcb/UVHqESi/SRofpukumy01oM3o6WrA1NC CMsb864oiqu9axF5PHH7ZMXlfbRT4BtUubKRnsfxNDJg+mmMEirKW7fSRTKga4LiEUiTCGJAEpl 1cgGNf6Eo4USfqEfgHrWfKxzr7eZ4QYFleUmzIpyhpDam782mFEyJ6Tz5Q6WkFuLneXymaEGvmH IcvH/MzCrkrrlZ8MEeiUF1YC8n6PHsFyzKmHCM3u+8bkcDk5vPjpz9AyYuIeUv2oPaEg/5Zv8rx qKtXC+0w00H+XFrWIggucDQ3QbSkf4yc71a5r0/aV0flB3q/WogO3g0wCWcJgFxCcEeob2+AQr3 NhpY5RyVm8VYxeZAQa9Fcea0IqqJuvUBKdeT/tZ2+iHOTDTwQMyqcPgmUMMddRTqRjM+07zvwWC YcoK4V8zLW8FqrUjfDbLK9oD+1Ep4KozKiXm4/Bj4tsK50UeyR2LvShn9vlE9qNa1UbtaWPKZWS vKTipTcvbITota19FUgCNL+0KW36rQ+JGZirgjrHKILIr7S5Kd+j/+fND0DiUivuaPP3yHQAg7B Seer7wDKNFrFj4Nw82d+9HiCkMyAl8HuuAEboC2FQ2aq4olgN3DiNRgN8ONIVTKV6StV+r2I6k2 zWEKtbtW5+IYXAg== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 A few new MIB counters have been added. They are being validated here. Most of the time, there are no errors, but sometimes, more MPJ SYN are queued compared to the numbers that are received. Only one test has an error, the one to connect to a broadcast IP address. Signed-off-by: Matthieu Baerts (NGI0) --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 63 +++++++++++++++++++++= ++++ 1 file changed, 63 insertions(+) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testin= g/selftests/net/mptcp/mptcp_join.sh index fbb0174145ad..c1f1ebd2340c 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -1372,6 +1372,66 @@ chk_join_nr() fi } =20 +chk_join_tx_nr() +{ + local syn_nr=3D$1 + local festab=3D$2 + local create=3D$3 + local bind=3D$4 + local connect=3D$5 + local count + + print_check "syn TX" + count=3D$(mptcp_lib_get_counter ${ns2} "MPTcpExtMPJoinSynTx") + if [ -z "$count" ]; then + print_skip + elif [ "$count" !=3D "$syn_nr" ]; then + fail_test "got $count JOIN[s] syn TX expected $syn_nr" + else + print_ok + fi + + print_check "syn TX Fully Estab Error" + count=3D$(mptcp_lib_get_counter ${ns2} "MPTcpExtMPJoinSynTxFEstabErr") + if [ -z "$count" ]; then + print_skip + elif [ "$count" !=3D "$festab" ]; then + fail_test "got $count JOIN[s] syn TX Fully Estab Error expected $festab" + else + print_ok + fi + + print_check "syn TX Create Socket Error" + count=3D$(mptcp_lib_get_counter ${ns2} "MPTcpExtMPJoinSynTxCreatSkErr") + if [ -z "$count" ]; then + print_skip + elif [ "$count" !=3D "$create" ]; then + fail_test "got $count JOIN[s] syn TX Create Socket Error expected $creat= e" + else + print_ok + fi + + print_check "syn TX Bind Error" + count=3D$(mptcp_lib_get_counter ${ns2} "MPTcpExtMPJoinSynTxBindErr") + if [ -z "$count" ]; then + print_skip + elif [ "$count" !=3D "$bind" ]; then + fail_test "got $count JOIN[s] syn TX Bind Error expected $bind" + else + print_ok + fi + + print_check "syn TX Connect Error" + count=3D$(mptcp_lib_get_counter ${ns2} "MPTcpExtMPJoinSynTxConnectErr") + if [ -z "$count" ]; then + print_skip + elif [ "$count" !=3D "$connect" ]; then + fail_test "got $count JOIN[s] syn TX Connect Error expected $connect" + else + print_ok + fi +} + # a negative value for 'stale_max' means no upper bound: # for bidirectional transfer, if one peer sleep for a while # - as these tests do - we can have a quite high number of @@ -1907,6 +1967,7 @@ subflows_error_tests() speed=3Dslow \ run_tests $ns1 $ns2 10.0.1.1 chk_join_nr 0 0 0 + chk_join_tx_nr 0 0 0 0 0 fi =20 # multiple subflows, with subflow creation error @@ -1919,6 +1980,7 @@ subflows_error_tests() speed=3Dslow \ run_tests $ns1 $ns2 10.0.1.1 chk_join_nr 1 1 1 + chk_join_tx_nr 2 0 0 0 0 fi =20 # multiple subflows, with subflow timeout on MPJ @@ -2306,6 +2368,7 @@ remove_tests() addr_nr_ns1=3D-3 speed=3D10 \ run_tests $ns1 $ns2 10.0.1.1 chk_join_nr 1 1 1 + chk_join_tx_nr 2 0 0 0 1 chk_add_nr 3 3 chk_rm_nr 3 1 invert chk_rst_nr 0 0 --=20 2.45.2