Skip to content

Commit 6a09788

Browse files
YonglongLikuba-moo
authored andcommitted
mptcp: pm: inc RmAddr MIB counter once per RM_ADDR ID
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: 7a7e52e ("mptcp: add RM_ADDR related mibs") Cc: stable@vger.kernel.org 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> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Link: https://lore.kernel.org/r/20240607-upstream-net-20240607-misc-fixes-v1-2-1ab9ddfa3d00@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 8031b58 commit 6a09788

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

net/mptcp/pm_netlink.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -814,10 +814,13 @@ static void mptcp_pm_nl_rm_addr_or_subflow(struct mptcp_sock *msk,
814814
spin_lock_bh(&msk->pm.lock);
815815

816816
removed = true;
817-
__MPTCP_INC_STATS(sock_net(sk), rm_type);
817+
if (rm_type == MPTCP_MIB_RMSUBFLOW)
818+
__MPTCP_INC_STATS(sock_net(sk), rm_type);
818819
}
819820
if (rm_type == MPTCP_MIB_RMSUBFLOW)
820821
__set_bit(rm_id ? rm_id : msk->mpc_endpoint_id, msk->pm.id_avail_bitmap);
822+
else if (rm_type == MPTCP_MIB_RMADDR)
823+
__MPTCP_INC_STATS(sock_net(sk), rm_type);
821824
if (!removed)
822825
continue;
823826

tools/testing/selftests/net/mptcp/mptcp_join.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2250,7 +2250,8 @@ remove_tests()
22502250
pm_nl_set_limits $ns1 3 3
22512251
pm_nl_add_endpoint $ns1 10.0.12.1 flags signal
22522252
pm_nl_add_endpoint $ns1 10.0.3.1 flags signal
2253-
pm_nl_add_endpoint $ns1 10.0.14.1 flags signal
2253+
# broadcast IP: no packet for this address will be received on ns1
2254+
pm_nl_add_endpoint $ns1 224.0.0.1 flags signal
22542255
pm_nl_set_limits $ns2 3 3
22552256
addr_nr_ns1=-3 speed=10 \
22562257
run_tests $ns1 $ns2 10.0.1.1

0 commit comments

Comments
 (0)