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

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

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/net/forwarding/bridge_mdb_host.sh
Extension
.sh
Size
1701 bytes
Lines
104
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
#
# Verify that adding host mdb entries work as intended for all types of
# multicast filters: ipv4, ipv6, and mac

ALL_TESTS="mdb_add_del_test"
NUM_NETIFS=2

TEST_GROUP_IP4="225.1.2.3"
TEST_GROUP_IP6="ff02::42"
TEST_GROUP_MAC="01:00:01:c0:ff:ee"

source lib.sh

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

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

switch_create()
{
	# Enable multicast filtering
	ip link add dev br0 type bridge mcast_snooping 1

	ip link set dev $swp1 master br0

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

switch_destroy()
{
	ip link set dev $swp1 down
	ip link del dev br0
}

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

	vrf_prepare

	h1_create
	switch_create
}

cleanup()
{
	pre_cleanup

	switch_destroy
	h1_destroy

	vrf_cleanup
}

do_mdb_add_del()
{
	local group=$1
	local flag=$2

	RET=0
	bridge mdb add dev br0 port br0 grp $group $flag 2>/dev/null

Annotation

Implementation Notes