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.
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
tools/testing/selftests/net/mptcp/pm_netlink.sh | 52 +++++++++++++++----------
1 file changed, 31 insertions(+), 21 deletions(-)
diff --git a/tools/testing/selftests/net/mptcp/pm_netlink.sh b/tools/testing/selftests/net/mptcp/pm_netlink.sh
index d844ee687a29..1ce5903c89c0 100755
--- a/tools/testing/selftests/net/mptcp/pm_netlink.sh
+++ b/tools/testing/selftests/net/mptcp/pm_netlink.sh
@@ -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 "${@}"
}
@@ -162,6 +171,7 @@ check "get_endpoint 2" "" "simple del addr"
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"
@@ -169,25 +179,25 @@ check "get_endpoint 4" "" "duplicate addr"
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"
+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"
+
+check "add_endpoint '10.0.1.1' &>/dev/null && echo 'no error'" "" \
+ "above hard addr limit"
flush_endpoint
check "show_endpoints" "" "flush addrs"
@@ -200,15 +210,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
--
2.53.0