tools/testing/selftests/net/broadcast_pmtu.sh
Source file repositories/reference/linux-study-clean/tools/testing/selftests/net/broadcast_pmtu.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/net/broadcast_pmtu.sh- Extension
.sh- Size
- 1360 bytes
- Lines
- 48
- 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
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
#
# Ensures broadcast route MTU is respected
CLIENT_NS=$(mktemp -u client-XXXXXXXX)
CLIENT_IP4="192.168.0.1/24"
CLIENT_BROADCAST_ADDRESS="192.168.0.255"
SERVER_NS=$(mktemp -u server-XXXXXXXX)
SERVER_IP4="192.168.0.2/24"
setup() {
ip netns add "${CLIENT_NS}"
ip netns add "${SERVER_NS}"
ip -net "${SERVER_NS}" link add link1 type veth peer name link0 netns "${CLIENT_NS}"
ip -net "${CLIENT_NS}" link set link0 up
ip -net "${CLIENT_NS}" link set link0 mtu 9000
ip -net "${CLIENT_NS}" addr add "${CLIENT_IP4}" dev link0
ip -net "${SERVER_NS}" link set link1 up
ip -net "${SERVER_NS}" link set link1 mtu 1500
ip -net "${SERVER_NS}" addr add "${SERVER_IP4}" dev link1
read -r -a CLIENT_BROADCAST_ENTRY <<< "$(ip -net "${CLIENT_NS}" route show table local type broadcast)"
ip -net "${CLIENT_NS}" route del "${CLIENT_BROADCAST_ENTRY[@]}"
ip -net "${CLIENT_NS}" route add "${CLIENT_BROADCAST_ENTRY[@]}" mtu 1500
ip net exec "${SERVER_NS}" sysctl -wq net.ipv4.icmp_echo_ignore_broadcasts=0
}
cleanup() {
ip -net "${SERVER_NS}" link del link1
ip netns del "${CLIENT_NS}"
ip netns del "${SERVER_NS}"
}
trap cleanup EXIT
setup &&
echo "Testing for broadcast route MTU" &&
ip net exec "${CLIENT_NS}" ping -f -M want -q -c 1 -s 8000 -w 1 -b "${CLIENT_BROADCAST_ADDRESS}" > /dev/null 2>&1
exit $?
Annotation
- 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.