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

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

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/net/forwarding/bridge_fdb_local_vlan_0.sh
Extension
.sh
Size
8996 bytes
Lines
388
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 (vrf)              | | H2 (vrf)              | | H3 (vrf)              |
# |    + $h1              | |    + $h2              | |    + $h3              |
# |    | 192.0.2.1/28     | |    | 192.0.2.2/28     | |    | 192.0.2.18/28    |
# |    | 2001:db8:1::1/64 | |    | 2001:db8:1::2/64 | |    | 2001:db8:2::2/64 |
# |    |                  | |    |                  | |    |                  |
# +----|------------------+ +----|------------------+ +----|------------------+
#      |                         |                         |
# +----|-------------------------|-------------------------|------------------+
# | +--|-------------------------|------------------+      |                  |
# | |  + $swp1                   + $swp2            |      + $swp3            |
# | |                                               |        192.0.2.17/28    |
# | |  BR1 (802.1q)                                 |        2001:db8:2::1/64 |
# | |  192.0.2.3/28                                 |                         |
# | |  2001:db8:1::3/64                             |                         |
# | +-----------------------------------------------+                      SW |
# +---------------------------------------------------------------------------+
#
#shellcheck disable=SC2317 # SC doesn't see our uses of functions.
#shellcheck disable=SC2034 # ... and global variables

ALL_TESTS="
	test_d_no_sharing
	test_d_sharing
	test_q_no_sharing
	test_q_sharing
	test_addr_set
"

NUM_NETIFS=6
source lib.sh

pMAC=00:11:22:33:44:55
bMAC=00:11:22:33:44:66
mMAC=00:11:22:33:44:77
xMAC=00:11:22:33:44:88

host_create()
{
	local h=$1; shift
	local ipv4=$1; shift
	local ipv6=$1; shift

	adf_simple_if_init "$h" "$ipv4" "$ipv6"
	adf_ip_route_add vrf "v$h" 192.0.2.16/28 nexthop via 192.0.2.3
	adf_ip_route_add vrf "v$h" 2001:db8:2::/64 nexthop via 2001:db8:1::3
}

h3_create()
{
	adf_simple_if_init "$h3" 192.0.2.18/28 2001:db8:2::2/64
	adf_ip_route_add vrf "v$h3" 192.0.2.0/28 nexthop via 192.0.2.17
	adf_ip_route_add vrf "v$h3" 2001:db8:1::/64 nexthop via 2001:db8:2::1

	tc qdisc add dev "$h3" clsact
	defer tc qdisc del dev "$h3" clsact

	tc filter add dev "$h3" ingress proto ip pref 104 \
	   flower skip_hw ip_proto udp dst_port 4096 \
	   action pass
	defer tc filter del dev "$h3" ingress proto ip pref 104

	tc qdisc add dev "$h2" clsact
	defer tc qdisc del dev "$h2" clsact

	tc filter add dev "$h2" ingress proto ip pref 104 \
	   flower skip_hw ip_proto udp dst_port 4096 \

Annotation

Implementation Notes