[Devel] [PATCH vz10 3/4] selftests: net: rtnetlink: skip erspan test if device type is unsupported

Konstantin Khorenko khorenko at virtuozzo.com
Fri Jan 9 19:23:22 MSK 2026


Please instead of this patch create a task in the Epic https://virtuozzo.atlassian.net/browse/VSTOR-104337

to
1. fix ERSPAN the code to be usable inside Containers
2. to drop the commit

commit c1f331213c42bc6b620f615ef2d9e7a09241f18d
Author: Nikolay Borisov <nikolay.borisov at virtuozzo.com>
Date:   Tue Jan 24 09:46:01 2023 +0200

     ve/net/gre: Disable ERSPAN support in ip_gre module

     Fix GRE support in Containers by disabling Encapsulated Remote Switched
     Port Analyzer (ERSPAN), this is needed as the newly added ERSPAN support
     isn't enabled for per-Container operation.

     Furthermore this is a Cisco-specific protocol supported on some Catalyst
     switches, used for traffic mirroring.

     https://jira.sw.ru/browse/PSBM-144221

     Signed-off-by: Nikolay Borisov <nikolay.borisov at virtuozzo.com>
     Feature: net: disable ERSPAN support in ip_gre module


On 1/4/26 02:50, Aleksei Oladko wrote:
> The net kselftest rtnetlink.sh tries to create an erspan device using:
> 
>    ip link add dev erspan00 type erspan...
> 
> On kernels built without erspan support this fails with:
> 
>    Error: Unknown device type.
> 
> and causes the entire test to fail.
> 
> Skip the test when erspan devices cannot be created.
> 
> https://virtuozzo.atlassian.net/browse/VSTOR-121804
> 
> Signed-off-by: Aleksei Oladko <aleksey.oladko at virtuozzo.com>
> ---
>   tools/testing/selftests/net/rtnetlink.sh | 9 +++++++++
>   1 file changed, 9 insertions(+)
> 
> diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh
> index e7a682183703..94f71f39b3dc 100755
> --- a/tools/testing/selftests/net/rtnetlink.sh
> +++ b/tools/testing/selftests/net/rtnetlink.sh
> @@ -65,6 +65,9 @@ run_cmd_common()
>   	fi
>   	out=$($cmd 2>&1)
>   	rc=$?
> +	if [[ "$out" == *"Error: Unknown device type"* ]]; then
> +		skip_test=1

creates a new global variable

> +	fi
>   	if [ "$VERBOSE" = "1" -a -n "$out" ]; then
>   		echo "    $out"
>   	fi
> @@ -934,6 +937,7 @@ kci_test_erspan()
>   {
>   	DEV_NS=erspan00
>   	local ret=0
> +	local skip_test=0

creates a local variable

>   	run_cmd_grep "^Usage:" ip link help erspan
>   	if [ $? -ne 0 ];then
>   		end_test "SKIP: erspan: iproute2 too old"
> @@ -949,6 +953,11 @@ kci_test_erspan()
>   	run_cmd ip -netns "$testns" link add dev "$DEV_NS" type erspan seq \
>   		key 102 local 172.16.1.100 remote 172.16.1.200 \
>   		erspan_ver 1 erspan 488
> +	if [ $skip_test -ne 0 ]; then

AFAIK the local variable should be checked here, not the global one.

> +		end_test "SKIP: erspan tests: not supported"
> +		ip netns del "$testns"
> +		return $ksft_skip
> +	fi
>   
>   
>   	run_cmd ip -netns "$testns" addr add dev "$DEV_NS" 10.1.1.100/24



More information about the Devel mailing list