--- /dev/null
+From 46565acdd29facbf418a11e4a3791b3c8967308d Mon Sep 17 00:00:00 2001
+From: Matthieu Baerts <matthieu.baerts@tessares.net>
+Date: Sun, 28 May 2023 19:35:30 +0200
+Subject: selftests: mptcp: diag: skip if MPTCP is not supported
+
+From: Matthieu Baerts <matthieu.baerts@tessares.net>
+
+commit 46565acdd29facbf418a11e4a3791b3c8967308d upstream.
+
+Selftests are supposed to run on any kernels, including the old ones not
+supporting MPTCP.
+
+A new check is then added to make sure MPTCP is supported. If not, the
+test stops and is marked as "skipped".
+
+Link: https://github.com/multipath-tcp/mptcp_net-next/issues/368
+Fixes: df62f2ec3df6 ("selftests/mptcp: add diag interface tests")
+Cc: stable@vger.kernel.org
+Acked-by: Paolo Abeni <pabeni@redhat.com>
+Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
+Signed-off-by: Paolo Abeni <pabeni@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ tools/testing/selftests/net/mptcp/diag.sh | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/tools/testing/selftests/net/mptcp/diag.sh
++++ b/tools/testing/selftests/net/mptcp/diag.sh
+@@ -1,6 +1,8 @@
+ #!/bin/bash
+ # SPDX-License-Identifier: GPL-2.0
+
++. "$(dirname "${0}")/mptcp_lib.sh"
++
+ rndh=$(printf %x $sec)-$(mktemp -u XXXXXX)
+ ns="ns1-$rndh"
+ ksft_skip=4
+@@ -25,6 +27,8 @@ cleanup()
+ ip netns del $ns
+ }
+
++mptcp_lib_check_mptcp
++
+ ip -Version > /dev/null 2>&1
+ if [ $? -ne 0 ];then
+ echo "SKIP: Could not run test without ip tool"
--- /dev/null
+From d328fe87067480cf2bd0b58dab428a98d31dbb7e Mon Sep 17 00:00:00 2001
+From: Matthieu Baerts <matthieu.baerts@tessares.net>
+Date: Sun, 28 May 2023 19:35:26 +0200
+Subject: selftests: mptcp: join: avoid using 'cmp --bytes'
+
+From: Matthieu Baerts <matthieu.baerts@tessares.net>
+
+commit d328fe87067480cf2bd0b58dab428a98d31dbb7e upstream.
+
+BusyBox's 'cmp' command doesn't support the '--bytes' parameter.
+
+Some CIs -- i.e. LKFT -- use BusyBox and have the mptcp_join.sh test
+failing [1] because their 'cmp' command doesn't support this '--bytes'
+option:
+
+ cmp: unrecognized option '--bytes=1024'
+ BusyBox v1.35.0 () multi-call binary.
+
+ Usage: cmp [-ls] [-n NUM] FILE1 [FILE2]
+
+Instead, 'head --bytes' can be used as this option is supported by
+BusyBox. A temporary file is needed for this operation.
+
+Because it is apparently quite common to use BusyBox, it is certainly
+better to backport this fix to impacted kernels.
+
+Fixes: 6bf41020b72b ("selftests: mptcp: update and extend fastclose test-cases")
+Cc: stable@vger.kernel.org
+Link: https://qa-reports.linaro.org/lkft/linux-mainline-master/build/v6.3-rc5-5-g148341f0a2f5/testrun/16088933/suite/kselftest-net-mptcp/test/net_mptcp_userspace_pm_sh/log [1]
+Suggested-by: Paolo Abeni <pabeni@redhat.com>
+Reviewed-by: Mat Martineau <martineau@kernel.org>
+Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
+Signed-off-by: Paolo Abeni <pabeni@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ tools/testing/selftests/net/mptcp/mptcp_join.sh | 13 +++++++++++--
+ 1 file changed, 11 insertions(+), 2 deletions(-)
+
+--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
++++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
+@@ -15,6 +15,7 @@ sout=""
+ cin=""
+ cinfail=""
+ cinsent=""
++tmpfile=""
+ cout=""
+ capout=""
+ ns1=""
+@@ -168,6 +169,7 @@ cleanup()
+ {
+ rm -f "$cin" "$cout" "$sinfail"
+ rm -f "$sin" "$sout" "$cinsent" "$cinfail"
++ rm -f "$tmpfile"
+ cleanup_partial
+ }
+
+@@ -362,9 +364,16 @@ check_transfer()
+ fail_test
+ return 1
+ fi
+- bytes="--bytes=${bytes}"
++
++ # note: BusyBox's "cmp" command doesn't support --bytes
++ tmpfile=$(mktemp)
++ head --bytes="$bytes" "$in" > "$tmpfile"
++ mv "$tmpfile" "$in"
++ head --bytes="$bytes" "$out" > "$tmpfile"
++ mv "$tmpfile" "$out"
++ tmpfile=""
+ fi
+- cmp -l "$in" "$out" ${bytes} | while read -r i a b; do
++ cmp -l "$in" "$out" | while read -r i a b; do
+ local sum=$((0${a} + 0${b}))
+ if [ $check_invert -eq 0 ] || [ $sum -ne $((0xff)) ]; then
+ echo "[ FAIL ] $what does not match (in, out):"
--- /dev/null
+From 9161f21c74a1a0e7bb39eb84ea0c86b23c92fc87 Mon Sep 17 00:00:00 2001
+From: Matthieu Baerts <matthieu.baerts@tessares.net>
+Date: Sun, 28 May 2023 19:35:31 +0200
+Subject: selftests: mptcp: simult flows: skip if MPTCP is not supported
+
+From: Matthieu Baerts <matthieu.baerts@tessares.net>
+
+commit 9161f21c74a1a0e7bb39eb84ea0c86b23c92fc87 upstream.
+
+Selftests are supposed to run on any kernels, including the old ones not
+supporting MPTCP.
+
+A new check is then added to make sure MPTCP is supported. If not, the
+test stops and is marked as "skipped".
+
+Link: https://github.com/multipath-tcp/mptcp_net-next/issues/368
+Fixes: 1a418cb8e888 ("mptcp: simult flow self-tests")
+Cc: stable@vger.kernel.org
+Acked-by: Paolo Abeni <pabeni@redhat.com>
+Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
+Signed-off-by: Paolo Abeni <pabeni@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ tools/testing/selftests/net/mptcp/simult_flows.sh | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/tools/testing/selftests/net/mptcp/simult_flows.sh
++++ b/tools/testing/selftests/net/mptcp/simult_flows.sh
+@@ -1,6 +1,8 @@
+ #!/bin/bash
+ # SPDX-License-Identifier: GPL-2.0
+
++. "$(dirname "${0}")/mptcp_lib.sh"
++
+ rndh=$(printf %x $sec)-$(mktemp -u XXXXXX)
+ ns1="ns1-$rndh"
+ ns2="ns2-$rndh"
+@@ -33,6 +35,8 @@ cleanup()
+ done
+ }
+
++mptcp_lib_check_mptcp
++
+ ip -Version > /dev/null 2>&1
+ if [ $? -ne 0 ];then
+ echo "SKIP: Could not run test without ip tool"
xfs-verify-buffer-contents-when-we-skip-log-replay.patch
tls-rx-strp-don-t-use-gfp_kernel-in-softirq-context.patch
arm64-efi-use-smbios-processor-version-to-key-off-ampere-quirk.patch
+selftests-mptcp-diag-skip-if-mptcp-is-not-supported.patch
+selftests-mptcp-simult-flows-skip-if-mptcp-is-not-supported.patch
+selftests-mptcp-join-avoid-using-cmp-bytes.patch