diff --git a/.gitignore b/.gitignore index 23c53b8..7664a05 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -ucarp-1.5.2.tar.bz2 +ucarp-1.2.tar.bz2 diff --git a/ucarp-1.5.2-sighup.patch b/ucarp-1.5.2-sighup.patch new file mode 100644 index 0000000..8135233 --- /dev/null +++ b/ucarp-1.5.2-sighup.patch @@ -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); + } diff --git a/ucarp.init b/ucarp.init index c7f6296..1abb550 100755 --- a/ucarp.init +++ b/ucarp.init @@ -21,11 +21,14 @@ . /etc/sysconfig/network # Check that networking is up. -[ ${NETWORKING} = "no" ] && exit 0 +[ "${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` + local FILE + cd ${CONFDIR} + for FILE in *.conf + do [ "${FILE}" != "vip-common.conf" ] && echo -n "${FILE} " + done } prog=$"common address redundancy protocol daemon" @@ -40,7 +43,7 @@ start() { echo -n $"Starting ${prog}: " - get_files + FILES=`get_files` if [ -z "${FILES}" ]; then ${LOGGER} "no virtual addresses are configured in ${CONFDIR}" @@ -48,17 +51,43 @@ start() { 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/'` + + 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 - 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 diff --git a/ucarp.spec b/ucarp.spec index 140d261..ad4a91b 100644 --- a/ucarp.spec +++ b/ucarp.spec @@ -1,7 +1,7 @@ Summary: Common Address Redundancy Protocol (CARP) for Unix Name: ucarp Version: 1.5.2 -Release: 3%{?dist} +Release: 9%{?dist} # See the COPYING file which details everything License: MIT and BSD Group: System Environment/Daemons @@ -13,6 +13,7 @@ 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 @@ -34,6 +35,7 @@ need for any dedicated extra network link between redundant hosts. %prep %setup -q +%patch0 -p0 %build %configure @@ -98,6 +100,31 @@ fi %{_sbindir}/ucarp %changelog +* Sat Mar 05 2016 Jon Ciesla - 1.5.2-9 +- Additional init fix, Petr Poky + +* Wed Feb 13 2013 Jon Ciesla - 1.5.2-8 +- Additional init fix, Trent Johnson. + +* Wed Jan 23 2013 Jon Ciesla - 1.5.2-7 +- Dropped MASTER from init, BZ 896576. + +* Tue Dec 11 2012 Jon Ciesla - 1.5.2-6 +- init fix from Alexander Bostrom, BZ 809421. + +* Tue Nov 13 2012 Jon Ciesla - 1.5.2-5 +- Additional init fix. + +* Mon Nov 12 2012 Jon Ciesla - 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 - 1.5.2-3.1 +- Patch for crash. + * Sat Jan 14 2012 Fedora Release Engineering - 1.5.2-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild