tools/testing/selftests/net/rtnetlink_notification.sh
Source file repositories/reference/linux-study-clean/tools/testing/selftests/net/rtnetlink_notification.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/net/rtnetlink_notification.sh- Extension
.sh- Size
- 2626 bytes
- Lines
- 113
- 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
#
# This test is for checking rtnetlink notification callpaths, and get as much
# coverage as possible.
#
# set -e
ALL_TESTS="
kci_test_mcast_addr_notification
kci_test_anycast_addr_notification
"
source lib.sh
test_dev="test-dummy1"
kci_test_mcast_addr_notification()
{
RET=0
local tmpfile
local monitor_pid
local match_result
tmpfile=$(mktemp)
defer rm "$tmpfile"
ip monitor maddr > $tmpfile &
monitor_pid=$!
defer kill_process "$monitor_pid"
sleep 1
if [ ! -e "/proc/$monitor_pid" ]; then
RET=$ksft_skip
log_test "mcast addr notification: iproute2 too old"
return $RET
fi
ip link add name "$test_dev" type dummy
check_err $? "failed to add dummy interface"
ip link set "$test_dev" up
check_err $? "failed to set dummy interface up"
ip link del dev "$test_dev"
check_err $? "Failed to delete dummy interface"
sleep 1
# There should be 4 line matches as follows.
# 13: test-dummy1 inet6 mcast ff02::1 scope global
# 13: test-dummy1 inet mcast 224.0.0.1 scope global
# Deleted 13: test-dummy1 inet mcast 224.0.0.1 scope global
# Deleted 13: test-dummy1 inet6 mcast ff02::1 scope global
match_result=$(grep -cE "$test_dev.*(224.0.0.1|ff02::1)" "$tmpfile")
if [ "$match_result" -ne 4 ]; then
RET=$ksft_fail
fi
log_test "mcast addr notification: Expected 4 matches, got $match_result"
return $RET
}
kci_test_anycast_addr_notification()
{
RET=0
local tmpfile
local monitor_pid
local match_result
tmpfile=$(mktemp)
defer rm "$tmpfile"
ip monitor acaddress > "$tmpfile" &
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.