V8.00.000.2025.06.17
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 1m54s
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 1m54s
Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
@@ -221,9 +221,14 @@ yaml_validator() {
|
||||
|
||||
guard_dir && return 0
|
||||
}
|
||||
### Prevents accidental 'unset -f'.
|
||||
# shellcheck disable=SC2034
|
||||
readonly -f yaml_validator
|
||||
|
||||
#######################################
|
||||
# Network connectivity prober.
|
||||
# Globals:
|
||||
# network_timeout_linkwait
|
||||
# Arguments:
|
||||
# 1: IP-Family
|
||||
# 2: TLD to probe
|
||||
@@ -237,21 +242,33 @@ probe_link() {
|
||||
|
||||
### 1) Try ping (quiet, 1 probe, 3s deadline)
|
||||
if ping -q -c 1 -W "${network_timeout_linkwait:-3}" "-${var_fam}" "${var_target}" >/dev/null 2>&1; then
|
||||
|
||||
var_ok="true"
|
||||
|
||||
else
|
||||
|
||||
### 2) Fallback: mtr in report mode (non-interactive), no DNS to avoid TUI/delays.
|
||||
if command -v mtr >/dev/null 2>&1; then
|
||||
|
||||
### Treat as success if ANY hop resolves to something other than "???".
|
||||
### '-r = report', '-c 2 = two cycles', -n = no DNS, -4/-6 = address family
|
||||
|
||||
# shellcheck disable=SC2312
|
||||
if mtr "-${var_fam}" -r -c 3 -n "${var_target}" 2>/dev/null \
|
||||
| awk 'NR>2 && $2!="???"{ok=1} END{exit ok?0:1}'; then
|
||||
|
||||
var_ok="true"
|
||||
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
printf '%s' "${var_ok}"
|
||||
return 0
|
||||
}
|
||||
### Prevents accidental 'unset -f'.
|
||||
# shellcheck disable=SC2034
|
||||
readonly -f probe_link
|
||||
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
||||
|
||||
Reference in New Issue
Block a user