tools/testing/selftests/net/hsr/prp_ping.sh
Source file repositories/reference/linux-study-clean/tools/testing/selftests/net/hsr/prp_ping.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/net/hsr/prp_ping.sh- Extension
.sh- Size
- 3573 bytes
- Lines
- 148
- 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 setup_prp_interfaces
Annotated Snippet
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
ipv6=true
source ./hsr_common.sh
optstring="h4"
usage() {
echo "Usage: $0 [OPTION]"
echo -e "\t-4: IPv4 only: disable IPv6 tests (default: test both IPv4 and IPv6)"
}
while getopts "$optstring" option;do
case "$option" in
"h")
usage "$0"
exit 0
;;
"4")
ipv6=false
;;
"?")
usage "$0"
exit 1
;;
esac
done
setup_prp_interfaces()
{
echo "INFO: Preparing interfaces for PRP"
# Two PRP nodes, connected by two links (treated as LAN A and LAN B).
#
# vethA ----- vethA
# prp1 prp2
# vethB ----- vethB
#
# node1 node2
# Interfaces
# shellcheck disable=SC2154 # variables assigned by setup_ns
ip link add vethA netns "$node1" type veth peer name vethA netns "$node2"
ip link add vethB netns "$node1" type veth peer name vethB netns "$node2"
# MAC addresses will be copied from LAN A interface
ip -net "$node1" link set address 00:11:22:00:00:01 dev vethA
ip -net "$node2" link set address 00:11:22:00:00:02 dev vethA
# PRP
ip -net "$node1" link add name prp1 type hsr \
slave1 vethA slave2 vethB supervision 45 proto 1
ip -net "$node2" link add name prp2 type hsr \
slave1 vethA slave2 vethB supervision 45 proto 1
# IP addresses
ip -net "$node1" addr add 100.64.0.1/24 dev prp1
ip -net "$node1" addr add dead:beef:0::1/64 dev prp1 nodad
ip -net "$node2" addr add 100.64.0.2/24 dev prp2
ip -net "$node2" addr add dead:beef:0::2/64 dev prp2 nodad
# All links up
ip -net "$node1" link set vethA up
ip -net "$node1" link set vethB up
ip -net "$node1" link set prp1 up
ip -net "$node2" link set vethA up
ip -net "$node2" link set vethB up
ip -net "$node2" link set prp2 up
}
Annotation
- Detected declarations: `function setup_prp_interfaces`.
- 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.