tools/testing/selftests/drivers/net/bonding/bond_ipsec_offload.sh
Source file repositories/reference/linux-study-clean/tools/testing/selftests/drivers/net/bonding/bond_ipsec_offload.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/drivers/net/bonding/bond_ipsec_offload.sh- Extension
.sh- Size
- 4868 bytes
- Lines
- 157
- 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
# IPsec over bonding offload test:
#
# +----------------+
# | bond0 |
# | | |
# | eth0 eth1 |
# +---+-------+----+
#
# We use netdevsim instead of physical interfaces
#-------------------------------------------------------------------
# Example commands
# ip x s add proto esp src 192.0.2.1 dst 192.0.2.2 \
# spi 0x07 mode transport reqid 0x07 replay-window 32 \
# aead 'rfc4106(gcm(aes))' 1234567890123456dcba 128 \
# sel src 192.0.2.1/24 dst 192.0.2.2/24
# offload dev bond0 dir out
# ip x p add dir out src 192.0.2.1/24 dst 192.0.2.2/24 \
# tmpl proto esp src 192.0.2.1 dst 192.0.2.2 \
# spi 0x07 mode transport reqid 0x07
#
#-------------------------------------------------------------------
lib_dir=$(dirname "$0")
# shellcheck disable=SC1091
source "$lib_dir"/../../../net/lib.sh
srcip=192.0.2.1
dstip=192.0.2.2
ipsec0=/sys/kernel/debug/netdevsim/netdevsim0/ports/0/ipsec
ipsec1=/sys/kernel/debug/netdevsim/netdevsim0/ports/1/ipsec
active_slave=""
# shellcheck disable=SC2317
active_slave_changed()
{
local old_active_slave=$1
local new_active_slave
# shellcheck disable=SC2154
new_active_slave=$(ip -n "${ns}" -d -j link show bond0 | \
jq -r ".[].linkinfo.info_data.active_slave")
[ "$new_active_slave" != "$old_active_slave" ] && [ "$new_active_slave" != "null" ]
}
test_offload()
{
# use ping to exercise the Tx path
ip netns exec "$ns" ping -I bond0 -c 3 -W 1 -i 0 "$dstip" >/dev/null
active_slave=$(ip -n "${ns}" -d -j link show bond0 | \
jq -r ".[].linkinfo.info_data.active_slave")
if [ "$active_slave" = "$nic0" ]; then
sysfs=$ipsec0
elif [ "$active_slave" = "$nic1" ]; then
sysfs=$ipsec1
else
check_err 1 "bond_ipsec_offload invalid active_slave $active_slave"
fi
# The tx/rx order in sysfs may changed after failover
grep -q "SA count=2 tx=3" "$sysfs" && grep -q "tx ipaddr=$dstip" "$sysfs"
check_err $? "incorrect tx count with link ${active_slave}"
log_test bond_ipsec_offload "active_slave ${active_slave}"
}
setup_env()
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.