Compare commits
14 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e32f6856cc | ||
|
|
276eb0ed91 | ||
|
|
cefbbddf70 | ||
|
|
75699e39a1 | ||
|
|
a7ebf46a06 | ||
|
|
d35b22d992 | ||
|
|
260c67d495 | ||
|
|
0c874fff02 | ||
|
|
5bd1639fff | ||
|
|
66b37a3607 | ||
|
|
fe164757d1 | ||
| 50241ca4ee | |||
|
|
e7fa0a80a3 | ||
|
|
0da662cd8b |
7 changed files with 1967 additions and 1 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
ucarp-1.2.tar.bz2
|
||||
143
carp.init
Executable file
143
carp.init
Executable file
|
|
@ -0,0 +1,143 @@
|
|||
#!/bin/bash
|
||||
# $Id: carp.init,v 1.3 2006/08/22 13:08:17 thias Exp $
|
||||
#
|
||||
# chkconfig: - 91 09
|
||||
# description: Starts and stops ucarp. \
|
||||
# used to provide common address redundancy.
|
||||
|
||||
# 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 /etc/sysconfig/carp -maxdepth 1 -type f -name 'vip-*.conf' \
|
||||
-printf "%f\n" | LC_COLLATE="C" sort`
|
||||
}
|
||||
|
||||
prog=$"common address redundancy protocol daemon"
|
||||
RETVAL=0
|
||||
|
||||
start() {
|
||||
echo -n $"Starting ${prog}: "
|
||||
|
||||
get_files
|
||||
|
||||
if [ -z "${FILES}" ]; then
|
||||
failure $"no virtual addresses are configured in /etc/sysconfig/carp/"
|
||||
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
|
||||
initlog $INITLOG_ARGS -n carp -s "configuration file name ${FILE} gave us a bad ID of ${ID}:" -e 2
|
||||
RETVAL=1
|
||||
break
|
||||
fi
|
||||
|
||||
# Source ucarp settings
|
||||
. /etc/sysconfig/carp/${FILE}
|
||||
|
||||
# Check that we have the ifcfg-<if> file for the main interface
|
||||
if [ -f /etc/sysconfig/network-scripts/ifcfg-${BIND_INTERFACE} ]; then
|
||||
. /etc/sysconfig/network-scripts/ifcfg-${BIND_INTERFACE}
|
||||
else
|
||||
initlog $INITLOG_ARGS -n carp -s $"no ifcfg-${BIND_INTERFACE} file found for carp ${FILE} configuration:" -e 2
|
||||
RETVAL=1
|
||||
break
|
||||
fi
|
||||
# Check that the ifcfg-<if> file does have an IPADDR
|
||||
BIND_ADDRESS=${IPADDR}
|
||||
if [ -z "${BIND_ADDRESS}" ]; then
|
||||
initlog $INITLOG_ARGS -n carp -s $"no IPADDR found in interface file ifcfg-${BIND_INTERFACE}:" -e 2
|
||||
RETVAL=1
|
||||
break
|
||||
fi
|
||||
|
||||
# Check that we have the ifcfg-<if> file for the virtual interface
|
||||
if [ -f /etc/sysconfig/network-scripts/ifcfg-${VIP_INTERFACE} ]; then
|
||||
. /etc/sysconfig/network-scripts/ifcfg-${VIP_INTERFACE}
|
||||
else
|
||||
initlog $INITLOG_ARGS -n carp -s $"no ifcfg-${VIP_INTERFACE} file found for carp ${FILE} configuration:" -e 2
|
||||
RETVAL=1
|
||||
break
|
||||
fi
|
||||
# Check that the ifcfg-<if> file does have an IPADDR
|
||||
VIP_ADDRESS=${IPADDR}
|
||||
if [ -z "${VIP_ADDRESS}" ]; then
|
||||
initlog $INITLOG_ARGS -n carp -s "no IPADDR found in interface file ifcfg-${VIP_INTERFACE}:" -e 2
|
||||
RETVAL=1
|
||||
break
|
||||
fi
|
||||
|
||||
daemon /usr/sbin/ucarp -v ${ID} -p ${PASSWORD} -s ${BIND_ADDRESS} -a ${VIP_ADDRESS} -i ${VIP_INTERFACE} ${OPTIONS} -B --upscript=/etc/sysconfig/carp/vip-up --downscript=/etc/sysconfig/carp/vip-down
|
||||
LAUNCH_RETVAL=$?
|
||||
[ ${LAUNCH_RETVAL} -ne 0 ] && RETVAL=1
|
||||
done
|
||||
[ "${RETVAL}" -ne 0 ] && failure $"error in one or more of the carp configurations, see above:"
|
||||
fi
|
||||
echo
|
||||
[ "$RETVAL" -eq 0 ] && touch /var/lock/subsys/carp
|
||||
}
|
||||
|
||||
stop() {
|
||||
echo -n $"Shutting down $prog: "
|
||||
killproc /usr/sbin/ucarp
|
||||
RETVAL=$?
|
||||
|
||||
# We put all interfaces managed by ucarp down when stopping the service
|
||||
# to avoid conflicting "leftovers"
|
||||
|
||||
get_files
|
||||
|
||||
[ ! -z "${FILES}" ] && \
|
||||
for FILE in ${FILES}; do
|
||||
|
||||
# Source ucarp settings
|
||||
. /etc/sysconfig/carp/${FILE}
|
||||
|
||||
# Check that we have the ifcfg-<if> file for the virtual interface
|
||||
if [ -f /etc/sysconfig/network-scripts/ifcfg-${VIP_INTERFACE} ]; then
|
||||
if /sbin/ifconfig ${VIP_INTERFACE} down >/dev/null 2>&1; then
|
||||
initlog $INITLOG_ARGS -n carp -s $"bringing down carp managed interface ${VIP_INTERFACE}:" -e 1
|
||||
else
|
||||
initlog $INITLOG_ARGS -n carp -s $"bringing down carp managed interface ${VIP_INTERFACE}:" -e 2
|
||||
fi
|
||||
fi
|
||||
done
|
||||
echo
|
||||
[ "$RETVAL" -eq 0 ] && rm -f /var/lock/subsys/carp
|
||||
}
|
||||
|
||||
# See how we were called.
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
restart|reload)
|
||||
stop
|
||||
start
|
||||
;;
|
||||
condrestart)
|
||||
if [ -f /var/lock/subsys/carp ]; then
|
||||
stop
|
||||
start
|
||||
fi
|
||||
;;
|
||||
status)
|
||||
status /usr/sbin/ucarp
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $RETVAL
|
||||
|
|
@ -1 +0,0 @@
|
|||
Dead upstream, old website NSFW
|
||||
1
sources
Normal file
1
sources
Normal file
|
|
@ -0,0 +1 @@
|
|||
bed7ae84520f2e0faf3e68e9cfe4e1aa ucarp-1.2.tar.bz2
|
||||
1656
ucarp-1.3-pre.patch
Normal file
1656
ucarp-1.3-pre.patch
Normal file
File diff suppressed because it is too large
Load diff
146
ucarp.spec
Normal file
146
ucarp.spec
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
Summary: Common Address Redundancy Protocol (CARP) for Unix
|
||||
Name: ucarp
|
||||
Version: 1.2
|
||||
Release: 4%{?dist}
|
||||
License: BSD
|
||||
Group: System Environment/Daemons
|
||||
URL: http://www.ucarp.org/
|
||||
Source0: http://download.pureftpd.org/pub/ucarp/ucarp-%{version}.tar.bz2
|
||||
Source1: carp.init
|
||||
Source2: vip-001.conf.example
|
||||
Patch0: ucarp-1.3-pre.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
|
||||
# Use libpcap up to FC5, and libpcap-devel for FC6+ and non-Fedora
|
||||
%if %{!?fedora:6}%{?fedora} >= 6
|
||||
BuildRequires: libpcap-devel
|
||||
%else
|
||||
BuildRequires: libpcap
|
||||
%endif
|
||||
|
||||
|
||||
%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
|
||||
%patch -p1
|
||||
|
||||
|
||||
%build
|
||||
%configure
|
||||
%{__make} %{?_smp_mflags}
|
||||
|
||||
|
||||
%install
|
||||
%{__rm} -rf %{buildroot}
|
||||
%makeinstall
|
||||
%find_lang %{name}
|
||||
|
||||
# Install the init script
|
||||
%{__install} -D -m 0755 %{SOURCE1} \
|
||||
%{buildroot}/etc/rc.d/init.d/carp
|
||||
|
||||
# Install the example config file
|
||||
%{__install} -D -m 0600 %{SOURCE2} \
|
||||
%{buildroot}/etc/sysconfig/carp/vip-001.conf.example
|
||||
|
||||
# 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
|
||||
|
||||
|
||||
%clean
|
||||
%{__rm} -rf %{buildroot}
|
||||
|
||||
|
||||
%post
|
||||
if [ $1 -eq 1 ]; then
|
||||
/sbin/chkconfig --add carp
|
||||
fi
|
||||
|
||||
%preun
|
||||
if [ $1 -eq 0 ]; then
|
||||
/sbin/service carp stop >/dev/null 2>&1 || :
|
||||
/sbin/chkconfig --del carp
|
||||
fi
|
||||
|
||||
%postun
|
||||
if [ $1 -ge 1 ]; then
|
||||
/sbin/service carp condrestart >/dev/null 2>&1 || :
|
||||
fi
|
||||
|
||||
|
||||
%files -f %{name}.lang
|
||||
%defattr(-, root, root, 0755)
|
||||
%doc AUTHORS COPYING ChangeLog NEWS README examples/linux/*.sh
|
||||
/etc/rc.d/init.d/carp
|
||||
%dir /etc/sysconfig/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
|
||||
%{_sbindir}/ucarp
|
||||
|
||||
|
||||
%changelog
|
||||
* 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.
|
||||
|
||||
20
vip-001.conf.example
Normal file
20
vip-001.conf.example
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
# 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.2 2006/06/22 10:05:17 thias Exp $
|
||||
|
||||
# Set the same password on all mamchines sharing the same virtual IP
|
||||
PASSWORD="love"
|
||||
|
||||
# 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"
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue