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

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

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/net/forwarding/custom_multipath_hash.sh
Extension
.sh
Size
10035 bytes
Lines
373
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
#
# Test traffic distribution between two paths when using custom hash policy.
#
# +--------------------------------+
# | H1                             |
# |                     $h1 +      |
# |   198.51.100.{2-253}/24 |      |
# |   2001:db8:1::{2-fd}/64 |      |
# +-------------------------|------+
#                           |
# +-------------------------|-------------------------+
# | SW1                     |                         |
# |                    $rp1 +                         |
# |         198.51.100.1/24                           |
# |        2001:db8:1::1/64                           |
# |                                                   |
# |                                                   |
# |            $rp11 +             + $rp12            |
# |     192.0.2.1/28 |             | 192.0.2.17/28    |
# | 2001:db8:2::1/64 |             | 2001:db8:3::1/64 |
# +------------------|-------------|------------------+
#                    |             |
# +------------------|-------------|------------------+
# | SW2              |             |                  |
# |                  |             |                  |
# |            $rp21 +             + $rp22            |
# |     192.0.2.2/28                 192.0.2.18/28    |
# | 2001:db8:2::2/64                 2001:db8:3::2/64 |
# |                                                   |
# |                                                   |
# |                    $rp2 +                         |
# |          203.0.113.1/24 |                         |
# |        2001:db8:4::1/64 |                         |
# +-------------------------|-------------------------+
#                           |
# +-------------------------|------+
# | H2                      |      |
# |                     $h2 +      |
# |    203.0.113.{2-253}/24        |
# |   2001:db8:4::{2-fd}/64        |
# +--------------------------------+

ALL_TESTS="
	ping_ipv4
	ping_ipv6
	custom_hash
"

NUM_NETIFS=8
source lib.sh

h1_create()
{
	simple_if_init $h1 198.51.100.2/24 2001:db8:1::2/64
	ip route add vrf v$h1 default via 198.51.100.1 dev $h1
	ip -6 route add vrf v$h1 default via 2001:db8:1::1 dev $h1
}

h1_destroy()
{
	ip -6 route del vrf v$h1 default
	ip route del vrf v$h1 default
	simple_if_fini $h1 198.51.100.2/24 2001:db8:1::2/64
}

sw1_create()
{
	simple_if_init $rp1 198.51.100.1/24 2001:db8:1::1/64

Annotation

Implementation Notes