From 993f03cecb2db3e845bfa6ba4326bc352f853e3c Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Mon, 15 Feb 2021 21:03:57 +0100 Subject: [PATCH] alfred: Fix procd process handling for disable state Alfred can be stopped during a (re)start or reload when: * disabled = 1 * batman-adv interface is missing * MAC based EUI64 IPv6 link-local address not set It is assumed that procd detects that the procd instance definition disappeared and the currently running instance must be stopped. But all these checks were triggering an "exit" which then stopped the alfred init script and the wrapper from /lib/functions/procd.sh. And thus procd was never informed about the instances which should be changed. The correct handling is to return the result of the function instead of directly killing the init scripts. Fixes: 45db0e60d2ff ("alfred: use procd") Signed-off-by: Sven Eckelmann --- alfred/Makefile | 2 +- alfred/files/alfred.init | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/alfred/Makefile b/alfred/Makefile index 14a2ca8..8ca6ecb 100644 --- a/alfred/Makefile +++ b/alfred/Makefile @@ -4,7 +4,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=alfred PKG_VERSION:=2021.0 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION) diff --git a/alfred/files/alfred.init b/alfred/files/alfred.init index 0c35e65..e439be1 100755 --- a/alfred/files/alfred.init +++ b/alfred/files/alfred.init @@ -24,10 +24,12 @@ wait_for_dir() { [ -d "$dir" ] && break if [ $i = $timeout ] ; then echo "$ifce not detected, alfred not starting." - exit 1 + return 1 fi done fi + + return 0 } wait_for_ll_address() { @@ -45,13 +47,13 @@ wait_for_ll_address() { $1 ~ /^fe80/ && $5 ~ /^[012389ab]/ && $6 == "'"$iface"'" { RET=0 } END { exit RET } ' /proc/net/if_inet6; then - return + return 0 fi sleep 1 done echo "$iface address not detected, alfred not starting." - exit 1 + return 1 } append_interface() @@ -86,7 +88,7 @@ alfred_start() { append args "-b $batmanif" if [ "$batmanif" != "none" ]; then - wait_for_dir "$batmanif" "/sys/devices/virtual/net/$batmanif" + wait_for_dir "$batmanif" "/sys/devices/virtual/net/$batmanif" || return 1 fi append alfred_args "$args" @@ -107,7 +109,7 @@ start_service() { config_load "alfred" config_foreach alfred_start alfred - [ "$enable" = "0" ] && exit 0 + [ "$enable" = "0" ] && return 0 procd_open_instance "alfred" procd_set_param command /usr/sbin/alfred -- 2.30.2