tools/testing/selftests/drivers/net/mlxsw/spectrum-2/vxlan_flooding_ipv6.sh

Source file repositories/reference/linux-study-clean/tools/testing/selftests/drivers/net/mlxsw/spectrum-2/vxlan_flooding_ipv6.sh

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/drivers/net/mlxsw/spectrum-2/vxlan_flooding_ipv6.sh
Extension
.sh
Size
9468 bytes
Lines
340
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 VxLAN flooding. The device stores flood records in a singly linked list
# where each record stores up to four IPv6 addresses of remote VTEPs. The test
# verifies that packets are correctly flooded in various cases such as deletion
# of a record in the middle of the list.
#
# +-----------------------+
# | H1 (vrf)              |
# |    + $h1              |
# |    | 2001:db8:1::1/64 |
# +----|------------------+
#      |
# +----|----------------------------------------------------------------------+
# | SW |                                                                      |
# | +--|--------------------------------------------------------------------+ |
# | |  + $swp1                   BR0 (802.1d)                               | |
# | |                                                                       | |
# | |  + vxlan0 (vxlan)                                                     | |
# | |    local 2001:db8:2::1                                                | |
# | |    remote 2001:db8:2::{2..17}                                         | |
# | |    id 10 dstport 4789                                                 | |
# | +-----------------------------------------------------------------------+ |
# |                                                                           |
# |  2001:db8:2::0/64 via 2001:db8:3::2                                       |
# |                                                                           |
# |    + $rp1                                                                 |
# |    | 2001:db8:3::1/64                                                     |
# +----|----------------------------------------------------------------------+
#      |
# +----|--------------------------------------------------------+
# |    |                                               R2 (vrf) |
# |    + $rp2                                                   |
# |      2001:db8:3::2/64                                       |
# |                                                             |
# +-------------------------------------------------------------+

lib_dir=$(dirname $0)/../../../../net/forwarding

ALL_TESTS="flooding_test"
NUM_NETIFS=4
source $lib_dir/tc_common.sh
source $lib_dir/lib.sh

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

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

switch_create()
{
	# Make sure the bridge uses the MAC address of the local port and
	# not that of the VxLAN's device
	ip link add dev br0 type bridge mcast_snooping 0
	ip link set dev br0 address $(mac_get $swp1)

	ip link add name vxlan0 type vxlan id 10 nolearning \
		udp6zerocsumrx udp6zerocsumtx ttl 20 tos inherit \
		local 2001:db8:2::1 dstport 4789

	ip address add 2001:db8:2::1/128 dev lo

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

Annotation

Implementation Notes