keepalived: fix ambigiuos functions in hotplug.sh
authorFrancesco Benini <francy.benini@gmail.com>
Sat, 19 Oct 2024 23:19:23 +0000 (01:19 +0200)
committerFlorian Eckert <Eckert.Florian@googlemail.com>
Tue, 22 Oct 2024 13:46:27 +0000 (15:46 +0200)
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 <francy.benini@gmail.com>
net/keepalived/Makefile
net/keepalived/files/lib/functions/keepalived/hotplug.sh

index 21ec9f73da4f9c330e79a4442f28b7d4850552c1..31292398733a2379943f4c66a14ce8009a1d41b0 100644 (file)
@@ -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
index 57db374e28fcfb760c0369c460b573a353c98c8d..5bd96d5cf564b18fe1037ae4221b165e287806f6 100644 (file)
@@ -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)" ;;