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

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

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/net/forwarding/mirror_gre_bridge_1q_lag.sh
Extension
.sh
Size
7192 bytes
Lines
277
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 for "tc action mirred egress mirror" when the underlay route points at a
# bridge device with vlan filtering (802.1q), and the egress device is a team
# device.
#
# +----------------------+                             +----------------------+
# | H1                   |                             |                   H2 |
# |     + $h1.333        |                             |        $h1.555 +     |
# |     | 192.0.2.1/28   |                             |  192.0.2.18/28 |     |
# +-----|----------------+                             +----------------|-----+
#       |                               $h1                             |
#       +--------------------------------+------------------------------+
#                                        |
# +--------------------------------------|------------------------------------+
# | SW                                   o---> mirror                         |
# |                                      |                                    |
# |     +--------------------------------+------------------------------+     |
# |     |                              $swp1                            |     |
# |     + $swp1.333                                           $swp1.555 +     |
# |       192.0.2.2/28                                    192.0.2.17/28       |
# |                                                                           |
# | +-----------------------------------------------------------------------+ |
# | |                        BR1 (802.1q)                                   | |
# | |     + lag (team)       192.0.2.129/28                                 | |
# | |    / \                 2001:db8:2::1/64                               | |
# | +---/---\---------------------------------------------------------------+ |
# |    /     \                                                            ^   |
# |   |       \                                        + gt4 (gretap)     |   |
# |   |        \                                         loc=192.0.2.129  |   |
# |   |         \                                        rem=192.0.2.130 -+   |
# |   |          \                                       ttl=100              |
# |   |           \                                      tos=inherit          |
# |   |            \                                                          |
# |   |             \_________________________________                        |
# |   |                                               \                       |
# |   + $swp3                                          + $swp4                |
# +---|------------------------------------------------|----------------------+
#     |                                                |
# +---|----------------------+                     +---|----------------------+
# |   + $h3               H3 |                     |   + $h4               H4 |
# |     192.0.2.130/28       |                     |     192.0.2.130/28       |
# |     2001:db8:2::2/64     |                     |     2001:db8:2::2/64     |
# +--------------------------+                     +--------------------------+

ALL_TESTS="
	test_mirror_gretap_first
	test_mirror_gretap_second
"

REQUIRE_TEAMD="yes"
NUM_NETIFS=6
source lib.sh
source mirror_lib.sh
source mirror_gre_lib.sh

require_command $ARPING

vlan_host_create()
{
	local if_name=$1; shift
	local vid=$1; shift
	local vrf_name=$1; shift
	local ips=("${@}")

	vrf_create $vrf_name
	ip link set dev $vrf_name up
	vlan_create $if_name $vid $vrf_name "${ips[@]}"
}

Annotation

Implementation Notes