💋 Sync 2026-10-11 00:16:14
Merge-upstream / merge (push) Canceled after 0s

This commit is contained in:
github-actions[bot] committed 2026-10-11 00:16:14 +08:00
1 parent c7bafc635d
commit c71da84035
264 files changed
+8169 -3944

No files matched your search

@@ -16,8 +16,10 @@ local filterfile = workdir .. "/tcpdump_filter"
local pcapbase = workdir .. "/capture.pcap"
local outputfile = "/tmp/capture.pcap"
-- Empty is valid: "Resolve domains" alone drops the default -n and leaves no
-- argument at all, and an error() here left the pidfile behind.
local function validate_args(value)
if type(value) ~= "string" or value == "" then
if type(value) ~= "string" then
return false
end
local tokens = {}
@@ -8,8 +8,14 @@ FILTERFILE="$WORKDIR/tcpdump_filter"
PCAPFILE="$WORKDIR/capture.pcap"
if [ -f "$PIDFILE" ]; then
echo "error: Packet capture is running"
exit 1
# a helper that died on an error never removed its pidfile
pid=$(cat "$PIDFILE" 2>/dev/null)
case "$pid" in ''|*[!0-9]*) pid="" ;; esac
if [ -n "$pid" ] && kill -0 "$pid" 2>/dev/null && grep -sq packet_capture "/proc/$pid/cmdline"; then
echo "error: Packet capture is running"
exit 1
fi
rm -f "$PIDFILE"
fi
mkdir -p "$WORKDIR"
@@ -84,6 +90,6 @@ fi
(/usr/libexec/packet_capture "$args" "$duration")&
echo $! > /var/run/packet_capture.pid
echo $! > "$PIDFILE"
exit 0
@@ -1,9 +1,16 @@
#!/bin/sh
pid=$(cat /var/run/packet_capture.pid)
PIDFILE="/var/run/packet_capture.pid"
pid=$(cat "$PIDFILE" 2>/dev/null)
case "$pid" in ''|*[!0-9]*) pid="" ;; esac
if [ -n "$pid" ] && grep -sq packet_capture "/proc/$pid/cmdline"; then
ppid=$(pgrep -P $pid)
kill -TERM $ppid
[ -n "$ppid" ] && kill -TERM $ppid
else
# Nothing runs it any more (the helper died on an error before removing
# it): a stale pidfile made every later start answer "running".
rm -f "$PIDFILE"
fi
exit 0