[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3c39994e-548e-4d67-b8e4-3236d27a6ca6@redhat.com>
Date: Thu, 13 Mar 2025 13:56:46 +0100
From: Paolo Abeni <pabeni@...hat.com>
To: Justin Iurman <justin.iurman@...ege.be>, netdev@...r.kernel.org
Cc: davem@...emloft.net, dsahern@...nel.org, edumazet@...gle.com,
kuba@...nel.org, horms@...nel.org, Shuah Khan <shuah@...nel.org>,
linux-kselftest@...r.kernel.org
Subject: Re: [PATCH net 7/7] selftests: net: test for lwtunnel dst ref loops
On 3/11/25 3:12 PM, Justin Iurman wrote:
> diff --git a/tools/testing/selftests/net/config b/tools/testing/selftests/net/config
> index 5b9baf708950..61e5116987f3 100644
> --- a/tools/testing/selftests/net/config
> +++ b/tools/testing/selftests/net/config
> @@ -107,3 +107,5 @@ CONFIG_XFRM_INTERFACE=m
> CONFIG_XFRM_USER=m
> CONFIG_IP_NF_MATCH_RPFILTER=m
> CONFIG_IP6_NF_MATCH_RPFILTER=m
> +CONFIG_IPV6_ILA=m
> +CONFIG_IPV6_RPL_LWTUNNEL=y
> diff --git a/tools/testing/selftests/net/lwt_dst_cache_ref_loop.sh b/tools/testing/selftests/net/lwt_dst_cache_ref_loop.sh
> new file mode 100755
> index 000000000000..9161f16154a5
> --- /dev/null
> +++ b/tools/testing/selftests/net/lwt_dst_cache_ref_loop.sh
> @@ -0,0 +1,250 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: GPL-2.0+
> +#
> +# Author: Justin Iurman <justin.iurman@...ege.be>
> +#
> +# WARNING
> +# -------
> +# This is just a dummy script that triggers encap cases with possible dst cache
> +# reference loops in affected lwt users (see list below). Some cases are
> +# pathological configurations for simplicity, others are valid. Overall, we
> +# don't want this issue to happen, no matter what. In order to catch any
> +# reference loops, kmemleak MUST be used. The results alone are always blindly
> +# successful, don't rely on them. Note that the following tests may crash the
> +# kernel if the fix to prevent lwtunnel_{input|output|xmit}() reentry loops is
> +# not present.
> +#
> +# Affected lwt users so far (please update accordingly if needed):
> +# - ila_lwt (output only)
> +# - ioam6_iptunnel (output only)
> +# - rpl_iptunnel (both input and output)
> +# - seg6_iptunnel (both input and output)
> +
> +source lib.sh
> +
> +check_compatibility()
> +{
> + setup_ns tmp_node &>/dev/null
> + if [ $? != 0 ]
> + then
We don't have formal codying stile written for shell files, but please
use tabs for indenting, and keep the 'then' keyword on the same line
with 'if'
> + echo "SKIP: Cannot create netns."
> + exit $ksft_skip
> + fi
> +
> + ip link add name veth0 netns $tmp_node type veth \
> + peer name veth1 netns $tmp_node &>/dev/null
> + local ret=$?
> +
> + ip -netns $tmp_node link set veth0 up &>/dev/null
> + ret=$((ret + $?))
> +
> + ip -netns $tmp_node link set veth1 up &>/dev/null
> + ret=$((ret + $?))
> +
> + if [ $ret != 0 ]
> + then
> + echo "SKIP: Cannot configure links."
> + cleanup_ns $tmp_node
If you add a:
trap cleanup EXIT
after setup, you can drop the explicit call in the various exit paths.
/P
Powered by blists - more mailing lists