tools/testing/selftests/net/test_neigh.sh

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

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/net/test_neigh.sh
Extension
.sh
Size
13717 bytes
Lines
367
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="
	extern_valid_ipv4
	extern_valid_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
}

################################################################################
# Setup

setup()
{
	set -e

	setup_ns ns1 ns2

	ip -n "$ns1" link add veth0 type veth peer name veth1 netns "$ns2"
	ip -n "$ns1" link set dev veth0 up
	ip -n "$ns2" link set dev veth1 up

	ip -n "$ns1" address add 192.0.2.1/24 dev veth0
	ip -n "$ns1" address add 2001:db8:1::1/64 dev veth0 nodad
	ip -n "$ns2" address add 192.0.2.2/24 dev veth1
	ip -n "$ns2" address add 2001:db8:1::2/64 dev veth1 nodad

	ip netns exec "$ns1" sysctl -qw net.ipv6.conf.all.keep_addr_on_down=1
	ip netns exec "$ns2" sysctl -qw net.ipv6.conf.all.keep_addr_on_down=1

	sleep 5

	set +e
}

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

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

extern_valid_common()
{

Annotation

Implementation Notes