[PATCH mptcp-next v2] mptcp: increment RmAddr MIB counter once per RM_ADDR

Matthieu Baerts (NGI0) posted 1 patch 4 months, 3 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/multipath-tcp/mptcp_net-next tags/patchew/20240527-mptcp-rmaddr-counter-once-v2-1-3e61360a90ac@kernel.org
net/mptcp/pm_netlink.c                          | 5 ++++-
tools/testing/selftests/net/mptcp/mptcp_join.sh | 3 ++-
2 files changed, 6 insertions(+), 2 deletions(-)
[PATCH mptcp-next v2] mptcp: increment RmAddr MIB counter once per RM_ADDR
Posted by Matthieu Baerts (NGI0) 4 months, 3 weeks ago
From: YonglongLi <liyonglong@chinatelecom.cn>

The RmAddr MIB counter is supposed to be incremented once when a valid
RM_ADDR has been received. Before this patch, it could have been
incremented as many times as the number of subflows connected to the
linked address ID, so it could have been 0, 1 or more than 1.

The "RmSubflow" is incremented after a local operation. In this case,
it is normal to tied it with the number of subflows that have been
actually removed.

The "remove invalid addresses" MP Join subtest has been modified to
validate this case. A broadcast IP address is now used instead: the
client will not be able to create a subflow to this address. The
consequence is that when receiving the RM_ADDR with the ID attached to
this broadcast IP address, no subflow linked to this ID will be found.

Fixes: 7a7e52e38a40 ("mptcp: add RM_ADDR related mibs")
Co-developed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: YonglongLi <liyonglong@chinatelecom.cn>
---
 net/mptcp/pm_netlink.c                          | 5 ++++-
 tools/testing/selftests/net/mptcp/mptcp_join.sh | 3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
index 7f53e022e27e..766a8409fa67 100644
--- a/net/mptcp/pm_netlink.c
+++ b/net/mptcp/pm_netlink.c
@@ -814,10 +814,13 @@ static void mptcp_pm_nl_rm_addr_or_subflow(struct mptcp_sock *msk,
 			spin_lock_bh(&msk->pm.lock);
 
 			removed = true;
-			__MPTCP_INC_STATS(sock_net(sk), rm_type);
+			if (rm_type == MPTCP_MIB_RMSUBFLOW)
+				__MPTCP_INC_STATS(sock_net(sk), rm_type);
 		}
 		if (rm_type == MPTCP_MIB_RMSUBFLOW)
 			__set_bit(rm_id ? rm_id : msk->mpc_endpoint_id, msk->pm.id_avail_bitmap);
+		else if (rm_type == MPTCP_MIB_RMADDR)
+			__MPTCP_INC_STATS(sock_net(sk), rm_type);
 		if (!removed)
 			continue;
 
diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index 2b66c5fa71eb..aea314d140c9 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -2250,7 +2250,8 @@ remove_tests()
 		pm_nl_set_limits $ns1 3 3
 		pm_nl_add_endpoint $ns1 10.0.12.1 flags signal
 		pm_nl_add_endpoint $ns1 10.0.3.1 flags signal
-		pm_nl_add_endpoint $ns1 10.0.14.1 flags signal
+		# broadcast IP: no packet for this address will be received on ns1
+		pm_nl_add_endpoint $ns1 224.0.0.1 flags signal
 		pm_nl_set_limits $ns2 3 3
 		addr_nr_ns1=-3 speed=10 \
 			run_tests $ns1 $ns2 10.0.1.1

---
base-commit: 13983c0940e0daaea1eda0e04493d1de05bd7a55
change-id: 20240527-mptcp-rmaddr-counter-once-304c17413b1b

Best regards,
-- 
Matthieu Baerts (NGI0) <matttbe@kernel.org>
Re: [PATCH mptcp-next v2] mptcp: increment RmAddr MIB counter once per RM_ADDR
Posted by Matthieu Baerts 4 months, 2 weeks ago
Hello,

On 27/05/2024 18:03, Matthieu Baerts (NGI0) wrote:
> From: YonglongLi <liyonglong@chinatelecom.cn>
> 
> The RmAddr MIB counter is supposed to be incremented once when a valid
> RM_ADDR has been received. Before this patch, it could have been
> incremented as many times as the number of subflows connected to the
> linked address ID, so it could have been 0, 1 or more than 1.
> 
> The "RmSubflow" is incremented after a local operation. In this case,
> it is normal to tied it with the number of subflows that have been
> actually removed.
> 
> The "remove invalid addresses" MP Join subtest has been modified to
> validate this case. A broadcast IP address is now used instead: the
> client will not be able to create a subflow to this address. The
> consequence is that when receiving the RM_ADDR with the ID attached to
> this broadcast IP address, no subflow linked to this ID will be found.

Now in our tree (fixes for -net):

New patches for t/upstream-net and t/upstream:
- 9c592aa6f604: mptcp: increment RmAddr MIB counter once per RM_ADDR
- Results: bbdf7fd48eef..e85c0954b4e4 (export-net)
- Results: 05497250894c..5e8a75a149b7 (export)

Tests are now in progress:

- export-net:
https://github.com/multipath-tcp/mptcp_net-next/commit/0cd8eb1e3be7cc7691835ad2b30d34a122253081/checks
- export:
https://github.com/multipath-tcp/mptcp_net-next/commit/37ac616090e02d163a41ceefbc28d3ff41afe470/checks

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