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

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

File Facts

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

ALL_TESTS="tunnel_key_nofrag_test"

NUM_NETIFS=4
source tc_common.sh
source lib.sh

tcflags="skip_hw"

h1_create()
{
	simple_if_init $h1 192.0.2.1/24
	forwarding_enable
	mtu_set $h1 1500
	tunnel_create h1-et vxlan 192.0.2.1 192.0.2.2 dev $h1 dstport 0 external
	tc qdisc add dev h1-et clsact
	mtu_set h1-et 1230
	mtu_restore $h1
	mtu_set $h1 1000
}

h1_destroy()
{
	tc qdisc del dev h1-et clsact
	tunnel_destroy h1-et
	forwarding_restore
	mtu_restore $h1
	simple_if_fini $h1 192.0.2.1/24
}

h2_create()
{
	simple_if_init $h2 192.0.2.2/24
}

h2_destroy()
{
	simple_if_fini $h2 192.0.2.2/24
}

switch_create()
{
	simple_if_init $swp1 192.0.2.2/24
	tc qdisc add dev $swp1 clsact
	simple_if_init $swp2 192.0.2.1/24
}

switch_destroy()
{
	simple_if_fini $swp2 192.0.2.1/24
	tc qdisc del dev $swp1 clsact
	simple_if_fini $swp1 192.0.2.2/24
}

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

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

	h1mac=$(mac_get $h1)
	h2mac=$(mac_get $h2)

	swp1origmac=$(mac_get $swp1)
	swp2origmac=$(mac_get $swp2)
	ip link set $swp1 address $h2mac

Annotation

Implementation Notes