tools/testing/selftests/net/netfilter/br_netfilter.sh
Source file repositories/reference/linux-study-clean/tools/testing/selftests/net/netfilter/br_netfilter.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/net/netfilter/br_netfilter.sh- Extension
.sh- Size
- 4416 bytes
- Lines
- 176
- 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
#
# Test for legacy br_netfilter module combined with connection tracking,
# a combination that doesn't really work.
# Multicast/broadcast packets race for hash table insertion.
# eth0 br0 eth0
# setup is: ns1 <->,ns0 <-> ns3
# ns2 <-' `'-> ns4
source lib.sh
checktool "nft --version" "run test without nft tool"
read t < /proc/sys/kernel/tainted
if [ "$t" -ne 0 ];then
echo SKIP: kernel is tainted
exit $ksft_skip
fi
cleanup() {
cleanup_all_ns
}
trap cleanup EXIT
setup_ns ns0 ns1 ns2 ns3 ns4
ret=0
do_ping()
{
fromns="$1"
dstip="$2"
if ! ip netns exec "$fromns" ping -c 1 -q "$dstip" > /dev/null; then
echo "ERROR: ping from $fromns to $dstip"
ip netns exec "$ns0" nft list ruleset
ret=1
fi
}
bcast_ping()
{
fromns="$1"
dstip="$2"
local packets=500
[ "$KSFT_MACHINE_SLOW" = yes ] && packets=100
for i in $(seq 1 $packets); do
if ! ip netns exec "$fromns" ping -q -f -b -c 1 -q "$dstip" > /dev/null 2>&1; then
echo "ERROR: ping -b from $fromns to $dstip"
ip netns exec "$ns0" nft list ruleset
ret=1
break
fi
done
}
if ! ip link add veth1 netns "$ns0" type veth peer name eth0 netns "$ns1"; then
echo "SKIP: Can't create veth device"
exit $ksft_skip
fi
ip link add veth2 netns "$ns0" type veth peer name eth0 netns "$ns2"
ip link add veth3 netns "$ns0" type veth peer name eth0 netns "$ns3"
ip link add veth4 netns "$ns0" type veth peer name eth0 netns "$ns4"
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.