tools/testing/selftests/net/hsr/hsr_ping.sh
Source file repositories/reference/linux-study-clean/tools/testing/selftests/net/hsr/hsr_ping.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/net/hsr/hsr_ping.sh- Extension
.sh- Size
- 5805 bytes
- Lines
- 207
- 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 do_ping_tests
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
do_ping_tests()
{
local netid="$1"
echo "INFO: Running ping tests."
echo "INFO: Initial validation ping."
# Each node has to be able to reach each one.
do_ping "$ns1" "100.64.$netid.2"
do_ping "$ns1" "100.64.$netid.3"
do_ping "$ns2" "100.64.$netid.1"
do_ping "$ns2" "100.64.$netid.3"
do_ping "$ns3" "100.64.$netid.1"
do_ping "$ns3" "100.64.$netid.2"
stop_if_error "Initial validation failed on IPv4."
do_ping "$ns1" "dead:beef:$netid::2"
do_ping "$ns1" "dead:beef:$netid::3"
do_ping "$ns2" "dead:beef:$netid::1"
do_ping "$ns2" "dead:beef:$netid::2"
do_ping "$ns3" "dead:beef:$netid::1"
do_ping "$ns3" "dead:beef:$netid::2"
stop_if_error "Initial validation failed on IPv6."
# Wait until supervisor all supervision frames have been processed and the node
# entries have been merged. Otherwise duplicate frames will be observed which is
# valid at this stage.
echo "INFO: Wait for node table entries to be merged."
WAIT=5
while [ ${WAIT} -gt 0 ]
do
grep 00:00:00:00:00:00 /sys/kernel/debug/hsr/hsr*/node_table
if [ $? -ne 0 ]
then
break
fi
sleep 1
let "WAIT = WAIT - 1"
done
# Just a safety delay in case the above check didn't handle it.
Annotation
- Detected declarations: `function do_ping_tests`.
- 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.