From: Greg Kroah-Hartman Date: Thu, 22 Jun 2023 17:12:46 +0000 (+0200) Subject: 5.10-stable patches X-Git-Tag: v4.14.320~52 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a8212c0ba63db02f9a88fc0470761d4bfafcd4ba;p=thirdparty%2Fkernel%2Fstable-queue.git 5.10-stable patches added patches: selftests-mptcp-join-skip-check-if-mib-counter-not-supported.patch selftests-mptcp-pm-nl-remove-hardcoded-default-limits.patch --- diff --git a/queue-5.10/selftests-mptcp-join-skip-check-if-mib-counter-not-supported.patch b/queue-5.10/selftests-mptcp-join-skip-check-if-mib-counter-not-supported.patch new file mode 100644 index 00000000000..dfa1a0a4d7b --- /dev/null +++ b/queue-5.10/selftests-mptcp-join-skip-check-if-mib-counter-not-supported.patch @@ -0,0 +1,171 @@ +From matthieu.baerts@tessares.net Thu Jun 22 16:00:10 2023 +From: Matthieu Baerts +Date: Thu, 22 Jun 2023 15:59:48 +0200 +Subject: selftests: mptcp: join: skip check if MIB counter not supported +To: stable@vger.kernel.org, gregkh@linuxfoundation.org +Cc: Matthieu Baerts , Jakub Kicinski +Message-ID: <20230622135948.3245451-2-matthieu.baerts@tessares.net> + +From: Matthieu Baerts + +commit 47867f0a7e831e24e5eab3330667ce9682d50fb1 upstream. + +Selftests are supposed to run on any kernels, including the old ones not +supporting all MPTCP features. + +One of them is the MPTCP MIB counters introduced in commit fc518953bc9c +("mptcp: add and use MIB counter infrastructure") and more later. The +MPTCP Join selftest heavily relies on these counters. + +If a counter is not supported by the kernel, it is not displayed when +using 'nstat -z'. We can then detect that and skip the verification. A +new helper (get_counter()) has been added to do the required checks and +return an error if the counter is not available. + +Note that if we expect to have these features available and if +SELFTESTS_MPTCP_LIB_EXPECT_ALL_FEATURES env var is set to 1, the tests +will be marked as failed instead of skipped. + +This new helper also makes sure we get the exact counter we want to +avoid issues we had in the past, e.g. with MPTcpExtRmAddr and +MPTcpExtRmAddrDrop sharing the same prefix. While at it, we uniform the +way we fetch a MIB counter. + +Note for the backports: we rarely change these modified blocks so if +there is are conflicts, it is very likely because a counter is not used +in the older kernels and we don't need that chunk. + +Link: https://github.com/multipath-tcp/mptcp_net-next/issues/368 +Fixes: b08fbf241064 ("selftests: add test-cases for MPTCP MP_JOIN") +Cc: stable@vger.kernel.org +Signed-off-by: Matthieu Baerts +Signed-off-by: Jakub Kicinski +Signed-off-by: Matthieu Baerts +Signed-off-by: Greg Kroah-Hartman +--- + tools/testing/selftests/net/mptcp/mptcp_join.sh | 65 ++++++++++++++++-------- + 1 file changed, 44 insertions(+), 21 deletions(-) + +--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh ++++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh +@@ -130,6 +130,22 @@ do_ping() + fi + } + ++# $1: ns ; $2: counter ++get_counter() ++{ ++ local ns="${1}" ++ local counter="${2}" ++ local count ++ ++ count=$(ip netns exec ${ns} nstat -asz "${counter}" | awk 'NR==1 {next} {print $2}') ++ if [ -z "${count}" ]; then ++ mptcp_lib_fail_if_expected_feature "${counter} counter" ++ return 1 ++ fi ++ ++ echo "${count}" ++} ++ + do_transfer() + { + listener_ns="$1" +@@ -291,9 +307,10 @@ chk_join_nr() + local dump_stats + + printf "%02u %-36s %s" "$TEST_COUNT" "$msg" "syn" +- count=`ip netns exec $ns1 nstat -as | grep MPTcpExtMPJoinSynRx | awk '{print $2}'` +- [ -z "$count" ] && count=0 +- if [ "$count" != "$syn_nr" ]; then ++ count=$(get_counter ${ns1} "MPTcpExtMPJoinSynRx") ++ if [ -z "$count" ]; then ++ echo -n "[skip]" ++ elif [ "$count" != "$syn_nr" ]; then + echo "[fail] got $count JOIN[s] syn expected $syn_nr" + ret=1 + dump_stats=1 +@@ -302,9 +319,10 @@ chk_join_nr() + fi + + echo -n " - synack" +- count=`ip netns exec $ns2 nstat -as | grep MPTcpExtMPJoinSynAckRx | awk '{print $2}'` +- [ -z "$count" ] && count=0 +- if [ "$count" != "$syn_ack_nr" ]; then ++ count=$(get_counter ${ns2} "MPTcpExtMPJoinSynAckRx") ++ if [ -z "$count" ]; then ++ echo -n "[skip]" ++ elif [ "$count" != "$syn_ack_nr" ]; then + echo "[fail] got $count JOIN[s] synack expected $syn_ack_nr" + ret=1 + dump_stats=1 +@@ -313,9 +331,10 @@ chk_join_nr() + fi + + echo -n " - ack" +- count=`ip netns exec $ns1 nstat -as | grep MPTcpExtMPJoinAckRx | awk '{print $2}'` +- [ -z "$count" ] && count=0 +- if [ "$count" != "$ack_nr" ]; then ++ count=$(get_counter ${ns1} "MPTcpExtMPJoinAckRx") ++ if [ -z "$count" ]; then ++ echo "[skip]" ++ elif [ "$count" != "$ack_nr" ]; then + echo "[fail] got $count JOIN[s] ack expected $ack_nr" + ret=1 + dump_stats=1 +@@ -338,9 +357,10 @@ chk_add_nr() + local dump_stats + + printf "%-39s %s" " " "add" +- count=`ip netns exec $ns2 nstat -as | grep MPTcpExtAddAddr | awk '{print $2}'` +- [ -z "$count" ] && count=0 +- if [ "$count" != "$add_nr" ]; then ++ count=$(get_counter ${ns2} "MPTcpExtAddAddr") ++ if [ -z "$count" ]; then ++ echo -n "[skip]" ++ elif [ "$count" != "$add_nr" ]; then + echo "[fail] got $count ADD_ADDR[s] expected $add_nr" + ret=1 + dump_stats=1 +@@ -349,9 +369,10 @@ chk_add_nr() + fi + + echo -n " - echo " +- count=`ip netns exec $ns1 nstat -as | grep MPTcpExtEchoAdd | awk '{print $2}'` +- [ -z "$count" ] && count=0 +- if [ "$count" != "$echo_nr" ]; then ++ count=$(get_counter ${ns1} "MPTcpExtEchoAdd") ++ if [ -z "$count" ]; then ++ echo "[skip]" ++ elif [ "$count" != "$echo_nr" ]; then + echo "[fail] got $count ADD_ADDR echo[s] expected $echo_nr" + ret=1 + dump_stats=1 +@@ -375,9 +396,10 @@ chk_rm_nr() + local dump_stats + + printf "%-39s %s" " " "rm " +- count=`ip netns exec $ns1 nstat -as | grep MPTcpExtRmAddr | awk '{print $2}'` +- [ -z "$count" ] && count=0 +- if [ "$count" != "$rm_addr_nr" ]; then ++ count=$(get_counter ${ns1} "MPTcpExtRmAddr") ++ if [ -z "$count" ]; then ++ echo -n "[skip]" ++ elif [ "$count" != "$rm_addr_nr" ]; then + echo "[fail] got $count RM_ADDR[s] expected $rm_addr_nr" + ret=1 + dump_stats=1 +@@ -386,9 +408,10 @@ chk_rm_nr() + fi + + echo -n " - sf " +- count=`ip netns exec $ns2 nstat -as | grep MPTcpExtRmSubflow | awk '{print $2}'` +- [ -z "$count" ] && count=0 +- if [ "$count" != "$rm_subflow_nr" ]; then ++ count=$(get_counter ${ns2} "MPTcpExtRmSubflow") ++ if [ -z "$count" ]; then ++ echo "[skip]" ++ elif [ "$count" != "$rm_subflow_nr" ]; then + echo "[fail] got $count RM_SUBFLOW[s] expected $rm_subflow_nr" + ret=1 + dump_stats=1 diff --git a/queue-5.10/selftests-mptcp-pm-nl-remove-hardcoded-default-limits.patch b/queue-5.10/selftests-mptcp-pm-nl-remove-hardcoded-default-limits.patch new file mode 100644 index 00000000000..0d259597f05 --- /dev/null +++ b/queue-5.10/selftests-mptcp-pm-nl-remove-hardcoded-default-limits.patch @@ -0,0 +1,66 @@ +From matthieu.baerts@tessares.net Thu Jun 22 16:00:08 2023 +From: Matthieu Baerts +Date: Thu, 22 Jun 2023 15:59:47 +0200 +Subject: selftests: mptcp: pm nl: remove hardcoded default limits +To: stable@vger.kernel.org, gregkh@linuxfoundation.org +Cc: Matthieu Baerts , Jakub Kicinski +Message-ID: <20230622135948.3245451-1-matthieu.baerts@tessares.net> + +From: Matthieu Baerts + +commit 2177d0b08e421971e035672b70f3228d9485c650 upstream. + +Selftests are supposed to run on any kernels, including the old ones not +supporting all MPTCP features. + +One of them is the checks of the default limits returned by the MPTCP +in-kernel path-manager. The default values have been modified by commit +72bcbc46a5c3 ("mptcp: increase default max additional subflows to 2"). +Instead of comparing with hardcoded values, we can get the default one +and compare with them. + +Note that if we expect to have the latest version, we continue to check +the hardcoded values to avoid unexpected behaviour changes. + +Link: https://github.com/multipath-tcp/mptcp_net-next/issues/368 +Fixes: eedbc685321b ("selftests: add PM netlink functional tests") +Cc: stable@vger.kernel.org +Signed-off-by: Matthieu Baerts +Signed-off-by: Jakub Kicinski +Signed-off-by: Matthieu Baerts +Signed-off-by: Greg Kroah-Hartman +--- + tools/testing/selftests/net/mptcp/pm_netlink.sh | 12 +++++++----- + 1 file changed, 7 insertions(+), 5 deletions(-) + +--- a/tools/testing/selftests/net/mptcp/pm_netlink.sh ++++ b/tools/testing/selftests/net/mptcp/pm_netlink.sh +@@ -73,8 +73,12 @@ check() + } + + check "ip netns exec $ns1 ./pm_nl_ctl dump" "" "defaults addr list" +-check "ip netns exec $ns1 ./pm_nl_ctl limits" "accept 0 ++ ++default_limits="$(ip netns exec $ns1 ./pm_nl_ctl limits)" ++if mptcp_lib_expect_all_features; then ++ check "ip netns exec $ns1 ./pm_nl_ctl limits" "accept 0 + subflows 0" "defaults limits" ++fi + + ip netns exec $ns1 ./pm_nl_ctl add 10.0.1.1 + ip netns exec $ns1 ./pm_nl_ctl add 10.0.1.2 flags subflow dev lo +@@ -120,12 +124,10 @@ ip netns exec $ns1 ./pm_nl_ctl flush + check "ip netns exec $ns1 ./pm_nl_ctl dump" "" "flush addrs" + + ip netns exec $ns1 ./pm_nl_ctl limits 9 1 +-check "ip netns exec $ns1 ./pm_nl_ctl limits" "accept 0 +-subflows 0" "rcv addrs above hard limit" ++check "ip netns exec $ns1 ./pm_nl_ctl limits" "$default_limits" "rcv addrs above hard limit" + + ip netns exec $ns1 ./pm_nl_ctl limits 1 9 +-check "ip netns exec $ns1 ./pm_nl_ctl limits" "accept 0 +-subflows 0" "subflows above hard limit" ++check "ip netns exec $ns1 ./pm_nl_ctl limits" "$default_limits" "subflows above hard limit" + + ip netns exec $ns1 ./pm_nl_ctl limits 8 8 + check "ip netns exec $ns1 ./pm_nl_ctl limits" "accept 8 diff --git a/queue-5.10/series b/queue-5.10/series index 87b32da98ad..13cace61564 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -4,3 +4,5 @@ tracing-add-tracing_reset_all_online_cpus_unlocked-function.patch tick-common-align-tick-period-during-sched_timer-setup.patch selftests-mptcp-lib-skip-if-missing-symbol.patch selftests-mptcp-lib-skip-if-not-below-kernel-version.patch +selftests-mptcp-pm-nl-remove-hardcoded-default-limits.patch +selftests-mptcp-join-skip-check-if-mib-counter-not-supported.patch