tools/testing/selftests/net/netfilter/nft_offload.sh
Source file repositories/reference/linux-study-clean/tools/testing/selftests/net/netfilter/nft_offload.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/net/netfilter/nft_offload.sh- Extension
.sh- Size
- 2843 bytes
- Lines
- 133
- 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 cleanup
Annotated Snippet
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
source lib.sh
checktool "nft --version" "run test without nft tool"
modprobe -q netdevsim
sysfs="/sys/kernel/debug/fail_function"
failname="/proc/self/make-it-fail"
duration=30
fault=0
ret=0
file_ft=""
file_rs=""
id=$((RANDOM%65536))
read -r t < /proc/sys/kernel/tainted
if [ "$t" -ne 0 ];then
echo SKIP: kernel is tainted
exit $ksft_skip
fi
cleanup() {
cleanup_netdevsim "$id" "$NS"
cleanup_ns "$NS"
[ "$fault" -eq 1 ] && echo '!nsim_setup_tc' > "$sysfs/inject"
rm -f "$file_ft" "$file_rs"
}
trap cleanup EXIT
skip() {
echo "SKIP: $*"
[ $ret -eq 0 ] && exit 4
exit $ret
}
set -e
setup_ns NS
create_netdevsim "$id" "$NS" >/dev/null
nsim_port=$(create_netdevsim_port "$id" "$NS" 2)
file_ft=$(mktemp)
cat > "$file_ft" <<EOF
flush ruleset
table inet t {
flowtable f {
flags offload
hook ingress priority filter + 10
devices = { "$nsim_port", "dummyf1" }
}
chain cf {
type filter hook forward priority 0; policy accept;
ct state new meta l4proto tcp flow add @f
}
}
EOF
if ip netns exec "$NS" nft -f "$file_ft"; then
echo "PASS: flowtable offload"
else
echo "FAIL: flowtable offload"
ret=1
fi
file_rs=$(mktemp)
cat > "$file_rs" <<EOF
Annotation
- Detected declarations: `function cleanup`.
- 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.