tools/testing/selftests/net/test_vxlan_nh.sh

Source file repositories/reference/linux-study-clean/tools/testing/selftests/net/test_vxlan_nh.sh

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/net/test_vxlan_nh.sh
Extension
.sh
Size
5880 bytes
Lines
224
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: tools
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

#!/bin/bash
# SPDX-License-Identifier: GPL-2.0

source lib.sh
TESTS="
	basic_tx_ipv4
	basic_tx_ipv6
	learning
	proxy_ipv4
	proxy_ipv6
"
VERBOSE=0

################################################################################
# Utilities

run_cmd()
{
	local cmd="$1"
	local out
	local stderr="2>/dev/null"

	if [ "$VERBOSE" = "1" ]; then
		echo "COMMAND: $cmd"
		stderr=
	fi

	out=$(eval "$cmd" "$stderr")
	rc=$?
	if [ "$VERBOSE" -eq 1 ] && [ -n "$out" ]; then
		echo "    $out"
	fi

	return $rc
}

################################################################################
# Cleanup

exit_cleanup_all()
{
	cleanup_all_ns
	exit "${EXIT_STATUS}"
}

################################################################################
# Tests

nh_stats_get()
{
	ip -n "$ns1" -s -j nexthop show id 10 | jq ".[][\"group_stats\"][][\"packets\"]"
}

tc_stats_get()
{
	tc_rule_handle_stats_get "dev dummy1 egress" 101 ".packets" "-n $ns1"
}

basic_tx_common()
{
	local af_str=$1; shift
	local proto=$1; shift
	local local_addr=$1; shift
	local plen=$1; shift
	local remote_addr=$1; shift

	RET=0

	# Test basic Tx functionality. Check that stats are incremented on
	# both the FDB nexthop group and the egress device.

Annotation

Implementation Notes