tools/testing/selftests/net/mptcp/diag.sh
Source file repositories/reference/linux-study-clean/tools/testing/selftests/net/mptcp/diag.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/net/mptcp/diag.sh- Extension
.sh- Size
- 10018 bytes
- Lines
- 448
- 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 get_msk_inuse
Annotated Snippet
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
# Double quotes to prevent globbing and word splitting is recommended in new
# code but we accept it, especially because there were too many before having
# address all other issues detected by shellcheck.
#shellcheck disable=SC2086
. "$(dirname "${0}")/mptcp_lib.sh"
ns=""
timeout_poll=30
timeout_test=$((timeout_poll * 2 + 1))
ret=0
flush_pids()
{
# mptcp_connect in join mode will sleep a bit before completing,
# give it some time
sleep 1.1
ip netns pids "${ns}" | xargs --no-run-if-empty kill -SIGUSR1 &>/dev/null
for _ in $(seq $((timeout_poll * 10))); do
[ -z "$(ip netns pids "${ns}")" ] && break
sleep 0.1
done
}
# This function is used in the cleanup trap
#shellcheck disable=SC2317,SC2329
cleanup()
{
ip netns pids "${ns}" | xargs --no-run-if-empty kill -SIGKILL &>/dev/null
mptcp_lib_ns_exit "${ns}"
}
mptcp_lib_check_mptcp
mptcp_lib_check_tools ip ss
get_msk_inuse()
{
ip netns exec $ns cat /proc/net/protocols | awk '$1~/^MPTCP$/{print $3}'
}
__chk_nr()
{
local command="$1"
local expected=$2
local msg="$3"
local skip="${4-SKIP}"
local nr
nr=$(eval $command)
mptcp_lib_print_title "$msg"
if [ "$nr" != "$expected" ]; then
if [ "$nr" = "$skip" ] && ! mptcp_lib_expect_all_features; then
mptcp_lib_pr_skip "Feature probably not supported"
mptcp_lib_result_skip "${msg}"
else
mptcp_lib_pr_fail "expected $expected found $nr"
mptcp_lib_result_fail "${msg}"
ret=${KSFT_FAIL}
fi
else
mptcp_lib_pr_ok
mptcp_lib_result_pass "${msg}"
fi
Annotation
- Detected declarations: `function get_msk_inuse`.
- 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.