tools/testing/selftests/net/netfilter/nft_conntrack_helper.sh
Source file repositories/reference/linux-study-clean/tools/testing/selftests/net/netfilter/nft_conntrack_helper.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/net/netfilter/nft_conntrack_helper.sh- Extension
.sh- Size
- 3971 bytes
- Lines
- 172
- 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
#
# This tests connection tracking helper assignment:
# 1. can attach ftp helper to a connection from nft ruleset.
# 2. auto-assign still works.
#
# Kselftest framework requirement - SKIP code is 4.
source lib.sh
ret=0
testipv6=1
checktool "socat -h" "run test without socat"
checktool "conntrack --version" "run test without conntrack"
checktool "nft --version" "run test without nft"
cleanup()
{
ip netns pids "$ns1" | xargs kill 2>/dev/null
ip netns del "$ns1"
ip netns del "$ns2"
}
trap cleanup EXIT
setup_ns ns1 ns2
if ! ip link add veth0 netns "$ns1" type veth peer name veth0 netns "$ns2" > /dev/null 2>&1;then
echo "SKIP: No virtual ethernet pair device support in kernel"
exit $ksft_skip
fi
ip -net "$ns1" link set veth0 up
ip -net "$ns2" link set veth0 up
ip -net "$ns1" addr add 10.0.1.1/24 dev veth0
ip -net "$ns1" addr add dead:1::1/64 dev veth0 nodad
ip -net "$ns2" addr add 10.0.1.2/24 dev veth0
ip -net "$ns2" addr add dead:1::2/64 dev veth0 nodad
load_ruleset_family() {
local family=$1
local ns=$2
ip netns exec "$ns" nft -f - <<EOF
table $family raw {
ct helper ftp {
type "ftp" protocol tcp
}
chain pre {
type filter hook prerouting priority 0; policy accept;
tcp dport 2121 ct helper set "ftp"
}
chain output {
type filter hook output priority 0; policy accept;
tcp dport 2121 ct helper set "ftp"
}
}
EOF
return $?
}
check_for_helper()
{
local netns=$1
local message=$2
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.