selftests: mptcp: pm: validate new limits

These limits have been recently updated, from 8 to:

- 64 for the subflows and accepted add_addr

- 255 for the MPTCP endpoints

These modifications validate the new limits, but are also compatible
with the previous ones, to be able to continue to validate stable kernel
using the last version of the selftests. That's why new variables are
now used instead of hard-coded values.

Reviewed-by: Mat Martineau <martineau@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20260508-net-next-mptcp-pm-inc-limits-v1-7-c84e3fdf9b6a@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Matthieu Baerts (NGI0) 2026-05-08 17:40:52 +02:00 committed by Jakub Kicinski
parent 1697837a67
commit c9b581e619

View File

@ -66,6 +66,15 @@ get_limits() {
fi
}
get_limits_nb() {
if mptcp_lib_is_ip_mptcp; then
ip -n "${ns1}" mptcp limits | awk '{ print $2" "$4 }'
else
ip netns exec "${ns1}" ./pm_nl_ctl limits | \
awk '{ printf "%s ", $2 }'
fi
}
format_endpoints() {
mptcp_lib_pm_nl_format_endpoints "${@}"
}
@ -164,6 +173,7 @@ check "get_endpoint 2" "" "simple del addr" 1
check "show_endpoints" \
"$(format_endpoints "1,10.0.1.1" \
"3,10.0.1.3,signal backup")" "dump addrs after del"
add_endpoint 10.0.1.2 id 2
add_endpoint 10.0.1.3 2>/dev/null
check "get_endpoint 4" "" "duplicate addr" 1
@ -171,25 +181,29 @@ check "get_endpoint 4" "" "duplicate addr" 1
add_endpoint 10.0.1.4 flags signal
check "get_endpoint 4" "$(format_endpoints "4,10.0.1.4,signal")" "id addr increment"
for i in $(seq 5 9); do
add_endpoint "10.0.1.${i}" flags signal >/dev/null 2>&1
done
check "get_endpoint 9" "$(format_endpoints "9,10.0.1.9,signal")" "hard addr limit"
check "get_endpoint 10" "" "above hard addr limit" 1
read -r -a default_limits_nb <<< "$(get_limits_nb)"
# limits have been increased: from 8 to 64 for subflows/add_addr & 255 for endp
if mptcp_lib_expect_all_features || set_limits 9 9 2>/dev/null; then
max_endp=255
max_limits=64
else
max_endp=8
max_limits=8
fi
set_limits "${default_limits_nb[@]}"
del_endpoint 9
for i in $(seq 10 255); do
add_endpoint 10.0.0.9 id "${i}"
del_endpoint "${i}"
for i in $(seq 5 ${max_endp}); do
add_endpoint "10.0.0.${i}" id "${i}"
done
check "show_endpoints" \
"$(format_endpoints "1,10.0.1.1" \
"3,10.0.1.3,signal backup" \
"4,10.0.1.4,signal" \
"5,10.0.1.5,signal" \
"6,10.0.1.6,signal" \
"7,10.0.1.7,signal" \
"8,10.0.1.8,signal")" "id limit"
check "get_endpoint ${max_endp}" \
"$(format_endpoints "${max_endp},10.0.0.${max_endp}")" "id limit"
if add_endpoint '10.0.0.1' &>/dev/null; then
hardlimit="no error"
else
hardlimit="error"
fi
check "echo ${hardlimit}" "error" "above hard addr limit"
flush_endpoint
check "show_endpoints" "" "flush addrs"
@ -202,15 +216,15 @@ if ! mptcp_lib_is_ip_mptcp; then
flush_endpoint
fi
set_limits 9 1 2>/dev/null
set_limits $((max_limits + 1)) 1 2>/dev/null
check "get_limits" "${default_limits}" "rcv addrs above hard limit"
set_limits 1 9 2>/dev/null
set_limits 1 $((max_limits + 1)) 2>/dev/null
check "get_limits" "${default_limits}" "subflows above hard limit"
set_limits 8 8
set_limits ${max_limits} ${max_limits}
flush_endpoint ## to make sure it doesn't affect the limits
check "get_limits" "$(format_limits 8 8)" "set limits"
check "get_limits" "$(format_limits ${max_limits} ${max_limits})" "set limits"
flush_endpoint
add_endpoint 10.0.1.1