From f3db28a1fd088ddf1b437ec0ac005d73773ff16e Mon Sep 17 00:00:00 2001 From: Josef Schlehofer Date: Mon, 5 Oct 2026 07:28:04 +0200 Subject: [PATCH] ripe-atlas: restart the probe on config changes Restart the probe when /etc/config/ripe-atlas changes. procd does not restart an instance when any of these options changes, and up to OpenWrt 25.12, when it stops one, it signals only the main script, so the measurement daemons, the ssh tunnel and telnetd would keep running. Stop and start the whole service instead. On stop, take the processes from the instance's cgroup, which holds exactly those of the probe, and fall back to the ripe-atlas group only when it holds none. Signed-off-by: Josef Schlehofer (cherry picked from commit 37b343293b436d4b8c04cac233cba2531c174884) --- net/ripe-atlas/files/ripe-atlas.init | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/net/ripe-atlas/files/ripe-atlas.init b/net/ripe-atlas/files/ripe-atlas.init index f09a4bf3a3..d5b922067f 100644 --- a/net/ripe-atlas/files/ripe-atlas.init +++ b/net/ripe-atlas/files/ripe-atlas.init @@ -211,17 +211,41 @@ stop_service() { local pids local pid + local procs - for pid in $(find /proc -type d -maxdepth 1 -group ${GROUP} -print); do - pids="${pid##*/} ${pids}" + # Up to OpenWrt 25.12, procd signals only the main script; the daemons, + # the ssh tunnel and telnetd it started would keep running. Take them + # from the instance's cgroup, or, when that holds none, from the group + # only the probe uses. + for procs in /sys/fs/cgroup/services/ripe-atlas/*/cgroup.procs; do + [ -f "${procs}" ] || continue + while read -r pid; do + pids="${pid} ${pids}" + done < "${procs}" done + if [ -z "${pids}" ]; then + for pid in $(find /proc -maxdepth 1 -type d -group ${GROUP} \ + 2> /dev/null); do + pids="${pid##*/} ${pids}" + done + fi if [ -n "${pids}" ]; then kill ${pids} 1>/dev/null 2>&1 fi } +# procd would not restart the probe when its options change, and up to +# OpenWrt 25.12, when it stops the instance, it signals only the main +# script. +reload_service() +{ + stop + start +} + service_triggers() { + procd_add_reload_trigger 'ripe-atlas' procd_add_validation validate_config }