Compare commits

..

23 commits

Author SHA1 Message Date
Jon Ciesla
236a37db12 Merge branch 'el6' into el5 2016-03-05 12:24:03 -05:00
Jon Ciesla
9e8215d18b Init fix. 2016-03-05 12:23:19 -05:00
Jon Ciesla
8621763adb Merge branch 'el6' into el5 2013-02-13 09:06:20 -06:00
Jon Ciesla
bd68be23ff init fix. 2013-02-13 09:03:23 -06:00
Jon Ciesla
3fa9d57d41 Merge branch 'el6' into el5 2013-01-23 13:03:20 -06:00
Jon Ciesla
da59abbadd Drop MASTER from init. 2013-01-23 13:02:44 -06:00
Jon Ciesla
9ddc1b70e9 init fix for octal. 2012-12-11 09:04:43 -06:00
Jon Ciesla
3583dadaa5 Merge branch 'el6' into el5 2012-11-13 11:47:47 -06:00
Jon Ciesla
0c5ad79177 Patch fix. 2012-11-13 11:46:43 -06:00
Jon Ciesla
c5b75e775d Merge branch 'el6' into el5 2012-11-12 14:45:32 -06:00
Jon Ciesla
20ecf82b26 Init fixes. 2012-11-12 14:44:59 -06:00
Jon Ciesla
7c86a53910 Merge branch 'el6' into el5
Conflicts:
	.gitignore
	ucarp.spec
2012-10-25 09:37:48 -05:00
Jon Ciesla
278f2feb65 Merge branch 'f17' into el6
Conflicts:
	.gitignore
	ucarp.spec
2012-10-25 09:36:08 -05:00
Jon Ciesla
3080009b6d Fix for crash. 2012-10-25 09:34:21 -05:00
Fedora Release Engineering
033985bacb dist-git conversion 2010-07-29 14:36:25 +00:00
Fedora Release Engineering
922f7c12ac dist-git conversion 2010-07-29 14:36:21 +00:00
cf255c1aae Version bump. 2010-07-08 13:45:21 +00:00
Dennis Gilmore
52ea21ce7f Initialize branch EL-6 for ucarp 2010-05-08 02:26:31 +00:00
8e15e3a68c Update, noreplace fix. 2010-04-29 13:22:13 +00:00
Bill Nottingham
973533e4ec Fix typo that causes a failure to update the common directory. (releng
#2781)
2009-11-26 01:13:15 +00:00
Bill Nottingham
93a7b8835f Fix typo that causes a failure to update the common directory. (releng
#2781)
2009-11-26 01:13:15 +00:00
f3126540ec 1.1 and 1.3 were never build, updating to 1.5 and building, BZ 510287. 2009-07-08 17:41:06 +00:00
Warren Togami
9dc59875c0 Initialize branch EL-5 for ucarp 2007-02-26 19:29:12 +00:00
10 changed files with 441 additions and 1 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
ucarp-1.2.tar.bz2

View file

@ -1 +0,0 @@
Dead upstream, old website NSFW

1
sources Normal file
View file

@ -0,0 +1 @@
723636dbf79fc6abd329a71ec4ddf79d ucarp-1.5.2.tar.bz2

10
ucarp-1.5.2-sighup.patch Normal file
View file

@ -0,0 +1,10 @@
--- src/carp.c~ 2010-01-31 15:59:12.000000000 -0600
+++ src/carp.c 2012-10-25 09:25:54.949976635 -0500
@@ -762,6 +762,7 @@
if (shutdown_at_exit != 0) {
(void) signal(SIGINT, sighandler_exit);
+ (void) signal(SIGHUP, sighandler_exit);
(void) signal(SIGQUIT, sighandler_exit);
(void) signal(SIGTERM, sighandler_exit);
}

185
ucarp.init Executable file
View file

@ -0,0 +1,185 @@
#!/bin/bash
# $Id$
#
# chkconfig: - 91 09
# description: Starts and stops the common address redundancy protocol daemon
### BEGIN INIT INFO
# Provides: lsb-ucarp
# Required-Start: $local_fs $network $remote_fs
# Required-Stop: $local_fs $network $remote_fs
# Default-Start:
# Default-Stop: 0 1 6
# Short-Description: start and stop ucarp
# Description: Common Address Redundancy Protocol (CARP) for Unix
### END INIT INFO
# Source function library.
. /etc/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 0
get_files() {
local FILE
cd ${CONFDIR}
for FILE in *.conf
do [ "${FILE}" != "vip-common.conf" ] && echo -n "${FILE} "
done
}
prog=$"common address redundancy protocol daemon"
LOGGER="/usr/bin/logger -p daemon.notice -t ucarp"
CONFDIR=/etc/ucarp
UPSCRIPT=/usr/libexec/ucarp/vip-up
DOWNSCRIPT=/usr/libexec/ucarp/vip-down
start() {
RETVAL=-1
VIP_RETVAL=0
echo -n $"Starting ${prog}: "
FILES=`get_files`
if [ -z "${FILES}" ]; then
${LOGGER} "no virtual addresses are configured in ${CONFDIR}"
failure
RETVAL=1
else
for FILE in ${FILES}; do
unset ID PASSWORD BIND_INTERFACE SOURCE_ADDRESS VIP_ADDRESS OPTIONS
. ${CONFDIR}/vip-common.conf
. ${CONFDIR}/${FILE}
# If the SOURCE_ADDRESS is not defined in the config, guess it from the ifcfg file
[ ${SOURCE_ADDRESS} ] || SOURCE_ADDRESS=$( . /etc/sysconfig/network-scripts/ifcfg-${BIND_INTERFACE} ; echo $IPADDR )
# If a value for MASTER is set in the file, use it to set advskew value
# The default advskew is 0, so if we are not the master, add advskew=1 to the options
# If the skew is already set in the options, then ignore the MASTER parameter
if ! [[ "${OPTIONS}" =~ "-k" || "${OPTIONS}" =~ "-advskew" ]]; then
[ "${MASTER:-NULL}" == "${SOURCE_ADDRESS}" ] || OPTIONS="${OPTIONS} --advskew=1"
fi
# Set the ID from the config file if it's defined, otherwise guess from the filename
if [[ -z "$ID" ]]; then
ID="${FILE#vip-}"; ID="${ID%.conf}"
IDnozero="${ID#0}"; IDnozero="${IDnozero#0}"
if [[ "$ID" != "$IDnozero" ]]; then
if [[ "${ID}" != "${ID/8}" || "${ID}" != "${ID/9}" ]]; then
# Has leading zeroes, is not a valid octal number.
# Remove leading zeroes, interpret it as decimal.
ID="$IDnozero"
else
# Has leading zeroes, will be interpreted as octal.
${LOGGER} "$FILE uses VIP ID" $(($ID)) "(octal $ID). To use $ID, add the line 'ID=$IDnozero' to $FILE or rename it to vip-$IDnozero.conf"
fi
fi
fi
if [ ${ID} -lt 1 -o ${ID} -gt 255 ]; then
${LOGGER} "ID out of range (1-255) for ${FILE}, skipped VIP ID ${ID}"
continue
fi
TMP_RETVAL=0
if [ -z "${PASSWORD}" ]; then
${LOGGER} "no PASSWORD found for ${FILE}, skipped VIP ID ${ID}"
TMP_RETVAL=1
fi
if [ -z "${BIND_INTERFACE}" ]; then
${LOGGER} "no BIND_INTERFACE found for ${FILE}, skipped VIP ID ${ID}"
TMP_RETVAL=1
fi
if [ -z "${SOURCE_ADDRESS}" ]; then
${LOGGER} "no SOURCE_ADDRESS found for ${FILE}, skipped VIP ID ${ID}"
TMP_RETVAL=1
fi
if [ -z "${VIP_ADDRESS}" ]; then
${LOGGER} "no VIP_ADDRESS found for ${FILE}, skipped VIP ID ${ID}"
TMP_RETVAL=1
fi
# If one of more of the above failed, skip the daemon launch
if [ ${TMP_RETVAL} -ne 0 ]; then
VIP_RETVAL=1
continue
fi
[ ${RETVAL} -eq -1 ] && RETVAL=0
daemon /usr/sbin/ucarp --daemonize --interface=${BIND_INTERFACE} --pass=${PASSWORD} --srcip=${SOURCE_ADDRESS} --vhid=${ID} --addr=${VIP_ADDRESS} ${OPTIONS} --upscript=$UPSCRIPT --downscript=$DOWNSCRIPT >/dev/null
LAUNCH_RETVAL=$?
[ ${LAUNCH_RETVAL} -ne 0 ] && RETVAL=1
done
# failure/success or warning if launch worked with some vip errors
if [ ${RETVAL} -eq 0 -a ${VIP_RETVAL} -eq 0 ]; then
${LOGGER} "all ucarp configurations were applied successfully"
success
touch /var/lock/subsys/ucarp
elif [ ${RETVAL} -eq 0 -a ${VIP_RETVAL} -eq 1 ]; then
${LOGGER} "error in one or more of the ucarp configurations"
warning
else
${LOGGER} "error running one or more of the ucarp daemon instances"
failure
fi
fi
echo
}
stop() {
echo -n $"Stopping $prog: "
killproc /usr/sbin/ucarp >/dev/null
RETVAL=$?
# With "--shutdown" in the default OPTIONS, the down script is called
# when ucarp is stopped, so IP addresses are released, no "leftovers".
# failure/success (no warning, too complicated to handle properly)
if [ ${RETVAL} -eq 1 ]; then
${LOGGER} "it seems like no ucarp daemon were running"
failure
else
${LOGGER} "all ucarp daemons stopped and IP addresses unassigned"
success
rm -f /var/lock/subsys/ucarp
fi
echo
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
condrestart)
if [ -f /var/lock/subsys/ucarp ]; then
stop
start
fi
;;
status)
status /usr/sbin/ucarp
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
exit 1
esac
exit $RETVAL

216
ucarp.spec Normal file
View file

@ -0,0 +1,216 @@
Summary: Common Address Redundancy Protocol (CARP) for Unix
Name: ucarp
Version: 1.5.2
Release: 9%{?dist}
# See the COPYING file which details everything
License: MIT and BSD
Group: System Environment/Daemons
URL: http://www.ucarp.org/
Source0: http://download.pureftpd.org/pub/ucarp/ucarp-%{version}.tar.bz2
Source1: ucarp.init
Source2: vip-001.conf.example
Source3: vip-common.conf
Source4: vip-up
Source5: vip-down
#Source6: vip-helper.sh
Patch0: ucarp-1.5.2-sighup.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
Requires(post): /sbin/chkconfig
Requires(preun): /sbin/chkconfig, /sbin/service
Requires(postun): /sbin/service
BuildRequires: gettext
BuildRequires: autoconf, automake, libtool
BuildRequires: libpcap-devel
%description
UCARP allows a couple of hosts to share common virtual IP addresses in order
to provide automatic failover. It is a portable userland implementation of the
secure and patent-free Common Address Redundancy Protocol (CARP, OpenBSD's
alternative to the patents-bloated VRRP).
Strong points of the CARP protocol are: very low overhead, cryptographically
signed messages, interoperability between different operating systems and no
need for any dedicated extra network link between redundant hosts.
%prep
%setup -q
%patch0 -p0
%build
%configure
%{__make} %{?_smp_mflags}
%install
%{__rm} -rf %{buildroot}
%{__make} install DESTDIR=%{buildroot}
%find_lang %{name}
# Install the init script
%{__install} -D -p -m 0755 %{SOURCE1} \
%{buildroot}/etc/rc.d/init.d/ucarp
%{__mkdir_p} %{buildroot}/etc/ucarp
%{__mkdir_p} %{buildroot}%{_libexecdir}/ucarp
# Install the example config files
%{__install} -D -p -m 0600 %{SOURCE2} %{SOURCE3} \
%{buildroot}/etc/ucarp/
# Install helper scripts
%{__install} -D -p -m 0700 %{SOURCE4} %{SOURCE5} \
%{buildroot}%{_libexecdir}/ucarp/
%clean
%{__rm} -rf %{buildroot}
%pre
# Legacy, in case we update from an older package where the service was "carp"
if [ -f /etc/rc.d/init.d/carp ]; then
/sbin/service carp stop &>/dev/null || :
/sbin/chkconfig --del carp
fi
%post
/sbin/chkconfig --add ucarp
%preun
if [ $1 -eq 0 ]; then
/sbin/service ucarp stop &>/dev/null || :
/sbin/chkconfig --del ucarp
fi
%postun
if [ $1 -ge 1 ]; then
/sbin/service ucarp condrestart &>/dev/null || :
fi
%files -f %{name}.lang
%defattr(-,root,root,-)
%doc AUTHORS COPYING ChangeLog NEWS README
/etc/rc.d/init.d/ucarp
%attr(0700,root,root) %dir /etc/ucarp/
%config(noreplace) /etc/ucarp/vip-common.conf
/etc/ucarp/vip-001.conf.example
%config(noreplace) %{_libexecdir}/ucarp/
%{_sbindir}/ucarp
%changelog
* Sat Mar 05 2016 Jon Ciesla <limburgher@gmail.com> - 1.5.2-9
- Additional init fix, Petr Poky
* Wed Feb 13 2013 Jon Ciesla <limburgher@gmail.com> - 1.5.2-8
- Additional init fix, Trent Johnson.
* Wed Jan 23 2013 Jon Ciesla <limburgher@gmail.com> - 1.5.2-7
- Dropped MASTER from init, BZ 896576.
* Tue Dec 11 2012 Jon Ciesla <limburgher@gmail.com> - 1.5.2-6
- init fix from Alexander Bostrom, BZ 809421.
* Tue Nov 13 2012 Jon Ciesla <limburgher@gmail.com> - 1.5.2-5
- Additional init fix.
* Mon Nov 12 2012 Jon Ciesla <limburgher@gmail.com> - 1.5.2-4
- Init script fixes from Trent Johnson and Dan Bassett at oreilly.com:
- Changed the get_files function in order to allow file names that don't include the ID.
- Moved config sourcing earlier in the script, allowing the ID parameter to be defined in the config, rather than the filename, if desired.
- Added a MASTER parameter option to the config file, allowing a master node to be selected in a deterministic way using the advskew.
- Added the ability to define the SOURCE_ADDRESS either in the config file, or using IPADDR from the ifcfg-$BIND_INTERFACE file.
* Thu Oct 25 2012 Jon Ciesla <limburgher@gmail.com> - 1.5.2-3.1
- Patch for crash.
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.5.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
* Mon Feb 07 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.5.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
* Wed Apr 28 2010 Jon Ciesla <limb@jcomserv.net> - 1.5.2-1
- New upstream.
- Uses arc4random() if available.
- Avoids adverts that might be twice as what they should be.
- Marked vip-up and vip-down config(noreplace), BZ 586893.
* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.5.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
* Wed Jul 08 2009 Jon Ciesla <limb@jcomserv.net> - 1.5.1-1
- New upstream.
- New option (--nomcast / -M) to use broadcast
- advertisements instead of multicast ones.
* Mon Apr 13 2009 Jon Ciesla <limb@jcomserv.net> - 1.5-1
- Update to 1.5 BZ 458767.
- Added LSB header to init script, BZ 247082.
- New upstream should address BZ 427495, 449266, 455394.
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
* Sun Feb 3 2008 Matthias Saou <http://freshrpms.net/> 1.4-1
- Update to 1.4.
- Rip out all of the "list" stuff and 255.255.255.255 address hack (#427495).
- Change from INITLOG (now deprecated) to LOGGER in the init script.
- Move helper scripts to /usr/libexec/ucarp/.
* Thu Aug 23 2007 Matthias Saou <http://freshrpms.net/> 1.2-9
- Rebuild for new BuildID feature.
* Sun Aug 5 2007 Matthias Saou <http://freshrpms.net/> 1.2-8
- Update License field.
* Fri Feb 2 2007 Matthias Saou <http://freshrpms.net/> 1.2-7
- Rename service from carp to ucarp, to be more consistent.
- Move /etc/sysconfig/carp to /etc/ucarp since it has become a config directory
of its own.
* Wed Nov 29 2006 Matthias Saou <http://freshrpms.net/> 1.2-6
- Rebuild against new libpcap.
* Mon Nov 13 2006 Matthias Saou <http://freshrpms.net/> 1.2-5
- Include all improvements from Denis Ovsienko (#200395).
* Mon Aug 28 2006 Matthias Saou <http://freshrpms.net/> 1.2-4
- FC6 rebuild.
* Tue Aug 22 2006 Matthias Saou <http://freshrpms.net/> 1.2-3
- Update to 1.3 snapshot, which includes the ARP fix, as well as fixes for the
segfaults reported in #200400 and #201596.
- Add autoconf, automake and libtool build reqs for the 1.3 patch.
* Thu Jul 27 2006 Matthias Saou <http://freshrpms.net/> 1.2-3
- Fix init script for recent find versions (#200395).
* Thu Jun 22 2006 Matthias Saou <http://freshrpms.net/> 1.2-2
- Include ARP patch backported from 1.3 snapshot (#196095).
- Make libpcap build requirement conditional to be able to share spec file.
* Wed Jun 21 2006 Matthias Saou <http://freshrpms.net/> 1.2-1
- Update to 1.2.
- BuildRequire libpcap-devel instead of libpcap now that it has been split.
* Mon Mar 6 2006 Matthias Saou <http://freshrpms.net/> 1.1-5
- FC5 rebuild.
* Thu Feb 9 2006 Matthias Saou <http://freshrpms.net/> 1.1-4
- Rebuild for new gcc/glibc.
* Thu Nov 17 2005 Matthias Saou <http://freshrpms.net/> 1.1-3
- Rebuild against new libpcap library.
* Fri Apr 1 2005 Michael Schwendt <mschwendt[AT]users.sf.net> - 1.1-2
- Add %%dir entry for /etc/sysconfig/carp directory.
* Thu Jan 13 2005 Matthias Saou <http://freshrpms.net/> 1.1-1
- Update to 1.1.
- Update source location.
* Fri Jul 9 2004 Matthias Saou <http://freshrpms.net/> 1.0-1
- Initial RPM release.

10
vip-001.conf.example Normal file
View file

@ -0,0 +1,10 @@
# Virtual IP configuration file for UCARP
# The number (from 001 to 255) in the name of the file is the identifier
# In the simple scenario, you want a single virtual IP address from the _same_
# network to be taken over by one of the routers.
VIP_ADDRESS="10.0.0.254"
# In more complex scenarios, check the "vip-common" file for values to override
# and how to add options.

8
vip-common.conf Normal file
View file

@ -0,0 +1,8 @@
# Common VIP settings which can be overridden in individual vip-<nnnn>.conf
PASSWORD="love"
BIND_INTERFACE="eth0"
SOURCE_ADDRESS=""
# If you have extra options to add, see "ucarp --help" output
OPTIONS="--shutdown --preempt"

5
vip-down Executable file
View file

@ -0,0 +1,5 @@
#!/bin/sh
exec 2>/dev/null
/sbin/ip address del "$2"/32 dev "$1"

5
vip-up Executable file
View file

@ -0,0 +1,5 @@
#!/bin/sh
exec 2>/dev/null
/sbin/ip address add "$2"/32 dev "$1"