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

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

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/net/forwarding/no_forwarding.sh
Extension
.sh
Size
5649 bytes
Lines
265
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="standalone two_bridges one_bridge_two_pvids"
NUM_NETIFS=4

source lib.sh

h1=${NETIFS[p1]}
h2=${NETIFS[p3]}
swp1=${NETIFS[p2]}
swp2=${NETIFS[p4]}

H1_IPV4="192.0.2.1"
H2_IPV4="192.0.2.2"
H1_IPV6="2001:db8:1::1"
H2_IPV6="2001:db8:1::2"

IPV4_ALLNODES="224.0.0.1"
IPV6_ALLNODES="ff02::1"
MACV4_ALLNODES="01:00:5e:00:00:01"
MACV6_ALLNODES="33:33:00:00:00:01"
NON_IP_MC="01:02:03:04:05:06"
NON_IP_PKT="00:04 48:45:4c:4f"
BC="ff:ff:ff:ff:ff:ff"

# The full 4K VLAN space is too much to check, so strategically pick some
# values which should provide reasonable coverage
vids=(0 1 2 5 10 20 50 100 200 500 1000 1000 2000 4000 4094)

send_non_ip()
{
	local if_name=$1
	local smac=$2
	local dmac=$3

	$MZ -q $if_name "$dmac $smac $NON_IP_PKT"
}

send_uc_ipv4()
{
	local if_name=$1
	local dmac=$2

	ip neigh add $H2_IPV4 lladdr $dmac dev $if_name
	ping_do $if_name $H2_IPV4
	ip neigh del $H2_IPV4 dev $if_name
}

send_mc_ipv4()
{
	local if_name=$1

	ping_do $if_name $IPV4_ALLNODES "-I $if_name"
}

send_uc_ipv6()
{
	local if_name=$1
	local dmac=$2

	ip -6 neigh add $H2_IPV6 lladdr $dmac dev $if_name
	ping6_do $if_name $H2_IPV6
	ip -6 neigh del $H2_IPV6 dev $if_name
}

send_mc_ipv6()
{
	local if_name=$1

Annotation

Implementation Notes