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

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

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/net/forwarding/bridge_locked_port.sh
Extension
.sh
Size
9469 bytes
Lines
366
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="
	locked_port_ipv4
	locked_port_ipv6
	locked_port_vlan
	locked_port_mab
	locked_port_mab_roam
	locked_port_mab_config
	locked_port_mab_flush
	locked_port_mab_redirect
"

NUM_NETIFS=4
CHECK_TC="no"
source lib.sh

h1_create()
{
	simple_if_init $h1 192.0.2.1/24 2001:db8:1::1/64
	vlan_create $h1 100 v$h1 198.51.100.1/24
}

h1_destroy()
{
	vlan_destroy $h1 100
	simple_if_fini $h1 192.0.2.1/24 2001:db8:1::1/64
}

h2_create()
{
	simple_if_init $h2 192.0.2.2/24 2001:db8:1::2/64
	vlan_create $h2 100 v$h2 198.51.100.2/24
}

h2_destroy()
{
	vlan_destroy $h2 100
	simple_if_fini $h2 192.0.2.2/24 2001:db8:1::2/64
}

switch_create()
{
	ip link add dev br0 type bridge vlan_filtering 1

	ip link set dev $swp1 master br0
	ip link set dev $swp2 master br0

	bridge link set dev $swp1 learning off

	ip link set dev br0 up
	ip link set dev $swp1 up
	ip link set dev $swp2 up
}

switch_destroy()
{
	ip link set dev $swp2 down
	ip link set dev $swp1 down

	ip link del dev br0
}

setup_prepare()
{
	h1=${NETIFS[p1]}
	swp1=${NETIFS[p2]}

	swp2=${NETIFS[p3]}

Annotation

Implementation Notes