Browse Source

Merge pull request #5166 from TDT-AG/pr/20171122-keepalived-uci-improvements

net/keepalived: uci improvements
lilik-openwrt-22.03
Hannu Nyman 7 years ago
committed by GitHub
parent
commit
89040a0deb
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 35 deletions
  1. +10
    -3
      net/keepalived/Makefile
  2. +21
    -32
      net/keepalived/files/keepalived.init

+ 10
- 3
net/keepalived/Makefile View File

@ -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 <ben@benjii.net>
PKG_MAINTAINER:=Ben Kelly <ben@benjii.net> \
Florian Eckert <fe@dev.tdt.de>
PKG_INSTALL:=1
@ -29,7 +30,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


+ 21
- 32
net/keepalived/files/keepalived.init View File

@ -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
}
@ -279,16 +283,17 @@ 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
notify_fault notify_stop
# Handle virtual_ipaddress & virtual_ipaddress_excluded lists
for opt in virtual_ipaddress virtual_ipaddress_excluded; do
@ -367,7 +372,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'
@ -398,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() {


Loading…
Cancel
Save