Compare commits

...
Sign in to create a new pull request.

7 commits

Author SHA1 Message Date
Fedora Release Engineering
8d50380d28 dist-git conversion 2010-07-29 14:36:18 +00:00
Bill Nottingham
cb350f2c42 Fix typo that causes a failure to update the common directory. (releng
#2781)
2009-11-26 01:13:14 +00:00
0e74d86a16 libpcap correction 2009-07-08 17:52:02 +00:00
d00e113cf5 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
199089b4da Initialize branch EL-4 for ucarp 2007-02-26 19:29:08 +00:00
Matthias Saou
e7fa0a80a3 Update. 2005-01-13 18:13:20 +00:00
gafton
0da662cd8b Fix braindead typo from the original import 2004-11-24 05:05:03 +00:00
10 changed files with 293 additions and 84 deletions

View file

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

1
.gitignore vendored Normal file
View file

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

View file

@ -1,21 +0,0 @@
# Makefile for source rpm: ucarp
# $Id$
NAME := ucarp
SPECFILE = $(firstword $(wildcard *.spec))
define find-makefile-common
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
endef
MAKEFILE_COMMON := $(shell $(find-makefile-common))
ifeq ($(MAKEFILE_COMMON),)
# attept a checkout
define checkout-makefile-common
test -f CVS/Rootx && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
endef
MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
endif
include $(MAKEFILE_COMMON)

View file

@ -1 +1 @@
f40451c2d614e00121cbae0b0cbdb832 ucarp-1.0.tar.bz2
5b50ca5553bc520f4e639964c9ad5056 ucarp-1.5.tar.bz2

156
ucarp.init Executable file
View file

@ -0,0 +1,156 @@
#!/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() {
FILES=`find ${CONFDIR} -maxdepth 1 -type f -name 'vip-*.conf' \
-printf "%f\n" | egrep '^vip-[[:digit:]]+\.conf$' | LC_COLLATE="C" sort`
}
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}: "
get_files
if [ -z "${FILES}" ]; then
${LOGGER} "no virtual addresses are configured in ${CONFDIR}"
failure
RETVAL=1
else
for FILE in ${FILES}; do
# Check that the file name gives us an ID between 1 and 255
ID=`echo ${FILE}| sed 's/^vip-\(.*\).conf/\1/'`
if [ ${ID} -lt 1 -o ${ID} -gt 255 ]; then
${LOGGER} "ID out of range (1-255) for ${FILE}, skipped VIP ID ${ID}"
continue
fi
unset PASSWORD BIND_INTERFACE SOURCE_ADDRESS VIP_ADDRESS OPTIONS
# Source ucarp settings
. ${CONFDIR}/vip-common.conf
. ${CONFDIR}/${FILE}
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

View file

@ -1,21 +1,25 @@
# $Id: ucarp.spec,v 1.2 2004/11/09 02:50:54 cvsextras Exp $
Summary: Common Address Redundancy Protocol (CARP) for Unix
Name: ucarp
Version: 1.0
Release: 1.1.fc2.fr
License: BSD
Version: 1.5
Release: 1%{?dist}
# See the COPYING file which details everything
License: MIT and BSD
Group: System Environment/Daemons
URL: http://www.ucarp.org/
Source: http://www.pureftpd.org/ucarp/ucarp-%{version}.tar.bz2
Source1: carp.init
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
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
Requires(post): /sbin/chkconfig
Requires(preun): /sbin/chkconfig, /sbin/service
Requires(postun): /sbin/service
BuildRequires: libpcap, gettext
BuildRequires: gettext
BuildRequires: autoconf, automake, libtool
BuildRequires: libpcap
%description
UCARP allows a couple of hosts to share common virtual IP addresses in order
@ -28,7 +32,7 @@ need for any dedicated extra network link between redundant hosts.
%prep
%setup
%setup -q
%build
@ -38,66 +42,128 @@ need for any dedicated extra network link between redundant hosts.
%install
%{__rm} -rf %{buildroot}
%makeinstall
%{__make} install DESTDIR=%{buildroot}
%find_lang %{name}
# Install the init script
%{__install} -D -m 0755 %{SOURCE1} \
%{buildroot}/etc/rc.d/init.d/carp
%{__install} -D -p -m 0755 %{SOURCE1} \
%{buildroot}/etc/rc.d/init.d/ucarp
# Install the example config file
%{__install} -D -m 0600 %{SOURCE2} \
%{buildroot}/etc/sysconfig/carp/vip-001.conf.example
%{__mkdir_p} %{buildroot}/etc/ucarp
%{__mkdir_p} %{buildroot}%{_libexecdir}/ucarp
# Install trivial interface up/down scripts
%{__cat} << 'EOF' > %{buildroot}/etc/sysconfig/carp/vip-up
#!/bin/sh
# We could use ifup directly, but it complains if the address is already used
#/sbin/ifup $1
. /etc/sysconfig/network-scripts/ifcfg-$1
#exec /sbin/ip addr add ${IPADDR}/${NETMASK} dev "$1"
exec /sbin/ifconfig $1 ${IPADDR} netmask ${NETMASK} up
EOF
%{__cat} << 'EOF' > %{buildroot}/etc/sysconfig/carp/vip-down
#!/bin/sh
#. /etc/sysconfig/network-scripts/ifcfg-$1
#exec /sbin/ip addr del ${IPADDR}/${NETMASK} dev "$1"
exec /sbin/ifconfig $1 down
EOF
# 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}
%post
if [ $1 -eq 1 ]; then
/sbin/chkconfig --add carp
%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 carp stop >/dev/null 2>&1 || :
/sbin/chkconfig --del carp
/sbin/service ucarp stop &>/dev/null || :
/sbin/chkconfig --del ucarp
fi
%postun
if [ $1 -ge 1 ]; then
/sbin/service carp condrestart >/dev/null 2>&1 || :
/sbin/service ucarp condrestart &>/dev/null || :
fi
%files -f %{name}.lang
%defattr(-, root, root, 0755)
%doc AUTHORS COPYING ChangeLog NEWS README examples/linux/*.sh
/etc/rc.d/init.d/carp
/etc/sysconfig/carp/vip-001.conf.example
%attr(0700, root, root) %config(noreplace) /etc/sysconfig/carp/vip-up
%attr(0700, root, root) %config(noreplace) /etc/sysconfig/carp/vip-down
%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
%{_libexecdir}/ucarp/
%{_sbindir}/ucarp
%changelog
* 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.

View file

@ -1,20 +1,10 @@
# Virtual IP configuration file for UCARP
# The number (from 001 to 255) in the name of the file is the identifier
# $Id: vip-001.conf.example,v 1.1 2004/11/09 02:50:47 cvsextras Exp $
# Set the same password on all mamchines sharing the same virtual IP
PASSWORD="love"
# 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"
# You are required to have an IPADDR= line in the configuration file for
# this interface (so no DHCP allowed)
BIND_INTERFACE="eth0"
# Do *NOT* use a main interface for the virtual IP, use an ethX:Y alias
# with the corresponding /etc/sysconfig/network-scripts/ifcfg-ethX:Y file
# already configured and ith ONBOOT=no
VIP_INTERFACE="eth0:0"
# If you have extra options to add, see "ucarp --help" output
# (the lower the "-k <val>" the higher priority and "-P" to become master ASAP)
OPTIONS="-k 128 -P"
# 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"