tools/testing/selftests/net/netfilter/nft_zones_many.sh
Source file repositories/reference/linux-study-clean/tools/testing/selftests/net/netfilter/nft_zones_many.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/net/netfilter/nft_zones_many.sh- Extension
.sh- Size
- 3759 bytes
- Lines
- 165
- 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 test_zones
Annotated Snippet
#!/bin/bash
# Test insertion speed for packets with identical addresses/ports
# that are all placed in distinct conntrack zones.
source lib.sh
zones=2000
[ "$KSFT_MACHINE_SLOW" = yes ] && zones=500
have_ct_tool=0
ret=0
cleanup()
{
cleanup_all_ns
}
checktool "nft --version" "run test without nft tool"
checktool "socat -V" "run test without socat tool"
setup_ns ns1
trap cleanup EXIT
if conntrack -V > /dev/null 2>&1; then
have_ct_tool=1
fi
test_zones() {
local max_zones=$1
ip netns exec "$ns1" nft -f /dev/stdin<<EOF
flush ruleset
table inet raw {
map rndzone {
typeof numgen inc mod $max_zones : ct zone
}
chain output {
type filter hook output priority -64000; policy accept;
udp dport 12345 ct zone set numgen inc mod 65536 map @rndzone
}
}
EOF
if [ "$?" -ne 0 ];then
echo "SKIP: Cannot add nftables rules"
exit $ksft_skip
fi
ip netns exec "$ns1" sysctl -q net.netfilter.nf_conntrack_udp_timeout=3600
(
echo "add element inet raw rndzone {"
for i in $(seq 1 "$max_zones");do
echo -n "$i : $i"
if [ "$i" -lt "$max_zones" ]; then
echo ","
else
echo "}"
fi
done
) | ip netns exec "$ns1" nft -f /dev/stdin
local i=0
local j=0
local outerstart
local stop
outerstart=$(date +%s%3N)
stop=$outerstart
Annotation
- Detected declarations: `function test_zones`.
- 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.