From: Florian Eckert Date: Tue, 4 Feb 2025 12:01:53 +0000 (+0100) Subject: keepalived: add new uci section config interface_up_down_delays X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=ae038d077373f1ea64b007c2bc46e5f8ee53f778;p=feed%2Fpackages.git keepalived: add new uci section config interface_up_down_delays If an interface that is being used (or tracked) by a VRRP instance goes to down state, the VRRP instance(s) will, by default, immediately transition to FAULT state, and when all relevant interfaces are back up again the VRRP instance(s) will immediately transition to BACKUP state. This can cause problems if interfaces are bouncing, and so delays can be specified between the interface state change and the transition to FAULT/BACKUP state. If the interface returns to its original state before the delay expires, no associated VRRP instance state transition will occur. New uci section 'interface_up_down_delay': config interface_up_down_delays option device option down_delay option up_delay Signed-off-by: Florian Eckert --- diff --git a/net/keepalived/files/keepalived.init b/net/keepalived/files/keepalived.init index cbbff49410..c017a679f8 100644 --- a/net/keepalived/files/keepalived.init +++ b/net/keepalived/files/keepalived.init @@ -287,6 +287,25 @@ static_routes() { done } +interface_up_down_delays() { + local device + local down_delay + local up_delay + local line + + config_get device "$1" device + config_get down_delay "$1" down_delay + config_get up_delay "$1" up_delay + + [ -z "$device" ] && return + [ -z "$down_delay" ] && return + + line="${device} ${down_delay}" + [ -z "$up_delay" ] || line="${line} ${up_delay}" + + printf '%b%s\n' "$INDENT_1" "$line" >> "$KEEPALIVED_CONF" +} + # Count 'vrrp_instance' with the given name ; called by vrrp_instance_check() vrrp_instance_name_count() { local name @@ -613,6 +632,10 @@ process_config() { config_foreach_wrapper static_routes config_section_close + config_section_open "interface_up_down_delays" + config_foreach_wrapper interface_up_down_delays + config_section_close + config_foreach_wrapper vrrp_script config_foreach_wrapper bfd_instance config_foreach_wrapper vrrp_sync_group