From: Rishabh Date: Mon, 20 Apr 2026 16:34:28 +0000 (+0530) Subject: keepalived: fix print_track_script_indent func X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=9542111b1402e9aeebb38ace7ed7832503e7ed1b;p=openwrt-packages.git keepalived: fix print_track_script_indent func Removed unnecessary option value. This was not needed as option name is already being used. Also removed a condition where the section was not parsed if option value was not given. Value was being used to name the script. Now the option name is used as the name when the script is called in track_script. Also added a condition where the section is not parsed if option name is not given. This is because the script cannot be called if it does not have a name. No upgrade script is required. The removed `value` option in `vrrp_script` was previously used to identify scripts referenced by `track_script`. However, this mechanism was non-functional: - `track_script` attempted to reference a `track_script` section, which is not implemented in the UCI configuration. - As a result, script references were not resolved correctly even if `value` was defined. With this change, `track_script` now correctly references the `vrrp_script` section, and the `name` option is used as the identifier. Since the previous behavior was not working as intended, removing the `value` option does not break any valid existing configurations. Signed-off-by: Rishabh --- diff --git a/net/keepalived/files/keepalived.init b/net/keepalived/files/keepalived.init index 59b798e20..dda66e822 100644 --- a/net/keepalived/files/keepalived.init +++ b/net/keepalived/files/keepalived.init @@ -219,16 +219,14 @@ print_track_script_indent() { local name value weight direction config_get name "$section" name - [ "$name" != "$curr_track_elem" ] && return 0 + [ -z "$name" ] && return 0 - config_get value "$section" value config_get weight "$section" weight config_get direction "$section" direction - [ -z "$value" ] && return 0 [ "$direction" != "reverse" ] && [ "$direction" != "noreverse" ] && unset direction - printf '%b%s' "$indent" "$value" >> "$KEEPALIVED_CONF" + printf '%b%s' "$indent" "$name" >> "$KEEPALIVED_CONF" [ -n "$weight" ] && printf ' weight %s' "$weight ${direction:+${direction}}" >> "$KEEPALIVED_CONF" printf '\n' >> "$KEEPALIVED_CONF" }