tools/testing/selftests/net/netfilter/nft_meta.sh
Source file repositories/reference/linux-study-clean/tools/testing/selftests/net/netfilter/nft_meta.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/net/netfilter/nft_meta.sh- Extension
.sh- Size
- 3658 bytes
- Lines
- 143
- 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
# check iif/iifname/oifgroup/iiftype match.
# Kselftest framework requirement - SKIP code is 4.
ksft_skip=4
sfx=$(mktemp -u "XXXXXXXX")
ns0="ns0-$sfx"
if ! nft --version > /dev/null 2>&1; then
echo "SKIP: Could not run test without nft tool"
exit $ksft_skip
fi
cleanup()
{
ip netns del "$ns0"
}
ip netns add "$ns0"
ip -net "$ns0" link set lo up
ip -net "$ns0" addr add 127.0.0.1 dev lo
trap cleanup EXIT
currentyear=$(date +%Y)
lastyear=$((currentyear-1))
ip netns exec "$ns0" nft -f /dev/stdin <<EOF
table inet filter {
counter iifcount {}
counter iifnamecount {}
counter iifgroupcount {}
counter iiftypecount {}
counter infproto4count {}
counter il4protocounter {}
counter imarkcounter {}
counter icpu0counter {}
counter ilastyearcounter {}
counter icurrentyearcounter {}
counter oifcount {}
counter oifnamecount {}
counter oifgroupcount {}
counter oiftypecount {}
counter onfproto4count {}
counter ol4protocounter {}
counter oskuidcounter {}
counter oskgidcounter {}
counter omarkcounter {}
chain input {
type filter hook input priority 0; policy accept;
meta iif lo counter name "iifcount"
meta iifname "lo" counter name "iifnamecount"
meta iifgroup "default" counter name "iifgroupcount"
meta iiftype "loopback" counter name "iiftypecount"
meta nfproto ipv4 counter name "infproto4count"
meta l4proto icmp counter name "il4protocounter"
meta mark 42 counter name "imarkcounter"
meta cpu 0 counter name "icpu0counter"
meta time "$lastyear-01-01" - "$lastyear-12-31" counter name ilastyearcounter
meta time "$currentyear-01-01" - "$currentyear-12-31" counter name icurrentyearcounter
}
chain output {
type filter hook output priority 0; policy accept;
meta oif lo counter name "oifcount" counter
meta oifname "lo" counter name "oifnamecount"
meta oifgroup "default" counter name "oifgroupcount"
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.