Merge pull request #5166 from TDT-AG/pr/20171122-keepalived-uci-improvements
net/keepalived: uci improvements
This commit is contained in:
commit
89040a0deb
2 changed files with 31 additions and 35 deletions
|
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=keepalived
|
PKG_NAME:=keepalived
|
||||||
PKG_VERSION:=1.3.9
|
PKG_VERSION:=1.3.9
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=2
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||||
PKG_SOURCE_URL:= http://www.keepalived.org/software
|
PKG_SOURCE_URL:= http://www.keepalived.org/software
|
||||||
|
@ -17,7 +17,8 @@ PKG_HASH:=d5bdd25530acf60989222fd92fbfd596e06ecc356a820f4c1015708b76a8d4f3
|
||||||
|
|
||||||
PKG_LICENSE:=GPL-2.0+
|
PKG_LICENSE:=GPL-2.0+
|
||||||
PKG_LICENSE_FILES:=COPYING
|
PKG_LICENSE_FILES:=COPYING
|
||||||
PKG_MAINTAINER:=Ben Kelly <ben@benjii.net>
|
PKG_MAINTAINER:=Ben Kelly <ben@benjii.net> \
|
||||||
|
Florian Eckert <fe@dev.tdt.de>
|
||||||
|
|
||||||
PKG_INSTALL:=1
|
PKG_INSTALL:=1
|
||||||
|
|
||||||
|
@ -29,7 +30,13 @@ define Package/keepalived
|
||||||
CATEGORY:=Network
|
CATEGORY:=Network
|
||||||
TITLE:=Failover and monitoring daemon for LVS clusters
|
TITLE:=Failover and monitoring daemon for LVS clusters
|
||||||
URL:=http://www.keepalived.org/
|
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
|
endef
|
||||||
|
|
||||||
define Package/keepalived/description
|
define Package/keepalived/description
|
||||||
|
|
|
@ -123,13 +123,17 @@ print_ipaddress_indent() {
|
||||||
# Default indent
|
# Default indent
|
||||||
[ -z "$indent" ] && indent=$INDENT_1
|
[ -z "$indent" ] && indent=$INDENT_1
|
||||||
|
|
||||||
# If no address or device exit
|
# If no address exit
|
||||||
[ -z "$address" -o -z "$device" ] && return 0
|
[ -z "$address" ] && return 0
|
||||||
|
|
||||||
|
if [ -z "$device" ]; then
|
||||||
|
printf "$indent$address" >> $KEEPALIVED_CONF
|
||||||
|
else
|
||||||
# Add IP address/netmask and device
|
# Add IP address/netmask and device
|
||||||
printf "$indent$address dev $device" >> $KEEPALIVED_CONF
|
printf "$indent$address dev $device" >> $KEEPALIVED_CONF
|
||||||
# Add scope
|
# Add scope
|
||||||
[ -n "$scope" ] && printf " scope $scope" >> $KEEPALIVED_CONF
|
[ -n "$scope" ] && printf " scope $scope" >> $KEEPALIVED_CONF
|
||||||
|
fi
|
||||||
|
|
||||||
printf "\n" >> $KEEPALIVED_CONF
|
printf "\n" >> $KEEPALIVED_CONF
|
||||||
}
|
}
|
||||||
|
@ -279,16 +283,17 @@ vrrp_instance() {
|
||||||
printf "$INDENT_1}\n" >> $KEEPALIVED_CONF
|
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 \
|
mcast_src_ip unicast_src_ip virtual_router_id version priority \
|
||||||
advert_int preempt_delay debug \
|
advert_int preempt_delay debug \
|
||||||
lvs_sync_daemon_interface garp_master_delay garp_master_refresh \
|
lvs_sync_daemon_interface garp_master_delay garp_master_refresh \
|
||||||
garp_master_repeat garp_master_refresh_repeat \
|
garp_master_repeat garp_master_refresh_repeat \
|
||||||
no_val_vmac_xmit_base no_val_native_ipv6 no_val_accept \
|
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 \
|
print_notify "INSTANCE" "$name" notify_backup notify_master \
|
||||||
notify_fault notify_stop notify
|
notify_fault notify_stop
|
||||||
|
|
||||||
# Handle virtual_ipaddress & virtual_ipaddress_excluded lists
|
# Handle virtual_ipaddress & virtual_ipaddress_excluded lists
|
||||||
for opt in virtual_ipaddress virtual_ipaddress_excluded; do
|
for opt in virtual_ipaddress virtual_ipaddress_excluded; do
|
||||||
|
@ -367,7 +372,8 @@ process_config() {
|
||||||
rm -f $KEEPALIVED_CONF
|
rm -f $KEEPALIVED_CONF
|
||||||
|
|
||||||
# First line
|
# 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
|
[ -f /etc/config/keepalived ] || return 0
|
||||||
config_load 'keepalived'
|
config_load 'keepalived'
|
||||||
|
@ -398,31 +404,14 @@ process_config() {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
service_running() {
|
service_triggers() {
|
||||||
pgrep -x /usr/sbin/keepalived &> /dev/null
|
procd_add_reload_trigger "keepalived"
|
||||||
}
|
|
||||||
|
|
||||||
conf_md5() {
|
|
||||||
echo "$(md5sum $KEEPALIVED_CONF | awk '{print $1}')"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
reload_service() {
|
reload_service() {
|
||||||
local cur_md5="$(conf_md5)"
|
|
||||||
running && {
|
|
||||||
process_config
|
process_config
|
||||||
|
#SIGHUP is used by keepalived to do init.d reload
|
||||||
# Return without performing the reload if config
|
procd_send_signal keepalived
|
||||||
# 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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
start_service() {
|
start_service() {
|
||||||
|
|
Loading…
Reference in a new issue