selftests: mptcp: add chk_subflows_total helper
authorGeliang Tang <geliang.tang@suse.com>
Tue, 28 Nov 2023 23:18:47 +0000 (15:18 -0800)
committerJakub Kicinski <kuba@kernel.org>
Thu, 30 Nov 2023 04:06:17 +0000 (20:06 -0800)
commit80775412882e273b8ef62124fae861cde8e6fb3d
tree8a90480cbb3b29a1e9a87df21b9b8dabce41f5f7
parent06848c0f341ee3f9226ed01e519c72e4d2b6f001
selftests: mptcp: add chk_subflows_total helper

This patch adds a new helper chk_subflows_total(), in it use the newly
added counter mptcpi_subflows_total to get the "correct" amount of
subflows, including the initial one.

To be compatible with old 'ss' or kernel versions not supporting this
counter, get the total subflows by listing TCP connections that are
MPTCP subflows:

    ss -ti state state established state syn-sent state syn-recv |
        grep -c tcp-ulp-mptcp.

Reviewed-by: Matthieu Baerts <matttbe@kernel.org>
Signed-off-by: Geliang Tang <geliang.tang@suse.com>
Signed-off-by: Mat Martineau <martineau@kernel.org>
Link: https://lore.kernel.org/r/20231128-send-net-next-2023107-v4-3-8d6b94150f6b@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/net/mptcp/mptcp_join.sh