From ebc64a2748ae67056500f0daf9a0bec9d3bce518 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Thu, 12 Oct 2017 13:47:51 +0200 Subject: net/keepalived: remove patches for version 1.2.19 This patches are already upstream. Not needed anymore. Signed-off-by: Florian Eckert --- .../101-0001-vrrp-update-struct-msghdr.patch | 50 ---------------------- ...Reinstate-initialisation-of-msghdr-fields.patch | 41 ------------------ 2 files changed, 91 deletions(-) delete mode 100644 net/keepalived/patches/101-0001-vrrp-update-struct-msghdr.patch delete mode 100644 net/keepalived/patches/101-0002-Reinstate-initialisation-of-msghdr-fields.patch diff --git a/net/keepalived/patches/101-0001-vrrp-update-struct-msghdr.patch b/net/keepalived/patches/101-0001-vrrp-update-struct-msghdr.patch deleted file mode 100644 index a18507c08..000000000 --- a/net/keepalived/patches/101-0001-vrrp-update-struct-msghdr.patch +++ /dev/null @@ -1,50 +0,0 @@ -From dbb2cac9139954bd18813e88bfcb622ad3e93c54 Mon Sep 17 00:00:00 2001 -From: Stijn Tintel -Date: Tue, 10 May 2016 04:26:31 +0300 -Subject: [PATCH] vrrp: update struct msghdr - -The vrrp netlink code assumes an order for the members of struct msghdr. -This breaks recvmsg and sendmsg with musl libc on mips64. Fix this by -using designated initializers instead. - -Signed-off-by: Stijn Tintel ---- - keepalived/vrrp/vrrp_netlink.c | 15 ++++++++++++--- - 1 file changed, 12 insertions(+), 3 deletions(-) - -diff --git a/keepalived/vrrp/vrrp_netlink.c b/keepalived/vrrp/vrrp_netlink.c -index b19e2e7..2c2fd59 100644 ---- a/keepalived/vrrp/vrrp_netlink.c -+++ b/keepalived/vrrp/vrrp_netlink.c -@@ -416,8 +416,12 @@ netlink_parse_info(int (*filter) (struct sockaddr_nl *, struct nlmsghdr *), - char buf[4096]; - struct iovec iov = { buf, sizeof buf }; - struct sockaddr_nl snl; -- struct msghdr msg = -- { (void *) &snl, sizeof snl, &iov, 1, NULL, 0, 0 }; -+ struct msghdr msg = { -+ .msg_name = &snl, -+ .msg_namelen = sizeof(snl), -+ .msg_iov = &iov, -+ .msg_iovlen = 1, -+ }; - struct nlmsghdr *h; - - status = recvmsg(nl->fd, &msg, 0); -@@ -538,7 +542,12 @@ netlink_talk(nl_handle_t *nl, struct nlmsghdr *n) - int ret, flags; - struct sockaddr_nl snl; - struct iovec iov = { (void *) n, n->nlmsg_len }; -- struct msghdr msg = { (void *) &snl, sizeof snl, &iov, 1, NULL, 0, 0 }; -+ struct msghdr msg = { -+ .msg_name = &snl, -+ .msg_namelen = sizeof(snl), -+ .msg_iov = &iov, -+ .msg_iovlen = 1, -+ }; - - memset(&snl, 0, sizeof snl); - snl.nl_family = AF_NETLINK; --- -2.10.2 - diff --git a/net/keepalived/patches/101-0002-Reinstate-initialisation-of-msghdr-fields.patch b/net/keepalived/patches/101-0002-Reinstate-initialisation-of-msghdr-fields.patch deleted file mode 100644 index cf97513b2..000000000 --- a/net/keepalived/patches/101-0002-Reinstate-initialisation-of-msghdr-fields.patch +++ /dev/null @@ -1,41 +0,0 @@ -From eaabcc1b09cccff2f8815d03da4d5778ab6bbd17 Mon Sep 17 00:00:00 2001 -From: Quentin Armitage -Date: Mon, 16 May 2016 23:09:13 +0100 -Subject: [PATCH] Reinstate initialisation of msghdr fields - -Commit dbb2cac removed initialisation of the struct msghdr msg_control, -msg_controllen and msg_flags fields. This commit reinstates initialisation -of those fields. - -Signed-off-by: Quentin Armitage ---- - keepalived/vrrp/vrrp_netlink.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/keepalived/vrrp/vrrp_netlink.c b/keepalived/vrrp/vrrp_netlink.c -index 2c2fd59..62c37d6 100644 ---- a/keepalived/vrrp/vrrp_netlink.c -+++ b/keepalived/vrrp/vrrp_netlink.c -@@ -421,6 +421,9 @@ netlink_parse_info(int (*filter) (struct sockaddr_nl *, struct nlmsghdr *), - .msg_namelen = sizeof(snl), - .msg_iov = &iov, - .msg_iovlen = 1, -+ .msg_control = NULL, -+ .msg_controllen = 0, -+ .msg_flags = 0 - }; - struct nlmsghdr *h; - -@@ -547,6 +550,9 @@ netlink_talk(nl_handle_t *nl, struct nlmsghdr *n) - .msg_namelen = sizeof(snl), - .msg_iov = &iov, - .msg_iovlen = 1, -+ .msg_control = NULL, -+ .msg_controllen = 0, -+ .msg_flags = 0 - }; - - memset(&snl, 0, sizeof snl); --- -2.10.2 - -- cgit v1.2.3 From b5104b0f625599f4e61288b97d7f29fa9c14b981 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Thu, 12 Oct 2017 13:48:38 +0200 Subject: net/keepalived: update version to 1.3.9 update keepalived to version 1.3.9 Signed-off-by: Florian Eckert --- net/keepalived/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/net/keepalived/Makefile b/net/keepalived/Makefile index 751e0262a..0be189b63 100644 --- a/net/keepalived/Makefile +++ b/net/keepalived/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=keepalived -PKG_VERSION:=1.2.19 -PKG_RELEASE:=2 +PKG_VERSION:=1.3.9 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:= http://www.keepalived.org/software -PKG_HASH:=32fbae732c1cd854cacd7a930d4a26f5bad6372cdecb5e3139f0c17e87493853 +PKG_HASH:=d5bdd25530acf60989222fd92fbfd596e06ecc356a820f4c1015708b76a8d4f3 PKG_LICENSE:=GPL-2.0+ PKG_LICENSE_FILES:=COPYING @@ -29,7 +29,7 @@ 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 + DEPENDS:=+PACKAGE_libnl-genl:libnl-genl +libopenssl +libip4tc +IPV6:libip6tc +libxtables endef define Package/keepalived/description -- cgit v1.2.3 From 2360f361f553446a15cd51c1d551de3efdc6f4ae Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Thu, 19 Oct 2017 11:33:05 +0200 Subject: net/keepalived: update CONFIGURE_ARGS Remove unused and unrecognized (outdated) configure options in Makefile. --enable-vrrp --enable-fwmark --disable-debug --disable-profile Signed-off-by: Florian Eckert --- net/keepalived/Makefile | 4 ---- 1 file changed, 4 deletions(-) diff --git a/net/keepalived/Makefile b/net/keepalived/Makefile index 0be189b63..335285724 100644 --- a/net/keepalived/Makefile +++ b/net/keepalived/Makefile @@ -41,14 +41,10 @@ define Package/keepalived/conffiles endef CONFIGURE_ARGS+= \ - --enable-vrrp \ - --enable-fwmark \ --enable-sha1 \ --disable-lvs \ --disable-lvs-syncd \ --disable-snmp \ - --disable-debug \ - --disable-profile \ --with-kernel-dir="$(LINUX_DIR)/$(LINUX_UAPI_DIR)" MAKE_FLAGS += \ -- cgit v1.2.3 From e58a068447fb891eb19d0ae2498965e2ec23ac8c Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Thu, 12 Oct 2017 13:51:58 +0200 Subject: net/keepalived: preserve keepalived uci file over sysupgrade Preserve keepalived uci file over sysupgrade. Signed-off-by: Florian Eckert --- net/keepalived/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/net/keepalived/Makefile b/net/keepalived/Makefile index 335285724..ad850511a 100644 --- a/net/keepalived/Makefile +++ b/net/keepalived/Makefile @@ -38,6 +38,7 @@ endef define Package/keepalived/conffiles /etc/keepalived/keepalived.conf +/etc/config/keepalived endef CONFIGURE_ARGS+= \ -- cgit v1.2.3 From b66372fb437830b9329c95956b8b8ce19ab10965 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Wed, 18 Oct 2017 14:19:34 +0200 Subject: net/keepalived: add quoting for print_elems_indent function If you add a notify_* script which is not only a path to a script or to a bin file, it is necessary to quote to whole string. If you do not quote this the config will not get accepted by keepalived and so will not start. This will fix this issue. Signed-off-by: Florian Eckert --- net/keepalived/files/keepalived.init | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/net/keepalived/files/keepalived.init b/net/keepalived/files/keepalived.init index 6e850f02d..400d12a01 100644 --- a/net/keepalived/files/keepalived.init +++ b/net/keepalived/files/keepalived.init @@ -49,7 +49,14 @@ print_elems_indent() { eval optval=\$$opt [ -z "$optval" ] && continue printf "$indent$opt" >> $KEEPALIVED_CONF - [ "$no_val" == "0" ] && printf " $optval" >> $KEEPALIVED_CONF + [ "$no_val" == "0" ] && { + local words=$(echo "$optval" | wc -w) + if [ $words -gt 1 ]; then + printf " \"$optval\"" >> $KEEPALIVED_CONF + else + printf " $optval" >> $KEEPALIVED_CONF + fi + } printf "\n" >> $KEEPALIVED_CONF done unset optval -- cgit v1.2.3 From d4e1c96cc489760bc46d382e4573ecb098c4bc17 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Wed, 18 Oct 2017 16:00:38 +0200 Subject: net/keepalived: move track_interface generation into own section In a vrrp_instance the track_interface could not be referenced similar to a track_script. The uci track_interface section must be always set into every vrrp_instance. During config generation use the already prepared function "print_track_elem_indent" to write the track_interface section into every vrrp_instance which references this. Signed-off-by: Florian Eckert --- net/keepalived/files/keepalived.init | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/net/keepalived/files/keepalived.init b/net/keepalived/files/keepalived.init index 400d12a01..41e311d54 100644 --- a/net/keepalived/files/keepalived.init +++ b/net/keepalived/files/keepalived.init @@ -297,8 +297,8 @@ vrrp_instance() { printf "$INDENT_1}\n" >> $KEEPALIVED_CONF done - # Handle track_interface & track_script lists - for opt in track_interface track_script; do + # Handle track_script lists + for opt in track_script; do config_get $opt $1 $opt eval optval=\$$opt [ -z "$optval" ] && continue @@ -309,6 +309,18 @@ vrrp_instance() { printf "$INDENT_1}\n" >> $KEEPALIVED_CONF done + # Handle track_interface lists + for opt in track_interface; do + config_get $opt $1 $opt + eval optval=\$$opt + [ -z "$optval" ] && continue + printf "$INDENT_1$opt {\n" >> $KEEPALIVED_CONF + for t in $optval; do + config_foreach print_track_elem_indent track_interface $t $INDENT_2 + done + printf "$INDENT_1}\n" >> $KEEPALIVED_CONF + done + # Handle simple lists of strings (with no spaces in between) for opt in unicast_peer; do config_get $opt $1 $opt -- cgit v1.2.3 From 4bd238e852a0cf6f8048708216b3127306810104 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Mon, 6 Nov 2017 10:47:07 +0100 Subject: net/keepalived: comment alt_config_file Comment alt_config_file option in default config Signed-off-by: Florian Eckert --- net/keepalived/files/keepalived.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/keepalived/files/keepalived.config b/net/keepalived/files/keepalived.config index b2ad5f9fb..7279381a8 100644 --- a/net/keepalived/files/keepalived.config +++ b/net/keepalived/files/keepalived.config @@ -1,5 +1,5 @@ config global_defs - option alt_config_file "/etc/keepalived/keepalived.conf" +# option alt_config_file "/etc/keepalived/keepalived.conf" # list notification_email "acassen@firewall.loc" # list notification_email "failover@firewall.loc" # list notification_email "sysadmin@firewall.loc" -- cgit v1.2.3 From ff33ff463b4ddeeb1aea2d4c8147722f8fb3ebcb Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Mon, 6 Nov 2017 15:47:00 +0100 Subject: net/keepalived: add notify hotplug-call script handling During keepalived config generation for the vrrp_instance and vrrp_sync_group the notify_* sections are automatic added to the runtime keepalived.conf. This could be used for service which want to react on keepalived notifications. Signed-off-by: Florian Eckert --- net/keepalived/files/keepalived.init | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/net/keepalived/files/keepalived.init b/net/keepalived/files/keepalived.init index 41e311d54..778777b67 100644 --- a/net/keepalived/files/keepalived.init +++ b/net/keepalived/files/keepalived.init @@ -79,6 +79,18 @@ print_list_indent() { printf "$indent}\n" >> $KEEPALIVED_CONF } +print_notify() { + local type=$1 + shift + local name=$1 + shift + for notify in $*; do + printf "$INDENT_1$notify" >> $KEEPALIVED_CONF + notify=$(echo $notify | tr 'a-z' 'A-Z') + printf " \"/bin/busybox env -i ACTION=$notify TYPE=$type NAME=$name /sbin/hotplug-call keepalived\"\n" >> $KEEPALIVED_CONF + done +} + global_defs() { local linkbeat_use_polling notification_email @@ -242,8 +254,11 @@ vrrp_sync_group() { group="$valid_group" print_list_indent group - print_elems_indent $1 $INDENT_1 notify_backup notify_master notify_fault \ - notify no_val_smtp_alert no_val_global_tracking + print_elems_indent $1 $INDENT_1 no_val_smtp_alert no_val_global_tracking + + print_notify "GROUP" "$name" notify_backup notify_master \ + notify_fault notify + config_section_close } @@ -266,13 +281,15 @@ vrrp_instance() { 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 \ + 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 + print_notify "INSTANCE" "$name" notify_backup notify_master \ + notify_fault notify_stop notify + # Handle virtual_ipaddress & virtual_ipaddress_excluded lists for opt in virtual_ipaddress virtual_ipaddress_excluded; do config_get $opt $1 $opt -- cgit v1.2.3 From 738da3146c63a6c8b151060b0598e400f53a352d Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Tue, 7 Nov 2017 11:31:18 +0100 Subject: net/keepalived: add keepalived.user script handling Add keepalived.user script handling which are also saved during sysupgrade. Signed-off-by: Florian Eckert --- net/keepalived/Makefile | 5 +++++ net/keepalived/files/hotplug-user | 7 +++++++ net/keepalived/files/keepalived.user | 14 ++++++++++++++ 3 files changed, 26 insertions(+) create mode 100644 net/keepalived/files/hotplug-user create mode 100644 net/keepalived/files/keepalived.user diff --git a/net/keepalived/Makefile b/net/keepalived/Makefile index ad850511a..b584a3280 100644 --- a/net/keepalived/Makefile +++ b/net/keepalived/Makefile @@ -39,6 +39,7 @@ endef define Package/keepalived/conffiles /etc/keepalived/keepalived.conf /etc/config/keepalived +/etc/keepalived.user endef CONFIGURE_ARGS+= \ @@ -62,6 +63,10 @@ define Package/keepalived/install $(INSTALL_BIN) ./files/keepalived.init $(1)/etc/init.d/keepalived $(INSTALL_DIR) $(1)/etc/config $(INSTALL_CONF) ./files/keepalived.config $(1)/etc/config/keepalived + $(INSTALL_DIR) $(1)/etc + $(INSTALL_CONF) ./files/keepalived.user $(1)/etc/keepalived.user + $(INSTALL_DIR) $(1)/etc/hotplug.d/keepalived + $(INSTALL_DATA) ./files/hotplug-user $(1)/etc/hotplug.d/keepalived/01-user endef $(eval $(call BuildPackage,keepalived)) diff --git a/net/keepalived/files/hotplug-user b/net/keepalived/files/hotplug-user new file mode 100644 index 000000000..329a8d51b --- /dev/null +++ b/net/keepalived/files/hotplug-user @@ -0,0 +1,7 @@ +#!/bin/sh + +[ -f "/etc/keepalived.user" ] && { + /bin/sh /etc/keepalived.user "$@" +} + +exit 0 diff --git a/net/keepalived/files/keepalived.user b/net/keepalived/files/keepalived.user new file mode 100644 index 000000000..283f53a49 --- /dev/null +++ b/net/keepalived/files/keepalived.user @@ -0,0 +1,14 @@ +#!/bin/sh +# +# This file is interpreted as a shell script. +# The first line of the script must be "#!/bin/sh" without quotes. +# Lines beginning with # are comments and are not executed. +# +# There are three environment arguments that are passed to this script. +# +# $TYPE Set to INSTANCE or GROUP, depending on whether keepalived invoked the program from vrrp_instance or vrrp_sync_group. +# $NAME Set to the name of the vrrp_instance or vrrp_sync_group. +# $ACTION Set to the end state of the transition. +# Valid values are: +# $TYPE==INSTANCE: [ NOTIFY_BACKUP | NOTIFY_MASTER | NOTIFY_FAULT | NOTIFY_STOP | NOTIFY ] +# $TYPE==GROUP: [ NOTIFY_BACKUP | NOTIFY_MASTER | NOTIFY_FAULT | NOTIFY ] -- cgit v1.2.3