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

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

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh
Extension
.sh
Size
24060 bytes
Lines
700
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="vlmc_control_test vlmc_querier_test vlmc_igmp_mld_version_test \
	   vlmc_last_member_test vlmc_startup_query_test vlmc_membership_test \
	   vlmc_querier_intvl_test vlmc_query_intvl_test vlmc_query_response_intvl_test \
	   vlmc_router_port_test vlmc_filtering_test vlmc_mcast_toggle_test"
NUM_NETIFS=4
CHECK_TC="yes"
TEST_GROUP="239.10.10.10"

source lib.sh

h1_create()
{
	simple_if_init $h1 192.0.2.1/24 2001:db8:1::1/64
	ip link add l $h1 $h1.10 up type vlan id 10
}

h1_destroy()
{
	ip link del $h1.10
	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
	ip link add l $h2 $h2.10 up type vlan id 10
}

h2_destroy()
{
	ip link del $h2.10
	simple_if_fini $h2 192.0.2.2/24 2001:db8:1::2/64
}

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

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

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

	tc qdisc add dev $swp1 clsact
	tc qdisc add dev $swp2 clsact

	bridge vlan add vid 10-11 dev $swp1 master
	bridge vlan add vid 10-11 dev $swp2 master

	ip link set dev br0 type bridge mcast_vlan_snooping 1
	check_err $? "Could not enable global vlan multicast snooping"
	log_test "Vlan multicast snooping enable"
}

switch_destroy()
{
	tc qdisc del dev $swp2 clsact
	tc qdisc del dev $swp1 clsact

	ip link set dev $swp2 down
	ip link set dev $swp1 down

	ip link del dev br0
}

Annotation

Implementation Notes