tools/testing/selftests/net/forwarding/mirror_gre_changes.sh

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

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/net/forwarding/mirror_gre_changes.sh
Extension
.sh
Size
5293 bytes
Lines
255
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

# This test uses standard topology for testing gretap. See
# mirror_gre_topo_lib.sh for more details.
#
# Test how mirrors to gretap and ip6gretap react to changes to relevant
# configuration.

ALL_TESTS="
	test_ttl
	test_tun_up
	test_egress_up
	test_remote_ip
	test_tun_del
	test_route_del
"

NUM_NETIFS=6
source lib.sh
source mirror_lib.sh
source mirror_gre_lib.sh
source mirror_gre_topo_lib.sh

setup_prepare()
{
	h1=${NETIFS[p1]}
	swp1=${NETIFS[p2]}

	swp2=${NETIFS[p3]}
	h2=${NETIFS[p4]}

	swp3=${NETIFS[p5]}
	h3=${NETIFS[p6]}

	vrf_prepare
	mirror_gre_topo_create

	# This test downs $swp3, which deletes the configured IPv6 address
	# unless this sysctl is set.
	sysctl_set net.ipv6.conf.$swp3.keep_addr_on_down 1

	ip address add dev $swp3 192.0.2.129/28
	ip address add dev $h3 192.0.2.130/28

	ip address add dev $swp3 2001:db8:2::1/64
	ip address add dev $h3 2001:db8:2::2/64
}

cleanup()
{
	pre_cleanup

	ip address del dev $h3 2001:db8:2::2/64
	ip address del dev $swp3 2001:db8:2::1/64

	ip address del dev $h3 192.0.2.130/28
	ip address del dev $swp3 192.0.2.129/28

	sysctl_restore net.ipv6.conf.$swp3.keep_addr_on_down

	mirror_gre_topo_destroy
	vrf_cleanup
}

test_span_gre_ttl()
{
	local tundev=$1; shift
	local type=$1; shift
	local prot=$1; shift

Annotation

Implementation Notes