keepalived: fix print_track_script_indent func
authorRishabh <redacted>
Mon, 20 Apr 2026 16:34:28 +0000 (22:04 +0530)
committerFlorian Eckert <redacted>
Mon, 27 Apr 2026 12:28:04 +0000 (14:28 +0200)
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 <redacted>
net/keepalived/files/keepalived.init

index 59b798e203735fef15b3c1aacc95144171b56a6c..dda66e822d33d535ee6da177682e86ccef4ed305 100644 (file)
@@ -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"
 }
git clone https://git.99rst.org/PROJECT