tools/testing/selftests/net/netfilter/nft_synproxy.sh
Source file repositories/reference/linux-study-clean/tools/testing/selftests/net/netfilter/nft_synproxy.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/net/netfilter/nft_synproxy.sh- Extension
.sh- Size
- 2404 bytes
- Lines
- 97
- 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
source lib.sh
ret=0
checktool "nft --version" "run test without nft tool"
checktool "iperf3 --version" "run test without iperf3"
setup_ns nsr ns1 ns2
modprobe -q nf_conntrack
cleanup() {
ip netns pids "$ns1" | xargs kill 2>/dev/null
ip netns pids "$ns2" | xargs kill 2>/dev/null
cleanup_all_ns
}
trap cleanup EXIT
ip link add veth0 netns "$nsr" type veth peer name eth0 netns "$ns1"
ip link add veth1 netns "$nsr" type veth peer name eth0 netns "$ns2"
for dev in veth0 veth1; do
ip -net "$nsr" link set "$dev" up
done
ip -net "$nsr" addr add 10.0.1.1/24 dev veth0
ip -net "$nsr" addr add 10.0.2.1/24 dev veth1
ip netns exec "$nsr" sysctl -q net.ipv4.conf.veth0.forwarding=1
ip netns exec "$nsr" sysctl -q net.ipv4.conf.veth1.forwarding=1
ip netns exec "$nsr" sysctl -q net.netfilter.nf_conntrack_tcp_loose=0
for n in $ns1 $ns2; do
ip -net "$n" link set eth0 up
done
ip -net "$ns1" addr add 10.0.1.99/24 dev eth0
ip -net "$ns2" addr add 10.0.2.99/24 dev eth0
ip -net "$ns1" route add default via 10.0.1.1
ip -net "$ns2" route add default via 10.0.2.1
# test basic connectivity
if ! ip netns exec "$ns1" ping -c 1 -q 10.0.2.99 > /dev/null; then
echo "ERROR: $ns1 cannot reach $ns2" 1>&2
exit 1
fi
if ! ip netns exec "$ns2" ping -c 1 -q 10.0.1.99 > /dev/null; then
echo "ERROR: $ns2 cannot reach $ns1" 1>&2
exit 1
fi
ip netns exec "$ns2" iperf3 -s > /dev/null 2>&1 &
# ip netns exec $nsr tcpdump -vvv -n -i veth1 tcp | head -n 10 &
sleep 1
ip netns exec "$nsr" nft -f - <<EOF
table inet filter {
chain prerouting {
type filter hook prerouting priority -300; policy accept;
meta iif veth0 tcp flags syn counter notrack
}
chain forward {
type filter hook forward priority 0; policy accept;
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.