Merge pull request #5077 from TDT-GmbH/20171030-keepalived-update-version
net/keepalived: update version and add hotplug.d notify handling
This commit is contained in:
commit
5e42ef5178
|
@ -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
|
||||
|
@ -38,17 +38,15 @@ endef
|
|||
|
||||
define Package/keepalived/conffiles
|
||||
/etc/keepalived/keepalived.conf
|
||||
/etc/config/keepalived
|
||||
/etc/keepalived.user
|
||||
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 += \
|
||||
|
@ -65,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))
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
[ -f "/etc/keepalived.user" ] && {
|
||||
/bin/sh /etc/keepalived.user "$@"
|
||||
}
|
||||
|
||||
exit 0
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
@ -72,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
|
||||
|
||||
|
@ -235,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
|
||||
}
|
||||
|
||||
|
@ -259,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
|
||||
|
@ -290,8 +314,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
|
||||
|
@ -302,6 +326,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
|
||||
|
|
|
@ -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 ]
|
|
@ -1,50 +0,0 @@
|
|||
From dbb2cac9139954bd18813e88bfcb622ad3e93c54 Mon Sep 17 00:00:00 2001
|
||||
From: Stijn Tintel <stijn@linux-ipv6.be>
|
||||
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 <stijn@linux-ipv6.be>
|
||||
---
|
||||
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
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
From eaabcc1b09cccff2f8815d03da4d5778ab6bbd17 Mon Sep 17 00:00:00 2001
|
||||
From: Quentin Armitage <quentin@armitage.org.uk>
|
||||
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 <quentin@armitage.org.uk>
|
||||
---
|
||||
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
|
||||
|
Loading…
Reference in New Issue