From 0b16c2ada2b881e9f9ba52635cc4b87e8626a31c Mon Sep 17 00:00:00 2001 From: Ben Kelly Date: Tue, 4 Oct 2016 18:41:47 +0300 Subject: [PATCH] keepalived: Fix ordering of config sections keepalived seems to be rather particular about which config parameters come before others. When defining a virtual IP address, keepalived will check to see if the vrrp instance is associated with a valid interface. Previously, the interface parameter was declared after the virtual IP address which caused an error when keepalived tried to run this check. Keepalived tries to fall back to checking if 'eth0' exists. The fix is to re-order the config stanzas so that the interface parameter comes before the virtual IP address definitions. Signed-off-by: Ben Kelly Signed-off-by: Alexandru Ardelean --- net/keepalived/files/keepalived.init | 36 ++++++++++++++-------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/net/keepalived/files/keepalived.init b/net/keepalived/files/keepalived.init index da5b69c4a5..125c087217 100644 --- a/net/keepalived/files/keepalived.init +++ b/net/keepalived/files/keepalived.init @@ -248,6 +248,24 @@ vrrp_instance() { config_section_open "vrrp_instance" "$name" + config_get auth_type $1 auth_type + config_get auth_pass $1 auth_pass + [ -n "$auth_type" -a -n "$auth_pass" ] && { + printf "${INDENT_1}authentication {\n" >> $KEEPALIVED_CONF + printf "${INDENT_2}auth_type $auth_type\n" >> $KEEPALIVED_CONF + printf "${INDENT_2}auth_pass $auth_pass\n" >> $KEEPALIVED_CONF + printf "$INDENT_1}\n" >> $KEEPALIVED_CONF + } + + print_elems_indent $1 $INDENT_1 use_vmac state interface \ + mcast_src_ip unicast_src_ip virtual_router_id version priority \ + advert_int preempt_delay debug notify_backup \ + notify_master notify_fault notify_stop notify \ + lvs_sync_daemon_interface garp_master_delay garp_master_refresh \ + garp_master_repeat garp_master_refresh_repeat \ + no_val_vmac_xmit_base no_val_native_ipv6 no_val_accept \ + no_val_dont_track_primary no_val_smtp_alert no_val_nopreempt + # Handle virtual_ipaddress & virtual_ipaddress_excluded lists for opt in virtual_ipaddress virtual_ipaddress_excluded; do config_get $opt $1 $opt @@ -291,24 +309,6 @@ vrrp_instance() { done unset optval - config_get auth_type $1 auth_type - config_get auth_pass $1 auth_pass - [ -n "$auth_type" -a -n "$auth_pass" ] && { - printf "${INDENT_1}authentication {\n" >> $KEEPALIVED_CONF - printf "${INDENT_2}auth_type $auth_type\n" >> $KEEPALIVED_CONF - printf "${INDENT_2}auth_pass $auth_pass\n" >> $KEEPALIVED_CONF - printf "$INDENT_1}\n" >> $KEEPALIVED_CONF - } - - print_elems_indent $1 $INDENT_1 use_vmac state interface \ - mcast_src_ip unicast_src_ip virtual_router_id version priority \ - advert_int preempt_delay debug notify_backup \ - notify_master notify_fault notify_stop notify \ - lvs_sync_daemon_interface garp_master_delay garp_master_refresh \ - garp_master_repeat garp_master_refresh_repeat \ - no_val_vmac_xmit_base no_val_native_ipv6 no_val_accept \ - no_val_dont_track_primary no_val_smtp_alert no_val_nopreempt - config_section_close } -- 2.30.2