Initial import.

This commit is contained in:
Matthias Saou 2007-03-26 17:32:27 +00:00
parent da7ef32ef6
commit 9c34e401a1
8 changed files with 506 additions and 0 deletions

View File

@ -0,0 +1 @@
keepalived-1.1.13.tar.gz

View File

@ -0,0 +1,153 @@
Index: doc/keepalived.conf.SYNOPSIS
===================================================================
RCS file: /sourceforge/cvs/abrazo/base/os/packages/keepalived/doc/keepalived.conf.SYNOPSIS,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 keepalived.conf.SYNOPSIS
--- doc/keepalived.conf.SYNOPSIS 27 Nov 2006 15:27:50 -0000 1.1.1.2
+++ doc/keepalived.conf.SYNOPSIS 27 Nov 2006 16:50:00 -0000
@@ -165,8 +165,8 @@
auth_pass <STRING> # Password string
}
virtual_ipaddress { # VRRP IP addres block
- <IP ADDRESS>/<MASK> brd <IP ADDRESS> dev <STRING> scope <SCOPE>
- <IP ADDRESS>/<MASK> brd <IP ADDRESS> dev <STRING> scope <SCOPE>
+ <IP ADDRESS>/<MASK> brd <IP ADDRESS> dev <STRING> scope <SCOPE> label <LABEL>
+ <IP ADDRESS>/<MASK> brd <IP ADDRESS> dev <STRING> scope <SCOPE> label <LABEL>
...
}
virtual_ipaddress_excluded { # VRRP IP excluded from VRRP
@@ -198,6 +198,10 @@
* nowhere
* global
+LABEL is optional and creates a name for the alias. For compatibility with
+"ifconfig", it should be of the form <realdev>:<anytext>, for example
+eth0:1 for an alias on eth0.
+
When a weight is specified in track_interface, instead of setting the vrrp
instance to the FAULT state in case of failure, its priority will be
increased by the weight when the interface is up (for positive weights),
Index: doc/man/man5/keepalived.conf.5
===================================================================
RCS file: /sourceforge/cvs/abrazo/base/os/packages/keepalived/doc/man/man5/keepalived.conf.5,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 keepalived.conf.5
--- doc/man/man5/keepalived.conf.5 1 Aug 2006 15:49:31 -0000 1.1.1.1
+++ doc/man/man5/keepalived.conf.5 27 Nov 2006 16:50:00 -0000
@@ -199,9 +199,9 @@
#With the same entries on other machines,
#the opposite transition will be occuring.
virtual_ipaddress {
- <IPADDR>/<MASK> brd <IPADDR> dev <STRING> scope <SCOPE>
+ <IPADDR>/<MASK> brd <IPADDR> dev <STRING> scope <SCOPE> label <LABEL>
192.168.200.17/24 dev eth1
- 192.168.200.18/24 dev eth2
+ 192.168.200.18/24 dev eth2 label eth2:1
}
#VRRP IP excluded from VRRP
Index: doc/samples/keepalived.conf.vrrp
===================================================================
RCS file: /sourceforge/cvs/abrazo/base/os/packages/keepalived/doc/samples/keepalived.conf.vrrp,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 keepalived.conf.vrrp
--- doc/samples/keepalived.conf.vrrp 1 Aug 2006 15:49:31 -0000 1.1.1.1
+++ doc/samples/keepalived.conf.vrrp 27 Nov 2006 16:50:00 -0000
@@ -26,7 +26,10 @@
virtual_ipaddress {
192.168.200.16
192.168.200.17
- 192.168.200.18
+
+ # optional label. should be of the form "realdev:sometext" for
+ # compatibility with ifconfig.
+ 192.168.200.18 label eth0:1
}
}
Index: keepalived/etc/keepalived/keepalived.conf
===================================================================
RCS file: /sourceforge/cvs/abrazo/base/os/packages/keepalived/keepalived/etc/keepalived/keepalived.conf,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 keepalived.conf
--- keepalived/etc/keepalived/keepalived.conf 1 Aug 2006 15:49:31 -0000 1.1.1.1
+++ keepalived/etc/keepalived/keepalived.conf 27 Nov 2006 16:50:00 -0000
@@ -25,7 +25,7 @@
virtual_ipaddress {
192.168.200.16
192.168.200.17
- 192.168.200.18
+ 192.168.200.18 label eth0:3
}
}
Index: keepalived/include/vrrp_ipaddress.h
===================================================================
RCS file: /sourceforge/cvs/abrazo/base/os/packages/keepalived/keepalived/include/vrrp_ipaddress.h,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 vrrp_ipaddress.h
--- keepalived/include/vrrp_ipaddress.h 27 Nov 2006 15:27:50 -0000 1.1.1.2
+++ keepalived/include/vrrp_ipaddress.h 27 Nov 2006 16:50:00 -0000
@@ -46,6 +46,7 @@
interface *ifp; /* Interface owning IP address */
int scope; /* the ip address scope */
int set; /* TRUE if addr is set */
+ char *label; /* Alias name, e.g. eth0:1 */
} ip_address;
#define IPADDRESS_DEL 0
Index: keepalived/vrrp/vrrp_ipaddress.c
===================================================================
RCS file: /sourceforge/cvs/abrazo/base/os/packages/keepalived/keepalived/vrrp/vrrp_ipaddress.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 vrrp_ipaddress.c
--- keepalived/vrrp/vrrp_ipaddress.c 27 Nov 2006 15:27:50 -0000 1.1.1.2
+++ keepalived/vrrp/vrrp_ipaddress.c 27 Nov 2006 16:50:00 -0000
@@ -53,6 +53,9 @@
if (ipaddr->broadcast)
addattr_l(&req.n, sizeof (req), IFA_BROADCAST,
&ipaddr->broadcast, sizeof (ipaddr->broadcast));
+ if (ipaddr->label)
+ addattr_l(&req.n, sizeof (req), IFA_LABEL,
+ ipaddr->label, strlen(ipaddr->label) + 1);
if (netlink_talk(&nl_cmd, &req.n) < 0)
status = -1;
@@ -90,18 +93,23 @@
void
free_ipaddress(void *if_data_obj)
{
- FREE(if_data_obj);
+ ip_address *ip_addr = if_data_obj;
+
+ FREE_PTR(ip_addr->label);
+ FREE(ip_addr);
}
void
dump_ipaddress(void *if_data_obj)
{
ip_address *ip_addr = if_data_obj;
- syslog(LOG_INFO, " %s/%d brd %s dev %s scope %s"
+ syslog(LOG_INFO, " %s/%d brd %s dev %s scope %s%s%s"
, inet_ntop2(ip_addr->addr)
, ip_addr->mask
, inet_ntop2(ip_addr->broadcast)
, IF_NAME(if_get_by_ifindex(ip_addr->ifindex))
- , netlink_scope_n2a(ip_addr->scope));
+ , netlink_scope_n2a(ip_addr->scope)
+ , ip_addr->label ? " label " : ""
+ , ip_addr->label ? ip_addr->label : "");
}
void
alloc_ipaddress(list ip_list, vector strvec, interface *ifp)
@@ -139,6 +147,10 @@
new->scope = netlink_scope_a2n(VECTOR_SLOT(strvec, ++i));
} else if (!strcmp(str, "broadcast") || !strcmp(str, "brd")) {
inet_ston(VECTOR_SLOT(strvec, ++i), &new->broadcast);
+ } else if (!strcmp(str, "label")) {
+ new->label = ALLOC(IFNAMSIZ);
+ strncpy(new->label, VECTOR_SLOT(strvec, ++i), IFNAMSIZ);
+ new->label[IFNAMSIZ-1] = '\0';
} else {
if (inet_ston(VECTOR_SLOT(strvec, i), &ipaddr)) {
inet_ston(VECTOR_SLOT(strvec, i), &new->addr);

View File

@ -0,0 +1,77 @@
diff -Naupr keepalived-1.1.13.orig/genhash/Makefile.in keepalived-1.1.13/genhash/Makefile.in
--- keepalived-1.1.13.orig/genhash/Makefile.in 2006-10-11 11:46:49.000000000 +0200
+++ keepalived-1.1.13/genhash/Makefile.in 2007-03-22 16:25:45.000000000 +0100
@@ -7,7 +7,8 @@ BIN = ../bin
prefix = @prefix@
exec_prefix = @exec_prefix@
-bindir = @bindir@
+bindir = @bindir@
+mandir = @mandir@
CC = @CC@
STRIP = @STRIP@
@@ -39,13 +40,13 @@ distclean: clean
uninstall:
rm -f $(DESTDIR)$(bindir)/$(EXEC)
- rm -f $(DESTDIR)@mandir@/man/man1/genhash.1
+ rm -f $(DESTDIR)$(mandir)/man1/genhash.1
install:
install -d $(DESTDIR)$(bindir)
install -m 755 $(BIN)/$(EXEC) $(DESTDIR)$(bindir)/
- install -d $(DESTDIR)@mandir@/man/man1
- install -m 644 ../doc/man/man1/genhash.1 $(DESTDIR)@mandir@/man/man1
+ install -d $(DESTDIR)$(mandir)/man1
+ install -m 644 ../doc/man/man1/genhash.1 $(DESTDIR)$(mandir)/man1
mrproper: clean distclean
rm -f config.*
diff -Naupr keepalived-1.1.13.orig/keepalived/Makefile.in keepalived-1.1.13/keepalived/Makefile.in
--- keepalived-1.1.13.orig/keepalived/Makefile.in 2006-10-11 11:46:32.000000000 +0200
+++ keepalived-1.1.13/keepalived/Makefile.in 2007-03-22 16:26:03.000000000 +0100
@@ -14,8 +14,9 @@ prefix = @prefix@
exec_prefix = @exec_prefix@
sbindir = @sbindir@
sysconfdir = @sysconfdir@
-init_script = etc/init.d/keepalived.init
-conf_file = etc/keepalived/keepalived.conf
+mandir = @mandir@
+init_dir = $(sysconfdir)/rc.d/init.d
+conf_dir = $(sysconfdir)/keepalived
CC = @CC@
STRIP = @STRIP@
@@ -89,20 +90,20 @@ mrproper: distclean
uninstall:
rm -f $(DESTDIR)$(sbindir)/$(EXEC)
+ rm -f $(DESTDIR)$(init_dir)/keepalived.init
rm -rf $(DESTDIR)$(sysconfdir)/keepalived
- rm -f $(DESTDIR)$(init_dir)/$(init_script)
- rm -f $(DESTDIR)@mandir@/man/man5/keepalived.conf.5
- rm -f $(DESTDIR)@mandir@/man/man8/keepalived.8
+ rm -f $(DESTDIR)$(mandir)/man/man5/keepalived.conf.5
+ rm -f $(DESTDIR)$(mandir)/man/man8/keepalived.8
install:
install -d $(DESTDIR)$(sbindir)
- install -m 700 $(BIN)/$(EXEC) $(DESTDIR)$(sbindir)/
- install -d $(DESTDIR)$(sysconfdir)/init.d
- install -m 755 $(init_script) $(DESTDIR)$(sysconfdir)/init.d/keepalived
+ install -m 755 $(BIN)/$(EXEC) $(DESTDIR)$(sbindir)/
+ install -d $(DESTDIR)$(init_dir)
+ install -m 755 etc/init.d/keepalived.init $(DESTDIR)$(init_dir)/keepalived
install -d $(DESTDIR)$(sysconfdir)/keepalived/samples
- install -m 644 $(conf_file) $(DESTDIR)$(sysconfdir)/keepalived/
+ install -m 644 etc/keepalived/keepalived.conf $(DESTDIR)$(sysconfdir)/keepalived/
install -m 644 ../doc/samples/* $(DESTDIR)$(sysconfdir)/keepalived/samples/
- install -d $(DESTDIR)@mandir@/man/man5
- install -d $(DESTDIR)@mandir@/man/man8
- install -m 644 ../doc/man/man5/keepalived.conf.5 $(DESTDIR)@mandir@/man/man5
- install -m 644 ../doc/man/man8/keepalived.8 $(DESTDIR)@mandir@/man/man8
+ install -d $(DESTDIR)$(mandir)/man5
+ install -d $(DESTDIR)$(mandir)/man8
+ install -m 644 ../doc/man/man5/keepalived.conf.5 $(DESTDIR)$(mandir)/man5
+ install -m 644 ../doc/man/man8/keepalived.8 $(DESTDIR)$(mandir)/man8

View File

@ -0,0 +1,21 @@
diff -Naupr keepalived-1.1.13.orig/keepalived/vrrp/vrrp_arp.c keepalived-1.1.13/keepalived/vrrp/vrrp_arp.c
--- keepalived-1.1.13.orig/keepalived/vrrp/vrrp_arp.c 2006-10-11 11:44:59.000000000 +0200
+++ keepalived-1.1.13/keepalived/vrrp/vrrp_arp.c 2007-03-22 16:22:29.000000000 +0100
@@ -22,14 +22,14 @@
* Copyright (C) 2001-2006 Alexandre Cassen, <acassen@linux-vs.org>
*/
-/* system includes */
-#include <linux/if_packet.h>
-
/* local includes */
#include "vrrp_arp.h"
#include "memory.h"
#include "utils.h"
+/* system includes */
+#include <linux/if_packet.h>
+
/* global vars */
char *garp_buffer;
int garp_fd;

73
keepalived.init Executable file
View File

@ -0,0 +1,73 @@
#!/bin/sh
#
# Startup script for the Keepalived daemon
#
# processname: keepalived
# pidfile: /var/run/keepalived.pid
# config: /etc/keepalived/keepalived.conf
# chkconfig: - 21 79
# description: Start and stop Keepalived
# Source function library
. /etc/rc.d/init.d/functions
# Source configuration file (we set KEEPALIVED_OPTIONS there)
. /etc/sysconfig/keepalived
RETVAL=0
prog="keepalived"
start() {
echo -n $"Starting $prog: "
daemon keepalived ${KEEPALIVED_OPTIONS}
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
}
stop() {
echo -n $"Stopping $prog: "
killproc keepalived
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
}
reload() {
echo -n $"Reloading $prog: "
killproc keepalived -1
RETVAL=$?
echo
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
reload)
reload
;;
restart)
stop
start
;;
condrestart)
if [ -f /var/lock/subsys/$prog ]; then
stop
start
fi
;;
status)
status keepalived
;;
*)
echo "Usage: $0 {start|stop|reload|restart|condrestart|status}"
exit 1
esac
exit $RETVAL

165
keepalived.spec Normal file
View File

@ -0,0 +1,165 @@
# Ugly, but we need headers from a kernel to rebuild against
%define kernel %(rpm -q kernel-devel --qf '%{RPMTAG_VERSION}-%{RPMTAG_RELEASE}\\n' 2>/dev/null | head -1)
Summary: HA monitor built upon LVS, VRRP and service pollers
Name: keepalived
Version: 1.1.13
Release: 6%{?dist}
License: GPL
Group: Applications/System
URL: http://www.keepalived.org/
Source0: http://www.keepalived.org/software/keepalived-%{version}.tar.gz
Source1: keepalived.init
Source2: keepalived.sysconfig
Patch0: keepalived-1.1.13-makefile.patch
Patch1: keepalived-1.1.13-iflabel.patch
Patch2: keepalived-1.1.13-types.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: openssl-devel
# We need both of these for proper LVS support
BuildRequires: kernel, kernel-devel
%description
The main goal of the keepalived project is to add a strong & robust keepalive
facility to the Linux Virtual Server project. This project is written in C with
multilayer TCP/IP stack checks. Keepalived implements a framework based on
three family checks : Layer3, Layer4 & Layer5/7. This framework gives the
daemon the ability to check the state of an LVS server pool. When one of the
servers of the LVS server pool is down, keepalived informs the linux kernel via
a setsockopt call to remove this server entry from the LVS topology. In
addition keepalived implements an independent VRRPv2 stack to handle director
failover. So in short keepalived is a userspace daemon for LVS cluster nodes
healthchecks and LVS directors failover.
%prep
%setup -q
%patch0 -p1 -b .makefile
%patch1 -p0 -b .iflabel
%patch2 -p1 -b .types
# Fix file mode (600 as of 1.1.13)
%{__chmod} a+r doc/samples/sample.misccheck.smbcheck.sh
%build
%configure --with-kernel-dir="/lib/modules/%{kernel}/build"
%{__make} %{?_smp_mflags} STRIP=/bin/true
%install
%{__rm} -rf %{buildroot}
%{__make} install DESTDIR=%{buildroot}
# Remove "samples", as we include them in %%doc
%{__rm} -rf %{buildroot}%{_sysconfdir}/keepalived/samples/
# Init script (based on the included one, but enhanced)
%{__install} -D -p -m 0755 %{SOURCE1} \
%{buildroot}%{_sysconfdir}/rc.d/init.d/keepalived
# Sysconfig file (used by the init script)
%{__install} -D -p -m 0640 %{SOURCE2} \
%{buildroot}%{_sysconfdir}/sysconfig/keepalived
%check
# A build could silently have LVS support disabled if the kernel includes can't
# be properly found, we need to avoid that.
if ! grep -q "IPVS_SUPPORT='_WITH_LVS_'" config.log; then
echo "ERROR: We do not want keeepalived lacking LVS support."
exit 1
fi
%clean
%{__rm} -rf %{buildroot}
%post
/sbin/chkconfig --add keepalived
%preun
if [ $1 -eq 0 ]; then
/sbin/service keepalived stop &>/dev/null || :
/sbin/chkconfig --del keepalived
fi
%postun
if [ $1 -ge 1 ]; then
/sbin/service keepalived condrestart &>/dev/null || :
fi
%files
%defattr(-,root,root,-)
%doc AUTHOR ChangeLog CONTRIBUTORS COPYING README TODO
%doc doc/keepalived.conf.SYNOPSIS doc/samples/
%dir %{_sysconfdir}/keepalived/
%attr(0640, root, root) %config(noreplace) %{_sysconfdir}/keepalived/keepalived.conf
%attr(0640, root, root) %config(noreplace) %{_sysconfdir}/sysconfig/keepalived
%{_sysconfdir}/rc.d/init.d/keepalived
%{_bindir}/genhash
%{_sbindir}/keepalived
%{_mandir}/man1/genhash.1*
%{_mandir}/man5/keepalived.conf.5*
%{_mandir}/man8/keepalived.8*
%changelog
* Mon Mar 26 2007 Matthias Saou <http://freshrpms.net/> 1.1.13-6
- Fix doc/samples/sample.misccheck.smbcheck.sh mode (600 -> 644).
* Thu Mar 22 2007 Matthias Saou <http://freshrpms.net/> 1.1.13-5
- Include types patch to fix compile on F7 (David Woodhouse).
- Fix up file modes (main binary 700 -> 755 and config 600 -> 640).
* Tue Feb 13 2007 Matthias Saou <http://freshrpms.net/> 1.1.13-4
- Add missing \n to the kernel define, for when multiple kernels are installed.
- Pass STRIP=/bin/true to "make" in order to get a useful debuginfo package.
* Tue Feb 13 2007 Matthias Saou <http://freshrpms.net/> 1.1.13-3
- Add %%check section to make sure any build without LVS support will fail.
* Mon Feb 5 2007 Matthias Saou <http://freshrpms.net/> 1.1.13-2
- Use our own init script, include a sysconfig entry used by it for options.
* Thu Jan 25 2007 Matthias Saou <http://freshrpms.net/> 1.1.13-1
- Update to 1.1.13.
- Change mode of configuration file to 0600.
- Don't include all of "doc" since it meant re-including all man pages.
- Don't include samples in the main configuration path, they're in %%doc.
- Include patch to add an optional label to interfaces.
* Sat Apr 08 2006 Dries Verachtert <dries@ulyssis.org> - 1.1.12-1.2
- Rebuild for Fedora Core 5.
* Sun Mar 12 2006 Dag Wieers <dag@wieers.com> - 1.1.12-1
- Updated to release 1.1.12.
* Fri Mar 04 2005 Dag Wieers <dag@wieers.com> - 1.1.11-1
- Updated to release 1.1.11.
* Wed Feb 23 2005 Dag Wieers <dag@wieers.com> - 1.1.10-2
- Fixed IPVS/LVS support. (Joe Sauer)
* Tue Feb 15 2005 Dag Wieers <dag@wieers.com> - 1.1.10-1
- Updated to release 1.1.10.
* Mon Feb 07 2005 Dag Wieers <dag@wieers.com> - 1.1.9-1
- Updated to release 1.1.9.
* Sun Oct 17 2004 Dag Wieers <dag@wieers.com> - 1.1.7-2
- Fixes to build with kernel IPVS support. (Tim Verhoeven)
* Fri Sep 24 2004 Dag Wieers <dag@wieers.com> - 1.1.7-1
- Updated to release 1.1.7. (Mathieu Lubrano)
* Mon Feb 23 2004 Dag Wieers <dag@wieers.com> - 1.1.6-0
- Updated to release 1.1.6.
* Mon Jan 26 2004 Dag Wieers <dag@wieers.com> - 1.1.5-0
- Updated to release 1.1.5.
* Mon Dec 29 2003 Dag Wieers <dag@wieers.com> - 1.1.4-0
- Updated to release 1.1.4.
* Fri Jun 06 2003 Dag Wieers <dag@wieers.com> - 1.0.3-0
- Initial package. (using DAR)

15
keepalived.sysconfig Normal file
View File

@ -0,0 +1,15 @@
# Options for keepalived. See `keepalived --help' output and keepalived(8) and
# keepalived.conf(5) man pages for a list of all options. Here are the most
# common ones :
#
# --vrrp -P Only run with VRRP subsystem.
# --check -C Only run with Health-checker subsystem.
# --dont-release-vrrp -V Dont remove VRRP VIPs & VROUTEs on daemon stop.
# --dont-release-ipvs -I Dont remove IPVS topology on daemon stop.
# --dump-conf -d Dump the configuration data.
# --log-detail -D Detailed log messages.
# --log-facility -S 0-7 Set local syslog facility (default=LOG_DAEMON)
#
KEEPALIVED_OPTIONS="-D"

View File

@ -0,0 +1 @@
578bdb8e3ff4cca50fc877893bad658c keepalived-1.1.13.tar.gz