From a7f02bf1c81531b22814f9f0ef28677474cc14fa Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Tue, 14 Nov 2017 13:42:36 +0100 Subject: [PATCH 1/7] net/keepalived: fix kmod-macvlan dependency If the option 'use_vmac' is selected in a keepalived config and kmod-macvlan is not installed then keepalived raise an error. Netlink: error: Not supported, type=(16), seq=1510647577, pid=0 vmac: Error creating VMAC interface vrrp.42 for vrrp_instance xxx!!! Add 'kmod-macvlan' to the package dependency list fixes this error. Signed-off-by: Florian Eckert --- net/keepalived/Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/net/keepalived/Makefile b/net/keepalived/Makefile index b584a3280f..bcf38055e4 100644 --- a/net/keepalived/Makefile +++ b/net/keepalived/Makefile @@ -29,7 +29,13 @@ define Package/keepalived CATEGORY:=Network TITLE:=Failover and monitoring daemon for LVS clusters URL:=http://www.keepalived.org/ - DEPENDS:=+PACKAGE_libnl-genl:libnl-genl +libopenssl +libip4tc +IPV6:libip6tc +libxtables + DEPENDS:= \ + +PACKAGE_libnl-genl:libnl-genl \ + +libopenssl \ + +libip4tc \ + +IPV6:libip6tc \ + +libxtables \ + +kmod-macvlan endef define Package/keepalived/description From 062c35f5600d0ab42693a0a40a80a31d9e1f95be Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Thu, 16 Nov 2017 10:47:23 +0100 Subject: [PATCH 2/7] net/keepalived: on virtual IP allow empty device option If ip is referenced in the instance section it is not necessary to add a device option on every "ip_address". In most sitution it es enough to add only an ip. Allow empty device option will solve this issue. Signed-off-by: Florian Eckert --- net/keepalived/files/keepalived.init | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/net/keepalived/files/keepalived.init b/net/keepalived/files/keepalived.init index 778777b671..8f50161cdb 100644 --- a/net/keepalived/files/keepalived.init +++ b/net/keepalived/files/keepalived.init @@ -123,13 +123,17 @@ print_ipaddress_indent() { # Default indent [ -z "$indent" ] && indent=$INDENT_1 - # If no address or device exit - [ -z "$address" -o -z "$device" ] && return 0 + # If no address exit + [ -z "$address" ] && return 0 - # Add IP address/netmask and device - printf "$indent$address dev $device" >> $KEEPALIVED_CONF - # Add scope - [ -n "$scope" ] && printf " scope $scope" >> $KEEPALIVED_CONF + if [ -z "$device" ]; then + printf "$indent$address" >> $KEEPALIVED_CONF + else + # Add IP address/netmask and device + printf "$indent$address dev $device" >> $KEEPALIVED_CONF + # Add scope + [ -n "$scope" ] && printf " scope $scope" >> $KEEPALIVED_CONF + fi printf "\n" >> $KEEPALIVED_CONF } From e518c65b5825ae86704a606e0b1ca25dc9d500f0 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Thu, 16 Nov 2017 11:03:25 +0100 Subject: [PATCH 3/7] net/keepalived: update keepalived.conf generation header Add date info to keepalived config generated. Signed-off-by: Florian Eckert --- net/keepalived/files/keepalived.init | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/keepalived/files/keepalived.init b/net/keepalived/files/keepalived.init index 8f50161cdb..ee0eb049e3 100644 --- a/net/keepalived/files/keepalived.init +++ b/net/keepalived/files/keepalived.init @@ -371,7 +371,8 @@ process_config() { rm -f $KEEPALIVED_CONF # First line - printf "! Configuration File for keepalived (autogenerated via init script)\n\n" > $KEEPALIVED_CONF + printf "! Configuration file for keepalived (autogenerated via init script)\n" > $KEEPALIVED_CONF + printf "! Written %s\n\n" "$(date +'%c')" >> $KEEPALIVED_CONF [ -f /etc/config/keepalived ] || return 0 config_load 'keepalived' From 455d9a5b48a784d0602d5f8371245b4cd14931b6 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Thu, 16 Nov 2017 11:46:06 +0100 Subject: [PATCH 4/7] net/keepalived: change use_vmac to boolean Append use_vmac with no_val_ so that the uci generation will treat this as an boolean option. If the option is set then a interface with vrrp.{virtual_router_id} is added to the system. Signed-off-by: Florian Eckert --- net/keepalived/files/keepalived.init | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/keepalived/files/keepalived.init b/net/keepalived/files/keepalived.init index ee0eb049e3..3b37750bae 100644 --- a/net/keepalived/files/keepalived.init +++ b/net/keepalived/files/keepalived.init @@ -283,13 +283,14 @@ vrrp_instance() { printf "$INDENT_1}\n" >> $KEEPALIVED_CONF } - print_elems_indent $1 $INDENT_1 use_vmac state interface \ + print_elems_indent $1 $INDENT_1 state interface \ mcast_src_ip unicast_src_ip virtual_router_id version priority \ advert_int preempt_delay debug \ 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 + no_val_dont_track_primary no_val_smtp_alert no_val_nopreempt \ + no_val_use_vmac print_notify "INSTANCE" "$name" notify_backup notify_master \ notify_fault notify_stop notify From 0e88bff102ea65669282ece60e0bd4e9bc61a6d3 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Thu, 16 Nov 2017 13:44:43 +0100 Subject: [PATCH 5/7] net/keepalived: add procd_add_reload_trigger Do service reload handling by procd. Signed-off-by: Florian Eckert --- net/keepalived/files/keepalived.init | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/net/keepalived/files/keepalived.init b/net/keepalived/files/keepalived.init index 3b37750bae..ff68705c0b 100644 --- a/net/keepalived/files/keepalived.init +++ b/net/keepalived/files/keepalived.init @@ -404,31 +404,14 @@ process_config() { return 0 } -service_running() { - pgrep -x /usr/sbin/keepalived &> /dev/null -} - -conf_md5() { - echo "$(md5sum $KEEPALIVED_CONF | awk '{print $1}')" +service_triggers() { + procd_add_reload_trigger "keepalived" } reload_service() { - local cur_md5="$(conf_md5)" - running && { - process_config - - # Return without performing the reload if config - # file md5sum has not changed - local new_md5="$(conf_md5)" - [ "$new_md5" == "$cur_md5" ] && return 0; - - # SIGHUP is used by keepalived to do init.d reload - # Get the oldest process (assumption is that it's the parent process) - PID=$(pgrep -o /usr/sbin/keepalived) - kill -SIGHUP $PID - return 0 - } - return 1 + process_config + #SIGHUP is used by keepalived to do init.d reload + procd_send_signal keepalived } start_service() { From d5793b49175b8926587331cf962197e4c3cae08b Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Fri, 17 Nov 2017 12:59:40 +0100 Subject: [PATCH 6/7] net/keepalived: remove unsupported notify form print_notify statement Remove unsupported "notify" script during uci config generation. This change will remove keepalived warnings on startup. Signed-off-by: Florian Eckert --- net/keepalived/files/keepalived.init | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/keepalived/files/keepalived.init b/net/keepalived/files/keepalived.init index ff68705c0b..49c64f0160 100644 --- a/net/keepalived/files/keepalived.init +++ b/net/keepalived/files/keepalived.init @@ -293,7 +293,7 @@ vrrp_instance() { no_val_use_vmac print_notify "INSTANCE" "$name" notify_backup notify_master \ - notify_fault notify_stop notify + notify_fault notify_stop # Handle virtual_ipaddress & virtual_ipaddress_excluded lists for opt in virtual_ipaddress virtual_ipaddress_excluded; do From 0cf53a97aa36970504f598f7607110e49abe37cc Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Wed, 22 Nov 2017 13:25:05 +0100 Subject: [PATCH 7/7] net/keepalived: bump PKG_RELEASE add co maintainer - Bump PKG_RELEASE number to 2 - Add me as co maintainer Signed-off-by: Florian Eckert --- net/keepalived/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/keepalived/Makefile b/net/keepalived/Makefile index bcf38055e4..f5caa1f0bc 100644 --- a/net/keepalived/Makefile +++ b/net/keepalived/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=keepalived PKG_VERSION:=1.3.9 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:= http://www.keepalived.org/software @@ -17,7 +17,8 @@ PKG_HASH:=d5bdd25530acf60989222fd92fbfd596e06ecc356a820f4c1015708b76a8d4f3 PKG_LICENSE:=GPL-2.0+ PKG_LICENSE_FILES:=COPYING -PKG_MAINTAINER:=Ben Kelly +PKG_MAINTAINER:=Ben Kelly \ + Florian Eckert PKG_INSTALL:=1