tools/testing/selftests/net/forwarding/lib.sh
Source file repositories/reference/linux-study-clean/tools/testing/selftests/net/forwarding/lib.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/net/forwarding/lib.sh- Extension
.sh- Size
- 47502 bytes
- Lines
- 2299
- 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.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
function check_driverfunction create_netif_vethfunction selectfunction select
Annotated Snippet
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
#shellcheck disable=SC2034 # SC doesn't see our uses of global variables
##############################################################################
# Topology description. p1 looped back to p2, p3 to p4 and so on.
declare -A NETIFS=(
[p1]=veth0
[p2]=veth1
[p3]=veth2
[p4]=veth3
[p5]=veth4
[p6]=veth5
[p7]=veth6
[p8]=veth7
[p9]=veth8
[p10]=veth9
)
# Port that does not have a cable connected.
: "${NETIF_NO_CABLE:=eth8}"
##############################################################################
# Defines
# Networking utilities.
: "${PING:=ping}"
: "${PING6:=ping6}" # Some distros just use ping.
: "${ARPING:=arping}"
: "${TROUTE6:=traceroute6}"
# Packet generator.
: "${MZ:=mausezahn}" # Some distributions use 'mz'.
: "${MZ_DELAY:=0}"
# Host configuration tools.
: "${TEAMD:=teamd}"
: "${MCD:=smcrouted}"
: "${MC_CLI:=smcroutectl}"
: "${MCD_TABLE_NAME:=selftests}"
# Constants for netdevice bring-up:
# Default time in seconds to wait for an interface to come up before giving up
# and bailing out. Used during initial setup.
: "${INTERFACE_TIMEOUT:=600}"
# Like INTERFACE_TIMEOUT, but default for ad-hoc waiting in testing scripts.
: "${WAIT_TIMEOUT:=20}"
# Time to wait after interfaces participating in the test are all UP.
: "${WAIT_TIME:=5}"
# Whether to pause on, respectively, after a failure and before cleanup.
: "${PAUSE_ON_CLEANUP:=no}"
# Whether to create virtual interfaces, and what netdevice type they should be.
: "${NETIF_CREATE:=yes}"
: "${NETIF_TYPE:=veth}"
# Constants for ping tests:
# How many packets should be sent.
: "${PING_COUNT:=10}"
# Timeout (in seconds) before ping exits regardless of how many packets have
# been sent or received
: "${PING_TIMEOUT:=5}"
# Minimum ageing_time (in centiseconds) supported by hardware
: "${LOW_AGEING_TIME:=1000}"
# Whether to check for availability of certain tools.
: "${REQUIRE_JQ:=yes}"
Annotation
- Detected declarations: `function check_driver`, `function create_netif_veth`, `function select`, `function select`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: atlas-only.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.