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

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

File Facts

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

# +-------------------------+
# |  H1                     |
# |               $h1 +     |
# |      192.0.2.2/24 |     |
# |  2001:db8:1::2/64 |     |
# +-------------------|-----+
#                     |
# +-------------------|----------------------+
# |                   |                   R1 |
# |             $rp11 +                      |
# |      192.0.2.1/24                        |
# |  2001:db8:1::1/64                        |
# |                                          |
# |  + $rp12              + $rp13            |
# |  | 169.254.2.12/24    | 169.254.3.13/24  |
# |  | fe80:2::12/64      | fe80:3::13/64    |
# +--|--------------------|------------------+
#    |                    |
# +--|--------------------|------------------+
# |  + $rp22              + $rp23            |
# |    169.254.2.22/24      169.254.3.23/24  |
# |    fe80:2::22/64        fe80:3::23/64    |
# |                                          |
# |             $rp21 +                      |
# |   198.51.100.1/24 |                      |
# |  2001:db8:2::1/64 |                   R2 |
# +-------------------|----------------------+
#                     |
# +-------------------|-----+
# |                   |     |
# |               $h2 +     |
# |   198.51.100.2/24       |
# |  2001:db8:2::2/64    H2 |
# +-------------------------+

ALL_TESTS="
	ping_ipv4
	ping_ipv6
	multipath_test
	multipath16_test
	ping_ipv4_blackhole
	ping_ipv6_blackhole
	nh_stats_test_v4
	nh_stats_test_v6
"
NUM_NETIFS=8
source lib.sh
source router_mpath_nh_lib.sh

h1_create()
{
	vrf_create "vrf-h1"
	ip link set dev $h1 master vrf-h1

	ip link set dev vrf-h1 up
	ip link set dev $h1 up

	ip address add 192.0.2.2/24 dev $h1
	ip address add 2001:db8:1::2/64 dev $h1

	ip route add 198.51.100.0/24 vrf vrf-h1 nexthop via 192.0.2.1
	ip route add 2001:db8:2::/64 vrf vrf-h1 nexthop via 2001:db8:1::1
}

h1_destroy()
{
	ip route del 2001:db8:2::/64 vrf vrf-h1

Annotation

Implementation Notes