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

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

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/net/forwarding/vxlan_reserved.sh
Extension
.sh
Size
7331 bytes
Lines
348
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)           |
# |    + $h1           |
# |    | 192.0.2.1/28  |
# +----|---------------+
#      |
# +----|--------------------------------+
# | SW |                                |
# | +--|------------------------------+ |
# | |  + $swp1           BR1 (802.1d) | |
# | |                                 | |
# | |  + vx1 (vxlan)                  | |
# | |    local 192.0.2.17             | |
# | |    id 1000 dstport $VXPORT      | |
# | +---------------------------------+ |
# |                                     |
# |  192.0.2.32/28 via 192.0.2.18       |
# |                                     |
# |  + $rp1                             |
# |  | 192.0.2.17/28                    |
# +--|----------------------------------+
#    |
# +--|----------------------------------+
# |  |                                  |
# |  + $rp2                             |
# |    192.0.2.18/28                    |
# |                                     |
# | VRP2 (vrf)                          |
# +-------------------------------------+

: ${VXPORT:=4789}
: ${ALL_TESTS:="
	default_test
	plain_test
	reserved_0_test
	reserved_10_test
	reserved_31_test
	reserved_56_test
	reserved_63_test
    "}

NUM_NETIFS=4
source lib.sh

h1_create()
{
	adf_simple_if_init $h1 192.0.2.1/28

	tc qdisc add dev $h1 clsact
	defer tc qdisc del dev $h1 clsact

	tc filter add dev $h1 ingress pref 77 \
	   prot ip flower skip_hw ip_proto icmp action drop
	defer tc filter del dev $h1 ingress pref 77
}

switch_create()
{
	adf_ip_link_add br1 type bridge vlan_filtering 0 mcast_snooping 0
	# Make sure the bridge uses the MAC address of the local port and not
	# that of the VxLAN's device.
	adf_ip_link_set_addr br1 $(mac_get $swp1)
	adf_ip_link_set_up br1

	adf_ip_link_set_up $rp1
	adf_ip_addr_add $rp1 192.0.2.17/28
	adf_ip_route_add 192.0.2.32/28 nexthop via 192.0.2.18

Annotation

Implementation Notes