tools/testing/selftests/net/forwarding/fib_offload_lib.sh
Source file repositories/reference/linux-study-clean/tools/testing/selftests/net/forwarding/fib_offload_lib.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/net/forwarding/fib_offload_lib.sh- Extension
.sh- Size
- 25157 bytes
- Lines
- 874
- 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
# SPDX-License-Identifier: GPL-2.0
#
# Various helpers and tests to verify FIB offload.
__fib_trap_check()
{
local ns=$1; shift
local family=$1; shift
local route=$1; shift
local should_fail=$1; shift
local ret
ip -n $ns -j -p -$family route show $route \
| jq -e '.[]["flags"] | contains(["trap"])' &> /dev/null
ret=$?
if [[ $should_fail == "true" ]]; then
if [[ $ret -ne 0 ]]; then
return 0
else
return 1
fi
fi
return $ret
}
fib_trap_check()
{
local ns=$1; shift
local family=$1; shift
local route=$1; shift
local should_fail=$1; shift
busywait 5000 __fib_trap_check $ns $family "$route" $should_fail
}
fib4_trap_check()
{
local ns=$1; shift
local route=$1; shift
local should_fail=$1; shift
fib_trap_check $ns 4 "$route" $should_fail
}
fib6_trap_check()
{
local ns=$1; shift
local route=$1; shift
local should_fail=$1; shift
fib_trap_check $ns 6 "$route" $should_fail
}
fib_ipv4_identical_routes_test()
{
local ns=$1; shift
local i
RET=0
for i in $(seq 1 3); do
ip -n $ns link add name dummy$i type dummy
ip -n $ns link set dev dummy$i up
done
ip -n $ns route add 192.0.2.0/24 dev dummy1 tos 0 metric 1024
fib4_trap_check $ns "192.0.2.0/24 dev dummy1 tos 0 metric 1024" false
check_err $? "Route not in hardware when should"
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.