From 97e760095578a8a1491f59423c712c7dc7b75a1f 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 66e82ce..ad38845 100644 --- a/alfred/Makefile +++ b/alfred/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=alfred PKG_VERSION:=2019.2 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_HASH:=b656f0e9a97a99c7531b6d49ebfd663451c16cdd275bbf7d48ff8daed3880bf2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz diff --git a/alfred/files/alfred.init b/alfred/files/alfred.init index 89e33ab..b2dc9d8 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 } alfred_start() { @@ -75,7 +77,7 @@ alfred_start() { append args "-b $batmanif" if [ "$batmanif" != "none" ]; then - wait_for_dir "$batmanif" "/sys/class/net/$batmanif/mesh" + wait_for_dir "$batmanif" "/sys/devices/virtual/net/$batmanif" || return 1 fi wait_for_ll_address "$interface" @@ -98,7 +100,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