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

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

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/net/forwarding/tc_flower_router.sh
Extension
.sh
Size
3096 bytes
Lines
173
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="match_indev_egress_test"
NUM_NETIFS=6
source tc_common.sh
source lib.sh

h1_create()
{
	simple_if_init $h1 192.0.1.1/24

	ip route add 192.0.2.0/24 vrf v$h1 nexthop via 192.0.1.2
	ip route add 192.0.3.0/24 vrf v$h1 nexthop via 192.0.1.2
}

h1_destroy()
{
	ip route del 192.0.3.0/24 vrf v$h1
	ip route del 192.0.2.0/24 vrf v$h1

	simple_if_fini $h1 192.0.1.1/24
}

h2_create()
{
	simple_if_init $h2 192.0.2.1/24

	ip route add 192.0.1.0/24 vrf v$h2 nexthop via 192.0.2.2
	ip route add 192.0.3.0/24 vrf v$h2 nexthop via 192.0.2.2
}

h2_destroy()
{
	ip route del 192.0.3.0/24 vrf v$h2
	ip route del 192.0.1.0/24 vrf v$h2

	simple_if_fini $h2 192.0.2.1/24
}

h3_create()
{
	simple_if_init $h3 192.0.3.1/24

	ip route add 192.0.1.0/24 vrf v$h3 nexthop via 192.0.3.2
	ip route add 192.0.2.0/24 vrf v$h3 nexthop via 192.0.3.2
}

h3_destroy()
{
	ip route del 192.0.2.0/24 vrf v$h3
	ip route del 192.0.1.0/24 vrf v$h3

	simple_if_fini $h3 192.0.3.1/24
}


router_create()
{
	ip link set dev $rp1 up
	ip link set dev $rp2 up
	ip link set dev $rp3 up

	tc qdisc add dev $rp3 clsact

	ip address add 192.0.1.2/24 dev $rp1
	ip address add 192.0.2.2/24 dev $rp2
	ip address add 192.0.3.2/24 dev $rp3
}

Annotation

Implementation Notes