diff --git a/net/keepalived/Makefile b/net/keepalived/Makefile index 95e10dfd31a8b6..67f7e0231274f2 100644 --- a/net/keepalived/Makefile +++ b/net/keepalived/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=keepalived PKG_VERSION:=2.3.3 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://www.keepalived.org/software diff --git a/net/keepalived/files/keepalived.config b/net/keepalived/files/keepalived.config index 4410514c42154a..db0c3d26452571 100644 --- a/net/keepalived/files/keepalived.config +++ b/net/keepalived/files/keepalived.config @@ -75,9 +75,12 @@ config globals 'globals' # list route "route1" #config vrrp_sync_group -# option name "VI_sync_group_1" -# list group "VI_1" -# list group "VI_2" +# option name "VI_sync_group_1" +# list group "VI_1" +# list group "VI_2" +# Note that priority will not work with vrrp_script +# when in sync group +# list track_script "vrrp_script1" # option smtp_alert "1" # option global_tracking 1 @@ -132,11 +135,16 @@ config globals 'globals' # option accept "1" #config vrrp_script +# option name "vrrp_script1" # option script "" # option interval "5" +# weight will increase +10 if script status is OK, otherwise -10 # option weight "10" # option fall "2" # option rise "3" +# valid values for direction reverse|noreverse -- reverse flips weight change +# option direction "reverse" +# option timeout "5" #config virtual_server # option enabled "1" @@ -191,4 +199,3 @@ config globals 'globals' # option name "url2" # option path "/testurl/test2.jsp" # option digest "22" - diff --git a/net/keepalived/files/keepalived.init b/net/keepalived/files/keepalived.init index ac59c8103fe7f8..fca0572274276a 100644 --- a/net/keepalived/files/keepalived.init +++ b/net/keepalived/files/keepalived.init @@ -215,16 +215,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" } @@ -347,6 +345,17 @@ vrrp_sync_group() { print_elems_indent "$1" "$INDENT_1" no_val_smtp_alert no_val_global_tracking + # Handle track_script list for sync group + local track_script_val + config_get track_script_val "$1" track_script + if [ -n "$track_script_val" ]; then + printf '%btrack_script {\n' "${INDENT_1}" >> "$KEEPALIVED_CONF" + for t in $track_script_val; do + config_foreach print_track_script_indent vrrp_script "$t" "$INDENT_2" + done + printf '%b}\n' "${INDENT_1}" >> "$KEEPALIVED_CONF" + fi + print_notify "GROUP" "$name" "$INDENT_1" notify_backup notify_master \ notify_fault notify @@ -413,7 +422,7 @@ vrrp_instance() { [ -z "$optval" ] && continue printf '%b%s {\n' "${INDENT_1}" "$opt" >> "$KEEPALIVED_CONF" for t in $optval; do - config_foreach print_track_script_indent track_script "$t" "$INDENT_2" + config_foreach print_track_script_indent vrrp_script "$t" "$INDENT_2" done printf '%b}\n' "${INDENT_1}" >> "$KEEPALIVED_CONF" done @@ -466,7 +475,7 @@ vrrp_script() { config_section_open "vrrp_script" "$name" - print_elems_indent "$1" "$INDENT_1" script interval weight fall rise + print_elems_indent "$1" "$INDENT_1" script interval weight fall rise timeout config_section_close }