From ac72a52fd90a7a0690965d2816d0bae9d7400449 Mon Sep 17 00:00:00 2001 From: Francesco Benini Date: Sun, 20 Oct 2024 01:19:23 +0200 Subject: [PATCH] keepalived: fix ambigiuos functions in hotplug.sh MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit When "set_reload_if_sync" is not set in the hotplug script, the service is not expected to reload. That is not true because even if not set, the value is set to the default 1 (reload active) or equals the parameter set when "keepalived_hotplug" is called. The default behavior should be:     - Reload if set_reload_if_sync is called     - NOT reload if set_reload_if_sync is NOT called A similar fix is ported to "set_update_target". Signed-off-by: Francesco Benini --- net/keepalived/Makefile | 2 +- .../files/lib/functions/keepalived/hotplug.sh | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/net/keepalived/Makefile b/net/keepalived/Makefile index 21ec9f73da..3129239873 100644 --- a/net/keepalived/Makefile +++ b/net/keepalived/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=keepalived PKG_VERSION:=2.2.8 -PKG_RELEASE:=8 +PKG_RELEASE:=9 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://www.keepalived.org/software diff --git a/net/keepalived/files/lib/functions/keepalived/hotplug.sh b/net/keepalived/files/lib/functions/keepalived/hotplug.sh index 57db374e28..5bd96d5cf5 100644 --- a/net/keepalived/files/lib/functions/keepalived/hotplug.sh +++ b/net/keepalived/files/lib/functions/keepalived/hotplug.sh @@ -82,7 +82,7 @@ is_sync_file() { list_contains SYNC_FILES_LIST "$1" } -set_update_target() { +_set_update_target() { set_var UPDATE_TARGET "${1:-1}" } @@ -90,8 +90,8 @@ get_update_target() { get_var UPDATE_TARGET } -unset_update_target() { - set_var UPDATE_TARGET +set_disable_update_target() { + _set_update_target 0 } is_update_target() { @@ -170,8 +170,12 @@ skip_running_check() { get_var_flag NOTIFY_SKIP_RUNNING } +_set_reload_if_sync() { + set_var NOTIFY_SYNC_RELOAD "${1:-0}" +} + set_reload_if_sync() { - set_var NOTIFY_SYNC_RELOAD "${1:-1}" + _set_reload_if_sync 1 } get_reload_if_sync() { @@ -257,8 +261,8 @@ keepalived_hotplug() { [ -z "$(get_fault_cb)" ] && set_fault_cb _notify_fault [ -z "$(get_sync_cb)" ] && set_sync_cb _notify_sync - [ -z "$(get_update_target)" ] && set_update_target "$@" - [ -z "$(get_reload_if_sync)" ] && set_reload_if_sync "$@" + [ -z "$(get_update_target)" ] && _set_update_target "$@" + [ -z "$(get_reload_if_sync)" ] && _set_reload_if_sync "$@" case $ACTION in NOTIFY_MASTER) call_cb "$(get_master_cb)" ;; -- 2.30.2