keepalived-1.1.16 v1.1.16
authorAlexandre Cassen <acassen@freebox.fr>
Sun, 15 Feb 2009 21:48:47 +0000 (22:48 +0100)
committerAlexandre Cassen <acassen@freebox.fr>
Mon, 28 Sep 2009 08:59:02 +0000 (10:59 +0200)
* keepalived-1.1.16 released.
* Code clean-up.
* Stefan Rompf, <stefan@loplof.de> extended scheduler to
  synchronize signal handling by sending the signal number through
  a self pipe, making signals select()able. Child reaping has been
  moved to a simple signal synchronous signal handler. Signal
  shutdown handling has been centralized.
* Denis Ovsienko, <pilot@etcnet.org> extended healthchecker
  framework to support alpha/omega design. It provides virtual
  service control in a more fine-graned maner. You may have a
  look to the SYNOPSIS file to have full picture on configation.
  It addresses the following issues :
  - A virtual service is considered up even with an empty RS pool.
  - There is no reliable mean to avoid service regression, when
    the server pool becomes too small.
  - There is no mean to escalate any of the above fault/recovery
    events.
  - Real servers are assumed alive initially. This leads to
    unnecessary state flap on keepalived start.
  - notify_down isn't executed for working real servers on
    keepalived shutdown.
  - There is no reliable mean to handle keepalived stop to move
    the virtual service over another load balancer.
* Stephan Mayr, <Mayr.Stefan@swm.de> fixed default value for
  checker loop... a missing TIMER_HZ.
* Merge keepalived.init.suse.
* Robin Garner, <robin.garner@scu.edu.au> added support to
  --log-console facility.
* Tobias Klausmann, <klausman@schwarzvogel.de> fixed an openfile
  leak while performing reload.
* Leo Baltus, <Leo.Baltus@omroep.nl> extended pidfile handling
  to allow keepalived to start using configurated pidfile.
* VRRP : Siim Poder, <siim@p6drad-teel.net> fixed IPSEC AH auth
  to skip IPv4 id field of zero. If zeroed kernel will fill it
  and lead to an unwanted protocol re-election.
* VRRP : Siim Poder, <siim@p6drad-teel.net> fixed reloading issue.
  New ip addresses are added (from configuration). State is kept
  instead of starting from whatever is in configuration file.
  If prios are changed in such a way, state change can occur after
  reload.
* VRRP : Vincent Bernat, <bernat@luffy.cx> extended virtual_route
  to support virtual "black hole" route as well as multihop route.
* VRRP : Stig Thormodsrud, <stig@vyatta.com> fixed a crash while
  using virtual_router_id set to 255.
* VRRP: Jon DeVree, <jadevree@arbor.net> fixed arp handling to
  to initialize the target hardware address, using 0xff as found
  in arping. Let scripts work without dealing with weight, if the
  script fails, VRRP fails.
* VRRP : Pierre-Yves Ritschard, <pierre-yves@spootnik.org> removed
  the GOTO_FAULT state from FSM.
* VRRP : Willy Tarreau, <w@1wt.eu> fixed link detection handling
  to support right ioctl values for recent kernel ! It can lead
  to issue while running instance on a bonding interface.
* VRRP : Willy Tarreau, <w@1wt.eu> extended scheduler to catch
  time drift. It implements an internal monotonic clock. It
  maintains an offset between sysclock and monotonic clock, if
  computed time if anterior to monotonic time then just update
  offset. If time computed if fare away into the future then
  limit delay and recompute offset.
* VRRP : Willy Tarreau, <w@1wt.eu> fixed autoconf issues.

118 files changed:
ChangeLog
Makefile.in
VERSION
configure
configure.in
doc/keepalived.conf.SYNOPSIS
doc/man/man5/keepalived.conf.5
doc/samples/keepalived.conf.quorum [new file with mode: 0644]
doc/samples/keepalived.conf.vrrp.routes
genhash/Makefile.in
genhash/http.c
genhash/http.h
genhash/layer4.c
genhash/layer4.h
genhash/main.c
genhash/main.h
genhash/sock.c
genhash/sock.h
genhash/ssl.c
genhash/ssl.h
keepalived/Makefile.in
keepalived/check/Makefile.in
keepalived/check/check_api.c
keepalived/check/check_daemon.c
keepalived/check/check_data.c
keepalived/check/check_http.c
keepalived/check/check_misc.c
keepalived/check/check_parser.c
keepalived/check/check_smtp.c
keepalived/check/check_ssl.c
keepalived/check/check_tcp.c
keepalived/check/ipfwwrapper.c
keepalived/check/ipvswrapper.c
keepalived/check/ipwrapper.c
keepalived/core/Makefile.in
keepalived/core/daemon.c
keepalived/core/global_data.c
keepalived/core/global_parser.c
keepalived/core/layer4.c
keepalived/core/main.c
keepalived/core/pidfile.c
keepalived/core/smtp.c
keepalived/etc/init.d/keepalived.suse.init [new file with mode: 0644]
keepalived/include/check_api.h
keepalived/include/check_daemon.h
keepalived/include/check_data.h
keepalived/include/check_http.h
keepalived/include/check_misc.h
keepalived/include/check_parser.h
keepalived/include/check_smtp.h
keepalived/include/check_ssl.h
keepalived/include/check_tcp.h
keepalived/include/config.h.in
keepalived/include/daemon.h
keepalived/include/global_data.h
keepalived/include/global_parser.h
keepalived/include/ipfwwrapper.h
keepalived/include/ipvswrapper.h
keepalived/include/ipwrapper.h
keepalived/include/layer4.h
keepalived/include/main.h
keepalived/include/pidfile.h
keepalived/include/smtp.h
keepalived/include/vrrp.h
keepalived/include/vrrp_arp.h
keepalived/include/vrrp_daemon.h
keepalived/include/vrrp_data.h
keepalived/include/vrrp_if.h
keepalived/include/vrrp_index.h
keepalived/include/vrrp_ipaddress.h
keepalived/include/vrrp_iproute.h
keepalived/include/vrrp_ipsecah.h
keepalived/include/vrrp_netlink.h
keepalived/include/vrrp_notify.h
keepalived/include/vrrp_parser.h
keepalived/include/vrrp_scheduler.h
keepalived/include/vrrp_sync.h
keepalived/include/vrrp_track.h
keepalived/libipfwc/Makefile [new file with mode: 0644]
keepalived/vrrp/Makefile.in
keepalived/vrrp/vrrp.c
keepalived/vrrp/vrrp_arp.c
keepalived/vrrp/vrrp_daemon.c
keepalived/vrrp/vrrp_data.c
keepalived/vrrp/vrrp_if.c
keepalived/vrrp/vrrp_index.c
keepalived/vrrp/vrrp_ipaddress.c
keepalived/vrrp/vrrp_iproute.c
keepalived/vrrp/vrrp_ipsecah.c
keepalived/vrrp/vrrp_netlink.c
keepalived/vrrp/vrrp_notify.c
keepalived/vrrp/vrrp_parser.c
keepalived/vrrp/vrrp_scheduler.c
keepalived/vrrp/vrrp_sync.c
keepalived/vrrp/vrrp_track.c
lib/Makefile.in
lib/html.c
lib/html.h
lib/list.c
lib/list.h
lib/logger.c [new file with mode: 0644]
lib/logger.h [new file with mode: 0644]
lib/memory.c
lib/memory.h
lib/notify.c
lib/notify.h
lib/parser.c
lib/parser.h
lib/scheduler.c
lib/scheduler.h
lib/signals.c
lib/signals.h
lib/timer.c
lib/timer.h
lib/utils.c
lib/utils.h
lib/vector.c
lib/vector.h

index 25c3206..ab30547 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,65 @@
+2009-02-15  Alexandre Cassen  <acassen@linux-vs.org>
+       * keepalived-1.1.16 released.
+       * Code clean-up.
+       * Stefan Rompf, <stefan@loplof.de> extended scheduler to
+         synchronize signal handling by sending the signal number through
+         a self pipe, making signals select()able. Child reaping has been
+         moved to a simple signal synchronous signal handler. Signal
+         shutdown handling has been centralized.
+       * Denis Ovsienko, <pilot@etcnet.org> extended healthchecker
+         framework to support alpha/omega design. It provides virtual
+         service control in a more fine-graned maner. You may have a
+         look to the SYNOPSIS file to have full picture on configation.
+         It addresses the following issues :
+         - A virtual service is considered up even with an empty RS pool.
+         - There is no reliable mean to avoid service regression, when
+           the server pool becomes too small.
+         - There is no mean to escalate any of the above fault/recovery
+           events.
+         - Real servers are assumed alive initially. This leads to
+           unnecessary state flap on keepalived start.
+         - notify_down isn't executed for working real servers on
+           keepalived shutdown.
+         - There is no reliable mean to handle keepalived stop to move
+           the virtual service over another load balancer.
+       * Stephan Mayr, <Mayr.Stefan@swm.de> fixed default value for
+         checker loop... a missing TIMER_HZ.
+       * Merge keepalived.init.suse.
+       * Robin Garner, <robin.garner@scu.edu.au> added support to
+         --log-console facility.
+       * Tobias Klausmann, <klausman@schwarzvogel.de> fixed an openfile
+         leak while performing reload.
+       * Leo Baltus, <Leo.Baltus@omroep.nl> extended pidfile handling
+         to allow keepalived to start using configurated pidfile.
+       * VRRP : Siim Poder, <siim@p6drad-teel.net> fixed IPSEC AH auth
+         to skip IPv4 id field of zero. If zeroed kernel will fill it
+         and lead to an unwanted protocol re-election.
+       * VRRP : Siim Poder, <siim@p6drad-teel.net> fixed reloading issue.
+         New ip addresses are added (from configuration). State is kept
+         instead of starting from whatever is in configuration file.
+         If prios are changed in such a way, state change can occur after
+         reload.
+       * VRRP : Vincent Bernat, <bernat@luffy.cx> extended virtual_route
+         to support virtual "black hole" route as well as multihop route.
+       * VRRP : Stig Thormodsrud, <stig@vyatta.com> fixed a crash while
+         using virtual_router_id set to 255.
+       * VRRP: Jon DeVree, <jadevree@arbor.net> fixed arp handling to
+         to initialize the target hardware address, using 0xff as found
+         in arping. Let scripts work without dealing with weight, if the
+         script fails, VRRP fails.
+       * VRRP : Pierre-Yves Ritschard, <pierre-yves@spootnik.org> removed
+         the GOTO_FAULT state from FSM.
+       * VRRP : Willy Tarreau, <w@1wt.eu> fixed link detection handling
+         to support right ioctl values for recent kernel ! It can lead
+         to issue while running instance on a bonding interface.
+       * VRRP : Willy Tarreau, <w@1wt.eu> extended scheduler to catch
+         time drift. It implements an internal monotonic clock. It
+         maintains an offset between sysclock and monotonic clock, if
+         computed time if anterior to monotonic time then just update
+         offset. If time computed if fare away into the future then
+         limit delay and recompute offset.
+       * VRRP : Willy Tarreau, <w@1wt.eu> fixed autoconf issues.
+
 2007-09-15  Alexandre Cassen  <acassen@linux-vs.org>
        * keepalived-1.1.15 released.
        * Matthias Saou, <matthias at rpmforge.net> fixed genhash
index 88832bc..8d155eb 100644 (file)
@@ -2,7 +2,7 @@
 #
 # Keepalived OpenSource project.
 #
-# Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
+# Copyright (C) 2001-2009 Alexandre Cassen, <acassen@linux-vs.org>
 
 TARFILES = AUTHOR bin ChangeLog configure configure.in CONTRIBUTORS COPYING \
           doc genhash INSTALL install-sh keepalived keepalived.spec.in lib Makefile.in \
diff --git a/VERSION b/VERSION
index 645377e..63b283b 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.1.15
+1.1.16
index 3b6a43d..55ebd43 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,25 +1,54 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59.
+# Generated by GNU Autoconf 2.61.
 #
-# Copyright (C) 2003 Free Software Foundation, Inc.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
 # This configure script is free software; the Free Software Foundation
 # gives unlimited permission to copy, distribute and modify it.
 ## --------------------- ##
 ## M4sh Initialization.  ##
 ## --------------------- ##
 
-# Be Bourne compatible
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
   emulate sh
   NULLCMD=:
   # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
   # is contrary to our usage.  Disable this feature.
   alias -g '${1+"$@"}'='"$@"'
-elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
-  set -o posix
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in
+  *posix*) set -o posix ;;
+esac
+
+fi
+
+
+
+
+# PATH needs CR
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
 fi
-DUALCASE=1; export DUALCASE # for MKS sh
 
 # Support unset when possible.
 if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
@@ -29,8 +58,43 @@ else
 fi
 
 
+# IFS
+# We need space, tab and new line, in precisely that order.  Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+as_nl='
+'
+IFS=" ""       $as_nl"
+
+# Find who we are.  Look in the path if we contain no directory separator.
+case $0 in
+  *[\\/]* ) as_myself=$0 ;;
+  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+IFS=$as_save_IFS
+
+     ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+  as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+  echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+  { (exit 1); exit 1; }
+fi
+
 # Work around bugs in pre-3.0 UWIN ksh.
-$as_unset ENV MAIL MAILPATH
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
 PS1='$ '
 PS2='> '
 PS4='+ '
@@ -44,18 +108,19 @@ do
   if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
     eval $as_var=C; export $as_var
   else
-    $as_unset $as_var
+    ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
   fi
 done
 
 # Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1; then
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
   as_expr=expr
 else
   as_expr=false
 fi
 
-if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
   as_basename=basename
 else
   as_basename=false
@@ -63,157 +128,388 @@ fi
 
 
 # Name of the executable.
-as_me=`$as_basename "$0" ||
+as_me=`$as_basename -- "$0" ||
 $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
         X"$0" : 'X\(//\)$' \| \
-        X"$0" : 'X\(/\)$' \| \
-        .     : '\(.\)' 2>/dev/null ||
+        X"$0" : 'X\(/\)' \| . 2>/dev/null ||
 echo X/"$0" |
-    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
-         /^X\/\(\/\/\)$/{ s//\1/; q; }
-         /^X\/\(\/\).*/{ s//\1/; q; }
-         s/.*/./; q'`
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
+           s//\1/
+           q
+         }
+         /^X\/\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\/\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
 
+# CDPATH.
+$as_unset CDPATH
 
-# PATH needs CR, and LINENO needs CR and PATH.
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
 
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
-  echo "#! /bin/sh" >conf$$.sh
-  echo  "exit 0"   >>conf$$.sh
-  chmod +x conf$$.sh
-  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
-    PATH_SEPARATOR=';'
-  else
-    PATH_SEPARATOR=:
-  fi
-  rm -f conf$$.sh
+if test "x$CONFIG_SHELL" = x; then
+  if (eval ":") 2>/dev/null; then
+  as_have_required=yes
+else
+  as_have_required=no
 fi
 
+  if test $as_have_required = yes &&    (eval ":
+(as_func_return () {
+  (exit \$1)
+}
+as_func_success () {
+  as_func_return 0
+}
+as_func_failure () {
+  as_func_return 1
+}
+as_func_ret_success () {
+  return 0
+}
+as_func_ret_failure () {
+  return 1
+}
 
-  as_lineno_1=$LINENO
-  as_lineno_2=$LINENO
-  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
-  test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
-  # Find who we are.  Look in the path if we contain no path at all
-  # relative or not.
-  case $0 in
-    *[\\/]* ) as_myself=$0 ;;
-    *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
+exitcode=0
+if as_func_success; then
+  :
+else
+  exitcode=1
+  echo as_func_success failed.
+fi
 
-       ;;
-  esac
-  # We did not find ourselves, most probably we were run as `sh COMMAND'
-  # in which case we are not to be found in the path.
-  if test "x$as_myself" = x; then
-    as_myself=$0
-  fi
-  if test ! -f "$as_myself"; then
-    { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
-   { (exit 1); exit 1; }; }
-  fi
-  case $CONFIG_SHELL in
-  '')
+if as_func_failure; then
+  exitcode=1
+  echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+  :
+else
+  exitcode=1
+  echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+  exitcode=1
+  echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+  :
+else
+  exitcode=1
+  echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0) || { (exit 1); exit 1; }
+
+(
+  as_lineno_1=\$LINENO
+  as_lineno_2=\$LINENO
+  test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
+  test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
+") 2> /dev/null; then
+  :
+else
+  as_candidate_shells=
     as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for as_base in sh bash ksh sh5; do
-        case $as_dir in
+  case $as_dir in
         /*)
-          if ("$as_dir/$as_base" -c '
+          for as_base in sh bash ksh sh5; do
+            as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
+          done;;
+       esac
+done
+IFS=$as_save_IFS
+
+
+      for as_shell in $as_candidate_shells $SHELL; do
+        # Try only shells that exist, to save several forks.
+        if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+               { ("$as_shell") 2> /dev/null <<\_ASEOF
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in
+  *posix*) set -o posix ;;
+esac
+
+fi
+
+
+:
+_ASEOF
+}; then
+  CONFIG_SHELL=$as_shell
+              as_have_required=yes
+              if { "$as_shell" 2> /dev/null <<\_ASEOF
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in
+  *posix*) set -o posix ;;
+esac
+
+fi
+
+
+:
+(as_func_return () {
+  (exit $1)
+}
+as_func_success () {
+  as_func_return 0
+}
+as_func_failure () {
+  as_func_return 1
+}
+as_func_ret_success () {
+  return 0
+}
+as_func_ret_failure () {
+  return 1
+}
+
+exitcode=0
+if as_func_success; then
+  :
+else
+  exitcode=1
+  echo as_func_success failed.
+fi
+
+if as_func_failure; then
+  exitcode=1
+  echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+  :
+else
+  exitcode=1
+  echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+  exitcode=1
+  echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = "$1" ); then
+  :
+else
+  exitcode=1
+  echo positional parameters were not saved.
+fi
+
+test $exitcode = 0) || { (exit 1); exit 1; }
+
+(
   as_lineno_1=$LINENO
   as_lineno_2=$LINENO
-  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
   test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
-            $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
-            $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
-            CONFIG_SHELL=$as_dir/$as_base
-            export CONFIG_SHELL
-            exec "$CONFIG_SHELL" "$0" ${1+"$@"}
-          fi;;
-        esac
-       done
-done
-;;
-  esac
+  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
+
+_ASEOF
+}; then
+  break
+fi
+
+fi
+
+      done
+
+      if test "x$CONFIG_SHELL" != x; then
+  for as_var in BASH_ENV ENV
+        do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+        done
+        export CONFIG_SHELL
+        exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+fi
+
+
+    if test $as_have_required = no; then
+  echo This script requires a shell more modern than all the
+      echo shells that I found on your system.  Please install a
+      echo modern shell, or manually run the script under such a
+      echo shell if you do have one.
+      { (exit 1); exit 1; }
+fi
+
+
+fi
+
+fi
+
+
+
+(eval "as_func_return () {
+  (exit \$1)
+}
+as_func_success () {
+  as_func_return 0
+}
+as_func_failure () {
+  as_func_return 1
+}
+as_func_ret_success () {
+  return 0
+}
+as_func_ret_failure () {
+  return 1
+}
+
+exitcode=0
+if as_func_success; then
+  :
+else
+  exitcode=1
+  echo as_func_success failed.
+fi
+
+if as_func_failure; then
+  exitcode=1
+  echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+  :
+else
+  exitcode=1
+  echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+  exitcode=1
+  echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+  :
+else
+  exitcode=1
+  echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0") || {
+  echo No shell found that supports shell functions.
+  echo Please tell autoconf@gnu.org about your system,
+  echo including any error possibly output before this
+  echo message
+}
+
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
 
   # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
   # uniformly replaced by the line number.  The first 'sed' inserts a
-  # line-number line before each line; the second 'sed' does the real
-  # work.  The second script uses 'N' to pair each line-number line
-  # with the numbered line, and appends trailing '-' during
-  # substitution so that $LINENO is not a special case at line end.
+  # line-number line after each line using $LINENO; the second 'sed'
+  # does the real work.  The second script uses 'N' to pair each
+  # line-number line with the line containing $LINENO, and appends
+  # trailing '-' during substitution so that $LINENO is not a special
+  # case at line end.
   # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
-  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
-  sed '=' <$as_myself |
+  # scripts with optimization help from Paolo Bonzini.  Blame Lee
+  # E. McMahon (1931-1989) for sed's syntax.  :-)
+  sed -n '
+    p
+    /[$]LINENO/=
+  ' <$as_myself |
     sed '
+      s/[$]LINENO.*/&-/
+      t lineno
+      b
+      :lineno
       N
-      s,$,-,
-      : loop
-      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+      :loop
+      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
       t loop
-      s,-$,,
-      s,^['$as_cr_digits']*\n,,
+      s/-\n.*//
     ' >$as_me.lineno &&
-  chmod +x $as_me.lineno ||
+  chmod +x "$as_me.lineno" ||
     { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
    { (exit 1); exit 1; }; }
 
   # Don't try to exec as it changes $[0], causing all sort of problems
   # (the dirname of $[0] is not the place where we might find the
-  # original and so on.  Autoconf is especially sensible to this).
-  . ./$as_me.lineno
+  # original and so on.  Autoconf is especially sensitive to this).
+  . "./$as_me.lineno"
   # Exit status is that of the last command.
   exit
 }
 
 
-case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
-  *c*,-n*) ECHO_N= ECHO_C='
-' ECHO_T='     ' ;;
-  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
-  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+  case `echo 'x\c'` in
+  *c*) ECHO_T='        ';;     # ECHO_T is single tab character.
+  *)   ECHO_C='\c';;
+  esac;;
+*)
+  ECHO_N='-n';;
 esac
 
-if expr a : '\(a\)' >/dev/null 2>&1; then
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
   as_expr=expr
 else
   as_expr=false
 fi
 
 rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+  rm -f conf$$.dir/conf$$.file
+else
+  rm -f conf$$.dir
+  mkdir conf$$.dir
+fi
 echo >conf$$.file
 if ln -s conf$$.file conf$$ 2>/dev/null; then
-  # We could just check for DJGPP; but this test a) works b) is more generic
-  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
-  if test -f conf$$.exe; then
-    # Don't use ln at all; we don't have any links
+  as_ln_s='ln -s'
+  # ... but there are two gotchas:
+  # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+  # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+  # In both cases, we have to default to `cp -p'.
+  ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
     as_ln_s='cp -p'
-  else
-    as_ln_s='ln -s'
-  fi
 elif ln conf$$.file conf$$ 2>/dev/null; then
   as_ln_s=ln
 else
   as_ln_s='cp -p'
 fi
-rm -f conf$$ conf$$.exe conf$$.file
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
 
 if mkdir -p . 2>/dev/null; then
   as_mkdir_p=:
@@ -222,7 +518,28 @@ else
   as_mkdir_p=false
 fi
 
-as_executable_p="test -f"
+if test -x / >/dev/null 2>&1; then
+  as_test_x='test -x'
+else
+  if ls -dL / >/dev/null 2>&1; then
+    as_ls_L_option=L
+  else
+    as_ls_L_option=
+  fi
+  as_test_x='
+    eval sh -c '\''
+      if test -d "$1"; then
+        test -d "$1/.";
+      else
+       case $1 in
+        -*)set "./$1";;
+       esac;
+       case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+       ???[sx]*):;;*)false;;esac;fi
+    '\'' sh
+  '
+fi
+as_executable_p=$as_test_x
 
 # Sed expression to map a string onto a valid CPP name.
 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -231,39 +548,27 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
 as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
 
 
-# IFS
-# We need space, tab and new line, in precisely that order.
-as_nl='
-'
-IFS="  $as_nl"
-
-# CDPATH.
-$as_unset CDPATH
 
+exec 7<&0 </dev/null 6>&1
 
 # Name of the host.
 # hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
 # so uname gets run too.
 ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
 
-exec 6>&1
-
 #
 # Initializations.
 #
 ac_default_prefix=/usr/local
+ac_clean_files=
 ac_config_libobj_dir=.
+LIBOBJS=
 cross_compiling=no
 subdirs=
 MFLAGS=
 MAKEFLAGS=
 SHELL=${CONFIG_SHELL-/bin/sh}
 
-# Maximum number of lines to put in a shell here document.
-# This variable seems obsolete.  It should probably be removed, and
-# only ac_max_sed_lines should be used.
-: ${ac_max_here_lines=38}
-
 # Identity of this package.
 PACKAGE_NAME=
 PACKAGE_TARNAME=
@@ -275,42 +580,111 @@ ac_unique_file="keepalived/core/main.c"
 # Factoring default headers for most tests.
 ac_includes_default="\
 #include <stdio.h>
-#if HAVE_SYS_TYPES_H
+#ifdef HAVE_SYS_TYPES_H
 # include <sys/types.h>
 #endif
-#if HAVE_SYS_STAT_H
+#ifdef HAVE_SYS_STAT_H
 # include <sys/stat.h>
 #endif
-#if STDC_HEADERS
+#ifdef STDC_HEADERS
 # include <stdlib.h>
 # include <stddef.h>
 #else
-# if HAVE_STDLIB_H
+# ifdef HAVE_STDLIB_H
 #  include <stdlib.h>
 # endif
 #endif
-#if HAVE_STRING_H
-# if !STDC_HEADERS && HAVE_MEMORY_H
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
 #  include <memory.h>
 # endif
 # include <string.h>
 #endif
-#if HAVE_STRINGS_H
+#ifdef HAVE_STRINGS_H
 # include <strings.h>
 #endif
-#if HAVE_INTTYPES_H
+#ifdef HAVE_INTTYPES_H
 # include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
 #endif
-#if HAVE_UNISTD_H
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_UNISTD_H
 # include <unistd.h>
 #endif"
 
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA STRIP ac_ct_STRIP CPP EGREP LINKWATCH_SUPPORT KERN IPVS_SYNCD DFLAGS VERSION VERSION_DATE IPVS_SUPPORT VRRP_SUPPORT LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL
+PATH_SEPARATOR
+PACKAGE_NAME
+PACKAGE_TARNAME
+PACKAGE_VERSION
+PACKAGE_STRING
+PACKAGE_BUGREPORT
+exec_prefix
+prefix
+program_transform_name
+bindir
+sbindir
+libexecdir
+datarootdir
+datadir
+sysconfdir
+sharedstatedir
+localstatedir
+includedir
+oldincludedir
+docdir
+infodir
+htmldir
+dvidir
+pdfdir
+psdir
+libdir
+localedir
+mandir
+DEFS
+ECHO_C
+ECHO_N
+ECHO_T
+LIBS
+build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+CPPFLAGS
+ac_ct_CC
+EXEEXT
+OBJEXT
+INSTALL_PROGRAM
+INSTALL_SCRIPT
+INSTALL_DATA
+STRIP
+CPP
+GREP
+EGREP
+LINKWATCH_SUPPORT
+KERN
+IPVS_SYNCD
+DFLAGS
+VERSION
+VERSION_DATE
+IPVS_SUPPORT
+VRRP_SUPPORT
+LIBOBJS
+LTLIBOBJS'
 ac_subst_files=''
+      ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CPP'
+
 
 # Initialize some variables set by options.
 ac_init_help=
@@ -337,34 +711,48 @@ x_libraries=NONE
 # and all the variables that are supposed to be based on exec_prefix
 # by default will actually change.
 # Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
 bindir='${exec_prefix}/bin'
 sbindir='${exec_prefix}/sbin'
 libexecdir='${exec_prefix}/libexec'
-datadir='${prefix}/share'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
-libdir='${exec_prefix}/lib'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
-infodir='${prefix}/info'
-mandir='${prefix}/man'
+docdir='${datarootdir}/doc/${PACKAGE}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
 
 ac_prev=
+ac_dashdash=
 for ac_option
 do
   # If the previous option needs an argument, assign it.
   if test -n "$ac_prev"; then
-    eval "$ac_prev=\$ac_option"
+    eval $ac_prev=\$ac_option
     ac_prev=
     continue
   fi
 
-  ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
+  case $ac_option in
+  *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+  *)   ac_optarg=yes ;;
+  esac
 
   # Accept the important Cygnus configure options, so we can diagnose typos.
 
-  case $ac_option in
+  case $ac_dashdash$ac_option in
+  --)
+    ac_dashdash=yes ;;
 
   -bindir | --bindir | --bindi | --bind | --bin | --bi)
     ac_prev=bindir ;;
@@ -386,33 +774,45 @@ do
   --config-cache | -C)
     cache_file=config.cache ;;
 
-  -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+  -datadir | --datadir | --datadi | --datad)
     ac_prev=datadir ;;
-  -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
-  | --da=*)
+  -datadir=* | --datadir=* | --datadi=* | --datad=*)
     datadir=$ac_optarg ;;
 
+  -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+  | --dataroo | --dataro | --datar)
+    ac_prev=datarootdir ;;
+  -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+  | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+    datarootdir=$ac_optarg ;;
+
   -disable-* | --disable-*)
     ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+    expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null &&
       { echo "$as_me: error: invalid feature name: $ac_feature" >&2
    { (exit 1); exit 1; }; }
-    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
-    eval "enable_$ac_feature=no" ;;
+    ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
+    eval enable_$ac_feature=no ;;
+
+  -docdir | --docdir | --docdi | --doc | --do)
+    ac_prev=docdir ;;
+  -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+    docdir=$ac_optarg ;;
+
+  -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+    ac_prev=dvidir ;;
+  -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+    dvidir=$ac_optarg ;;
 
   -enable-* | --enable-*)
     ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+    expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null &&
       { echo "$as_me: error: invalid feature name: $ac_feature" >&2
    { (exit 1); exit 1; }; }
-    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
-    case $ac_option in
-      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
-      *) ac_optarg=yes ;;
-    esac
-    eval "enable_$ac_feature='$ac_optarg'" ;;
+    ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
+    eval enable_$ac_feature=\$ac_optarg ;;
 
   -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
   | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
@@ -439,6 +839,12 @@ do
   -host=* | --host=* | --hos=* | --ho=*)
     host_alias=$ac_optarg ;;
 
+  -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+    ac_prev=htmldir ;;
+  -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+  | --ht=*)
+    htmldir=$ac_optarg ;;
+
   -includedir | --includedir | --includedi | --included | --include \
   | --includ | --inclu | --incl | --inc)
     ac_prev=includedir ;;
@@ -463,13 +869,16 @@ do
   | --libexe=* | --libex=* | --libe=*)
     libexecdir=$ac_optarg ;;
 
+  -localedir | --localedir | --localedi | --localed | --locale)
+    ac_prev=localedir ;;
+  -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+    localedir=$ac_optarg ;;
+
   -localstatedir | --localstatedir | --localstatedi | --localstated \
-  | --localstate | --localstat | --localsta | --localst \
-  | --locals | --local | --loca | --loc | --lo)
+  | --localstate | --localstat | --localsta | --localst | --locals)
     ac_prev=localstatedir ;;
   -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
-  | --localstate=* | --localstat=* | --localsta=* | --localst=* \
-  | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+  | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
     localstatedir=$ac_optarg ;;
 
   -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
@@ -534,6 +943,16 @@ do
   | --progr-tra=* | --program-tr=* | --program-t=*)
     program_transform_name=$ac_optarg ;;
 
+  -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+    ac_prev=pdfdir ;;
+  -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+    pdfdir=$ac_optarg ;;
+
+  -psdir | --psdir | --psdi | --psd | --ps)
+    ac_prev=psdir ;;
+  -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+    psdir=$ac_optarg ;;
+
   -q | -quiet | --quiet | --quie | --qui | --qu | --q \
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
@@ -586,24 +1005,20 @@ do
   -with-* | --with-*)
     ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+    expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null &&
       { echo "$as_me: error: invalid package name: $ac_package" >&2
    { (exit 1); exit 1; }; }
-    ac_package=`echo $ac_package| sed 's/-/_/g'`
-    case $ac_option in
-      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
-      *) ac_optarg=yes ;;
-    esac
-    eval "with_$ac_package='$ac_optarg'" ;;
+    ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
+    eval with_$ac_package=\$ac_optarg ;;
 
   -without-* | --without-*)
     ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+    expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null &&
       { echo "$as_me: error: invalid package name: $ac_package" >&2
    { (exit 1); exit 1; }; }
-    ac_package=`echo $ac_package | sed 's/-/_/g'`
-    eval "with_$ac_package=no" ;;
+    ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
+    eval with_$ac_package=no ;;
 
   --x)
     # Obsolete; use --with-x.
@@ -634,8 +1049,7 @@ Try \`$0 --help' for more information." >&2
     expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
       { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
    { (exit 1); exit 1; }; }
-    ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
-    eval "$ac_envvar='$ac_optarg'"
+    eval $ac_envvar=\$ac_optarg
     export $ac_envvar ;;
 
   *)
@@ -655,27 +1069,19 @@ if test -n "$ac_prev"; then
    { (exit 1); exit 1; }; }
 fi
 
-# Be sure to have absolute paths.
-for ac_var in exec_prefix prefix
-do
-  eval ac_val=$`echo $ac_var`
-  case $ac_val in
-    [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
-    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
-   { (exit 1); exit 1; }; };;
-  esac
-done
-
-# Be sure to have absolute paths.
-for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
-             localstatedir libdir includedir oldincludedir infodir mandir
+# Be sure to have absolute directory names.
+for ac_var in  exec_prefix prefix bindir sbindir libexecdir datarootdir \
+               datadir sysconfdir sharedstatedir localstatedir includedir \
+               oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+               libdir localedir mandir
 do
-  eval ac_val=$`echo $ac_var`
+  eval ac_val=\$$ac_var
   case $ac_val in
-    [\\/$]* | ?:[\\/]* ) ;;
-    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
-   { (exit 1); exit 1; }; };;
+    [\\/$]* | ?:[\\/]* )  continue;;
+    NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
   esac
+  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+   { (exit 1); exit 1; }; }
 done
 
 # There might be people who depend on the old broken behavior: `$host'
@@ -702,74 +1108,76 @@ test -n "$host_alias" && ac_tool_prefix=$host_alias-
 test "$silent" = yes && exec 6>/dev/null
 
 
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+  { echo "$as_me: error: Working directory cannot be determined" >&2
+   { (exit 1); exit 1; }; }
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+  { echo "$as_me: error: pwd does not report name of working directory" >&2
+   { (exit 1); exit 1; }; }
+
+
 # Find the source files, if location was not specified.
 if test -z "$srcdir"; then
   ac_srcdir_defaulted=yes
-  # Try the directory containing this script, then its parent.
-  ac_confdir=`(dirname "$0") 2>/dev/null ||
+  # Try the directory containing this script, then the parent directory.
+  ac_confdir=`$as_dirname -- "$0" ||
 $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
         X"$0" : 'X\(//\)[^/]' \| \
         X"$0" : 'X\(//\)$' \| \
-        X"$0" : 'X\(/\)' \| \
-        .     : '\(.\)' 2>/dev/null ||
+        X"$0" : 'X\(/\)' \| . 2>/dev/null ||
 echo X"$0" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
-         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
-         /^X\(\/\/\)$/{ s//\1/; q; }
-         /^X\(\/\).*/{ s//\1/; q; }
-         s/.*/./; q'`
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)[^/].*/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
   srcdir=$ac_confdir
-  if test ! -r $srcdir/$ac_unique_file; then
+  if test ! -r "$srcdir/$ac_unique_file"; then
     srcdir=..
   fi
 else
   ac_srcdir_defaulted=no
 fi
-if test ! -r $srcdir/$ac_unique_file; then
-  if test "$ac_srcdir_defaulted" = yes; then
-    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
+if test ! -r "$srcdir/$ac_unique_file"; then
+  test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+  { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
    { (exit 1); exit 1; }; }
-  else
-    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
-   { (exit 1); exit 1; }; }
-  fi
 fi
-(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
-  { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+       cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2
    { (exit 1); exit 1; }; }
-srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
-ac_env_build_alias_set=${build_alias+set}
-ac_env_build_alias_value=$build_alias
-ac_cv_env_build_alias_set=${build_alias+set}
-ac_cv_env_build_alias_value=$build_alias
-ac_env_host_alias_set=${host_alias+set}
-ac_env_host_alias_value=$host_alias
-ac_cv_env_host_alias_set=${host_alias+set}
-ac_cv_env_host_alias_value=$host_alias
-ac_env_target_alias_set=${target_alias+set}
-ac_env_target_alias_value=$target_alias
-ac_cv_env_target_alias_set=${target_alias+set}
-ac_cv_env_target_alias_value=$target_alias
-ac_env_CC_set=${CC+set}
-ac_env_CC_value=$CC
-ac_cv_env_CC_set=${CC+set}
-ac_cv_env_CC_value=$CC
-ac_env_CFLAGS_set=${CFLAGS+set}
-ac_env_CFLAGS_value=$CFLAGS
-ac_cv_env_CFLAGS_set=${CFLAGS+set}
-ac_cv_env_CFLAGS_value=$CFLAGS
-ac_env_LDFLAGS_set=${LDFLAGS+set}
-ac_env_LDFLAGS_value=$LDFLAGS
-ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
-ac_cv_env_LDFLAGS_value=$LDFLAGS
-ac_env_CPPFLAGS_set=${CPPFLAGS+set}
-ac_env_CPPFLAGS_value=$CPPFLAGS
-ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
-ac_cv_env_CPPFLAGS_value=$CPPFLAGS
-ac_env_CPP_set=${CPP+set}
-ac_env_CPP_value=$CPP
-ac_cv_env_CPP_set=${CPP+set}
-ac_cv_env_CPP_value=$CPP
+       pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+  srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+  eval ac_env_${ac_var}_set=\${${ac_var}+set}
+  eval ac_env_${ac_var}_value=\$${ac_var}
+  eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+  eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
 
 #
 # Report the --help message.
@@ -798,9 +1206,6 @@ Configuration:
   -n, --no-create         do not create output files
       --srcdir=DIR        find the sources in DIR [configure dir or \`..']
 
-_ACEOF
-
-  cat <<_ACEOF
 Installation directories:
   --prefix=PREFIX         install architecture-independent files in PREFIX
                          [$ac_default_prefix]
@@ -818,15 +1223,22 @@ Fine tuning of the installation directories:
   --bindir=DIR           user executables [EPREFIX/bin]
   --sbindir=DIR          system admin executables [EPREFIX/sbin]
   --libexecdir=DIR       program executables [EPREFIX/libexec]
-  --datadir=DIR          read-only architecture-independent data [PREFIX/share]
   --sysconfdir=DIR       read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR   modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR    modifiable single-machine data [PREFIX/var]
   --libdir=DIR           object code libraries [EPREFIX/lib]
   --includedir=DIR       C header files [PREFIX/include]
   --oldincludedir=DIR    C header files for non-gcc [/usr/include]
-  --infodir=DIR          info documentation [PREFIX/info]
-  --mandir=DIR           man documentation [PREFIX/man]
+  --datarootdir=DIR      read-only arch.-independent data root [PREFIX/share]
+  --datadir=DIR          read-only architecture-independent data [DATAROOTDIR]
+  --infodir=DIR          info documentation [DATAROOTDIR/info]
+  --localedir=DIR        locale-dependent data [DATAROOTDIR/locale]
+  --mandir=DIR           man documentation [DATAROOTDIR/man]
+  --docdir=DIR           documentation root [DATAROOTDIR/doc/PACKAGE]
+  --htmldir=DIR          html documentation [DOCDIR]
+  --dvidir=DIR           dvi documentation [DOCDIR]
+  --pdfdir=DIR           pdf documentation [DOCDIR]
+  --psdir=DIR            ps documentation [DOCDIR]
 _ACEOF
 
   cat <<\_ACEOF
@@ -856,126 +1268,95 @@ Some influential environment variables:
   CFLAGS      C compiler flags
   LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
               nonstandard directory <lib dir>
-  CPPFLAGS    C/C++ preprocessor flags, e.g. -I<include dir> if you have
-              headers in a nonstandard directory <include dir>
+  LIBS        libraries to pass to the linker, e.g. -l<library>
+  CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
+              you have headers in a nonstandard directory <include dir>
   CPP         C preprocessor
 
 Use these variables to override the choices made by `configure' or to help
 it to find libraries and programs with nonstandard names/locations.
 
 _ACEOF
+ac_status=$?
 fi
 
 if test "$ac_init_help" = "recursive"; then
   # If there are subdirs, report their specific --help.
-  ac_popdir=`pwd`
   for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
-    test -d $ac_dir || continue
+    test -d "$ac_dir" || continue
     ac_builddir=.
 
-if test "$ac_dir" != .; then
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
   ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
-  # A "../" for each directory in $ac_dir_suffix.
-  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
-else
-  ac_dir_suffix= ac_top_builddir=
-fi
+  # A ".." for each directory in $ac_dir_suffix.
+  ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
+  case $ac_top_builddir_sub in
+  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+  esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
 
 case $srcdir in
-  .)  # No --srcdir option.  We are building in place.
+  .)  # We are building in place.
     ac_srcdir=.
-    if test -z "$ac_top_builddir"; then
-       ac_top_srcdir=.
-    else
-       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
-    fi ;;
-  [\\/]* | ?:[\\/]* )  # Absolute path.
+    ac_top_srcdir=$ac_top_builddir_sub
+    ac_abs_top_srcdir=$ac_pwd ;;
+  [\\/]* | ?:[\\/]* )  # Absolute name.
     ac_srcdir=$srcdir$ac_dir_suffix;
-    ac_top_srcdir=$srcdir ;;
-  *) # Relative path.
-    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
-    ac_top_srcdir=$ac_top_builddir$srcdir ;;
-esac
-
-# Do not use `cd foo && pwd` to compute absolute paths, because
-# the directories may not exist.
-case `pwd` in
-.) ac_abs_builddir="$ac_dir";;
-*)
-  case "$ac_dir" in
-  .) ac_abs_builddir=`pwd`;;
-  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
-  *) ac_abs_builddir=`pwd`/"$ac_dir";;
-  esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_builddir=${ac_top_builddir}.;;
-*)
-  case ${ac_top_builddir}. in
-  .) ac_abs_top_builddir=$ac_abs_builddir;;
-  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
-  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
-  esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_srcdir=$ac_srcdir;;
-*)
-  case $ac_srcdir in
-  .) ac_abs_srcdir=$ac_abs_builddir;;
-  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
-  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
-  esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_srcdir=$ac_top_srcdir;;
-*)
-  case $ac_top_srcdir in
-  .) ac_abs_top_srcdir=$ac_abs_builddir;;
-  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
-  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
-  esac;;
+    ac_top_srcdir=$srcdir
+    ac_abs_top_srcdir=$srcdir ;;
+  *) # Relative name.
+    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_build_prefix$srcdir
+    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
 esac
-
-    cd $ac_dir
-    # Check for guested configure; otherwise get Cygnus style configure.
-    if test -f $ac_srcdir/configure.gnu; then
-      echo
-      $SHELL $ac_srcdir/configure.gnu  --help=recursive
-    elif test -f $ac_srcdir/configure; then
-      echo
-      $SHELL $ac_srcdir/configure  --help=recursive
-    elif test -f $ac_srcdir/configure.ac ||
-          test -f $ac_srcdir/configure.in; then
-      echo
-      $ac_configure --help
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+    cd "$ac_dir" || { ac_status=$?; continue; }
+    # Check for guested configure.
+    if test -f "$ac_srcdir/configure.gnu"; then
+      echo &&
+      $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+    elif test -f "$ac_srcdir/configure"; then
+      echo &&
+      $SHELL "$ac_srcdir/configure" --help=recursive
     else
       echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
-    fi
-    cd $ac_popdir
+    fi || ac_status=$?
+    cd "$ac_pwd" || { ac_status=$?; break; }
   done
 fi
 
-test -n "$ac_init_help" && exit 0
+test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
+configure
+generated by GNU Autoconf 2.61
 
-Copyright (C) 2003 Free Software Foundation, Inc.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it.
 _ACEOF
-  exit 0
+  exit
 fi
-exec 5>config.log
-cat >&5 <<_ACEOF
+cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
 It was created by $as_me, which was
-generated by GNU Autoconf 2.59.  Invocation command line was
+generated by GNU Autoconf 2.61.  Invocation command line was
 
   $ $0 $@
 
 _ACEOF
+exec 5>>config.log
 {
 cat <<_ASUNAME
 ## --------- ##
@@ -994,7 +1375,7 @@ uname -v = `(uname -v) 2>/dev/null || echo unknown`
 /bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
 /usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
 /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
-hostinfo               = `(hostinfo) 2>/dev/null               || echo unknown`
+/usr/bin/hostinfo      = `(/usr/bin/hostinfo) 2>/dev/null      || echo unknown`
 /bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
 /usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
 /bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
@@ -1008,6 +1389,7 @@ do
   test -z "$as_dir" && as_dir=.
   echo "PATH: $as_dir"
 done
+IFS=$as_save_IFS
 
 } >&5
 
@@ -1029,7 +1411,6 @@ _ACEOF
 ac_configure_args=
 ac_configure_args0=
 ac_configure_args1=
-ac_sep=
 ac_must_keep_next=false
 for ac_pass in 1 2
 do
@@ -1040,7 +1421,7 @@ do
     -q | -quiet | --quiet | --quie | --qui | --qu | --q \
     | -silent | --silent | --silen | --sile | --sil)
       continue ;;
-    *" "*|*"   "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+    *\'*)
       ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
     esac
     case $ac_pass in
@@ -1062,9 +1443,7 @@ do
          -* ) ac_must_keep_next=true ;;
        esac
       fi
-      ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
-      # Get rid of the leading space.
-      ac_sep=" "
+      ac_configure_args="$ac_configure_args '$ac_arg'"
       ;;
     esac
   done
@@ -1075,8 +1454,8 @@ $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_
 # When interrupted or exit'd, cleanup temporary files, and complete
 # config.log.  We remove comments because anyway the quotes in there
 # would cause problems or look ugly.
-# WARNING: Be sure not to use single quotes in there, as some shells,
-# such as our DU 5.0 friend, will then `close' the trap.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
 trap 'exit_status=$?
   # Save into config.log some information that might help in debugging.
   {
@@ -1089,20 +1468,34 @@ trap 'exit_status=$?
 _ASBOX
     echo
     # The following way of writing the cache mishandles newlines in values,
-{
+(
+  for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+    eval ac_val=\$$ac_var
+    case $ac_val in #(
+    *${as_nl}*)
+      case $ac_var in #(
+      *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
+echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+      esac
+      case $ac_var in #(
+      _ | IFS | as_nl) ;; #(
+      *) $as_unset $ac_var ;;
+      esac ;;
+    esac
+  done
   (set) 2>&1 |
-    case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
-    *ac_space=\ *)
+    case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+    *${as_nl}ac_space=\ *)
       sed -n \
-       "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
-         s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
-      ;;
+       "s/'\''/'\''\\\\'\'''\''/g;
+         s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+      ;; #(
     *)
-      sed -n \
-       "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
       ;;
-    esac;
-}
+    esac |
+    sort
+)
     echo
 
     cat <<\_ASBOX
@@ -1113,22 +1506,28 @@ _ASBOX
     echo
     for ac_var in $ac_subst_vars
     do
-      eval ac_val=$`echo $ac_var`
-      echo "$ac_var='"'"'$ac_val'"'"'"
+      eval ac_val=\$$ac_var
+      case $ac_val in
+      *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+      esac
+      echo "$ac_var='\''$ac_val'\''"
     done | sort
     echo
 
     if test -n "$ac_subst_files"; then
       cat <<\_ASBOX
-## ------------- ##
-## Output files. ##
-## ------------- ##
+## ------------------- ##
+## File substitutions. ##
+## ------------------- ##
 _ASBOX
       echo
       for ac_var in $ac_subst_files
       do
-       eval ac_val=$`echo $ac_var`
-       echo "$ac_var='"'"'$ac_val'"'"'"
+       eval ac_val=\$$ac_var
+       case $ac_val in
+       *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+       esac
+       echo "$ac_var='\''$ac_val'\''"
       done | sort
       echo
     fi
@@ -1140,26 +1539,24 @@ _ASBOX
 ## ----------- ##
 _ASBOX
       echo
-      sed "/^$/d" confdefs.h | sort
+      cat confdefs.h
       echo
     fi
     test "$ac_signal" != 0 &&
       echo "$as_me: caught signal $ac_signal"
     echo "$as_me: exit $exit_status"
   } >&5
-  rm -f core *.core &&
-  rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
+  rm -f core *.core core.conftest.* &&
+    rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
     exit $exit_status
-     ' 0
+' 0
 for ac_signal in 1 2 13 15; do
   trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
 done
 ac_signal=0
 
 # confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -rf conftest* confdefs.h
-# AIX cpp loses on an empty file, so make sure it contains at least a newline.
-echo >confdefs.h
+rm -f -r conftest* confdefs.h
 
 # Predefined preprocessor variables.
 
@@ -1190,14 +1587,17 @@ _ACEOF
 
 # Let the site file select an alternate cache file if it wants to.
 # Prefer explicitly selected file to automatically selected ones.
-if test -z "$CONFIG_SITE"; then
-  if test "x$prefix" != xNONE; then
-    CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
-  else
-    CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
-  fi
+if test -n "$CONFIG_SITE"; then
+  set x "$CONFIG_SITE"
+elif test "x$prefix" != xNONE; then
+  set x "$prefix/share/config.site" "$prefix/etc/config.site"
+else
+  set x "$ac_default_prefix/share/config.site" \
+       "$ac_default_prefix/etc/config.site"
 fi
-for ac_site_file in $CONFIG_SITE; do
+shift
+for ac_site_file
+do
   if test -r "$ac_site_file"; then
     { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
 echo "$as_me: loading site script $ac_site_file" >&6;}
@@ -1213,8 +1613,8 @@ if test -r "$cache_file"; then
     { echo "$as_me:$LINENO: loading cache $cache_file" >&5
 echo "$as_me: loading cache $cache_file" >&6;}
     case $cache_file in
-      [\\/]* | ?:[\\/]* ) . $cache_file;;
-      *)                      . ./$cache_file;;
+      [\\/]* | ?:[\\/]* ) . "$cache_file";;
+      *)                      . "./$cache_file";;
     esac
   fi
 else
@@ -1226,12 +1626,11 @@ fi
 # Check that the precious variables saved in the cache have kept the same
 # value.
 ac_cache_corrupted=false
-for ac_var in `(set) 2>&1 |
-              sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
+for ac_var in $ac_precious_vars; do
   eval ac_old_set=\$ac_cv_env_${ac_var}_set
   eval ac_new_set=\$ac_env_${ac_var}_set
-  eval ac_old_val="\$ac_cv_env_${ac_var}_value"
-  eval ac_new_val="\$ac_env_${ac_var}_value"
+  eval ac_old_val=\$ac_cv_env_${ac_var}_value
+  eval ac_new_val=\$ac_env_${ac_var}_value
   case $ac_old_set,$ac_new_set in
     set,)
       { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
@@ -1256,8 +1655,7 @@ echo "$as_me:   current value: $ac_new_val" >&2;}
   # Pass precious variables to config.status.
   if test "$ac_new_set" = set; then
     case $ac_new_val in
-    *" "*|*"   "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
-      ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+    *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
     *) ac_arg=$ac_var=$ac_new_val ;;
     esac
     case " $ac_configure_args " in
@@ -1274,12 +1672,6 @@ echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start ov
    { (exit 1); exit 1; }; }
 fi
 
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
 
 
 
@@ -1296,6 +1688,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 VERSION=`cat VERSION`
@@ -1310,8 +1707,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
 set dummy ${ac_tool_prefix}gcc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
 if test "${ac_cv_prog_CC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -1324,32 +1721,34 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_CC="${ac_tool_prefix}gcc"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
+IFS=$as_save_IFS
 
 fi
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
+
 fi
 if test -z "$ac_cv_prog_CC"; then
   ac_ct_CC=$CC
   # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -1362,36 +1761,51 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_CC="gcc"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
+IFS=$as_save_IFS
 
 fi
 fi
 ac_ct_CC=$ac_cv_prog_ac_ct_CC
 if test -n "$ac_ct_CC"; then
-  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
+  { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6; }
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
-  CC=$ac_ct_CC
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
 else
   CC="$ac_cv_prog_CC"
 fi
 
 if test -z "$CC"; then
-  if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+          if test -n "$ac_tool_prefix"; then
+    # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
 set dummy ${ac_tool_prefix}cc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
 if test "${ac_cv_prog_CC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -1404,74 +1818,34 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_CC="${ac_tool_prefix}cc"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
+IFS=$as_save_IFS
 
 fi
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
-else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-fi
-if test -z "$ac_cv_prog_CC"; then
-  ac_ct_CC=$CC
-  # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$ac_ct_CC"; then
-  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_CC="cc"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
-  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
-  CC=$ac_ct_CC
-else
-  CC="$ac_cv_prog_CC"
-fi
 
+  fi
 fi
 if test -z "$CC"; then
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
 if test "${ac_cv_prog_CC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -1485,7 +1859,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
        ac_prog_rejected=yes
        continue
@@ -1496,6 +1870,7 @@ do
   fi
 done
 done
+IFS=$as_save_IFS
 
 if test $ac_prog_rejected = yes; then
   # We found a bogon in the path, so make sure we never use it.
@@ -1513,22 +1888,23 @@ fi
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
+
 fi
 if test -z "$CC"; then
   if test -n "$ac_tool_prefix"; then
-  for ac_prog in cl
+  for ac_prog in cl.exe
   do
     # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
 if test "${ac_cv_prog_CC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -1541,36 +1917,38 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
+IFS=$as_save_IFS
 
 fi
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
+
     test -n "$CC" && break
   done
 fi
 if test -z "$CC"; then
   ac_ct_CC=$CC
-  for ac_prog in cl
+  for ac_prog in cl.exe
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -1583,29 +1961,45 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_CC="$ac_prog"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
+IFS=$as_save_IFS
 
 fi
 fi
 ac_ct_CC=$ac_cv_prog_ac_ct_CC
 if test -n "$ac_ct_CC"; then
-  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
+  { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6; }
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
+
   test -n "$ac_ct_CC" && break
 done
 
-  CC=$ac_ct_CC
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
 fi
 
 fi
@@ -1618,21 +2012,35 @@ See \`config.log' for more details." >&2;}
    { (exit 1); exit 1; }; }
 
 # Provide some information about the compiler.
-echo "$as_me:$LINENO:" \
-     "checking for C compiler version" >&5
+echo "$as_me:$LINENO: checking for C compiler version" >&5
 ac_compiler=`set X $ac_compile; echo $2`
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
-  (eval $ac_compiler --version </dev/null >&5) 2>&5
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler --version >&5") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
-  (eval $ac_compiler -v </dev/null >&5) 2>&5
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -v >&5") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
-  (eval $ac_compiler -V </dev/null >&5) 2>&5
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -V >&5") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }
@@ -1657,47 +2065,77 @@ ac_clean_files="$ac_clean_files a.out a.exe b.out"
 # Try to create an executable without -o first, disregard a.out.
 # It will help us diagnose broken compilers, and finding out an intuition
 # of exeext.
-echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
-echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; }
 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
-if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
-  (eval $ac_link_default) 2>&5
+#
+# List of possible output files, starting from the most likely.
+# The algorithm is not robust to junk in `.', hence go to wildcards (a.*)
+# only as a last resort.  b.out is created by i960 compilers.
+ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out'
+#
+# The IRIX 6 linker writes into existing files which may not be
+# executable, retaining their permissions.  Remove them first so a
+# subsequent execution test works.
+ac_rmfiles=
+for ac_file in $ac_files
+do
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
+    * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+  esac
+done
+rm -f $ac_rmfiles
+
+if { (ac_try="$ac_link_default"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link_default") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; then
-  # Find the output, starting from the most likely.  This scheme is
-# not robust to junk in `.', hence go to wildcards (a.*) only as a last
-# resort.
-
-# Be careful to initialize this variable, since it used to be cached.
-# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
-ac_cv_exeext=
-# b.out is created by i960 compilers.
-for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
+  # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile.  We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
 do
   test -f "$ac_file" || continue
   case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
-       ;;
-    conftest.$ac_ext )
-       # This is the source file.
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj )
        ;;
     [ab].out )
        # We found the default executable, but exeext='' is most
        # certainly right.
        break;;
     *.* )
-       ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
-       # FIXME: I believe we export ac_cv_exeext for Libtool,
-       # but it would be cool to find out if it's true.  Does anybody
-       # maintain Libtool? --akim.
-       export ac_cv_exeext
+        if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+       then :; else
+          ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+       fi
+       # We set ac_cv_exeext here because the later test for it is not
+       # safe: cross compilers may not add the suffix if given an `-o'
+       # argument, so we may need to know it at that point already.
+       # Even if this section looks crufty: it has the advantage of
+       # actually working.
        break;;
     * )
        break;;
   esac
 done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
 else
+  ac_file=''
+fi
+
+{ echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6; }
+if test -z "$ac_file"; then
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
@@ -1709,19 +2147,21 @@ See \`config.log' for more details." >&2;}
 fi
 
 ac_exeext=$ac_cv_exeext
-echo "$as_me:$LINENO: result: $ac_file" >&5
-echo "${ECHO_T}$ac_file" >&6
 
-# Check the compiler produces executables we can run.  If not, either
+# Check that the compiler produces executables we can run.  If not, either
 # the compiler is broken, or we cross compile.
-echo "$as_me:$LINENO: checking whether the C compiler works" >&5
-echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; }
 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0
 # If not cross compiling, check that we can run a simple program.
 if test "$cross_compiling" != yes; then
   if { ac_try='./$ac_file'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
@@ -1740,22 +2180,27 @@ See \`config.log' for more details." >&2;}
     fi
   fi
 fi
-echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
+{ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
 
 rm -f a.out a.exe conftest$ac_cv_exeext b.out
 ac_clean_files=$ac_clean_files_save
-# Check the compiler produces executables we can run.  If not, either
+# Check that the compiler produces executables we can run.  If not, either
 # the compiler is broken, or we cross compile.
-echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
-echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
-echo "$as_me:$LINENO: result: $cross_compiling" >&5
-echo "${ECHO_T}$cross_compiling" >&6
-
-echo "$as_me:$LINENO: checking for suffix of executables" >&5
-echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6; }
+
+{ echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; }
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; then
@@ -1766,9 +2211,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
 for ac_file in conftest.exe conftest conftest.*; do
   test -f "$ac_file" || continue
   case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
     *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
-         export ac_cv_exeext
          break;;
     * ) break;;
   esac
@@ -1782,14 +2226,14 @@ See \`config.log' for more details." >&2;}
 fi
 
 rm -f conftest$ac_cv_exeext
-echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
-echo "${ECHO_T}$ac_cv_exeext" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6; }
 
 rm -f conftest.$ac_ext
 EXEEXT=$ac_cv_exeext
 ac_exeext=$EXEEXT
-echo "$as_me:$LINENO: checking for suffix of object files" >&5
-echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; }
 if test "${ac_cv_objext+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -1809,14 +2253,20 @@ main ()
 }
 _ACEOF
 rm -f conftest.o conftest.obj
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; then
-  for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
+  for ac_file in conftest.o conftest.obj conftest.*; do
+  test -f "$ac_file" || continue;
   case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;;
     *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
        break;;
   esac
@@ -1834,12 +2284,12 @@ fi
 
 rm -f conftest.$ac_cv_objext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
-echo "${ECHO_T}$ac_cv_objext" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6; }
 OBJEXT=$ac_cv_objext
 ac_objext=$OBJEXT
-echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
-echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; }
 if test "${ac_cv_c_compiler_gnu+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -1862,50 +2312,49 @@ main ()
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_compiler_gnu=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_compiler_gnu=no
+       ac_compiler_gnu=no
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 ac_cv_c_compiler_gnu=$ac_compiler_gnu
 
 fi
-echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
-echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; }
 GCC=`test $ac_compiler_gnu = yes && echo yes`
 ac_test_CFLAGS=${CFLAGS+set}
 ac_save_CFLAGS=$CFLAGS
-CFLAGS="-g"
-echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
-echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; }
 if test "${ac_cv_prog_cc_g+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
+  ac_save_c_werror_flag=$ac_c_werror_flag
+   ac_c_werror_flag=yes
+   ac_cv_prog_cc_g=no
+   CFLAGS="-g"
+   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -1921,38 +2370,118 @@ main ()
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cc_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       CFLAGS=""
+      cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_c_werror_flag=$ac_save_c_werror_flag
+        CFLAGS="-g"
+        cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_cv_prog_cc_g=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_prog_cc_g=no
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_c_werror_flag=$ac_save_c_werror_flag
 fi
-echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; }
 if test "$ac_test_CFLAGS" = set; then
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
@@ -1968,12 +2497,12 @@ else
     CFLAGS=
   fi
 fi
-echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
-echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
-if test "${ac_cv_prog_cc_stdc+set}" = set; then
+{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
+echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cc_c89+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_cv_prog_cc_stdc=no
+  ac_cv_prog_cc_c89=no
 ac_save_CC=$CC
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -2007,12 +2536,17 @@ static char *f (char * (*g) (char **, int), char **p, ...)
 /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
    function prototypes and stuff, but not '\xHH' hex character constants.
    These don't provoke an error unfortunately, instead are silently treated
-   as 'x'.  The following induces an error, until -std1 is added to get
+   as 'x'.  The following induces an error, until -std is added to get
    proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
    array size at least.  It's necessary to write '\x00'==0 to get something
-   that's true only with -std1.  */
+   that's true only with -std.  */
 int osf4_cc_array ['\x00' == 0 ? 1 : -1];
 
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+   inside strings and character constants.  */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
 int test (int i, double x);
 struct s1 {int (*f) (int a);};
 struct s2 {int (*f) (double a);};
@@ -2027,205 +2561,57 @@ return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
   return 0;
 }
 _ACEOF
-# Don't try gcc -ansi; that turns off useful extensions and
-# breaks some systems' header files.
-# AIX                  -qlanglvl=ansi
-# Ultrix and OSF/1     -std1
-# HP-UX 10.20 and later        -Ae
-# HP-UX older versions -Aa -D_HPUX_SOURCE
-# SVR4                 -Xc -D__EXTENSIONS__
-for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+       -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
 do
   CC="$ac_save_CC $ac_arg"
   rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_prog_cc_stdc=$ac_arg
-break
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cc_c89=$ac_arg
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
+
 fi
-rm -f conftest.err conftest.$ac_objext
+
+rm -f core conftest.err conftest.$ac_objext
+  test "x$ac_cv_prog_cc_c89" != "xno" && break
 done
-rm -f conftest.$ac_ext conftest.$ac_objext
+rm -f conftest.$ac_ext
 CC=$ac_save_CC
 
 fi
-
-case "x$ac_cv_prog_cc_stdc" in
-  x|xno)
-    echo "$as_me:$LINENO: result: none needed" >&5
-echo "${ECHO_T}none needed" >&6 ;;
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+  x)
+    { echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6; } ;;
+  xno)
+    { echo "$as_me:$LINENO: result: unsupported" >&5
+echo "${ECHO_T}unsupported" >&6; } ;;
   *)
-    echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
-    CC="$CC $ac_cv_prog_cc_stdc" ;;
+    CC="$CC $ac_cv_prog_cc_c89"
+    { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;;
 esac
 
-# Some people use a C++ compiler to compile C.  Since we use `exit',
-# in C++ we need to declare it.  In case someone uses the same compiler
-# for both compiling C and C++ we need to have the C++ compiler decide
-# the declaration of exit, since it's the most demanding environment.
-cat >conftest.$ac_ext <<_ACEOF
-#ifndef __cplusplus
-  choke me
-#endif
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  for ac_declaration in \
-   '' \
-   'extern "C" void std::exit (int) throw (); using std::exit;' \
-   'extern "C" void std::exit (int); using std::exit;' \
-   'extern "C" void exit (int) throw ();' \
-   'extern "C" void exit (int);' \
-   'void exit (int);'
-do
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_declaration
-#include <stdlib.h>
-int
-main ()
-{
-exit (42);
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  :
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-continue
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_declaration
-int
-main ()
-{
-exit (42);
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  break
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-rm -f conftest*
-if test -n "$ac_declaration"; then
-  echo '#ifdef __cplusplus' >>confdefs.h
-  echo $ac_declaration      >>confdefs.h
-  echo '#endif'             >>confdefs.h
-fi
-
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -2233,29 +2619,35 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 ac_aux_dir=
-for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
-  if test -f $ac_dir/install-sh; then
+for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
+  if test -f "$ac_dir/install-sh"; then
     ac_aux_dir=$ac_dir
     ac_install_sh="$ac_aux_dir/install-sh -c"
     break
-  elif test -f $ac_dir/install.sh; then
+  elif test -f "$ac_dir/install.sh"; then
     ac_aux_dir=$ac_dir
     ac_install_sh="$ac_aux_dir/install.sh -c"
     break
-  elif test -f $ac_dir/shtool; then
+  elif test -f "$ac_dir/shtool"; then
     ac_aux_dir=$ac_dir
     ac_install_sh="$ac_aux_dir/shtool install -c"
     break
   fi
 done
 if test -z "$ac_aux_dir"; then
-  { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5
-echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;}
+  { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5
+echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;}
    { (exit 1); exit 1; }; }
 fi
-ac_config_guess="$SHELL $ac_aux_dir/config.guess"
-ac_config_sub="$SHELL $ac_aux_dir/config.sub"
-ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"  # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"  # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
+
 
 # Find a good install program.  We prefer a C program (faster),
 # so one script is as good as another.  But avoid the broken or
@@ -2270,8 +2662,8 @@ ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # OS/2's system install, which has a completely different semantic
 # ./install, which can be erroneously created by make from ./install.sh.
-echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
-echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; }
 if test -z "$INSTALL"; then
 if test "${ac_cv_path_install+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -2293,7 +2685,7 @@ case $as_dir/ in
     # by default.
     for ac_prog in ginstall scoinst install; do
       for ac_exec_ext in '' $ac_executable_extensions; do
-       if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+       if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
          if test $ac_prog = install &&
            grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
            # AIX install.  It has an incompatible calling convention.
@@ -2312,21 +2704,22 @@ case $as_dir/ in
     ;;
 esac
 done
+IFS=$as_save_IFS
 
 
 fi
   if test "${ac_cv_path_install+set}" = set; then
     INSTALL=$ac_cv_path_install
   else
-    # As a last resort, use the slow shell script.  We don't cache a
-    # path for INSTALL within a source directory, because that will
+    # As a last resort, use the slow shell script.  Don't cache a
+    # value for INSTALL within a source directory, because that will
     # break other packages using the cache if that directory is
-    # removed, or if the path is relative.
+    # removed, or if the value is a relative name.
     INSTALL=$ac_install_sh
   fi
 fi
-echo "$as_me:$LINENO: result: $INSTALL" >&5
-echo "${ECHO_T}$INSTALL" >&6
+{ echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6; }
 
 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
 # It thinks the first close brace ends the variable substitution.
@@ -2339,8 +2732,8 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
 set dummy ${ac_tool_prefix}strip; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
 if test "${ac_cv_prog_STRIP+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -2353,32 +2746,34 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_STRIP="${ac_tool_prefix}strip"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
+IFS=$as_save_IFS
 
 fi
 fi
 STRIP=$ac_cv_prog_STRIP
 if test -n "$STRIP"; then
-  echo "$as_me:$LINENO: result: $STRIP" >&5
-echo "${ECHO_T}$STRIP" >&6
+  { echo "$as_me:$LINENO: result: $STRIP" >&5
+echo "${ECHO_T}$STRIP" >&6; }
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
+
 fi
 if test -z "$ac_cv_prog_STRIP"; then
   ac_ct_STRIP=$STRIP
   # Extract the first word of "strip", so it can be a program name with args.
 set dummy strip; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
 if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -2391,64 +2786,79 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_STRIP="strip"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
+IFS=$as_save_IFS
 
 fi
 fi
 ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
 if test -n "$ac_ct_STRIP"; then
-  echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
-echo "${ECHO_T}$ac_ct_STRIP" >&6
+  { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+echo "${ECHO_T}$ac_ct_STRIP" >&6; }
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
-  STRIP=$ac_ct_STRIP
+  if test "x$ac_ct_STRIP" = x; then
+    STRIP=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    STRIP=$ac_ct_STRIP
+  fi
 else
   STRIP="$ac_cv_prog_STRIP"
 fi
 
 
-# Check whether --enable-lvs-syncd or --disable-lvs-syncd was given.
+# Check whether --enable-lvs-syncd was given.
 if test "${enable_lvs_syncd+set}" = set; then
-  enableval="$enable_lvs_syncd"
+  enableval=$enable_lvs_syncd;
+fi
 
-fi;
-# Check whether --enable-lvs or --disable-lvs was given.
+# Check whether --enable-lvs was given.
 if test "${enable_lvs+set}" = set; then
-  enableval="$enable_lvs"
+  enableval=$enable_lvs;
+fi
 
-fi;
-# Check whether --enable-vrrp or --disable-vrrp was given.
+# Check whether --enable-vrrp was given.
 if test "${enable_vrrp+set}" = set; then
-  enableval="$enable_vrrp"
+  enableval=$enable_vrrp;
+fi
 
-fi;
 
-# Check whether --with-kernel-dir or --without-kernel-dir was given.
+# Check whether --with-kernel-dir was given.
 if test "${with_kernel_dir+set}" = set; then
-  withval="$with_kernel_dir"
-  kernelinc="$withval/include" kernelpath="$withval"
+  withval=$with_kernel_dir; kernelinc="$withval/include" kernelpath="$withval"
 else
   kernelinc="/usr/src/linux/include" kernelpath="/usr/src/linux"
-fi;
-# Check whether --enable-debug or --disable-debug was given.
+fi
+
+# Check whether --enable-debug was given.
 if test "${enable_debug+set}" = set; then
-  enableval="$enable_debug"
+  enableval=$enable_debug;
+fi
 
-fi;
-# Check whether --enable-profile or --disable-profile was given.
+# Check whether --enable-profile was given.
 if test "${enable_profile+set}" = set; then
-  enableval="$enable_profile"
+  enableval=$enable_profile;
+fi
 
-fi;
 
 
 ac_ext=c
@@ -2456,8 +2866,8 @@ ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
-echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
-echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; }
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -2491,24 +2901,22 @@ cat >>conftest.$ac_ext <<_ACEOF
 #endif
                     Syntax error
 _ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
+  (exit $ac_status); } >/dev/null && {
+        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       }; then
   :
 else
   echo "$as_me: failed program was:" >&5
@@ -2517,9 +2925,10 @@ sed 's/^/| /' conftest.$ac_ext >&5
   # Broken: fails on valid input.
 continue
 fi
+
 rm -f conftest.err conftest.$ac_ext
 
-  # OK, works on sane cases.  Now check whether non-existent headers
+  # OK, works on sane cases.  Now check whether nonexistent headers
   # can be detected and how.
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -2529,24 +2938,22 @@ cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 #include <ac_nonexistent.h>
 _ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
+  (exit $ac_status); } >/dev/null && {
+        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       }; then
   # Broken: success on invalid input.
 continue
 else
@@ -2557,6 +2964,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 ac_preproc_ok=:
 break
 fi
+
 rm -f conftest.err conftest.$ac_ext
 
 done
@@ -2574,8 +2982,8 @@ fi
 else
   ac_cv_prog_CPP=$CPP
 fi
-echo "$as_me:$LINENO: result: $CPP" >&5
-echo "${ECHO_T}$CPP" >&6
+{ echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6; }
 ac_preproc_ok=false
 for ac_c_preproc_warn_flag in '' yes
 do
@@ -2598,24 +3006,22 @@ cat >>conftest.$ac_ext <<_ACEOF
 #endif
                     Syntax error
 _ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
+  (exit $ac_status); } >/dev/null && {
+        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       }; then
   :
 else
   echo "$as_me: failed program was:" >&5
@@ -2624,9 +3030,10 @@ sed 's/^/| /' conftest.$ac_ext >&5
   # Broken: fails on valid input.
 continue
 fi
+
 rm -f conftest.err conftest.$ac_ext
 
-  # OK, works on sane cases.  Now check whether non-existent headers
+  # OK, works on sane cases.  Now check whether nonexistent headers
   # can be detected and how.
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -2636,24 +3043,22 @@ cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 #include <ac_nonexistent.h>
 _ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
+  (exit $ac_status); } >/dev/null && {
+        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       }; then
   # Broken: success on invalid input.
 continue
 else
@@ -2664,6 +3069,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 ac_preproc_ok=:
 break
 fi
+
 rm -f conftest.err conftest.$ac_ext
 
 done
@@ -2686,23 +3092,170 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
-echo "$as_me:$LINENO: checking for egrep" >&5
-echo $ECHO_N "checking for egrep... $ECHO_C" >&6
-if test "${ac_cv_prog_egrep+set}" = set; then
+{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5
+echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; }
+if test "${ac_cv_path_GREP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  # Extract the first word of "grep ggrep" to use in msg output
+if test -z "$GREP"; then
+set dummy grep ggrep; ac_prog_name=$2
+if test "${ac_cv_path_GREP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_path_GREP_found=false
+# Loop through the user's path and test for each of PROGNAME-LIST
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_prog in grep ggrep; do
+  for ac_exec_ext in '' $ac_executable_extensions; do
+    ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+    { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+    # Check for GNU ac_path_GREP and select it if it is found.
+  # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+  ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    echo 'GREP' >> "conftest.nl"
+    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    ac_count=`expr $ac_count + 1`
+    if test $ac_count -gt ${ac_path_GREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_GREP="$ac_path_GREP"
+      ac_path_GREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+
+    $ac_path_GREP_found && break 3
+  done
+done
+
+done
+IFS=$as_save_IFS
+
+
+fi
+
+GREP="$ac_cv_path_GREP"
+if test -z "$GREP"; then
+  { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+else
+  ac_cv_path_GREP=$GREP
+fi
+
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5
+echo "${ECHO_T}$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6; }
+if test "${ac_cv_path_EGREP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+   then ac_cv_path_EGREP="$GREP -E"
+   else
+     # Extract the first word of "egrep" to use in msg output
+if test -z "$EGREP"; then
+set dummy egrep; ac_prog_name=$2
+if test "${ac_cv_path_EGREP+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  if echo a | (grep -E '(a|b)') >/dev/null 2>&1
-    then ac_cv_prog_egrep='grep -E'
-    else ac_cv_prog_egrep='egrep'
+  ac_path_EGREP_found=false
+# Loop through the user's path and test for each of PROGNAME-LIST
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_prog in egrep; do
+  for ac_exec_ext in '' $ac_executable_extensions; do
+    ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+    { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+    # Check for GNU ac_path_EGREP and select it if it is found.
+  # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+  ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    echo 'EGREP' >> "conftest.nl"
+    "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    ac_count=`expr $ac_count + 1`
+    if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_EGREP="$ac_path_EGREP"
+      ac_path_EGREP_max=$ac_count
     fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+
+    $ac_path_EGREP_found && break 3
+  done
+done
+
+done
+IFS=$as_save_IFS
+
+
+fi
+
+EGREP="$ac_cv_path_EGREP"
+if test -z "$EGREP"; then
+  { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+else
+  ac_cv_path_EGREP=$EGREP
 fi
-echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
-echo "${ECHO_T}$ac_cv_prog_egrep" >&6
- EGREP=$ac_cv_prog_egrep
 
 
-echo "$as_me:$LINENO: checking for ANSI C header files" >&5
-echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+   fi
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
+echo "${ECHO_T}$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; }
 if test "${ac_cv_header_stdc+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -2726,35 +3279,31 @@ main ()
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_cv_header_stdc=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_header_stdc=no
+       ac_cv_header_stdc=no
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
@@ -2810,6 +3359,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 #include <ctype.h>
+#include <stdlib.h>
 #if ((' ' & 0x0FF) == 0x020)
 # define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
 # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
@@ -2829,18 +3379,27 @@ main ()
   for (i = 0; i < 256; i++)
     if (XOR (islower (i), ISLOWER (i))
        || toupper (i) != TOUPPER (i))
-      exit(2);
-  exit (0);
+      return 2;
+  return 0;
 }
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
@@ -2853,12 +3412,14 @@ sed 's/^/| /' conftest.$ac_ext >&5
 ( exit $ac_status )
 ac_cv_header_stdc=no
 fi
-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
+
+
 fi
 fi
-echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
-echo "${ECHO_T}$ac_cv_header_stdc" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6; }
 if test $ac_cv_header_stdc = yes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -2867,8 +3428,8 @@ _ACEOF
 
 fi
 
-echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5
-echo $ECHO_N "checking for sys/wait.h that is POSIX.1 compatible... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5
+echo $ECHO_N "checking for sys/wait.h that is POSIX.1 compatible... $ECHO_C" >&6; }
 if test "${ac_cv_header_sys_wait_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -2881,7 +3442,7 @@ cat >>conftest.$ac_ext <<_ACEOF
 #include <sys/types.h>
 #include <sys/wait.h>
 #ifndef WEXITSTATUS
-# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
+# define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8)
 #endif
 #ifndef WIFEXITED
 # define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
@@ -2898,38 +3459,34 @@ main ()
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_cv_header_sys_wait_h=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_header_sys_wait_h=no
+       ac_cv_header_sys_wait_h=no
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5
-echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5
+echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6; }
 if test $ac_cv_header_sys_wait_h = yes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -2952,9 +3509,9 @@ for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
                  inttypes.h stdint.h unistd.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -2968,38 +3525,35 @@ $ac_includes_default
 #include <$ac_header>
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   eval "$as_ac_Header=yes"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-eval "$as_ac_Header=no"
+       eval "$as_ac_Header=no"
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+              { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
   cat >>confdefs.h <<_ACEOF
 #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
@@ -3018,18 +3572,19 @@ done
 for ac_header in fcntl.h syslog.h unistd.h sys/ioctl.h sys/time.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+              { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 else
   # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -3040,41 +3595,37 @@ $ac_includes_default
 #include <$ac_header>
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_header_compiler=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_header_compiler=no
+       ac_header_compiler=no
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -3083,24 +3634,22 @@ cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 #include <$ac_header>
 _ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
+  (exit $ac_status); } >/dev/null && {
+        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       }; then
   ac_header_preproc=yes
 else
   echo "$as_me: failed program was:" >&5
@@ -3108,9 +3657,10 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
   ac_header_preproc=no
 fi
+
 rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
 
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
@@ -3134,25 +3684,19 @@ echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\
 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
     { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to the AC_PACKAGE_NAME lists.  ##
-## ------------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
+
     ;;
 esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   eval "$as_ac_Header=\$ac_header_preproc"
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+              { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 
 fi
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
@@ -3170,18 +3714,19 @@ done
 for ac_header in openssl/ssl.h openssl/md5.h openssl/err.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+              { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 else
   # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -3192,41 +3737,37 @@ $ac_includes_default
 #include <$ac_header>
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_header_compiler=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_header_compiler=no
+       ac_header_compiler=no
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -3235,24 +3776,22 @@ cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 #include <$ac_header>
 _ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
+  (exit $ac_status); } >/dev/null && {
+        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       }; then
   ac_header_preproc=yes
 else
   echo "$as_me: failed program was:" >&5
@@ -3260,9 +3799,10 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
   ac_header_preproc=no
 fi
+
 rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
 
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
@@ -3286,25 +3826,19 @@ echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\
 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
     { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to the AC_PACKAGE_NAME lists.  ##
-## ------------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
+
     ;;
 esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   eval "$as_ac_Header=\$ac_header_preproc"
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+              { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 
 fi
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
@@ -3326,8 +3860,8 @@ done
 
 
 
-echo "$as_me:$LINENO: checking for MD5_Init in -lcrypto" >&5
-echo $ECHO_N "checking for MD5_Init in -lcrypto... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for MD5_Init in -lcrypto" >&5
+echo $ECHO_N "checking for MD5_Init in -lcrypto... $ECHO_C" >&6; }
 if test "${ac_cv_lib_crypto_MD5_Init+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -3340,56 +3874,53 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
 #ifdef __cplusplus
 extern "C"
 #endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char MD5_Init ();
 int
 main ()
 {
-MD5_Init ();
+return MD5_Init ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   ac_cv_lib_crypto_MD5_Init=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_crypto_MD5_Init=no
+       ac_cv_lib_crypto_MD5_Init=no
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_crypto_MD5_Init" >&5
-echo "${ECHO_T}$ac_cv_lib_crypto_MD5_Init" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_crypto_MD5_Init" >&5
+echo "${ECHO_T}$ac_cv_lib_crypto_MD5_Init" >&6; }
 if test $ac_cv_lib_crypto_MD5_Init = yes; then
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBCRYPTO 1
@@ -3404,8 +3935,8 @@ echo "$as_me: error: OpenSSL libraries are required" >&2;}
 fi
 
 
-echo "$as_me:$LINENO: checking for SSL_CTX_new in -lssl" >&5
-echo $ECHO_N "checking for SSL_CTX_new in -lssl... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for SSL_CTX_new in -lssl" >&5
+echo $ECHO_N "checking for SSL_CTX_new in -lssl... $ECHO_C" >&6; }
 if test "${ac_cv_lib_ssl_SSL_CTX_new+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -3418,56 +3949,53 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
 #ifdef __cplusplus
 extern "C"
 #endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char SSL_CTX_new ();
 int
 main ()
 {
-SSL_CTX_new ();
+return SSL_CTX_new ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   ac_cv_lib_ssl_SSL_CTX_new=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_ssl_SSL_CTX_new=no
+       ac_cv_lib_ssl_SSL_CTX_new=no
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_ssl_SSL_CTX_new" >&5
-echo "${ECHO_T}$ac_cv_lib_ssl_SSL_CTX_new" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_ssl_SSL_CTX_new" >&5
+echo "${ECHO_T}$ac_cv_lib_ssl_SSL_CTX_new" >&6; }
 if test $ac_cv_lib_ssl_SSL_CTX_new = yes; then
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBSSL 1
@@ -3482,8 +4010,8 @@ echo "$as_me: error: OpenSSL libraries are required" >&2;}
 fi
 
 
-echo "$as_me:$LINENO: checking for poptGetContext in -lpopt" >&5
-echo $ECHO_N "checking for poptGetContext in -lpopt... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for poptGetContext in -lpopt" >&5
+echo $ECHO_N "checking for poptGetContext in -lpopt... $ECHO_C" >&6; }
 if test "${ac_cv_lib_popt_poptGetContext+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -3496,56 +4024,53 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
 #ifdef __cplusplus
 extern "C"
 #endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char poptGetContext ();
 int
 main ()
 {
-poptGetContext ();
+return poptGetContext ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   ac_cv_lib_popt_poptGetContext=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_popt_poptGetContext=no
+       ac_cv_lib_popt_poptGetContext=no
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_popt_poptGetContext" >&5
-echo "${ECHO_T}$ac_cv_lib_popt_poptGetContext" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_popt_poptGetContext" >&5
+echo "${ECHO_T}$ac_cv_lib_popt_poptGetContext" >&6; }
 if test $ac_cv_lib_popt_poptGetContext = yes; then
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBPOPT 1
@@ -3561,8 +4086,8 @@ fi
 
 
 CPPFLAGS="$CPPFLAGS -I$kernelinc"
-echo "$as_me:$LINENO: checking for kernel version" >&5
-echo $ECHO_N "checking for kernel version... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for kernel version" >&5
+echo $ECHO_N "checking for kernel version... $ECHO_C" >&6; }
 if test "$cross_compiling" = yes; then
 
     LINUX_MAJOR="0"
@@ -3593,13 +4118,22 @@ cat >>conftest.$ac_ext <<_ACEOF
 
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
@@ -3620,11 +4154,13 @@ sed 's/^/| /' conftest.$ac_ext >&5
     LINUX_PATCH="0"
 
 fi
-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
+
+
   rm -f linuxinfo
-  echo "$as_me:$LINENO: result: $LINUX_MAJOR.$LINUX_MINOR.$LINUX_PATCH" >&5
-echo "${ECHO_T}$LINUX_MAJOR.$LINUX_MINOR.$LINUX_PATCH" >&6
+  { echo "$as_me:$LINENO: result: $LINUX_MAJOR.$LINUX_MINOR.$LINUX_PATCH" >&5
+echo "${ECHO_T}$LINUX_MAJOR.$LINUX_MINOR.$LINUX_PATCH" >&6; }
   if test "$LINUX_MINOR" = "6"; then
     KERN="_KRNL_2_6_"
   elif test "$LINUX_MINOR" = "4"; then
@@ -3638,9 +4174,9 @@ echo "$as_me: WARNING: Cannot determine Linux Kernel version." >&2;}
   fi
 
 as_ac_File=`echo "ac_cv_file_$kernelpath/net/core/link_watch.c" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $kernelpath/net/core/link_watch.c" >&5
-echo $ECHO_N "checking for $kernelpath/net/core/link_watch.c... $ECHO_C" >&6
-if eval "test \"\${$as_ac_File+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $kernelpath/net/core/link_watch.c" >&5
+echo $ECHO_N "checking for $kernelpath/net/core/link_watch.c... $ECHO_C" >&6; }
+if { as_var=$as_ac_File; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   test "$cross_compiling" = yes &&
@@ -3653,8 +4189,9 @@ else
   eval "$as_ac_File=no"
 fi
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_File'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_File'}'`" >&6
+ac_res=`eval echo '${'$as_ac_File'}'`
+              { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 if test `eval echo '${'$as_ac_File'}'` = yes; then
 
                 LINKWATCH_SUPPORT="_WITH_LINKWATCH_"
@@ -3672,17 +4209,17 @@ fi
 IPVS_SUPPORT="_WITHOUT_LVS_"
 if test "$enable_lvs" != "no"; then
   if test "${ac_cv_header_net_ip_vs_h+set}" = set; then
-  echo "$as_me:$LINENO: checking for net/ip_vs.h" >&5
-echo $ECHO_N "checking for net/ip_vs.h... $ECHO_C" >&6
+  { echo "$as_me:$LINENO: checking for net/ip_vs.h" >&5
+echo $ECHO_N "checking for net/ip_vs.h... $ECHO_C" >&6; }
 if test "${ac_cv_header_net_ip_vs_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-echo "$as_me:$LINENO: result: $ac_cv_header_net_ip_vs_h" >&5
-echo "${ECHO_T}$ac_cv_header_net_ip_vs_h" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_header_net_ip_vs_h" >&5
+echo "${ECHO_T}$ac_cv_header_net_ip_vs_h" >&6; }
 else
   # Is the header compilable?
-echo "$as_me:$LINENO: checking net/ip_vs.h usability" >&5
-echo $ECHO_N "checking net/ip_vs.h usability... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking net/ip_vs.h usability" >&5
+echo $ECHO_N "checking net/ip_vs.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -3693,41 +4230,37 @@ $ac_includes_default
 #include <net/ip_vs.h>
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_header_compiler=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_header_compiler=no
+       ac_header_compiler=no
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-echo "$as_me:$LINENO: checking net/ip_vs.h presence" >&5
-echo $ECHO_N "checking net/ip_vs.h presence... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking net/ip_vs.h presence" >&5
+echo $ECHO_N "checking net/ip_vs.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -3736,24 +4269,22 @@ cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 #include <net/ip_vs.h>
 _ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
+  (exit $ac_status); } >/dev/null && {
+        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       }; then
   ac_header_preproc=yes
 else
   echo "$as_me: failed program was:" >&5
@@ -3761,9 +4292,10 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
   ac_header_preproc=no
 fi
+
 rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
 
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
@@ -3787,25 +4319,18 @@ echo "$as_me: WARNING: net/ip_vs.h:     section \"Present But Cannot Be Compiled
 echo "$as_me: WARNING: net/ip_vs.h: proceeding with the preprocessor's result" >&2;}
     { echo "$as_me:$LINENO: WARNING: net/ip_vs.h: in the future, the compiler will take precedence" >&5
 echo "$as_me: WARNING: net/ip_vs.h: in the future, the compiler will take precedence" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to the AC_PACKAGE_NAME lists.  ##
-## ------------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
+
     ;;
 esac
-echo "$as_me:$LINENO: checking for net/ip_vs.h" >&5
-echo $ECHO_N "checking for net/ip_vs.h... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for net/ip_vs.h" >&5
+echo $ECHO_N "checking for net/ip_vs.h... $ECHO_C" >&6; }
 if test "${ac_cv_header_net_ip_vs_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_cv_header_net_ip_vs_h=$ac_header_preproc
 fi
-echo "$as_me:$LINENO: result: $ac_cv_header_net_ip_vs_h" >&5
-echo "${ECHO_T}$ac_cv_header_net_ip_vs_h" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_header_net_ip_vs_h" >&5
+echo "${ECHO_T}$ac_cv_header_net_ip_vs_h" >&6; }
 
 fi
 if test $ac_cv_header_net_ip_vs_h = yes; then
@@ -3813,9 +4338,6 @@ if test $ac_cv_header_net_ip_vs_h = yes; then
 else
 
       IPVS_SUPPORT="_WITHOUT_LVS_"
-      IPVS_MAJOR="0"
-      IPVS_MINOR="0"
-      IPVS_PATCH="0"
       { echo "$as_me:$LINENO: WARNING: keepalived will be built without LVS support." >&5
 echo "$as_me: WARNING: keepalived will be built without LVS support." >&2;}
 
 
 fi
 
+if test "$IPVS_SUPPORT" = "_WITHOUT_LVS_" -a "$enable_vrrp" = "no"; then
+  { { echo "$as_me:$LINENO: error: keepalived MUST be compiled at least with LVS or VRRP framework" >&5
+echo "$as_me: error: keepalived MUST be compiled at least with LVS or VRRP framework" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+IPVS_SYNCD="_WITHOUT_IPVS_SYNCD_"
 if test "$IPVS_SUPPORT" = "_WITH_LVS_"; then
-  echo "$as_me:$LINENO: checking for IPVS version" >&5
-echo $ECHO_N "checking for IPVS version... $ECHO_C" >&6
-  if test "$cross_compiling" = yes; then
+  { echo "$as_me:$LINENO: checking for IPVS syncd support" >&5
+echo $ECHO_N "checking for IPVS syncd support... $ECHO_C" >&6; }
+  if test "$KERN" = "_KRNL_2_6_"; then
+    IPVS_SYNCD="_HAVE_IPVS_SYNCD_"
+  elif test "_KRNL_2_4_"; then
+    IPVS_SYNCD="_HAVE_IPVS_SYNCD_"
+  else
+    IPVS_SYNCD="_WITHOUT_IPVS_SYNCD_"
+  fi
 
-    IPVS_MAJOR="0"
-    IPVS_MINOR="0"
-    IPVS_PATCH="0"
-
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-    #include <stdlib.h>
-    #include <stdio.h>
-    #include <net/ip_vs.h>
-    int main (void) {
-      FILE *fp = fopen ("ipvsinfo", "w");
-      if (!fp) return 1;
-      fprintf (fp, "%d\n%d\n%d\n", NVERSION(IP_VS_VERSION_CODE));
-      fclose (fp);
-      return 0;
-    }
-
-_ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-
-    IPVS_MAJOR=`head -n 1 ipvsinfo | tail -n 1`
-    IPVS_MINOR=`head -n 2 ipvsinfo | tail -n 1`
-    IPVS_PATCH=`head -n 3 ipvsinfo | tail -n 1`
-
-else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-
-    IPVS_MAJOR="0"
-    IPVS_MINOR="0"
-    IPVS_PATCH="0"
-
-fi
-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-  rm -f ipvsinfo
-  echo "$as_me:$LINENO: result: $IPVS_MAJOR.$IPVS_MINOR.$IPVS_PATCH" >&5
-echo "${ECHO_T}$IPVS_MAJOR.$IPVS_MINOR.$IPVS_PATCH" >&6
-  if test "$IPVS_MAJOR" = "0" -a "$IPVS_MINOR" = "0" -a "$IPVS_PATCH" = "0"; then
-    { echo "$as_me:$LINENO: WARNING: Cannot determine IPVS version." >&5
-echo "$as_me: WARNING: Cannot determine IPVS version." >&2;}
-  fi
-fi
-
-if test "$IPVS_SUPPORT" = "_WITHOUT_LVS_" -a "$enable_vrrp" = "no"; then
-  { { echo "$as_me:$LINENO: error: keepalived MUST be compiled at least with LVS or VRRP framework" >&5
-echo "$as_me: error: keepalived MUST be compiled at least with LVS or VRRP framework" >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
-
-IPVS_SYNCD="_WITHOUT_IPVS_SYNCD_"
-if test "$IPVS_SUPPORT" = "_WITH_LVS_"; then
-  echo "$as_me:$LINENO: checking for IPVS syncd support" >&5
-echo $ECHO_N "checking for IPVS syncd support... $ECHO_C" >&6
-  if test "$KERN" = "_KRNL_2_6_"; then
-    IPVS_SYNCD="_HAVE_IPVS_SYNCD_"
-  elif test "$IPVS_MAJOR" -ge 1 -a "$KERN" = "_KRNL_2_4_"; then
-    IPVS_SYNCD="_HAVE_IPVS_SYNCD_"
-  elif test "$IPVS_MINOR" -ge 9 -a "$IPVS_PATCH" -ge 2 -a "$KERN" = "_KRNL_2_4_"; then
-    IPVS_SYNCD="_HAVE_IPVS_SYNCD_"
-  else
-    IPVS_SYNCD="_WITHOUT_IPVS_SYNCD_"
-  fi
-
-  if test "${IPVS_SUPPORT}" = "_WITHOUT_LVS_" -o "$enable_lvs_syncd" = "no"; then
-    IPVS_SYNCD="_WITHOUT_IPVS_SYNCD_"
-  fi
+  if test "${IPVS_SUPPORT}" = "_WITHOUT_LVS_" -o "$enable_lvs_syncd" = "no"; then
+    IPVS_SYNCD="_WITHOUT_IPVS_SYNCD_"
+  fi
 
   if test "$IPVS_SYNCD" = "_HAVE_IPVS_SYNCD_"; then
-    echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
+    { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
   else
-    echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+    { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
   fi
 fi
 
@@ -3930,61 +4381,7 @@ fi
 
 VRRP_SUPPORT="_WITHOUT_VRRP_"
 if test "$enable_vrrp" != "no"; then
-  echo "$as_me:$LINENO: checking for kernel netlink support" >&5
-echo $ECHO_N "checking for kernel netlink support... $ECHO_C" >&6
-  if test "$cross_compiling" = yes; then
-
-      echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-    #include <asm/types.h>
-    #include <sys/socket.h>
-    #include <linux/netlink.h>
-    int main (void) {
-      int fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
-      if (fd < 0)
-        exit(1);
-      close(fd);
-      exit(0);
-    }
-_ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-
-      echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
-      VRRP_SUPPORT="_WITH_VRRP_"
-
-else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-
-      echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-
-fi
-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
+  VRRP_SUPPORT="_WITH_VRRP_"
 fi
 
 if test "${enable_debug}" = "yes"; then
@@ -4001,8 +4398,8 @@ fi
 
 
 
-echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
-echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
+echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6; }
 if test "${ac_cv_c_const+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -4020,10 +4417,10 @@ main ()
 #ifndef __cplusplus
   /* Ultrix mips cc rejects this.  */
   typedef int charset[2];
-  const charset x;
+  const charset cs;
   /* SunOS 4.1.1 cc rejects this.  */
-  char const *const *ccp;
-  char **p;
+  char const *const *pcpcc;
+  char **ppc;
   /* NEC SVR4.0.2 mips cc rejects this.  */
   struct point {int x, y;};
   static struct point const zero = {0,0};
@@ -4032,16 +4429,17 @@ main ()
      an arm of an if-expression whose if-part is not a constant
      expression */
   const char *g = "string";
-  ccp = &g + (g ? g-g : 0);
+  pcpcc = &g + (g ? g-g : 0);
   /* HPUX 7.0 cc rejects these. */
-  ++ccp;
-  p = (char**) ccp;
-  ccp = (char const *const *) p;
+  ++pcpcc;
+  ppc = (char**) pcpcc;
+  pcpcc = (char const *const *) ppc;
   { /* SCO 3.2v4 cc rejects this.  */
     char *t;
     char const *s = 0 ? (char *) 0 : (char const *) 0;
 
     *t++ = 0;
+    if (s) return 0;
   }
   { /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
     int x[] = {25, 17};
@@ -4060,7 +4458,9 @@ main ()
   }
   { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
     const int foo = 10;
+    if (!foo) return 0;
   }
+  return !cs[0] && !zero.x;
 #endif
 
   ;
@@ -4068,38 +4468,34 @@ main ()
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_cv_c_const=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_c_const=no
+       ac_cv_c_const=no
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
-echo "${ECHO_T}$ac_cv_c_const" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
+echo "${ECHO_T}$ac_cv_c_const" >&6; }
 if test $ac_cv_c_const = no; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -4108,8 +4504,8 @@ _ACEOF
 
 fi
 
-echo "$as_me:$LINENO: checking for pid_t" >&5
-echo $ECHO_N "checking for pid_t... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for pid_t" >&5
+echo $ECHO_N "checking for pid_t... $ECHO_C" >&6; }
 if test "${ac_cv_type_pid_t+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -4120,50 +4516,47 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
+typedef pid_t ac__type_new_;
 int
 main ()
 {
-if ((pid_t *) 0)
+if ((ac__type_new_ *) 0)
   return 0;
-if (sizeof (pid_t))
+if (sizeof (ac__type_new_))
   return 0;
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_cv_type_pid_t=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_type_pid_t=no
+       ac_cv_type_pid_t=no
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5
-echo "${ECHO_T}$ac_cv_type_pid_t" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5
+echo "${ECHO_T}$ac_cv_type_pid_t" >&6; }
 if test $ac_cv_type_pid_t = yes; then
   :
 else
@@ -4174,8 +4567,8 @@ _ACEOF
 
 fi
 
-echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
-echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
+echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6; }
 if test "${ac_cv_header_time+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -4199,38 +4592,34 @@ return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_cv_header_time=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_header_time=no
+       ac_cv_header_time=no
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5
-echo "${ECHO_T}$ac_cv_header_time" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5
+echo "${ECHO_T}$ac_cv_header_time" >&6; }
 if test $ac_cv_header_time = yes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -4241,8 +4630,8 @@ fi
 
 
 if test $ac_cv_c_compiler_gnu = yes; then
-    echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5
-echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6
+    { echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5
+echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6; }
 if test "${ac_cv_prog_gcc_traditional+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -4283,15 +4672,15 @@ rm -f conftest*
 
   fi
 fi
-echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5
-echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5
+echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6; }
   if test $ac_cv_prog_gcc_traditional = yes; then
     CC="$CC -traditional"
   fi
 fi
 
-echo "$as_me:$LINENO: checking for working memcmp" >&5
-echo $ECHO_N "checking for working memcmp... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for working memcmp" >&5
+echo $ECHO_N "checking for working memcmp... $ECHO_C" >&6; }
 if test "${ac_cv_func_memcmp_working+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -4310,9 +4699,9 @@ main ()
 {
 
   /* Some versions of memcmp are not 8-bit clean.  */
-  char c0 = 0x40, c1 = 0x80, c2 = 0x81;
+  char c0 = '\100', c1 = '\200', c2 = '\201';
   if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0)
-    exit (1);
+    return 1;
 
   /* The Next x86 OpenStep bug shows up only when comparing 16 bytes
      or more and with at least one buffer not starting on a 4-byte boundary.
@@ -4328,9 +4717,9 @@ main ()
        strcpy (a, "--------01111111");
        strcpy (b, "--------10000000");
        if (memcmp (a, b, 16) >= 0)
-         exit (1);
+         return 1;
       }
-    exit (0);
+    return 0;
   }
 
   ;
@@ -4338,13 +4727,22 @@ main ()
 }
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
@@ -4357,22 +4755,22 @@ sed 's/^/| /' conftest.$ac_ext >&5
 ( exit $ac_status )
 ac_cv_func_memcmp_working=no
 fi
-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
+
+
 fi
-echo "$as_me:$LINENO: result: $ac_cv_func_memcmp_working" >&5
-echo "${ECHO_T}$ac_cv_func_memcmp_working" >&6
-test $ac_cv_func_memcmp_working = no && case $LIBOBJS in
-    "memcmp.$ac_objext"   | \
-  *" memcmp.$ac_objext"   | \
-    "memcmp.$ac_objext "* | \
+{ echo "$as_me:$LINENO: result: $ac_cv_func_memcmp_working" >&5
+echo "${ECHO_T}$ac_cv_func_memcmp_working" >&6; }
+test $ac_cv_func_memcmp_working = no && case " $LIBOBJS " in
   *" memcmp.$ac_objext "* ) ;;
-  *) LIBOBJS="$LIBOBJS memcmp.$ac_objext" ;;
+  *) LIBOBJS="$LIBOBJS memcmp.$ac_objext"
+ ;;
 esac
 
 
-echo "$as_me:$LINENO: checking return type of signal handlers" >&5
-echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking return type of signal handlers" >&5
+echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6; }
 if test "${ac_cv_type_signal+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -4384,56 +4782,44 @@ cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 #include <sys/types.h>
 #include <signal.h>
-#ifdef signal
-# undef signal
-#endif
-#ifdef __cplusplus
-extern "C" void (*signal (int, void (*)(int)))(int);
-#else
-void (*signal ()) ();
-#endif
 
 int
 main ()
 {
-int i;
+return *(signal (0, 0)) (0) == 1;
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_type_signal=void
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_type_signal=int
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_type_signal=int
+       ac_cv_type_signal=void
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5
-echo "${ECHO_T}$ac_cv_type_signal" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5
+echo "${ECHO_T}$ac_cv_type_signal" >&6; }
 
 cat >>confdefs.h <<_ACEOF
 #define RETSIGTYPE $ac_cv_type_signal
@@ -4449,9 +4835,9 @@ _ACEOF
 for ac_func in gettimeofday select socket strerror strtol uname
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-if eval "test \"\${$as_ac_var+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -4477,68 +4863,60 @@ cat >>conftest.$ac_ext <<_ACEOF
 
 #undef $ac_func
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
 #ifdef __cplusplus
 extern "C"
-{
 #endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char $ac_func ();
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+#if defined __stub_$ac_func || defined __stub___$ac_func
 choke me
-#else
-char (*f) () = $ac_func;
-#endif
-#ifdef __cplusplus
-}
 #endif
 
 int
 main ()
 {
-return f != $ac_func;
+return $ac_func ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   eval "$as_ac_var=yes"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-eval "$as_ac_var=no"
+       eval "$as_ac_var=no"
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+ac_res=`eval echo '${'$as_ac_var'}'`
+              { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 if test `eval echo '${'$as_ac_var'}'` = yes; then
   cat >>confdefs.h <<_ACEOF
 #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
@@ -4562,7 +4940,8 @@ if test "$IPVS_SUPPORT" = "_WITH_LVS_"; then
     OUTPUT_TARGET="$OUTPUT_TARGET keepalived/libipfwc/Makefile"
   fi
 fi
-          ac_config_files="$ac_config_files $OUTPUT_TARGET"
+ac_config_files="$ac_config_files $OUTPUT_TARGET"
+
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
 # tests run on this system so they can be shared between configure
@@ -4581,39 +4960,58 @@ _ACEOF
 
 # The following way of writing the cache mishandles newlines in values,
 # but we know of no workaround that is simple, portable, and efficient.
-# So, don't put newlines in cache variables' values.
+# So, we kill variables containing newlines.
 # Ultrix sh set writes to stderr and can't be redirected directly,
 # and sets the high bit in the cache file unless we assign to the vars.
-{
+(
+  for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+    eval ac_val=\$$ac_var
+    case $ac_val in #(
+    *${as_nl}*)
+      case $ac_var in #(
+      *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
+echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+      esac
+      case $ac_var in #(
+      _ | IFS | as_nl) ;; #(
+      *) $as_unset $ac_var ;;
+      esac ;;
+    esac
+  done
+
   (set) 2>&1 |
-    case `(ac_space=' '; set | grep ac_space) 2>&1` in
-    *ac_space=\ *)
+    case $as_nl`(ac_space=' '; set) 2>&1` in #(
+    *${as_nl}ac_space=\ *)
       # `set' does not quote correctly, so add quotes (double-quote
       # substitution turns \\\\ into \\, and sed turns \\ into \).
       sed -n \
        "s/'/'\\\\''/g;
          s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
-      ;;
+      ;; #(
     *)
       # `set' quotes correctly as required by POSIX, so do not add quotes.
-      sed -n \
-       "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
       ;;
-    esac;
-} |
+    esac |
+    sort
+) |
   sed '
+     /^ac_cv_env_/b end
      t clear
-     : clear
+     :clear
      s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
      t end
-     /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
-     : end' >>confcache
-if diff $cache_file confcache >/dev/null 2>&1; then :; else
-  if test -w $cache_file; then
-    test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
+     s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+     :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+  if test -w "$cache_file"; then
+    test "x$cache_file" != "x/dev/null" &&
+      { echo "$as_me:$LINENO: updating cache $cache_file" >&5
+echo "$as_me: updating cache $cache_file" >&6;}
     cat confcache >$cache_file
   else
-    echo "not updating unwritable cache $cache_file"
+    { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
+echo "$as_me: not updating unwritable cache $cache_file" >&6;}
   fi
 fi
 rm -f confcache
@@ -4622,63 +5020,48 @@ test "x$prefix" = xNONE && prefix=$ac_default_prefix
 # Let make expand exec_prefix.
 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
 
-# VPATH may cause trouble with some makes, so we remove $(srcdir),
-# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
-# trailing colons and then remove the whole line if VPATH becomes empty
-# (actually we leave an empty line to preserve line numbers).
-if test "x$srcdir" = x.; then
-  ac_vpsub='/^[         ]*VPATH[        ]*=/{
-s/:*\$(srcdir):*/:/;
-s/:*\${srcdir}:*/:/;
-s/:*@srcdir@:*/:/;
-s/^\([^=]*=[    ]*\):*/\1/;
-s/:*$//;
-s/^[^=]*=[      ]*$//;
-}'
-fi
-
 # Transform confdefs.h into DEFS.
 # Protect against shell expansion while executing Makefile rules.
 # Protect against Makefile macro expansion.
 #
 # If the first sed substitution is executed (which looks for macros that
-# take arguments), then we branch to the quote section.  Otherwise,
+# take arguments), then branch to the quote section.  Otherwise,
 # look for a macro that doesn't take arguments.
-cat >confdef2opt.sed <<\_ACEOF
+ac_script='
 t clear
-: clear
-s,^[    ]*#[    ]*define[       ][      ]*\([^  (][^    (]*([^)]*)\)[   ]*\(.*\),-D\1=\2,g
+:clear
+s/^[    ]*#[    ]*define[       ][      ]*\([^  (][^    (]*([^)]*)\)[   ]*\(.*\)/-D\1=\2/g
 t quote
-s,^[    ]*#[    ]*define[       ][      ]*\([^  ][^     ]*\)[   ]*\(.*\),-D\1=\2,g
+s/^[    ]*#[    ]*define[       ][      ]*\([^  ][^     ]*\)[   ]*\(.*\)/-D\1=\2/g
 t quote
-d
-: quote
-s,[     `~#$^&*(){}\\|;'"<>?],\\&,g
-s,\[,\\&,g
-s,\],\\&,g
-s,\$,$$,g
-p
-_ACEOF
-# We use echo to avoid assuming a particular line-breaking character.
-# The extra dot is to prevent the shell from consuming trailing
-# line-breaks from the sub-command output.  A line-break within
-# single-quotes doesn't work because, if this script is created in a
-# platform that uses two characters for line-breaks (e.g., DOS), tr
-# would break.
-ac_LF_and_DOT=`echo; echo .`
-DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'`
-rm -f confdef2opt.sed
+b any
+:quote
+s/[     `~#$^&*(){}\\|;'\''"<>?]/\\&/g
+s/\[/\\&/g
+s/\]/\\&/g
+s/\$/$$/g
+H
+:any
+${
+       g
+       s/^\n//
+       s/\n/ /g
+       p
+}
+'
+DEFS=`sed -n "$ac_script" confdefs.h`
 
 
 ac_libobjs=
 ac_ltlibobjs=
 for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
   # 1. Remove the extension, and $U if already installed.
-  ac_i=`echo "$ac_i" |
-        sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
-  # 2. Add them.
-  ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
-  ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
+  ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+  ac_i=`echo "$ac_i" | sed "$ac_script"`
+  # 2. Prepend LIBOBJDIR.  When used with automake>=1.10 LIBOBJDIR
+  #    will be set to the directory where LIBOBJS objects are built.
+  ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+  ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
 done
 LIBOBJS=$ac_libobjs
 
@@ -4709,17 +5092,45 @@ cat >>$CONFIG_STATUS <<\_ACEOF
 ## M4sh Initialization.  ##
 ## --------------------- ##
 
-# Be Bourne compatible
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
   emulate sh
   NULLCMD=:
   # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
   # is contrary to our usage.  Disable this feature.
   alias -g '${1+"$@"}'='"$@"'
-elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
-  set -o posix
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in
+  *posix*) set -o posix ;;
+esac
+
+fi
+
+
+
+
+# PATH needs CR
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
 fi
-DUALCASE=1; export DUALCASE # for MKS sh
 
 # Support unset when possible.
 if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
@@ -4729,8 +5140,43 @@ else
 fi
 
 
+# IFS
+# We need space, tab and new line, in precisely that order.  Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+as_nl='
+'
+IFS=" ""       $as_nl"
+
+# Find who we are.  Look in the path if we contain no directory separator.
+case $0 in
+  *[\\/]* ) as_myself=$0 ;;
+  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+IFS=$as_save_IFS
+
+     ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+  as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+  echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+  { (exit 1); exit 1; }
+fi
+
 # Work around bugs in pre-3.0 UWIN ksh.
-$as_unset ENV MAIL MAILPATH
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
 PS1='$ '
 PS2='> '
 PS4='+ '
@@ -4744,18 +5190,19 @@ do
   if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
     eval $as_var=C; export $as_var
   else
-    $as_unset $as_var
+    ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
   fi
 done
 
 # Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1; then
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
   as_expr=expr
 else
   as_expr=false
 fi
 
-if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
   as_basename=basename
 else
   as_basename=false
 
 
 # Name of the executable.
-as_me=`$as_basename "$0" ||
+as_me=`$as_basename -- "$0" ||
 $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
         X"$0" : 'X\(//\)$' \| \
-        X"$0" : 'X\(/\)$' \| \
-        .     : '\(.\)' 2>/dev/null ||
+        X"$0" : 'X\(/\)' \| . 2>/dev/null ||
 echo X/"$0" |
-    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
-         /^X\/\(\/\/\)$/{ s//\1/; q; }
-         /^X\/\(\/\).*/{ s//\1/; q; }
-         s/.*/./; q'`
-
-
-# PATH needs CR, and LINENO needs CR and PATH.
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
+           s//\1/
+           q
+         }
+         /^X\/\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\/\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
 
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
-  echo "#! /bin/sh" >conf$$.sh
-  echo  "exit 0"   >>conf$$.sh
-  chmod +x conf$$.sh
-  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
-    PATH_SEPARATOR=';'
-  else
-    PATH_SEPARATOR=:
-  fi
-  rm -f conf$$.sh
-fi
+# CDPATH.
+$as_unset CDPATH
 
 
-  as_lineno_1=$LINENO
-  as_lineno_2=$LINENO
-  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
-  test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
-  # Find who we are.  Look in the path if we contain no path at all
-  # relative or not.
-  case $0 in
-    *[\\/]* ) as_myself=$0 ;;
-    *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
 
-       ;;
-  esac
-  # We did not find ourselves, most probably we were run as `sh COMMAND'
-  # in which case we are not to be found in the path.
-  if test "x$as_myself" = x; then
-    as_myself=$0
-  fi
-  if test ! -f "$as_myself"; then
-    { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
-echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
-   { (exit 1); exit 1; }; }
-  fi
-  case $CONFIG_SHELL in
-  '')
-    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for as_base in sh bash ksh sh5; do
-        case $as_dir in
-        /*)
-          if ("$as_dir/$as_base" -c '
   as_lineno_1=$LINENO
   as_lineno_2=$LINENO
-  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
   test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
-            $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
-            $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
-            CONFIG_SHELL=$as_dir/$as_base
-            export CONFIG_SHELL
-            exec "$CONFIG_SHELL" "$0" ${1+"$@"}
-          fi;;
-        esac
-       done
-done
-;;
-  esac
+  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
 
   # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
   # uniformly replaced by the line number.  The first 'sed' inserts a
-  # line-number line before each line; the second 'sed' does the real
-  # work.  The second script uses 'N' to pair each line-number line
-  # with the numbered line, and appends trailing '-' during
-  # substitution so that $LINENO is not a special case at line end.
+  # line-number line after each line using $LINENO; the second 'sed'
+  # does the real work.  The second script uses 'N' to pair each
+  # line-number line with the line containing $LINENO, and appends
+  # trailing '-' during substitution so that $LINENO is not a special
+  # case at line end.
   # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
-  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
-  sed '=' <$as_myself |
+  # scripts with optimization help from Paolo Bonzini.  Blame Lee
+  # E. McMahon (1931-1989) for sed's syntax.  :-)
+  sed -n '
+    p
+    /[$]LINENO/=
+  ' <$as_myself |
     sed '
+      s/[$]LINENO.*/&-/
+      t lineno
+      b
+      :lineno
       N
-      s,$,-,
-      : loop
-      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+      :loop
+      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
       t loop
-      s,-$,,
-      s,^['$as_cr_digits']*\n,,
+      s/-\n.*//
     ' >$as_me.lineno &&
-  chmod +x $as_me.lineno ||
-    { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
-echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
+  chmod +x "$as_me.lineno" ||
+    { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
    { (exit 1); exit 1; }; }
 
   # Don't try to exec as it changes $[0], causing all sort of problems
   # (the dirname of $[0] is not the place where we might find the
-  # original and so on.  Autoconf is especially sensible to this).
-  . ./$as_me.lineno
+  # original and so on.  Autoconf is especially sensitive to this).
+  . "./$as_me.lineno"
   # Exit status is that of the last command.
   exit
 }
 
 
-case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
-  *c*,-n*) ECHO_N= ECHO_C='
-' ECHO_T='     ' ;;
-  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
-  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+  case `echo 'x\c'` in
+  *c*) ECHO_T='        ';;     # ECHO_T is single tab character.
+  *)   ECHO_C='\c';;
+  esac;;
+*)
+  ECHO_N='-n';;
 esac
 
-if expr a : '\(a\)' >/dev/null 2>&1; then
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
   as_expr=expr
 else
   as_expr=false
 fi
 
 rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+  rm -f conf$$.dir/conf$$.file
+else
+  rm -f conf$$.dir
+  mkdir conf$$.dir
+fi
 echo >conf$$.file
 if ln -s conf$$.file conf$$ 2>/dev/null; then
-  # We could just check for DJGPP; but this test a) works b) is more generic
-  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
-  if test -f conf$$.exe; then
-    # Don't use ln at all; we don't have any links
+  as_ln_s='ln -s'
+  # ... but there are two gotchas:
+  # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+  # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+  # In both cases, we have to default to `cp -p'.
+  ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
     as_ln_s='cp -p'
-  else
-    as_ln_s='ln -s'
-  fi
 elif ln conf$$.file conf$$ 2>/dev/null; then
   as_ln_s=ln
 else
   as_ln_s='cp -p'
 fi
-rm -f conf$$ conf$$.exe conf$$.file
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
 
 if mkdir -p . 2>/dev/null; then
   as_mkdir_p=:
@@ -4924,7 +5332,28 @@ else
   as_mkdir_p=false
 fi
 
-as_executable_p="test -f"
+if test -x / >/dev/null 2>&1; then
+  as_test_x='test -x'
+else
+  if ls -dL / >/dev/null 2>&1; then
+    as_ls_L_option=L
+  else
+    as_ls_L_option=
+  fi
+  as_test_x='
+    eval sh -c '\''
+      if test -d "$1"; then
+        test -d "$1/.";
+      else
+       case $1 in
+        -*)set "./$1";;
+       esac;
+       case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+       ???[sx]*):;;*)false;;esac;fi
+    '\'' sh
+  '
+fi
+as_executable_p=$as_test_x
 
 # Sed expression to map a string onto a valid CPP name.
 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -4933,31 +5362,14 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
 as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
 
 
-# IFS
-# We need space, tab and new line, in precisely that order.
-as_nl='
-'
-IFS="  $as_nl"
-
-# CDPATH.
-$as_unset CDPATH
-
 exec 6>&1
 
-# Open the log real soon, to keep \$[0] and so on meaningful, and to
+# Save the log message, to keep $[0] and so on meaningful, and to
 # report actual input values of CONFIG_FILES etc. instead of their
-# values after options handling.  Logging --version etc. is OK.
-exec 5>>config.log
-{
-  echo
-  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
-## Running $as_me. ##
-_ASBOX
-} >&5
-cat >&5 <<_CSEOF
-
+# values after options handling.
+ac_log="
 This file was extended by $as_me, which was
-generated by GNU Autoconf 2.59.  Invocation command line was
+generated by GNU Autoconf 2.61.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -4965,30 +5377,18 @@ generated by GNU Autoconf 2.59.  Invocation command line was
   CONFIG_COMMANDS = $CONFIG_COMMANDS
   $ $0 $@
 
-_CSEOF
-echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
-echo >&5
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
 _ACEOF
 
+cat >>$CONFIG_STATUS <<_ACEOF
 # Files that config.status was made for.
-if test -n "$ac_config_files"; then
-  echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
-fi
+config_files="$ac_config_files"
 
-if test -n "$ac_config_headers"; then
-  echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
-fi
-
-if test -n "$ac_config_links"; then
-  echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
-fi
-
-if test -n "$ac_config_commands"; then
-  echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
-fi
+_ACEOF
 
 cat >>$CONFIG_STATUS <<\_ACEOF
-
 ac_cs_usage="\
 \`$as_me' instantiates files from templates according to the
 current configuration.
@@ -4996,7 +5396,7 @@ current configuration.
 Usage: $0 [OPTIONS] [FILE]...
 
   -h, --help       print this help, then exit
-  -V, --version    print version number, then exit
+  -V, --version    print version number and configuration settings, then exit
   -q, --quiet      do not print progress messages
   -d, --debug      don't remove temporary files
       --recheck    update $as_me by reconfiguring in the same conditions
@@ -5007,19 +5407,21 @@ Configuration files:
 $config_files
 
 Report bugs to <bug-autoconf@gnu.org>."
-_ACEOF
 
+_ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF
 ac_cs_version="\\
 config.status
-configured by $0, generated by GNU Autoconf 2.59,
-  with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
+configured by $0, generated by GNU Autoconf 2.61,
+  with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
 
-Copyright (C) 2003 Free Software Foundation, Inc.
+Copyright (C) 2006 Free Software Foundation, Inc.
 This config.status script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it."
-srcdir=$srcdir
-INSTALL="$INSTALL"
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+INSTALL='$INSTALL'
 _ACEOF
 
 cat >>$CONFIG_STATUS <<\_ACEOF
@@ -5030,60 +5432,42 @@ while test $# != 0
 do
   case $1 in
   --*=*)
-    ac_option=`expr "x$1" : 'x\([^=]*\)='`
-    ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
+    ac_option=`expr "X$1" : 'X\([^=]*\)='`
+    ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
     ac_shift=:
     ;;
-  -*)
+  *)
     ac_option=$1
     ac_optarg=$2
     ac_shift=shift
     ;;
-  *) # This is not an option, so the user has probably given explicit
-     # arguments.
-     ac_option=$1
-     ac_need_defaults=false;;
   esac
 
   case $ac_option in
   # Handling of the options.
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
   -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
     ac_cs_recheck=: ;;
-  --version | --vers* | -V )
-    echo "$ac_cs_version"; exit 0 ;;
-  --he | --h)
-    # Conflict between --help and --header
-    { { echo "$as_me:$LINENO: error: ambiguous option: $1
-Try \`$0 --help' for more information." >&5
-echo "$as_me: error: ambiguous option: $1
-Try \`$0 --help' for more information." >&2;}
-   { (exit 1); exit 1; }; };;
-  --help | --hel | -h )
-    echo "$ac_cs_usage"; exit 0 ;;
-  --debug | --d* | -d )
+  --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+    echo "$ac_cs_version"; exit ;;
+  --debug | --debu | --deb | --de | --d | -d )
     debug=: ;;
   --file | --fil | --fi | --f )
     $ac_shift
     CONFIG_FILES="$CONFIG_FILES $ac_optarg"
     ac_need_defaults=false;;
-  --header | --heade | --head | --hea )
-    $ac_shift
-    CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
-    ac_need_defaults=false;;
+  --he | --h |  --help | --hel | -h )
+    echo "$ac_cs_usage"; exit ;;
   -q | -quiet | --quiet | --quie | --qui | --qu | --q \
   | -silent | --silent | --silen | --sile | --sil | --si | --s)
     ac_cs_silent=: ;;
 
   # This is an error.
-  -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&5
-echo "$as_me: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&2;}
+  -*) { echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2
    { (exit 1); exit 1; }; } ;;
 
-  *) ac_config_targets="$ac_config_targets $1" ;;
+  *) ac_config_targets="$ac_config_targets $1"
+     ac_need_defaults=false ;;
 
   esac
   shift
@@ -5099,28 +5483,42 @@ fi
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF
 if \$ac_cs_recheck; then
-  echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
-  exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+  echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+  CONFIG_SHELL=$SHELL
+  export CONFIG_SHELL
+  exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
 fi
 
 _ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+exec 5>>config.log
+{
+  echo
+  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+  echo "$ac_log"
+} >&5
 
-
-
-
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+_ACEOF
 
 cat >>$CONFIG_STATUS <<\_ACEOF
+
+# Handling of arguments.
 for ac_config_target in $ac_config_targets
 do
-  case "$ac_config_target" in
-  # Handling of arguments.
-  "$OUTPUT_TARGET" ) CONFIG_FILES="$CONFIG_FILES $OUTPUT_TARGET" ;;
+  case $ac_config_target in
+    "$OUTPUT_TARGET") CONFIG_FILES="$CONFIG_FILES $OUTPUT_TARGET" ;;
+
   *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
 echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
    { (exit 1); exit 1; }; };;
   esac
 done
 
+
 # If the user did not use the arguments to specify the items to instantiate,
 # then the envvar interface is used.  Set only those that are not.
 # We use the long form for the default assignment because of an extremely
@@ -5130,308 +5528,375 @@ if $ac_need_defaults; then
 fi
 
 # Have a temporary directory for convenience.  Make it in the build tree
-# simply because there is no reason to put it here, and in addition,
+# simply because there is no reason against having it here, and in addition,
 # creating and moving files from /tmp can sometimes cause problems.
-# Create a temporary directory, and hook for its removal unless debugging.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
 $debug ||
 {
-  trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+  tmp=
+  trap 'exit_status=$?
+  { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+' 0
   trap '{ (exit 1); exit 1; }' 1 2 13 15
 }
-
 # Create a (secure) tmp directory for tmp files.
 
 {
-  tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
+  tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
   test -n "$tmp" && test -d "$tmp"
 }  ||
 {
-  tmp=./confstat$$-$RANDOM
-  (umask 077 && mkdir $tmp)
+  tmp=./conf$$-$RANDOM
+  (umask 077 && mkdir "$tmp")
 } ||
 {
    echo "$me: cannot create a temporary directory in ." >&2
    { (exit 1); exit 1; }
 }
 
-_ACEOF
-
-cat >>$CONFIG_STATUS <<_ACEOF
-
 #
-# CONFIG_FILES section.
+# Set up the sed scripts for CONFIG_FILES section.
 #
 
 # No need to generate the scripts if there are no CONFIG_FILES.
 # This happens for instance when ./config.status config.h
-if test -n "\$CONFIG_FILES"; then
-  # Protect against being on the right side of a sed subst in config.status.
-  sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
-   s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
-s,@SHELL@,$SHELL,;t t
-s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
-s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
-s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
-s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
-s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
-s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
-s,@exec_prefix@,$exec_prefix,;t t
-s,@prefix@,$prefix,;t t
-s,@program_transform_name@,$program_transform_name,;t t
-s,@bindir@,$bindir,;t t
-s,@sbindir@,$sbindir,;t t
-s,@libexecdir@,$libexecdir,;t t
-s,@datadir@,$datadir,;t t
-s,@sysconfdir@,$sysconfdir,;t t
-s,@sharedstatedir@,$sharedstatedir,;t t
-s,@localstatedir@,$localstatedir,;t t
-s,@libdir@,$libdir,;t t
-s,@includedir@,$includedir,;t t
-s,@oldincludedir@,$oldincludedir,;t t
-s,@infodir@,$infodir,;t t
-s,@mandir@,$mandir,;t t
-s,@build_alias@,$build_alias,;t t
-s,@host_alias@,$host_alias,;t t
-s,@target_alias@,$target_alias,;t t
-s,@DEFS@,$DEFS,;t t
-s,@ECHO_C@,$ECHO_C,;t t
-s,@ECHO_N@,$ECHO_N,;t t
-s,@ECHO_T@,$ECHO_T,;t t
-s,@LIBS@,$LIBS,;t t
-s,@CC@,$CC,;t t
-s,@CFLAGS@,$CFLAGS,;t t
-s,@LDFLAGS@,$LDFLAGS,;t t
-s,@CPPFLAGS@,$CPPFLAGS,;t t
-s,@ac_ct_CC@,$ac_ct_CC,;t t
-s,@EXEEXT@,$EXEEXT,;t t
-s,@OBJEXT@,$OBJEXT,;t t
-s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
-s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
-s,@INSTALL_DATA@,$INSTALL_DATA,;t t
-s,@STRIP@,$STRIP,;t t
-s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t
-s,@CPP@,$CPP,;t t
-s,@EGREP@,$EGREP,;t t
-s,@LINKWATCH_SUPPORT@,$LINKWATCH_SUPPORT,;t t
-s,@KERN@,$KERN,;t t
-s,@IPVS_SYNCD@,$IPVS_SYNCD,;t t
-s,@DFLAGS@,$DFLAGS,;t t
-s,@VERSION@,$VERSION,;t t
-s,@VERSION_DATE@,$VERSION_DATE,;t t
-s,@IPVS_SUPPORT@,$IPVS_SUPPORT,;t t
-s,@VRRP_SUPPORT@,$VRRP_SUPPORT,;t t
-s,@LIBOBJS@,$LIBOBJS,;t t
-s,@LTLIBOBJS@,$LTLIBOBJS,;t t
-CEOF
+if test -n "$CONFIG_FILES"; then
 
 _ACEOF
 
-  cat >>$CONFIG_STATUS <<\_ACEOF
-  # Split the substitutions into bite-sized pieces for seds with
-  # small command number limits, like on Digital OSF/1 and HP-UX.
-  ac_max_sed_lines=48
-  ac_sed_frag=1 # Number of current file.
-  ac_beg=1 # First line for current file.
-  ac_end=$ac_max_sed_lines # Line after last line for current file.
-  ac_more_lines=:
-  ac_sed_cmds=
-  while $ac_more_lines; do
-    if test $ac_beg -gt 1; then
-      sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
-    else
-      sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
-    fi
-    if test ! -s $tmp/subs.frag; then
-      ac_more_lines=false
-    else
-      # The purpose of the label and of the branching condition is to
-      # speed up the sed processing (if there are no `@' at all, there
-      # is no need to browse any of the substitutions).
-      # These are the two extra sed commands mentioned above.
-      (echo ':t
-  /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
-      if test -z "$ac_sed_cmds"; then
-       ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
-      else
-       ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
-      fi
-      ac_sed_frag=`expr $ac_sed_frag + 1`
-      ac_beg=$ac_end
-      ac_end=`expr $ac_end + $ac_max_sed_lines`
-    fi
-  done
-  if test -z "$ac_sed_cmds"; then
-    ac_sed_cmds=cat
+
+
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+  cat >conf$$subs.sed <<_ACEOF
+SHELL!$SHELL$ac_delim
+PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim
+PACKAGE_NAME!$PACKAGE_NAME$ac_delim
+PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim
+PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim
+PACKAGE_STRING!$PACKAGE_STRING$ac_delim
+PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim
+exec_prefix!$exec_prefix$ac_delim
+prefix!$prefix$ac_delim
+program_transform_name!$program_transform_name$ac_delim
+bindir!$bindir$ac_delim
+sbindir!$sbindir$ac_delim
+libexecdir!$libexecdir$ac_delim
+datarootdir!$datarootdir$ac_delim
+datadir!$datadir$ac_delim
+sysconfdir!$sysconfdir$ac_delim
+sharedstatedir!$sharedstatedir$ac_delim
+localstatedir!$localstatedir$ac_delim
+includedir!$includedir$ac_delim
+oldincludedir!$oldincludedir$ac_delim
+docdir!$docdir$ac_delim
+infodir!$infodir$ac_delim
+htmldir!$htmldir$ac_delim
+dvidir!$dvidir$ac_delim
+pdfdir!$pdfdir$ac_delim
+psdir!$psdir$ac_delim
+libdir!$libdir$ac_delim
+localedir!$localedir$ac_delim
+mandir!$mandir$ac_delim
+DEFS!$DEFS$ac_delim
+ECHO_C!$ECHO_C$ac_delim
+ECHO_N!$ECHO_N$ac_delim
+ECHO_T!$ECHO_T$ac_delim
+LIBS!$LIBS$ac_delim
+build_alias!$build_alias$ac_delim
+host_alias!$host_alias$ac_delim
+target_alias!$target_alias$ac_delim
+CC!$CC$ac_delim
+CFLAGS!$CFLAGS$ac_delim
+LDFLAGS!$LDFLAGS$ac_delim
+CPPFLAGS!$CPPFLAGS$ac_delim
+ac_ct_CC!$ac_ct_CC$ac_delim
+EXEEXT!$EXEEXT$ac_delim
+OBJEXT!$OBJEXT$ac_delim
+INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim
+INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim
+INSTALL_DATA!$INSTALL_DATA$ac_delim
+STRIP!$STRIP$ac_delim
+CPP!$CPP$ac_delim
+GREP!$GREP$ac_delim
+EGREP!$EGREP$ac_delim
+LINKWATCH_SUPPORT!$LINKWATCH_SUPPORT$ac_delim
+KERN!$KERN$ac_delim
+IPVS_SYNCD!$IPVS_SYNCD$ac_delim
+DFLAGS!$DFLAGS$ac_delim
+VERSION!$VERSION$ac_delim
+VERSION_DATE!$VERSION_DATE$ac_delim
+IPVS_SUPPORT!$IPVS_SUPPORT$ac_delim
+VRRP_SUPPORT!$VRRP_SUPPORT$ac_delim
+LIBOBJS!$LIBOBJS$ac_delim
+LTLIBOBJS!$LTLIBOBJS$ac_delim
+_ACEOF
+
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 61; then
+    break
+  elif $ac_last_try; then
+    { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+   { (exit 1); exit 1; }; }
+  else
+    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
   fi
-fi # test -n "$CONFIG_FILES"
+done
 
+ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
+if test -n "$ac_eof"; then
+  ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
+  ac_eof=`expr $ac_eof + 1`
+fi
+
+cat >>$CONFIG_STATUS <<_ACEOF
+cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end
 _ACEOF
+sed '
+s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
+s/^/s,@/; s/!/@,|#_!!_#|/
+:n
+t n
+s/'"$ac_delim"'$/,g/; t
+s/$/\\/; p
+N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
+' >>$CONFIG_STATUS <conf$$subs.sed
+rm -f conf$$subs.sed
+cat >>$CONFIG_STATUS <<_ACEOF
+:end
+s/|#_!!_#|//g
+CEOF$ac_eof
+_ACEOF
+
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+  ac_vpsub='/^[         ]*VPATH[        ]*=/{
+s/:*\$(srcdir):*/:/
+s/:*\${srcdir}:*/:/
+s/:*@srcdir@:*/:/
+s/^\([^=]*=[    ]*\):*/\1/
+s/:*$//
+s/^[^=]*=[      ]*$//
+}'
+fi
+
 cat >>$CONFIG_STATUS <<\_ACEOF
-for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
-  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
-  case $ac_file in
-  - | *:- | *:-:* ) # input from stdin
-       cat >$tmp/stdin
-       ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
-       ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
-  *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
-       ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
-  * )   ac_file_in=$ac_file.in ;;
+fi # test -n "$CONFIG_FILES"
+
+
+for ac_tag in  :F $CONFIG_FILES
+do
+  case $ac_tag in
+  :[FHLC]) ac_mode=$ac_tag; continue;;
+  esac
+  case $ac_mode$ac_tag in
+  :[FHL]*:*);;
+  :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5
+echo "$as_me: error: Invalid tag $ac_tag." >&2;}
+   { (exit 1); exit 1; }; };;
+  :[FH]-) ac_tag=-:-;;
+  :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+  esac
+  ac_save_IFS=$IFS
+  IFS=:
+  set x $ac_tag
+  IFS=$ac_save_IFS
+  shift
+  ac_file=$1
+  shift
+
+  case $ac_mode in
+  :L) ac_source=$1;;
+  :[FH])
+    ac_file_inputs=
+    for ac_f
+    do
+      case $ac_f in
+      -) ac_f="$tmp/stdin";;
+      *) # Look for the file first in the build tree, then in the source tree
+        # (if the path is not absolute).  The absolute path cannot be DOS-style,
+        # because $ac_f cannot contain `:'.
+        test -f "$ac_f" ||
+          case $ac_f in
+          [\\/$]*) false;;
+          *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+          esac ||
+          { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
+echo "$as_me: error: cannot find input file: $ac_f" >&2;}
+   { (exit 1); exit 1; }; };;
+      esac
+      ac_file_inputs="$ac_file_inputs $ac_f"
+    done
+
+    # Let's still pretend it is `configure' which instantiates (i.e., don't
+    # use $as_me), people would be surprised to read:
+    #    /* config.h.  Generated by config.status.  */
+    configure_input="Generated from "`IFS=:
+         echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure."
+    if test x"$ac_file" != x-; then
+      configure_input="$ac_file.  $configure_input"
+      { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+    fi
+
+    case $ac_tag in
+    *:-:* | *:-) cat >"$tmp/stdin";;
+    esac
+    ;;
   esac
 
-  # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
-  ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+  ac_dir=`$as_dirname -- "$ac_file" ||
 $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
         X"$ac_file" : 'X\(//\)[^/]' \| \
         X"$ac_file" : 'X\(//\)$' \| \
-        X"$ac_file" : 'X\(/\)' \| \
-        .     : '\(.\)' 2>/dev/null ||
+        X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
 echo X"$ac_file" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
-         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
-         /^X\(\/\/\)$/{ s//\1/; q; }
-         /^X\(\/\).*/{ s//\1/; q; }
-         s/.*/./; q'`
-  { if $as_mkdir_p; then
-    mkdir -p "$ac_dir"
-  else
-    as_dir="$ac_dir"
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)[^/].*/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
+  { as_dir="$ac_dir"
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
     as_dirs=
-    while test ! -d "$as_dir"; do
-      as_dirs="$as_dir $as_dirs"
-      as_dir=`(dirname "$as_dir") 2>/dev/null ||
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
 $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
         X"$as_dir" : 'X\(//\)[^/]' \| \
         X"$as_dir" : 'X\(//\)$' \| \
-        X"$as_dir" : 'X\(/\)' \| \
-        .     : '\(.\)' 2>/dev/null ||
+        X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
 echo X"$as_dir" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
-         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
-         /^X\(\/\/\)$/{ s//\1/; q; }
-         /^X\(\/\).*/{ s//\1/; q; }
-         s/.*/./; q'`
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)[^/].*/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
+      test -d "$as_dir" && break
     done
-    test ! -n "$as_dirs" || mkdir $as_dirs
-  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
-echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
+echo "$as_me: error: cannot create directory $as_dir" >&2;}
    { (exit 1); exit 1; }; }; }
-
   ac_builddir=.
 
-if test "$ac_dir" != .; then
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
   ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
-  # A "../" for each directory in $ac_dir_suffix.
-  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
-else
-  ac_dir_suffix= ac_top_builddir=
-fi
+  # A ".." for each directory in $ac_dir_suffix.
+  ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
+  case $ac_top_builddir_sub in
+  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+  esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
 
 case $srcdir in
-  .)  # No --srcdir option.  We are building in place.
+  .)  # We are building in place.
     ac_srcdir=.
-    if test -z "$ac_top_builddir"; then
-       ac_top_srcdir=.
-    else
-       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
-    fi ;;
-  [\\/]* | ?:[\\/]* )  # Absolute path.
+    ac_top_srcdir=$ac_top_builddir_sub
+    ac_abs_top_srcdir=$ac_pwd ;;
+  [\\/]* | ?:[\\/]* )  # Absolute name.
     ac_srcdir=$srcdir$ac_dir_suffix;
-    ac_top_srcdir=$srcdir ;;
-  *) # Relative path.
-    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
-    ac_top_srcdir=$ac_top_builddir$srcdir ;;
+    ac_top_srcdir=$srcdir
+    ac_abs_top_srcdir=$srcdir ;;
+  *) # Relative name.
+    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_build_prefix$srcdir
+    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
 esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
 
-# Do not use `cd foo && pwd` to compute absolute paths, because
-# the directories may not exist.
-case `pwd` in
-.) ac_abs_builddir="$ac_dir";;
-*)
-  case "$ac_dir" in
-  .) ac_abs_builddir=`pwd`;;
-  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
-  *) ac_abs_builddir=`pwd`/"$ac_dir";;
-  esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_builddir=${ac_top_builddir}.;;
-*)
-  case ${ac_top_builddir}. in
-  .) ac_abs_top_builddir=$ac_abs_builddir;;
-  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
-  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
-  esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_srcdir=$ac_srcdir;;
-*)
-  case $ac_srcdir in
-  .) ac_abs_srcdir=$ac_abs_builddir;;
-  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
-  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
-  esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_srcdir=$ac_top_srcdir;;
-*)
-  case $ac_top_srcdir in
-  .) ac_abs_top_srcdir=$ac_abs_builddir;;
-  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
-  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
-  esac;;
-esac
 
+  case $ac_mode in
+  :F)
+  #
+  # CONFIG_FILE
+  #
 
   case $INSTALL in
   [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
-  *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
+  *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
   esac
+_ACEOF
 
-  if test x"$ac_file" != x-; then
-    { echo "$as_me:$LINENO: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
-    rm -f "$ac_file"
-  fi
-  # Let's still pretend it is `configure' which instantiates (i.e., don't
-  # use $as_me), people would be surprised to read:
-  #    /* config.h.  Generated by config.status.  */
-  if test x"$ac_file" = x-; then
-    configure_input=
-  else
-    configure_input="$ac_file.  "
-  fi
-  configure_input=$configure_input"Generated from `echo $ac_file_in |
-                                    sed 's,.*/,,'` by configure."
-
-  # First look for the input files in the build tree, otherwise in the
-  # src tree.
-  ac_file_inputs=`IFS=:
-    for f in $ac_file_in; do
-      case $f in
-      -) echo $tmp/stdin ;;
-      [\\/$]*)
-        # Absolute (can't be DOS-style, as IFS=:)
-        test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
-   { (exit 1); exit 1; }; }
-        echo "$f";;
-      *) # Relative
-        if test -f "$f"; then
-          # Build tree
-          echo "$f"
-        elif test -f "$srcdir/$f"; then
-          # Source tree
-          echo "$srcdir/$f"
-        else
-          # /dev/null tree
-          { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
-   { (exit 1); exit 1; }; }
-        fi;;
-      esac
-    done` || { (exit 1); exit 1; }
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+
+case `sed -n '/datarootdir/ {
+  p
+  q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p
+' $ac_file_inputs` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+  { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+  ac_datarootdir_hack='
+  s&@datadir@&$datadir&g
+  s&@docdir@&$docdir&g
+  s&@infodir@&$infodir&g
+  s&@localedir@&$localedir&g
+  s&@mandir@&$mandir&g
+    s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
 _ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
 cat >>$CONFIG_STATUS <<_ACEOF
   sed "$ac_vpsub
 $extrasub
@@ -5439,29 +5904,40 @@ _ACEOF
 cat >>$CONFIG_STATUS <<\_ACEOF
 :t
 /@[a-zA-Z_][a-zA-Z_0-9]*@/!b
-s,@configure_input@,$configure_input,;t t
-s,@srcdir@,$ac_srcdir,;t t
-s,@abs_srcdir@,$ac_abs_srcdir,;t t
-s,@top_srcdir@,$ac_top_srcdir,;t t
-s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
-s,@builddir@,$ac_builddir,;t t
-s,@abs_builddir@,$ac_abs_builddir,;t t
-s,@top_builddir@,$ac_top_builddir,;t t
-s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
-s,@INSTALL@,$ac_INSTALL,;t t
-" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
-  rm -f $tmp/stdin
-  if test x"$ac_file" != x-; then
-    mv $tmp/out $ac_file
-  else
-    cat $tmp/out
-    rm -f $tmp/out
-  fi
+s&@configure_input@&$configure_input&;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+s&@INSTALL@&$ac_INSTALL&;t t
+$ac_datarootdir_hack
+" $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+  { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
+  { ac_out=`sed -n '/^[         ]*datarootdir[  ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
+  { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined.  Please make sure it is defined." >&5
+echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined.  Please make sure it is defined." >&2;}
+
+  rm -f "$tmp/stdin"
+  case $ac_file in
+  -) cat "$tmp/out"; rm -f "$tmp/out";;
+  *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;;
+  esac
+ ;;
 
-done
-_ACEOF
 
-cat >>$CONFIG_STATUS <<\_ACEOF
+
+  esac
+
+done # for ac_tag
+
 
 { (exit 0); exit 0; }
 _ACEOF
index 4d7aa34..36dcf28 100644 (file)
@@ -4,7 +4,7 @@
 # Configuration template file for keepalived.
 # autoconf will generate & check deps for proper compilation
 #
-# Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
+# Copyright (C) 2001-2009 Alexandre Cassen, <acassen@linux-vs.org>
 
 dnl ----[ Process this file with autoconf to produce a configure script ]----
 AC_INIT(keepalived/core/main.c)
@@ -106,61 +106,21 @@ if test "$enable_lvs" != "no"; then
     [IPVS_SUPPORT="_WITH_LVS_"],
     [
       IPVS_SUPPORT="_WITHOUT_LVS_"
-      IPVS_MAJOR="0"
-      IPVS_MINOR="0"
-      IPVS_PATCH="0"
       AC_MSG_WARN([keepalived will be built without LVS support.])
     ])
 fi  
 
-if test "$IPVS_SUPPORT" = "_WITH_LVS_"; then
-  AC_MSG_CHECKING([for IPVS version])
-  AC_TRY_RUN([ 
-    #include <stdlib.h>
-    #include <stdio.h>
-    #include <net/ip_vs.h>
-    int main (void) {
-      FILE *fp = fopen ("ipvsinfo", "w");
-      if (!fp) return 1;
-      fprintf (fp, "%d\n%d\n%d\n", NVERSION(IP_VS_VERSION_CODE));
-      fclose (fp); 
-      return 0;
-    } 
-  ], [
-    IPVS_MAJOR=`head -n 1 ipvsinfo | tail -n 1`
-    IPVS_MINOR=`head -n 2 ipvsinfo | tail -n 1`
-    IPVS_PATCH=`head -n 3 ipvsinfo | tail -n 1`
-  ], [
-    IPVS_MAJOR="0"
-    IPVS_MINOR="0"
-    IPVS_PATCH="0"
-  ], [
-    IPVS_MAJOR="0"
-    IPVS_MINOR="0"
-    IPVS_PATCH="0"
-  ])
-  rm -f ipvsinfo
-  AC_MSG_RESULT([$IPVS_MAJOR.$IPVS_MINOR.$IPVS_PATCH])
-  if test "$IPVS_MAJOR" = "0" -a "$IPVS_MINOR" = "0" -a "$IPVS_PATCH" = "0"; then
-    AC_MSG_WARN([Cannot determine IPVS version.])
-  fi
-fi
-
 if test "$IPVS_SUPPORT" = "_WITHOUT_LVS_" -a "$enable_vrrp" = "no"; then
   AC_MSG_ERROR([keepalived MUST be compiled at least with LVS or VRRP framework])
 fi
 
 dnl ----[ IPVS syncd support probe ]---
-dnl Sync daemon is supported since IPVS 0.9.2 for kernel 2.4
-
 IPVS_SYNCD="_WITHOUT_IPVS_SYNCD_"
 if test "$IPVS_SUPPORT" = "_WITH_LVS_"; then
   AC_MSG_CHECKING([for IPVS syncd support])
   if test "$KERN" = "_KRNL_2_6_"; then
     IPVS_SYNCD="_HAVE_IPVS_SYNCD_"
-  elif test "$IPVS_MAJOR" -ge 1 -a "$KERN" = "_KRNL_2_4_"; then
-    IPVS_SYNCD="_HAVE_IPVS_SYNCD_"
-  elif test "$IPVS_MINOR" -ge 9 -a "$IPVS_PATCH" -ge 2 -a "$KERN" = "_KRNL_2_4_"; then
+  elif test "_KRNL_2_4_"; then
     IPVS_SYNCD="_HAVE_IPVS_SYNCD_"
   else
     IPVS_SYNCD="_WITHOUT_IPVS_SYNCD_"
@@ -182,25 +142,7 @@ AC_SUBST(IPVS_SYNCD)
 dnl ----[ Checks for kernel netlink support ]----
 VRRP_SUPPORT="_WITHOUT_VRRP_"
 if test "$enable_vrrp" != "no"; then
-  AC_MSG_CHECKING([for kernel netlink support])
-  AC_TRY_RUN([
-    #include <asm/types.h>
-    #include <sys/socket.h>
-    #include <linux/netlink.h>
-    int main (void) {
-      int fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
-      if (fd < 0)
-        exit(1);
-      close(fd);
-      exit(0);
-    }], [
-      AC_MSG_RESULT(yes)
-      VRRP_SUPPORT="_WITH_VRRP_"
-    ], [
-      AC_MSG_RESULT(no)
-    ], [
-      AC_MSG_RESULT(no)
-    ])
+  VRRP_SUPPORT="_WITH_VRRP_"
 fi
 
 if test "${enable_debug}" = "yes"; then
index 6f9804c..d48e665 100644 (file)
@@ -58,6 +58,8 @@ SCOPE can take the following values :
 static_routes {                                                        # block identification
     src <IP ADDRESS> [to] <IP ADDRESS>/<MASK> via|gw <IP ADDRESS> dev <STRING> scope <SCOPE> table <TABLE-ID> # to is optional
     src <IP ADDRESS> [to] <IP ADDRESS>/<MASK> via|gw <IP ADDRESS> dev <STRING> scope <SCOPE> table <TABLE-ID> # to is optional
+    src <IP ADDRESS> [to] <IP ADDRESS>/<MASK> via|gw <IP ADDRESS> or <IP ADDRESS> dev <STRING> scope <SCOPE> table <TABLE-ID> # will use multipath route
+    blackhole <IP ADDRESS>[/<MASK>]
     ...
 }
 
@@ -177,7 +179,9 @@ vrrp_instance <STRING> {            # VRRP instance declaration
     virtual_routes {                   # VRRP virtual routes
        src <IP ADDRESS> [to] <IP ADDRESS>/<MASK> via|gw <IP ADDRESS> dev <STRING> scope <SCOPE> table <TABLE-ID> metric <METRIC> # to is optional
        src <IP ADDRESS> [to] <IP ADDRESS>/<MASK> via|gw <IP ADDRESS> dev <STRING> scope <SCOPE> table <TABLE-ID> metric <METRIC> # to is optional
+       src <IP ADDRESS> [to] <IP ADDRESS>/<MASK> via|gw <IP ADDRESS> or <IP ADDRESS> dev <STRING> scope <SCOPE> table <TABLE-ID> # will use multipath route
         ...
+       blackhole <IP ADDRESS>[/<MASK>]
     }
     nopreempt                                  # Override VRRP RFC preemption default
     preempt_delay                              # Seconds after startup until
@@ -271,6 +275,33 @@ virtual_server group <STRING>      {       # VS group declaration
     virtualhost <STRING>               # VirtualHost string to use for
                                        #  HTTP_GET or SSL_GET
 
+    # Assume silently all RSs down and healthchecks
+    # failed on start. This helps preventing false
+    # positive actions on startup. Alpha mode is
+    # disabled by default.
+    alpha
+
+    # On daemon shutdown, consider quorum and RS
+    # down notifiers for execution, where appropriate.
+    # Omega mode is disabled by default.
+    omega
+
+    # Minimum total weight of all live servers in
+    # the pool necessary to operate VS with no
+    # quality regression. Defaults to 1.
+    quorum <INT>
+
+    # Tolerate this much weight units compared to the
+    # nominal quorum, when considering quorum gain
+    # or loss. A flap dampener. Defaults to 0.
+    hysteresis <INT>
+
+    # Script to launch when quorum is gained.
+    quorum_up <STRING>|<QUOTED-STRING>
+
+    # Script to launch when quorum is lost.
+    quorum_down <STRING>|<QUOTED-STRING>
+
     sorry_server <IP ADDRESS> <PORT>   # RS to add to LVS topology when all
                                        #   realserver are down
 
index dff2951..ca35420 100644 (file)
@@ -324,6 +324,34 @@ A virtual_server can be a declaration of one of
     # eg virtualhost www.firewall.loc\r
     virtualhost <STRING>                \r
 \r
+    # Assume silently all RSs down and healthchecks\r
+    # failed on start. This helps preventing false\r
+    # positive actions on startup. Alpha mode is\r
+    # disabled by default.\r
+    alpha\r
+\r
+    # On daemon shutdown, consider quorum and RS\r
+    # down notifiers for execution, where appropriate.\r
+    # Omega mode is disabled by default.\r
+    omega\r
+\r
+    # Minimum total weight of all live servers in\r
+    # the pool necessary to operate VS with no\r
+    # quality regression. Defaults to 1.\r
+    quorum <INT>\r
+\r
+    # Tolerate this much weight units compared to the\r
+    # nominal quorum, when considering quorum gain\r
+    # or loss. A flap dampener. Defaults to 0.\r
+    hysteresis <INT>\r
+\r
+    # Script to launch when quorum is gained.\r
+    quorum_up <STRING>|<QUOTED-STRING>\r
+\r
+    # Script to launch when quorum is lost.\r
+    quorum_down <STRING>|<QUOTED-STRING>\r
+\r
+\r
     # setup realserver(s)\r
 \r
     # RS to add when all realservers are down\r
diff --git a/doc/samples/keepalived.conf.quorum b/doc/samples/keepalived.conf.quorum
new file mode 100644 (file)
index 0000000..053a622
--- /dev/null
@@ -0,0 +1,106 @@
+! Sample configuration for quorum/hysteresis setup.
+! The server pool below consists of 10 servers. After
+! start, the quorum will not be reached until 9 (7+2)
+! live servers are present in the pool (all servers are
+! equally weighted, and quorum is the sum of weights).
+! Once this happens, a custom script will be executed,
+! which supposedly invokes some actions to start
+! announcing IP address of the virtual server to the
+! world. After that the quorum will not break until
+! the pool has 5 (7-2) or more live servers. Pool size
+! change from 7 to 6 and back will not trigger a quorum
+! flap this way. Once there are less than 5 servers,
+! the quorum is considered lost and corresponding
+! script is executed, supposedly propagating the
+! failure, so necessary actions can be taken.
+!
+! Due to the alpha mode, all real servers are considered
+! down on server start, so the quorum is initially lost.
+! Due to the omega mode, quorum_down notifier is executed
+! on keepalived shutdown as well (see keepalived.conf
+! manpage for details).
+
+virtual_server 10.0.1.1 80 {
+  delay_loop 6
+  lb_algo wrr
+  lb_kind NAT
+  persistence_timeout 900
+  protocol TCP
+  alpha
+  omega
+  quorum 7
+  hysteresis 2
+  quorum_up /usr/local/sbin/quorum-up.sh
+  quorum_down /usr/local/sbin/quorum-down.sh
+
+  real_server 10.0.0.1 8080 {
+    weight 1
+    TCP_CHECK {
+      connect_port    80
+      connect_timeout 3
+    }
+  }
+  real_server 10.0.0.2 8080 {
+    weight 1
+    TCP_CHECK {
+      connect_port    80
+      connect_timeout 3
+    }
+  }
+  real_server 10.0.0.3 8080 {
+    weight 1
+    TCP_CHECK {
+      connect_port    80
+      connect_timeout 3
+    }
+  }
+  real_server 10.0.0.4 8080 {
+    weight 1
+    TCP_CHECK {
+      connect_port    80
+      connect_timeout 3
+    }
+  }
+  real_server 10.0.0.5 8080 {
+    weight 1
+    TCP_CHECK {
+      connect_port    80
+      connect_timeout 3
+    }
+  }
+  real_server 10.0.0.6 8080 {
+    weight 1
+    TCP_CHECK {
+      connect_port    80
+      connect_timeout 3
+    }
+  }
+  real_server 10.0.0.7 8080 {
+    weight 1
+    TCP_CHECK {
+      connect_port    80
+      connect_timeout 3
+    }
+  }
+  real_server 10.0.0.8 8080 {
+    weight 1
+    TCP_CHECK {
+      connect_port    80
+      connect_timeout 3
+    }
+  }
+  real_server 10.0.0.9 8080 {
+    weight 1
+    TCP_CHECK {
+      connect_port    80
+      connect_timeout 3
+    }
+  }
+  real_server 10.0.0.10 8080 {
+    weight 1
+    TCP_CHECK {
+      connect_port    80
+      connect_timeout 3
+    }
+  }
+}
index 17412f6..1d526aa 100644 (file)
@@ -27,5 +27,7 @@ vrrp_instance VI_1 {
         192.168.110.0/24 via 192.168.200.254 dev eth1
         192.168.111.0/24 dev eth2
         192.168.112.0/24 via 192.168.100.254
+        192.168.113.0/24 via 192.168.100.252 or 192.168.100.253
+       blackhole 192.168.113.1/32
     }
 }
index 9e3bae4..74806ab 100644 (file)
@@ -1,6 +1,6 @@
 # Makefile.in
 #
-# Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+# Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
 
 EXEC = genhash
 BIN  = ../bin
@@ -19,7 +19,7 @@ LDFLAGS = @LIBS@ @LDFLAGS@
 
 OBJS = main.o sock.o layer4.o http.o ssl.o
 LIB_OBJS = ../lib/timer.o ../lib/scheduler.o ../lib/memory.o ../lib/list.o \
-          ../lib/utils.o ../lib/html.o ../lib/signals.o
+          ../lib/utils.o ../lib/html.o ../lib/signals.o ../lib/logger.o
 
 all:   $(BIN)/$(EXEC)
        $(STRIP) $(BIN)/$(EXEC)
index 2c7cfae..6e687dc 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        HTTP asynchronous engine.
  *
- * Version:     $Id: http.c,v 1.0.0 2002/11/20 21:34:18 acassen Exp $
+ * Version:     $Id: http.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #include <errno.h>
@@ -96,7 +96,7 @@ finalize(thread * thread_obj)
        if (req->verbose) {
                printf("\n");
                printf(HTML_MD5);
-               dump_buffer(digest, 16);
+               dump_buffer((char *) digest, 16);
 
                printf(HTML_MD5_FINAL);
        }
index a85afd6..09bb0f2 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        http.c include file.
  *
- * Version:     $Id: http.h,v 1.0.0 2002/11/20 21:34:18 acassen Exp $
+ * Version:     $Id: http.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _HTTP_H
index 0f0df24..ff6f15e 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Layer4 asynchronous primitives.
  *
- * Version:     $Id: layer4.c,v 1.0.0 2002/11/20 21:34:18 acassen Exp $
+ * Version:     $Id: layer4.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #include "layer4.h"
@@ -79,7 +79,7 @@ tcp_socket_state(int fd, thread * thread_obj, uint32_t addr_ip, uint16_t addr_po
                 int (*func) (struct _thread *))
 {
        int status;
-       int slen;
+       socklen_t slen;
        int ret = 0;
        TIMEVAL timer_min;
 
index ad4f59c..4b55b35 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        layer4.c include file.
  *
- * Version:     $Id: layer4.h,v 1.0.0 2002/11/20 21:34:18 acassen Exp $
+ * Version:     $Id: layer4.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _LAYER4_H
index d295fee..662a8ee 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Main entry point.
  *
- * Version:     $Id: main.c,v 1.0.0 2002/11/20 21:34:18 acassen Exp $
+ * Version:     $Id: main.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #include <signal.h>
@@ -34,7 +34,7 @@ REQ *req = NULL;
 
 /* Terminate handler */
 void
-sigend(int sig)
+sigend(void *v, int sig)
 {
        /* register the terminate thread */
        thread_add_terminate_event(master);
@@ -45,9 +45,9 @@ void
 signal_init(void)
 {
        signal_handler_init();
-       signal_set(SIGHUP, sigend);
-       signal_set(SIGINT, sigend);
-       signal_set(SIGTERM, sigend);
+       signal_set(SIGHUP, sigend, NULL);
+       signal_set(SIGINT, sigend, NULL);
+       signal_set(SIGTERM, sigend, NULL);
        signal_ignore(SIGPIPE);
 }
 
@@ -207,6 +207,9 @@ main(int argc, char **argv)
         * Processing the master thread queues,
         * return and execute one ready thread.
         * Run until error, used for debuging only.
+        * Note that not calling launch_scheduler() does
+        * not activate SIGCHLD handling, however, this
+        * is no issue here.
         */
        while (thread_fetch(master, &thread_obj))
                thread_call(&thread_obj);
index 496d147..f594849 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        main.c include file.
  *
- * Version:     $Id: main.h,v 1.0.0 2002/11/20 21:34:18 acassen Exp $
+ * Version:     $Id: main.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _MAIN_H
index 1643bfa..06cb9b5 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Socket pool utility functions.
  *
- * Version:     $Id: sock.c,v 1.0.0 2002/11/20 21:34:18 acassen Exp $
+ * Version:     $Id: sock.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #include <string.h>
index c4f4c4d..ef3af46 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        sock.c include file.
  *
- * Version:     $Id: sock.h,v 1.0.0 2002/11/20 21:34:18 acassen Exp $
+ * Version:     $Id: sock.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _SOCK_H
index a2c5a57..41215d1 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        SSL engine. 'Semi' asyncrhonous stream handling.
  *
- * Version:     $Id: ssl.c,v 1.0.0 2002/11/20 21:34:18 acassen Exp $
+ * Version:     $Id: ssl.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #include <openssl/err.h>
index 5646a29..5ae396f 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        ssl.c include file.
  *
- * Version:     $Id: ssl.h,v 1.0.0 2002/11/20 21:34:18 acassen Exp $
+ * Version:     $Id: ssl.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _SSL_H
index 2f77b43..aefd3e0 100644 (file)
@@ -2,7 +2,7 @@
 #
 # Keepalived OpenSource project.
 #
-# Copyright (C) 2001-2006 Alexandre Cassen, <acassen@linux-vs.org>
+# Copyright (C) 2001-2009 Alexandre Cassen, <acassen@linux-vs.org>
 
 EXEC      = keepalived
 BIN       = ../bin
index dc6df31..f0b6580 100644 (file)
@@ -2,7 +2,7 @@
 #
 # Keepalived OpenSource project.
 #
-# Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+# Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
 
 KERNEL   = @KERN@
 CC      = @CC@
index 57ebe4b..7a526ca 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Checkers registration.
  *
- * Version:     $Id: check_api.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: check_api.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #include <dirent.h>
@@ -29,6 +29,7 @@
 #include "parser.h"
 #include "memory.h"
 #include "utils.h"
+#include "logger.h"
 #include "global_data.h"
 #include "check_misc.h"
 #include "check_smtp.h"
@@ -53,7 +54,7 @@ static void
 dump_checker(void *data_obj)
 {
        checker *checker_obj = data_obj;
-       syslog(LOG_INFO, " %s:%d", inet_ntop2(CHECKER_RIP(checker_obj))
+       log_message(LOG_INFO, " %s:%d", inet_ntop2(CHECKER_RIP(checker_obj))
               , ntohs(CHECKER_RPORT(checker_obj)));
        (*checker_obj->dump_func) (checker_obj);
 }
@@ -82,6 +83,14 @@ queue_checker(void (*free_func) (void *), void (*dump_func) (void *)
 
        /* queue the checker */
        list_add(checkers_queue, check_obj);
+
+       /* In Alpha mode also mark the check as failed. */
+       if (vs->alpha) {
+               list fc = rs->failed_checkers;
+               checker_id_t *id = (checker_id_t *) MALLOC(sizeof(checker_id_t));
+               *id = check_obj->id;
+               list_add (fc, id);
+       }
 }
 
 /* dump the checkers_queue */
@@ -89,7 +98,7 @@ void
 dump_checkers_queue(void)
 {
        if (!LIST_ISEMPTY(checkers_queue)) {
-               syslog(LOG_INFO, "------< Health checkers >------");
+               log_message(LOG_INFO, "------< Health checkers >------");
                dump_list(checkers_queue);
        }
 }
@@ -119,7 +128,7 @@ register_checkers_thread(void)
 
        for (e = LIST_HEAD(checkers_queue); e; ELEMENT_NEXT(e)) {
                checker_obj = ELEMENT_DATA(e);
-               syslog(LOG_INFO,
+               log_message(LOG_INFO,
                       "Activating healtchecker for service [%s:%d]",
                       inet_ntop2(CHECKER_RIP(checker_obj)),
                       ntohs(CHECKER_RPORT(checker_obj)));
@@ -139,7 +148,7 @@ update_checker_activity(uint32_t address, int enable)
 
        /* Display netlink operation */
        if (debug & 32)
-               syslog(LOG_INFO, "Netlink reflector reports IP %s %s",
+               log_message(LOG_INFO, "Netlink reflector reports IP %s %s",
                       inet_ntop2(address), (enable) ? "added" : "removed");
 
        /* Processing Healthcheckers queue */
@@ -148,12 +157,12 @@ update_checker_activity(uint32_t address, int enable)
                        checker_obj = ELEMENT_DATA(e);
                        if (CHECKER_VIP(checker_obj) == address && CHECKER_HA_SUSPEND(checker_obj)) {
                                if (!CHECKER_ENABLED(checker_obj) && enable)
-                                       syslog(LOG_INFO,
+                                       log_message(LOG_INFO,
                                               "Activating healtchecker for service [%s:%d]",
                                               inet_ntop2(CHECKER_RIP(checker_obj)),
                                               ntohs(CHECKER_RPORT(checker_obj)));
                                if (CHECKER_ENABLED(checker_obj) && !enable)
-                                       syslog(LOG_INFO,
+                                       log_message(LOG_INFO,
                                               "Suspending healtchecker for service [%s:%d]",
                                               inet_ntop2(CHECKER_RIP(checker_obj)),
                                               ntohs(CHECKER_RPORT(checker_obj)));
index e1daecd..aed209b 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Healthcheckrs child process handling.
  *
- * Version:     $Id: check_daemon.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: check_daemon.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #include "check_daemon.h"
@@ -33,6 +33,7 @@
 #include "pidfile.h"
 #include "daemon.h"
 #include "signals.h"
+#include "logger.h"
 #include "list.h"
 #include "main.h"
 #include "memory.h"
 #include "vrrp_netlink.h"
 #include "vrrp_if.h"
 
+extern char *checkers_pidfile;
+
 /* Daemon stop sequence */
 static void
 stop_check(void)
 {
        /* Destroy master thread */
+       signal_handler_destroy();
        thread_destroy_master(master);
        free_checkers_queue();
        free_ssl();
@@ -53,7 +57,7 @@ stop_check(void)
        ipvs_stop();
 
        /* Stop daemon */
-       pidfile_rm(CHECKERS_PID_FILE);
+       pidfile_rm(checkers_pidfile);
 
        /* Clean data */
        free_global_data(data);
@@ -96,7 +100,7 @@ start_check(void)
        }
 
        /* Post initializations */
-       syslog(LOG_INFO, "Configuration is using : %lu Bytes", mem_allocated);
+       log_message(LOG_INFO, "Configuration is using : %lu Bytes", mem_allocated);
 
        /* SSL load static data & initialize common ctx context */
        if (!init_ssl_ctx()) {
@@ -159,18 +163,18 @@ reload_check_thread(thread * thread_obj)
 
 /* Reload handler */
 void
-sighup_check(int sig)
+sighup_check(void *v, int sig)
 {
-       syslog(LOG_INFO, "Reloading Healthchecker child processi(%d) on signal",
+       log_message(LOG_INFO, "Reloading Healthchecker child processi(%d) on signal",
               checkers_child);
        thread_add_event(master, reload_check_thread, NULL, 0);
 }
 
 /* Terminate handler */
 void
-sigend_check(int sig)
+sigend_check(void *v, int sig)
 {
-       syslog(LOG_INFO, "Terminating Healthchecker child process on signal");
+       log_message(LOG_INFO, "Terminating Healthchecker child process on signal");
        if (master)
                thread_add_terminate_event(master);
 }
@@ -180,11 +184,10 @@ void
 check_signal_init(void)
 {
        signal_handler_init();
-       signal_set(SIGHUP, sighup_check);
-       signal_set(SIGINT, sigend_check);
-       signal_set(SIGTERM, sigend_check);
+       signal_set(SIGHUP, sighup_check, NULL);
+       signal_set(SIGINT, sigend_check, NULL);
+       signal_set(SIGTERM, sigend_check, NULL);
        signal_ignore(SIGPIPE);
-       signal_noignore_sigchld();
 }
 
 /* CHECK Child respawning thread */
@@ -204,7 +207,7 @@ check_respawn_thread(thread * thread_obj)
        }
 
        /* We catch a SIGCHLD, handle it */
-       syslog(LOG_INFO, "Healthcheck child process(%d) died: Respawning", pid);
+       log_message(LOG_INFO, "Healthcheck child process(%d) died: Respawning", pid);
        start_check_child();
        return 0;
 }
@@ -217,7 +220,7 @@ start_check_child(void)
 
        /* Dont start if pid is already running */
        if (checkers_running()) {
-               syslog(LOG_INFO, "Healthcheck child process already running");
+               log_message(LOG_INFO, "Healthcheck child process already running");
                return -1;
        }
 
@@ -226,12 +229,12 @@ start_check_child(void)
        pid = fork();
 
        if (pid < 0) {
-               syslog(LOG_INFO, "Healthcheck child process: fork error(%s)"
+               log_message(LOG_INFO, "Healthcheck child process: fork error(%s)"
                               , strerror(errno));
                return -1;
        } else if (pid) {
                checkers_child = pid;
-               syslog(LOG_INFO, "Starting Healthcheck child process, pid=%d"
+               log_message(LOG_INFO, "Starting Healthcheck child process, pid=%d"
                               , pid);
 
                /* Start respawning thread */
@@ -245,12 +248,13 @@ start_check_child(void)
                (log_facility==LOG_DAEMON) ? LOG_LOCAL2 : log_facility);
 
        /* Child process part, write pidfile */
-       if (!pidfile_write(CHECKERS_PID_FILE, getpid())) {
-               syslog(LOG_INFO, "Healthcheck child process: cannot write pidfile");
+       if (!pidfile_write(checkers_pidfile, getpid())) {
+               log_message(LOG_INFO, "Healthcheck child process: cannot write pidfile");
                exit(0);
        }
 
        /* Create the new master thread */
+       signal_handler_destroy();
        thread_destroy_master(master);
        master = thread_make_master();
 
index dfd28f9..ce34ff5 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Healthcheckers dynamic data structure definition.
  *
- * Version:     $Id: check_data.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: check_data.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #include "check_data.h"
 #include "check_api.h"
+#include "logger.h"
 #include "memory.h"
 #include "utils.h"
+#include "ipwrapper.h"
 
 /* global vars */
 check_conf_data *check_data = NULL;
@@ -57,15 +59,15 @@ dump_ssl(void)
        SSL_DATA *ssl = check_data->ssl;
 
        if (ssl->password)
-               syslog(LOG_INFO, " Password : %s", ssl->password);
+               log_message(LOG_INFO, " Password : %s", ssl->password);
        if (ssl->cafile)
-               syslog(LOG_INFO, " CA-file : %s", ssl->cafile);
+               log_message(LOG_INFO, " CA-file : %s", ssl->cafile);
        if (ssl->certfile)
-               syslog(LOG_INFO, " Certificate file : %s", ssl->certfile);
+               log_message(LOG_INFO, " Certificate file : %s", ssl->certfile);
        if (ssl->keyfile)
-               syslog(LOG_INFO, " Key file : %s", ssl->keyfile);
+               log_message(LOG_INFO, " Key file : %s", ssl->keyfile);
        if (!ssl->password && !ssl->cafile && !ssl->certfile && !ssl->keyfile)
-               syslog(LOG_INFO, " Using autogen SSL context");
+               log_message(LOG_INFO, " Using autogen SSL context");
 }
 
 /* Virtual server group facility functions */
@@ -84,7 +86,7 @@ dump_vsg(void *data)
 {
        virtual_server_group *vsg = data;
 
-       syslog(LOG_INFO, " Virtual Server Group = %s", vsg->gname);
+       log_message(LOG_INFO, " Virtual Server Group = %s", vsg->gname);
        dump_list(vsg->addr_ip);
        dump_list(vsg->range);
        dump_list(vsg->vfwmark);
@@ -100,14 +102,14 @@ dump_vsg_entry(void *data)
        virtual_server_group_entry *vsg_entry = data;
 
        if (vsg_entry->vfwmark)
-               syslog(LOG_INFO, "   FWMARK = %d", vsg_entry->vfwmark);
+               log_message(LOG_INFO, "   FWMARK = %d", vsg_entry->vfwmark);
        else if (vsg_entry->range)
-               syslog(LOG_INFO, "   VIP Range = %s-%d, VPORT = %d"
+               log_message(LOG_INFO, "   VIP Range = %s-%d, VPORT = %d"
                       , inet_ntop2(SVR_IP(vsg_entry))
                       , vsg_entry->range
                       , ntohs(SVR_PORT(vsg_entry)));
        else
-               syslog(LOG_INFO, "   VIP = %s, VPORT = %d"
+               log_message(LOG_INFO, "   VIP = %s, VPORT = %d"
                       , inet_ntop2(SVR_IP(vsg_entry))
                       , ntohs(SVR_PORT(vsg_entry)));
 }
@@ -157,6 +159,8 @@ free_vs(void *data)
        FREE_PTR(vs->virtualhost);
        FREE_PTR(vs->s_svr);
        free_list(vs->rs);
+       FREE_PTR(vs->quorum_up);
+       FREE_PTR(vs->quorum_down);
        FREE(vs);
 }
 static void
@@ -165,59 +169,68 @@ dump_vs(void *data)
        virtual_server *vs = data;
 
        if (vs->vsgname)
-               syslog(LOG_INFO, " VS GROUP = %s", vs->vsgname);
+               log_message(LOG_INFO, " VS GROUP = %s", vs->vsgname);
        else if (vs->vfwmark)
-               syslog(LOG_INFO, " VS FWMARK = %d", vs->vfwmark);
+               log_message(LOG_INFO, " VS FWMARK = %d", vs->vfwmark);
        else
-               syslog(LOG_INFO, " VIP = %s, VPORT = %d", inet_ntop2(SVR_IP(vs))
+               log_message(LOG_INFO, " VIP = %s, VPORT = %d", inet_ntop2(SVR_IP(vs))
                       , ntohs(SVR_PORT(vs)));
        if (vs->virtualhost)
-               syslog(LOG_INFO, "   VirtualHost = %s", vs->virtualhost);
-       syslog(LOG_INFO, "   delay_loop = %lu, lb_algo = %s",
+               log_message(LOG_INFO, "   VirtualHost = %s", vs->virtualhost);
+       log_message(LOG_INFO, "   delay_loop = %lu, lb_algo = %s",
               (vs->delay_loop >= TIMER_MAX_SEC) ? vs->delay_loop/TIMER_HZ :
                                                   vs->delay_loop,
               vs->sched);
        if (atoi(vs->timeout_persistence) > 0)
-               syslog(LOG_INFO, "   persistence timeout = %s",
+               log_message(LOG_INFO, "   persistence timeout = %s",
                       vs->timeout_persistence);
        if (vs->granularity_persistence)
-               syslog(LOG_INFO, "   persistence granularity = %s",
+               log_message(LOG_INFO, "   persistence granularity = %s",
                       inet_ntop2(vs->granularity_persistence));
-       syslog(LOG_INFO, "   protocol = %s",
+       log_message(LOG_INFO, "   protocol = %s",
               (vs->service_type == IPPROTO_TCP) ? "TCP" : "UDP");
+       log_message(LOG_INFO, "   alpha is %s, omega is %s",
+                   vs->alpha ? "ON" : "OFF", vs->omega ? "ON" : "OFF");
+       log_message(LOG_INFO, "   quorum = %lu, hysteresis = %lu", vs->quorum, vs->hysteresis);
+       if (vs->quorum_up)
+               log_message(LOG_INFO, "   -> Notify script UP = %s",
+                           vs->quorum_up);
+       if (vs->quorum_down)
+               log_message(LOG_INFO, "   -> Notify script DOWN = %s",
+                           vs->quorum_down);
        if (vs->ha_suspend)
-               syslog(LOG_INFO, "   Using HA suspend");
+               log_message(LOG_INFO, "   Using HA suspend");
 
        switch (vs->loadbalancing_kind) {
 #ifdef _WITH_LVS_
 #ifdef _KRNL_2_2_
        case 0:
-               syslog(LOG_INFO, "   lb_kind = NAT");
+               log_message(LOG_INFO, "   lb_kind = NAT");
                if (vs->nat_mask)
-                       syslog(LOG_INFO, "   nat mask = %s", inet_ntop2(vs->nat_mask));
+                       log_message(LOG_INFO, "   nat mask = %s", inet_ntop2(vs->nat_mask));
                break;
        case IP_MASQ_F_VS_DROUTE:
-               syslog(LOG_INFO, "   lb_kind = DR");
+               log_message(LOG_INFO, "   lb_kind = DR");
                break;
        case IP_MASQ_F_VS_TUNNEL:
-               syslog(LOG_INFO, "   lb_kind = TUN");
+               log_message(LOG_INFO, "   lb_kind = TUN");
                break;
 #else
        case IP_VS_CONN_F_MASQ:
-               syslog(LOG_INFO, "   lb_kind = NAT");
+               log_message(LOG_INFO, "   lb_kind = NAT");
                break;
        case IP_VS_CONN_F_DROUTE:
-               syslog(LOG_INFO, "   lb_kind = DR");
+               log_message(LOG_INFO, "   lb_kind = DR");
                break;
        case IP_VS_CONN_F_TUNNEL:
-               syslog(LOG_INFO, "   lb_kind = TUN");
+               log_message(LOG_INFO, "   lb_kind = TUN");
                break;
 #endif
 #endif
        }
 
        if (vs->s_svr) {
-               syslog(LOG_INFO, "   sorry server = %s:%d",
+               log_message(LOG_INFO, "   sorry server = %s:%d",
                       inet_ntop2(SVR_IP(vs->s_svr))
                       , ntohs(SVR_PORT(vs->s_svr)));
        }
@@ -245,6 +258,13 @@ alloc_vs(char *ip, char *port)
        new->delay_loop = KEEPALIVED_DEFAULT_DELAY;
        strncpy(new->timeout_persistence, "0", 1);
        new->virtualhost = NULL;
+       new->alpha = 0;
+       new->omega = 0;
+       new->quorum_up = NULL;
+       new->quorum_down = NULL;
+       new->quorum = 1;
+       new->hysteresis = 0;
+       new->quorum_state = DOWN;
 
        list_add(check_data->vs, new);
 }
@@ -275,17 +295,17 @@ static void
 dump_rs(void *data)
 {
        real_server *rs = data;
-       syslog(LOG_INFO, "   RIP = %s, RPORT = %d, WEIGHT = %d",
+       log_message(LOG_INFO, "   RIP = %s, RPORT = %d, WEIGHT = %d",
               inet_ntop2(SVR_IP(rs))
               , ntohs(SVR_PORT(rs))
               , rs->weight);
        if (rs->inhibit)
-               syslog(LOG_INFO, "     -> Inhibit service on failure");
+               log_message(LOG_INFO, "     -> Inhibit service on failure");
        if (rs->notify_up)
-               syslog(LOG_INFO, "     -> Notify script UP = %s",
+               log_message(LOG_INFO, "     -> Notify script UP = %s",
                       rs->notify_up);
        if (rs->notify_down)
-               syslog(LOG_INFO, "     -> Notify script DOWN = %s",
+               log_message(LOG_INFO, "     -> Notify script DOWN = %s",
                       rs->notify_down);
 }
 
@@ -338,12 +358,12 @@ void
 dump_check_data(check_conf_data *check_data_obj)
 {
        if (check_data_obj->ssl) {
-               syslog(LOG_INFO, "------< SSL definitions >------");
+               log_message(LOG_INFO, "------< SSL definitions >------");
                dump_ssl();
        }
        if (!LIST_ISEMPTY(check_data_obj->vs)) {
-               syslog(LOG_INFO, "------< LVS Topology >------");
-               syslog(LOG_INFO, " System is compiled with LVS v%d.%d.%d",
+               log_message(LOG_INFO, "------< LVS Topology >------");
+               log_message(LOG_INFO, " System is compiled with LVS v%d.%d.%d",
                       NVERSION(IP_VS_VERSION_CODE));
                if (!LIST_ISEMPTY(check_data_obj->vs_group))
                        dump_list(check_data_obj->vs_group);
index c27b6a8..5c7c922 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        WEB CHECK. Common HTTP/SSL checker primitives.
  *
- * Version:     $Id: check_http.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: check_http.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #include <openssl/err.h>
 #include "check_http.h"
 #include "check_ssl.h"
 #include "check_api.h"
+#include "logger.h"
 #include "memory.h"
 #include "parser.h"
 #include "utils.h"
@@ -48,12 +49,12 @@ void
 dump_url(void *data)
 {
        url *url_obj = data;
-       syslog(LOG_INFO, "   Checked url = %s", url_obj->path);
+       log_message(LOG_INFO, "   Checked url = %s", url_obj->path);
        if (url_obj->digest)
-               syslog(LOG_INFO, "           digest = %s",
+               log_message(LOG_INFO, "           digest = %s",
                       url_obj->digest);
        if (url_obj->status_code)
-               syslog(LOG_INFO, "           HTTP Status Code = %d",
+               log_message(LOG_INFO, "           HTTP Status Code = %d",
                       url_obj->status_code);
 }
 
@@ -74,19 +75,19 @@ dump_http_get_check(void *data)
        http_get_checker *http_get_chk = CHECKER_DATA(data);
 
        if (http_get_chk->proto == PROTO_HTTP)
-               syslog(LOG_INFO, "   Keepalive method = HTTP_GET");
+               log_message(LOG_INFO, "   Keepalive method = HTTP_GET");
        else
-               syslog(LOG_INFO, "   Keepalive method = SSL_GET");
+               log_message(LOG_INFO, "   Keepalive method = SSL_GET");
        if (http_get_chk->connection_port)
-               syslog(LOG_INFO, "   Connection port = %d",
+               log_message(LOG_INFO, "   Connection port = %d",
                       ntohs(http_get_chk->connection_port));
        if (http_get_chk->bindto)
-               syslog(LOG_INFO, "   Bind to = %s",
+               log_message(LOG_INFO, "   Bind to = %s",
                       inet_ntop2(http_get_chk->bindto));
-       syslog(LOG_INFO, "   Connection timeout = %lu",
+       log_message(LOG_INFO, "   Connection timeout = %lu",
               http_get_chk->connection_to/TIMER_HZ);
-       syslog(LOG_INFO, "   Nb get retry = %d", http_get_chk->nb_get_retry);
-       syslog(LOG_INFO, "   Delay before retry = %lu",
+       log_message(LOG_INFO, "   Nb get retry = %d", http_get_chk->nb_get_retry);
+       log_message(LOG_INFO, "   Delay before retry = %lu",
               http_get_chk->delay_before_retry/TIMER_HZ);
        dump_list(http_get_chk->url);
 }
@@ -309,7 +310,7 @@ epilog(thread * thread_obj, int method, int t, int c)
         */
        if (http_arg_obj->retry_it > http_get_check->nb_get_retry-1) {
                if (svr_checker_up(checker_obj->id, checker_obj->rs)) {
-                       syslog(LOG_INFO, "Check on service [%s:%d] failed after %d retry."
+                       log_message(LOG_INFO, "Check on service [%s:%d] failed after %d retry."
                               , inet_ntop2(CHECKER_RIP(checker_obj))
                               , ntohs(addr_port), http_arg_obj->retry_it);
                        smtp_alert(checker_obj->rs, NULL, NULL,
@@ -365,7 +366,7 @@ timeout_epilog(thread * thread_obj, char *smtp_msg, char *debug_msg)
        checker *checker_obj = THREAD_ARG(thread_obj);
        uint16_t addr_port = get_service_port(checker_obj);
 
-       syslog(LOG_INFO, "Timeout %s server [%s:%d].",
+       log_message(LOG_INFO, "Timeout %s server [%s:%d].",
               debug_msg
               , inet_ntop2(CHECKER_RIP(checker_obj))
               , ntohs(addr_port));
@@ -402,7 +403,7 @@ http_handle_response(thread * thread_obj, unsigned char digest[16]
        REQ *req = HTTP_REQ(http_arg_obj);
        uint16_t addr_port = get_service_port(checker_obj);
        int r, di = 0;
-       unsigned char *digest_tmp;
+       char *digest_tmp;
        url *fetched_url = fetch_next_url(http_get_check);
 
        /* First check if remote webserver returned data */
@@ -416,7 +417,7 @@ http_handle_response(thread * thread_obj, unsigned char digest[16]
                if (req->status_code != fetched_url->status_code) {
                        /* check if server is currently alive */
                        if (svr_checker_up(checker_obj->id, checker_obj->rs)) {
-                               syslog(LOG_INFO,
+                               log_message(LOG_INFO,
                                       "HTTP status code error to [%s:%d] url(%s)"
                                       ", status_code [%d].",
                                       inet_ntop2(CHECKER_RIP(checker_obj)),
@@ -444,7 +445,7 @@ http_handle_response(thread * thread_obj, unsigned char digest[16]
                        return epilog(thread_obj, 2, 0, 1);
                } else {
                        if (!svr_checker_up(checker_obj->id, checker_obj->rs))
-                               syslog(LOG_INFO,
+                               log_message(LOG_INFO,
                                       "HTTP status code success to [%s:%d] url(%d).",
                                       inet_ntop2(CHECKER_RIP(checker_obj))
                                       , ntohs(addr_port)
@@ -465,7 +466,7 @@ http_handle_response(thread * thread_obj, unsigned char digest[16]
                if (r) {
                        /* check if server is currently alive */
                        if (svr_checker_up(checker_obj->id, checker_obj->rs)) {
-                               syslog(LOG_INFO,
+                               log_message(LOG_INFO,
                                       "MD5 digest error to [%s:%d] url[%s]"
                                       ", MD5SUM [%s].",
                                       inet_ntop2(CHECKER_RIP(checker_obj)),
@@ -494,7 +495,7 @@ http_handle_response(thread * thread_obj, unsigned char digest[16]
                        return epilog(thread_obj, 2, 0, 1);
                } else {
                        if (!svr_checker_up(checker_obj->id, checker_obj->rs))
-                               syslog(LOG_INFO, "MD5 digest success to [%s:%d] url(%d).",
+                               log_message(LOG_INFO, "MD5 digest success to [%s:%d] url(%d).",
                                       inet_ntop2(CHECKER_RIP(checker_obj))
                                       , ntohs(addr_port)
                                       , http_arg_obj->url_it + 1);
@@ -563,7 +564,7 @@ http_read_thread(thread * thread_obj)
 
        /* Test if data are ready */
        if (r == -1 && (errno == EAGAIN || errno == EINTR)) {
-               syslog(LOG_INFO, "Read error with server [%s:%d]: %s",
+               log_message(LOG_INFO, "Read error with server [%s:%d]: %s",
                       inet_ntop2(CHECKER_RIP(checker_obj))
                       , ntohs(addr_port)
                       , strerror(errno));
@@ -580,7 +581,7 @@ http_read_thread(thread * thread_obj)
                if (r == -1) {
                        /* We have encourred a real read error */
                        if (svr_checker_up(checker_obj->id, checker_obj->rs)) {
-                               syslog(LOG_INFO, "Read error with server [%s:%d]: %s",
+                               log_message(LOG_INFO, "Read error with server [%s:%d]: %s",
                                       inet_ntop2(CHECKER_RIP(checker_obj))
                                       , ntohs(addr_port)
                                       , strerror(errno));
@@ -701,7 +702,7 @@ http_request_thread(thread * thread_obj)
        FREE(str_request);
 
        if (!ret) {
-               syslog(LOG_INFO, "Cannot send get request to [%s:%d].",
+               log_message(LOG_INFO, "Cannot send get request to [%s:%d].",
                       inet_ntop2(CHECKER_RIP(checker_obj))
                       , ntohs(addr_port));
 
@@ -747,7 +748,7 @@ http_check_thread(thread * thread_obj)
        case connect_error:
                /* check if server is currently alive */
                if (svr_checker_up(checker_obj->id, checker_obj->rs)) {
-                       syslog(LOG_INFO, "Error connecting server [%s:%d].",
+                       log_message(LOG_INFO, "Error connecting server [%s:%d].",
                               inet_ntop2(CHECKER_RIP(checker_obj))
                               , ntohs(addr_port));
                        smtp_alert(checker_obj->rs, NULL, NULL,
@@ -832,7 +833,7 @@ http_check_thread(thread * thread_obj)
 #endif
                                if ((http_get_check->proto == PROTO_SSL) &&
                                    (svr_checker_up(checker_obj->id, checker_obj->rs))) {
-                                       syslog(LOG_INFO, "SSL handshake/communication error"
+                                       log_message(LOG_INFO, "SSL handshake/communication error"
                                                         " connecting to server"
                                                         " (openssl errno: %d) [%s:%d]."
                                                       , SSL_get_error (http_arg_obj->req->ssl, ret)
@@ -886,7 +887,7 @@ http_connect_thread(thread * thread_obj)
                 * check if server is currently alive.
                 */
                if (!svr_checker_up(checker_obj->id, checker_obj->rs)) {
-                       syslog(LOG_INFO, "Remote Web server [%s:%d] succeed on service.",
+                       log_message(LOG_INFO, "Remote Web server [%s:%d] succeed on service.",
                               inet_ntop2(CHECKER_RIP(checker_obj))
                               , ntohs(addr_port));
                        smtp_alert(checker_obj->rs, NULL, NULL, "UP",
index f406d26..2f49347 100644 (file)
@@ -6,7 +6,7 @@
  * Part:        MISC CHECK. Perform a system call to run an extra
  *              system prog or script.
  *
- * Version:     $Id: check_misc.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: check_misc.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Eric Jarman, <ehj38230@cmsu2.cmsu.edu>
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #include "check_misc.h"
 #include "check_api.h"
 #include "memory.h"
 #include "ipwrapper.h"
+#include "logger.h"
 #include "smtp.h"
 #include "utils.h"
 #include "parser.h"
 #include "notify.h"
 #include "daemon.h"
+#include "signals.h"
 
 int misc_check_thread(thread *);
 int misc_check_child_thread(thread *);
@@ -54,10 +56,10 @@ void
 dump_misc_check(void *data)
 {
        misc_checker *misc_chk = CHECKER_DATA(data);
-       syslog(LOG_INFO, "   Keepalive method = MISC_CHECK");
-       syslog(LOG_INFO, "   script = %s", misc_chk->path);
-       syslog(LOG_INFO, "   timeout = %lu", misc_chk->timeout/TIMER_HZ);
-       syslog(LOG_INFO, "   dynamic = %s", misc_chk->dynamic ? "YES" : "NO");
+       log_message(LOG_INFO, "   Keepalive method = MISC_CHECK");
+       log_message(LOG_INFO, "   script = %s", misc_chk->path);
+       log_message(LOG_INFO, "   timeout = %lu", misc_chk->timeout/TIMER_HZ);
+       log_message(LOG_INFO, "   dynamic = %s", misc_chk->dynamic ? "YES" : "NO");
 }
 
 void
@@ -133,7 +135,7 @@ misc_check_thread(thread * thread_obj)
 
        /* In case of fork is error. */
        if (pid < 0) {
-               syslog(LOG_INFO, "Failed fork process");
+               log_message(LOG_INFO, "Failed fork process");
                return -1;
        }
 
@@ -148,24 +150,13 @@ misc_check_thread(thread * thread_obj)
        }
 
        /* Child part */
+       signal_handler_destroy();
        closeall(0);
 
        open("/dev/null", O_RDWR);
        dup(0);
        dup(0);
 
-       /* Also need to reset the signal state */
-       {
-               sigset_t empty_set;
-               sigemptyset(&empty_set);
-               sigprocmask(SIG_SETMASK, &empty_set, NULL);
-
-               signal(SIGHUP, SIG_DFL);
-               signal(SIGINT, SIG_DFL);
-               signal(SIGTERM, SIG_DFL);
-               signal(SIGKILL, SIG_DFL);
-       }
-
        status = system_call(misc_chk->path);
 
        if (status < 0 || !WIFEXITED(status))
@@ -193,7 +184,7 @@ misc_check_child_thread(thread * thread_obj)
 
                /* The child hasn't responded. Kill it off. */
                if (svr_checker_up(checker_obj->id, checker_obj->rs)) {
-                       syslog(LOG_INFO, "Misc check to [%s] for [%s] timed out",
+                       log_message(LOG_INFO, "Misc check to [%s] for [%s] timed out",
                               inet_ntop2(CHECKER_RIP(checker_obj)),
                               misc_chk->path);
                        smtp_alert(checker_obj->rs, NULL, NULL,
@@ -227,7 +218,7 @@ misc_check_child_thread(thread * thread_obj)
 
                        /* everything is good */
                        if (!svr_checker_up(checker_obj->id, checker_obj->rs)) {
-                               syslog(LOG_INFO, "Misc check to [%s] for [%s] success.",
+                               log_message(LOG_INFO, "Misc check to [%s] for [%s] success.",
                                       inet_ntop2(CHECKER_RIP(checker_obj)),
                                       misc_chk->path);
                                smtp_alert(checker_obj->rs, NULL, NULL,
@@ -239,7 +230,7 @@ misc_check_child_thread(thread * thread_obj)
                        }
                } else {
                        if (svr_checker_up(checker_obj->id, checker_obj->rs)) {
-                               syslog(LOG_INFO, "Misc check to [%s] for [%s] failed.",
+                               log_message(LOG_INFO, "Misc check to [%s] for [%s] failed.",
                                       inet_ntop2(CHECKER_RIP(checker_obj)),
                                       misc_chk->path);
                                smtp_alert(checker_obj->rs, NULL, NULL,
@@ -272,7 +263,7 @@ misc_check_child_timeout_thread(thread * thread_obj)
                return 0;
        }
 
-       syslog(LOG_WARNING, "Process [%d] didn't respond to SIGTERM", pid);
+       log_message(LOG_WARNING, "Process [%d] didn't respond to SIGTERM", pid);
        waitpid(pid, NULL, 0);
 
        return 0;
index 5ce6fcc..2156049 100644 (file)
@@ -7,7 +7,7 @@
  *              data structure representation the conf file representing
  *              the loadbalanced server pool.
  *  
- * Version:     $Id: check_parser.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: check_parser.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -21,7 +21,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #include "check_parser.h"
@@ -29,6 +29,7 @@
 #include "check_api.h"
 #include "global_data.h"
 #include "global_parser.h"
+#include "logger.h"
 #include "parser.h"
 #include "memory.h"
 #include "utils.h"
@@ -114,7 +115,7 @@ lbkind_handler(vector strvec)
                vs->loadbalancing_kind = IP_VS_CONN_F_TUNNEL;
 #endif
        else
-               syslog(LOG_INFO, "PARSER : unknown [%s] routing method.", str);
+               log_message(LOG_INFO, "PARSER : unknown [%s] routing method.", str);
 }
 static void
 natmask_handler(vector strvec)
@@ -218,6 +219,57 @@ notify_down_handler(vector strvec)
        real_server *rs = LIST_TAIL_DATA(vs->rs);
        rs->notify_down = set_value(strvec);
 }
+static void
+alpha_handler(vector strvec)
+{
+       virtual_server *vs = LIST_TAIL_DATA(check_data->vs);
+       vs->alpha = 1;
+}
+static void
+omega_handler(vector strvec)
+{
+       virtual_server *vs = LIST_TAIL_DATA(check_data->vs);
+       vs->omega = 1;
+}
+static void
+quorum_up_handler(vector strvec)
+{
+       virtual_server *vs = LIST_TAIL_DATA(check_data->vs);
+       vs->quorum_up = set_value(strvec);
+}
+static void
+quorum_down_handler(vector strvec)
+{
+       virtual_server *vs = LIST_TAIL_DATA(check_data->vs);
+       vs->quorum_down = set_value(strvec);
+}
+static void
+quorum_handler(vector strvec)
+{
+       virtual_server *vs = LIST_TAIL_DATA(check_data->vs);
+       long tmp = atol (VECTOR_SLOT(strvec, 1));
+       if (tmp < 1) {
+               log_message(LOG_ERR, "Condition not met: Quorum >= 1");
+               log_message(LOG_ERR, "Ignoring requested value %s, using 1 instead",
+                 (char *) VECTOR_SLOT(strvec, 1));
+               tmp = 1;
+       }
+       vs->quorum = tmp;
+}
+static void
+hysteresis_handler(vector strvec)
+{
+       virtual_server *vs = LIST_TAIL_DATA(check_data->vs);
+       long tmp = atol (VECTOR_SLOT(strvec, 1));
+       if (tmp < 0 || tmp >= vs->quorum) {
+               log_message(LOG_ERR, "Condition not met: 0 <= Hysteresis <= Quorum - 1");
+               log_message(LOG_ERR, "Ignoring requested value %s, using 0 instead",
+                      (char *) VECTOR_SLOT(strvec, 1));
+               log_message(LOG_ERR, "Hint: try defining hysteresis after quorum");
+               tmp = 0;
+       }
+       vs->hysteresis = tmp;
+}
 
 vector
 check_init_keywords(void)
@@ -247,6 +299,14 @@ check_init_keywords(void)
        install_keyword("ha_suspend", &hasuspend_handler);
        install_keyword("virtualhost", &virtualhost_handler);
 
+       /* Pool regression detection and handling. */
+       install_keyword("alpha", &alpha_handler);
+       install_keyword("omega", &omega_handler);
+       install_keyword("quorum_up", &quorum_up_handler);
+       install_keyword("quorum_down", &quorum_down_handler);
+       install_keyword("quorum", &quorum_handler);
+       install_keyword("hysteresis", &hysteresis_handler);
+
        /* Real server mapping */
        install_keyword("sorry_server", &ssvr_handler);
        install_keyword("real_server", &rs_handler);
index ab317d8..c828d20 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        SMTP CHECK. Check an SMTP-server.
  *
- * Version:     $Id: check_smtp.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: check_smtp.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Authors:     Jeremy Rumpf, <jrumpf@heavyload.net>
  *              Alexandre Cassen, <acassen@linux-vs.org>
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #include <ctype.h>
 
 #include "check_smtp.h"
 #include "check_api.h"
+#include "logger.h"
 #include "memory.h"
 #include "ipwrapper.h"
 #include "utils.h"
@@ -70,10 +71,10 @@ void
 smtp_dump_host(void *data)
 {
         smtp_host *smtp_hst = data;
-        syslog(LOG_INFO, "   Checked ip = %s", inet_ntop2(smtp_hst->ip));
-        syslog(LOG_INFO, "           port = %d", ntohs(smtp_hst->port));
+        log_message(LOG_INFO, "   Checked ip = %s", inet_ntop2(smtp_hst->ip));
+        log_message(LOG_INFO, "           port = %d", ntohs(smtp_hst->port));
        if (smtp_hst->bindto)
-               syslog(LOG_INFO, "           bindto = %s", inet_ntop2(smtp_hst->bindto));
+               log_message(LOG_INFO, "           bindto = %s", inet_ntop2(smtp_hst->bindto));
 }
 
 /* 
@@ -84,11 +85,11 @@ void
 dump_smtp_check(void *data)
 {
        smtp_checker *smtp_chk = CHECKER_DATA(data);
-       syslog(LOG_INFO, "   Keepalive method = SMTP_CHECK");
-        syslog(LOG_INFO, "           helo = %s", smtp_chk->helo_name);
-        syslog(LOG_INFO, "           timeout = %ld", smtp_chk->timeout/TIMER_HZ);
-        syslog(LOG_INFO, "           retry = %d", smtp_chk->retry);
-        syslog(LOG_INFO, "           delay before retry = %ld", smtp_chk->db_retry/TIMER_HZ);
+       log_message(LOG_INFO, "   Keepalive method = SMTP_CHECK");
+        log_message(LOG_INFO, "           helo = %s", smtp_chk->helo_name);
+        log_message(LOG_INFO, "           timeout = %ld", smtp_chk->timeout/TIMER_HZ);
+        log_message(LOG_INFO, "           retry = %d", smtp_chk->retry);
+        log_message(LOG_INFO, "           delay before retry = %ld", smtp_chk->db_retry/TIMER_HZ);
        dump_list(smtp_chk->host);
 }
 
@@ -297,9 +298,9 @@ smtp_final(thread *thread_obj, int error, const char *format, ...)
                                va_end(varg_list);
                                error_buff[512 - 1] = '\0';
 
-                               syslog(LOG_INFO, error_buff);
+                               log_message(LOG_INFO, error_buff);
                        } else {
-                               syslog(LOG_INFO, "SMTP_CHECK Unknown error");
+                               log_message(LOG_INFO, "SMTP_CHECK Unknown error");
                        }
                }
 
@@ -392,7 +393,7 @@ smtp_get_line_cb(thread *thread_obj)
 
        /* wrap the buffer, if full, by clearing it */
        if (SMTP_BUFF_MAX - smtp_chk->buff_ctr <= 0) {
-               syslog(LOG_INFO, "SMTP_CHECK Buffer overflow reading from server [%s:%d]. "
+               log_message(LOG_INFO, "SMTP_CHECK Buffer overflow reading from server [%s:%d]. "
                       "Increase SMTP_BUFF_MAX in smtp_check.h",
                       inet_ntop2(smtp_hst->ip), ntohs(smtp_hst->port));
                smtp_clear_buff(thread_obj);
@@ -779,7 +780,7 @@ smtp_connect_thread(thread *thread_obj)
         */
        if ((smtp_chk->host_ptr = list_element(smtp_chk->host, smtp_chk->host_ctr)) == NULL) {
                if (!svr_checker_up(chk->id, chk->rs)) {
-                       syslog(LOG_INFO, "Remote SMTP server [%s:%d] succeed on service.",
+                       log_message(LOG_INFO, "Remote SMTP server [%s:%d] succeed on service.",
                               inet_ntop2(CHECKER_RIP(chk)), ntohs(CHECKER_RPORT(chk)));
 
                        smtp_alert(chk->rs, NULL, NULL, "UP",
index 10ab7ca..6877cd0 100644 (file)
@@ -7,7 +7,7 @@
  *              url, compute a MD5 over this result and match it to the
  *              expected value.
  *
- * Version:     $Id: check_ssl.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: check_ssl.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #include <openssl/err.h>
 #include "check_ssl.h"
 #include "check_api.h"
+#include "logger.h"
 #include "memory.h"
 #include "parser.h"
 #include "smtp.h"
@@ -91,7 +92,7 @@ build_ssl_ctx(void)
                if (!
                    (SSL_CTX_use_certificate_chain_file
                     (ssl->ctx, check_data->ssl->keyfile))) {
-                       syslog(LOG_INFO,
+                       log_message(LOG_INFO,
                               "SSL error : Cant load certificate file...");
                        return 0;
                }
@@ -107,7 +108,7 @@ build_ssl_ctx(void)
                if (!
                    (SSL_CTX_use_PrivateKey_file
                     (ssl->ctx, check_data->ssl->keyfile, SSL_FILETYPE_PEM))) {
-                       syslog(LOG_INFO, "SSL error : Cant load key file...");
+                       log_message(LOG_INFO, "SSL error : Cant load key file...");
                        return 0;
                }
 
@@ -116,7 +117,7 @@ build_ssl_ctx(void)
                if (!
                    (SSL_CTX_load_verify_locations
                     (ssl->ctx, check_data->ssl->cafile, 0))) {
-                       syslog(LOG_INFO, "SSL error : Cant load CA file...");
+                       log_message(LOG_INFO, "SSL error : Cant load CA file...");
                        return 0;
                }
 
@@ -138,11 +139,11 @@ init_ssl_ctx(void)
        SSL_DATA *ssl = check_data->ssl;
 
        if (!build_ssl_ctx()) {
-               syslog(LOG_INFO, "Error Initialize SSL, ctx Instance");
-               syslog(LOG_INFO, "  SSL  keyfile:%s", ssl->keyfile);
-               syslog(LOG_INFO, "  SSL password:%s", ssl->password);
-               syslog(LOG_INFO, "  SSL   cafile:%s", ssl->cafile);
-               syslog(LOG_INFO, "Terminate...\n");
+               log_message(LOG_INFO, "Error Initialize SSL, ctx Instance");
+               log_message(LOG_INFO, "  SSL  keyfile:%s", ssl->keyfile);
+               log_message(LOG_INFO, "  SSL password:%s", ssl->password);
+               log_message(LOG_INFO, "  SSL   cafile:%s", ssl->cafile);
+               log_message(LOG_INFO, "Terminate...\n");
                clear_ssl(ssl);
                return 0;
        }
@@ -158,29 +159,29 @@ ssl_printerr(int err)
 
        switch (err) {
        case SSL_ERROR_ZERO_RETURN:
-               syslog(LOG_INFO, "  SSL error: (zero return)");
+               log_message(LOG_INFO, "  SSL error: (zero return)");
                break;
        case SSL_ERROR_WANT_READ:
-               syslog(LOG_INFO, "  SSL error: (read error)");
+               log_message(LOG_INFO, "  SSL error: (read error)");
                break;
        case SSL_ERROR_WANT_WRITE:
-               syslog(LOG_INFO, "  SSL error: (write error)");
+               log_message(LOG_INFO, "  SSL error: (write error)");
                break;
        case SSL_ERROR_WANT_CONNECT:
-               syslog(LOG_INFO, "  SSL error: (connect error)");
+               log_message(LOG_INFO, "  SSL error: (connect error)");
                break;
        case SSL_ERROR_WANT_X509_LOOKUP:
-               syslog(LOG_INFO, "  SSL error: (X509 lookup error)");
+               log_message(LOG_INFO, "  SSL error: (X509 lookup error)");
                break;
        case SSL_ERROR_SYSCALL:
-               syslog(LOG_INFO, "  SSL error: (syscall error)");
+               log_message(LOG_INFO, "  SSL error: (syscall error)");
                break;
        case SSL_ERROR_SSL:{
                        ssl_strerr = (char *) MALLOC(500);
 
                        extended_error = ERR_get_error();
                        ERR_error_string(extended_error, ssl_strerr);
-                       syslog(LOG_INFO, "  SSL error: (%s)", ssl_strerr);
+                       log_message(LOG_INFO, "  SSL error: (%s)", ssl_strerr);
                        FREE(ssl_strerr);
                        break;
                }
index 0515587..fd2eeea 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        TCP checker.
  *
- * Version:     $Id: check_tcp.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: check_tcp.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #include "check_tcp.h"
@@ -27,6 +27,7 @@
 #include "memory.h"
 #include "ipwrapper.h"
 #include "layer4.h"
+#include "logger.h"
 #include "smtp.h"
 #include "utils.h"
 #include "parser.h"
@@ -48,13 +49,13 @@ dump_tcp_check(void *data)
 {
        tcp_checker *tcp_chk = CHECKER_DATA(data);
 
-       syslog(LOG_INFO, "   Keepalive method = TCP_CHECK");
+       log_message(LOG_INFO, "   Keepalive method = TCP_CHECK");
        if (tcp_chk->connection_port)
-               syslog(LOG_INFO, "   Connection port = %d",
+               log_message(LOG_INFO, "   Connection port = %d",
                       ntohs(tcp_chk->connection_port));
        if (tcp_chk->bindto)
-               syslog(LOG_INFO, "   Bind to = %s", inet_ntop2(tcp_chk->bindto));
-       syslog(LOG_INFO, "   Connection timeout = %d", tcp_chk->connection_to/TIMER_HZ);
+               log_message(LOG_INFO, "   Bind to = %s", inet_ntop2(tcp_chk->bindto));
+       log_message(LOG_INFO, "   Connection timeout = %d", tcp_chk->connection_to/TIMER_HZ);
 }
 
 void
@@ -123,7 +124,7 @@ tcp_check_thread(thread * thread_obj)
                close(thread_obj->u.fd);
 
                if (!svr_checker_up(checker_obj->id, checker_obj->rs)) {
-                       syslog(LOG_INFO, "TCP connection to [%s:%d] success.",
+                       log_message(LOG_INFO, "TCP connection to [%s:%d] success.",
                               inet_ntop2(CHECKER_RIP(checker_obj))
                               , ntohs(addr_port));
                        smtp_alert(checker_obj->rs, NULL, NULL,
@@ -137,7 +138,7 @@ tcp_check_thread(thread * thread_obj)
        } else {
 
                if (svr_checker_up(checker_obj->id, checker_obj->rs)) {
-                       syslog(LOG_INFO, "TCP connection to [%s:%d] failed !!!",
+                       log_message(LOG_INFO, "TCP connection to [%s:%d] failed !!!",
                               inet_ntop2(CHECKER_RIP(checker_obj))
                               , ntohs(addr_port));
                        smtp_alert(checker_obj->rs, NULL, NULL,
index 8b47c17..b4f4a41 100644 (file)
@@ -7,7 +7,7 @@
  *              library to add/remove server MASQ rules to the kernel 
  *              firewall framework.
  *
- * Version:     $Id: ipfwwrapper.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: ipfwwrapper.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -21,7 +21,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #include "ipfwwrapper.h"
index 5992ead..77fd2d0 100644 (file)
@@ -6,7 +6,7 @@
  * Part:        IPVS Kernel wrapper. Use setsockopt call to add/remove
  *              server to/from the loadbalanced server pool.
  *  
- * Version:     $Id: ipvswrapper.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: ipvswrapper.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -20,7 +20,7 @@
  *               as published by the Free Software Foundation; either version
  *               2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #include "ipvswrapper.h"
@@ -28,6 +28,7 @@
 #include "list.h"
 #include "utils.h"
 #include "memory.h"
+#include "logger.h"
 
 /* local helpers functions */
 static int parse_timeout(char *, unsigned *);
@@ -65,7 +66,7 @@ ipvs_stop(void)
 int
 ipvs_syncd_cmd(int cmd, char *ifname, int state, int syncid)
 {
-       syslog(LOG_INFO, "IPVS : Sync daemon not supported on kernel v2.2");
+       log_message(LOG_INFO, "IPVS : Sync daemon not supported on kernel v2.2");
        return IPVS_ERROR;
 }
 
@@ -87,7 +88,7 @@ ipvs_cmd(int cmd, list vs_group, virtual_server * vs, real_server * rs)
        ctl.u.vs_user.protocol = vs->service_type;
 
        if (!parse_timeout(vs->timeout_persistence, &ctl.u.vs_user.timeout))
-               syslog(LOG_INFO,
+               log_message(LOG_INFO,
                       "IPVS : Virtual service [%s:%d] illegal timeout.",
                       inet_ntop2(SVR_IP(vs))
                       , ntohs(SVR_PORT(vs)));
@@ -125,7 +126,7 @@ ipvs_cmd(int cmd, list vs_group, virtual_server * vs, real_server * rs)
 
        sockfd = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
        if (sockfd == -1) {
-               syslog(LOG_INFO,
+               log_message(LOG_INFO,
                       "IPVS : Can not initialize SOCK_RAW descriptor.");
                return IPVS_ERROR;
        }
@@ -135,20 +136,20 @@ ipvs_cmd(int cmd, list vs_group, virtual_server * vs, real_server * rs)
                       sizeof (ctl));
 
        if (errno == ESRCH) {
-               syslog(LOG_INFO, "IPVS : Virtual service [%s:%d] not defined.",
+               log_message(LOG_INFO, "IPVS : Virtual service [%s:%d] not defined.",
                       inet_ntop2(SVR_IP(vs))
                       , ntohs(SVR_PORT(vs)));
                close(sockfd);
                return IPVS_ERROR;
        } else if (errno == EEXIST) {
                if (rs)
-                       syslog(LOG_INFO,
+                       log_message(LOG_INFO,
                               "IPVS : Destination already exists [%s:%d].",
                               inet_ntop2(SVR_IP(rs))
                               , ntohs(SVR_PORT(rs)));
        } else if (errno == ENOENT) {
                if (rs)
-                       syslog(LOG_INFO, "IPVS : No such destination [%s:%d].",
+                       log_message(LOG_INFO, "IPVS : No such destination [%s:%d].",
                               inet_ntop2(SVR_IP(rs))
                               , ntohs(SVR_PORT(rs)));
        }
@@ -167,11 +168,12 @@ static struct ip_vs_rule_user *urule;
 int
 ipvs_start(void)
 {
+       log_message(LOG_DEBUG, "Initializing ipvs 2.4");
        /* Init IPVS kernel channel */
        if (ipvs_init()) {
                /* try to insmod the ip_vs module if ipvs_init failed */
                if (modprobe_ipvs() || ipvs_init()) {
-                       syslog(LOG_INFO,
+                       log_message(LOG_INFO,
                               "IPVS : Can't initialize ipvs: %s",
                               ipvs_strerror(errno));
                        return IPVS_ERROR;
@@ -195,7 +197,7 @@ static int
 ipvs_talk(int cmd)
 {
        if (ipvs_command(cmd, urule))
-               syslog(LOG_INFO, "IPVS : %s", ipvs_strerror(errno));
+               log_message(LOG_INFO, "IPVS : %s", ipvs_strerror(errno));
        return IPVS_SUCCESS;
 }
 
@@ -216,7 +218,7 @@ ipvs_syncd_cmd(int cmd, char *ifname, int state, int syncid)
        return ipvs_talk(cmd);
 
 #else
-       syslog(LOG_INFO, "IPVS : Sync daemon not supported");
+       log_message(LOG_INFO, "IPVS : Sync daemon not supported");
        return IPVS_ERROR;
 #endif
 }
@@ -314,7 +316,7 @@ ipvs_set_rule(int cmd, virtual_server * vs, real_server * rs)
        urule->protocol = vs->service_type;
 
        if (!parse_timeout(vs->timeout_persistence, &urule->timeout))
-               syslog(LOG_INFO,
+               log_message(LOG_INFO,
                       "IPVS : Virtual service [%s:%d] illegal timeout.",
                       inet_ntop2(SVR_IP(vs)), ntohs(SVR_PORT(vs)));
 
@@ -438,10 +440,11 @@ static struct ip_vs_daemon_user *daemonrule;
 int
 ipvs_start(void)
 {
+       log_message(LOG_DEBUG, "Initializing ipvs 2.6");
        /* Initialize IPVS module */
        if (ipvs_init()) {
                if (modprobe_ipvs() || ipvs_init()) {
-                       syslog(LOG_INFO, "IPVS: Can't initialize ipvs: %s",
+                       log_message(LOG_INFO, "IPVS: Can't initialize ipvs: %s",
                               ipvs_strerror(errno));
                        return IPVS_ERROR;
                }
@@ -501,7 +504,7 @@ ipvs_talk(int cmd)
        }
 
        if (result)
-               syslog(LOG_INFO, "IPVS: %s", ipvs_strerror(errno));
+               log_message(LOG_INFO, "IPVS: %s", ipvs_strerror(errno));
 }
 
 int
@@ -609,7 +612,7 @@ ipvs_set_rule(int cmd, virtual_server * vs, real_server * rs)
        srule->protocol = vs->service_type;
 
        if (!parse_timeout(vs->timeout_persistence, &srule->timeout))
-               syslog(LOG_INFO,
+               log_message(LOG_INFO,
                       "IPVS : Virtual service [%s:%d] illegal timeout.",
                       inet_ntop2(SVR_IP(vs)), ntohs(SVR_PORT(vs)));
 
index c351ce4..b500624 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Manipulation functions for IPVS & IPFW wrappers.
  *
- * Version:     $Id: ipwrapper.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: ipwrapper.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #include "ipwrapper.h"
 #include "ipvswrapper.h"
+#include "logger.h"
 #include "memory.h"
 #include "utils.h"
 #include "notify.h"
+#include "main.h"
+
+/* Returns the sum of all RS weight in a virtual server. */
+long unsigned
+weigh_live_realservers(virtual_server * vs)
+{
+       element e;
+       real_server *svr;
+       long unsigned count = 0;
+
+       for (e = LIST_HEAD(vs->rs); e; ELEMENT_NEXT(e)) {
+               svr = ELEMENT_DATA(e);
+               if (ISALIVE(svr))
+                       count += svr->weight;
+       }
+       return count;
+}
 
 /* Remove a realserver IPVS rule */
 static int
@@ -34,6 +52,7 @@ clear_service_rs(list vs_group, virtual_server * vs, list l)
 {
        element e;
        real_server *rs;
+       char rsip[16], vsip[16];
 
        for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) {
                rs = ELEMENT_DATA(e);
@@ -44,6 +63,36 @@ clear_service_rs(list vs_group, virtual_server * vs, list l)
                                      , rs))
                                return 0;
                        UNSET_ALIVE(rs);
+                       if (!vs->omega)
+                               continue;
+
+                       /* In Omega mode we call VS and RS down notifiers
+                        * all the way down the exit, as necessary.
+                        */
+                       if (rs->notify_down) {
+                               log_message(LOG_INFO, "Executing [%s] for service [%s:%d]"
+                                           " in VS [%s:%d]"
+                                           , rs->notify_down
+                                           , inet_ntoa2(SVR_IP(rs), rsip)
+                                           , ntohs(SVR_PORT(rs))
+                                           , (vs->vsgname) ? vs->vsgname : inet_ntoa2(SVR_IP(vs), vsip)
+                                           , ntohs(SVR_PORT(vs)));
+                               notify_exec(rs->notify_down);
+                       }
+
+                       /* Sooner or later VS will lose the quorum (if any). However,
+                        * we don't push in a sorry server then, hence the regression
+                        * is intended.
+                        */
+                       if (vs->quorum_state == UP && vs->quorum_down
+                         && weigh_live_realservers(vs) < vs->quorum - vs->hysteresis) {
+                               vs->quorum_state = DOWN;
+                               log_message(LOG_INFO, "Executing [%s] for VS [%s:%d]"
+                                           , vs->quorum_down
+                                           , (vs->vsgname) ? vs->vsgname : inet_ntoa2(SVR_IP(vs), vsip)
+                                           , ntohs(SVR_PORT(vs)));
+                               notify_exec(vs->quorum_down);
+                       }
                }
 #ifdef _KRNL_2_2_
                /* if we have a /32 mask, we create one nat rules per
@@ -72,6 +121,7 @@ clear_service_vs(list vs_group, virtual_server * vs)
                                        return 0;
                } else if (!clear_service_rs(vs_group, vs, vs->rs))
                        return 0;
+               /* The above will handle Omega case for VS as well. */
        }
 
        if (!ipvs_cmd(LVS_CMD_DEL, vs_group, vs, NULL))
@@ -106,13 +156,21 @@ clear_services(void)
 
 /* Set a realserver IPVS rules */
 static int
-init_service_rs(virtual_server * vs, list l)
+init_service_rs(virtual_server * vs)
 {
        element e;
        real_server *rs;
 
-       for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) {
+       for (e = LIST_HEAD(vs->rs); e; ELEMENT_NEXT(e)) {
                rs = ELEMENT_DATA(e);
+               /* In alpha mode, be pessimistic (or realistic?) and don't
+                * add real servers into the VS pool. They will get there
+                * later upon healthchecks recovery (if ever).
+                */
+               if (vs->alpha) {
+                       UNSET_ALIVE(rs);
+                       continue;
+               }
                if (!ISALIVE(rs)) {
                        if (!ipvs_cmd(LVS_CMD_ADD_DEST, check_data->vs_group, vs, rs))
                                return 0;
@@ -151,7 +209,7 @@ init_service_vs(virtual_server * vs)
 
        /* Processing real server queue */
        if (!LIST_ISEMPTY(vs->rs))
-               if (!init_service_rs(vs, vs->rs))
+               if (!init_service_rs(vs))
                        return 0;
        return 1;
 }
@@ -182,26 +240,18 @@ init_services(void)
        return 1;
 }
 
-/* Check if all rs for a specific vs are down */
-int
-all_realservers_down(virtual_server * vs)
-{
-       element e;
-       real_server *svr;
-
-       for (e = LIST_HEAD(vs->rs); e; ELEMENT_NEXT(e)) {
-               svr = ELEMENT_DATA(e);
-               if (ISALIVE(svr))
-                       return 0;
-       }
-       return 1;
-}
-
 /* manipulate add/remove rs according to alive state */
 void
 perform_svr_state(int alive, virtual_server * vs, real_server * rs)
 {
        char rsip[16], vsip[16];
+/*
+ * | ISALIVE(rs) | alive | context
+ * | 0           | 0     | first check failed under alpha mode, unreachable here
+ * | 0           | 1     | RS went up, add it to the pool
+ * | 1           | 0     | RS went down, remove it from the pool
+ * | 1           | 1     | first check succeeded w/o alpha mode, unreachable here
+ */
 
        if (!ISALIVE(rs) && alive) {
 
@@ -210,7 +260,7 @@ perform_svr_state(int alive, virtual_server * vs, real_server * rs)
                 */
                if (vs->s_svr) {
                        if (ISALIVE(vs->s_svr)) {
-                               syslog(LOG_INFO,
+                               log_message(LOG_INFO,
                                       "Removing sorry server [%s:%d] from VS [%s:%d]",
                                       inet_ntoa2(SVR_IP(vs->s_svr), rsip)
                                       , ntohs(SVR_PORT(vs->s_svr))
@@ -228,7 +278,7 @@ perform_svr_state(int alive, virtual_server * vs, real_server * rs)
                        }
                }
 
-               syslog(LOG_INFO, "%s service [%s:%d] to VS [%s:%d]",
+               log_message(LOG_INFO, "%s service [%s:%d] to VS [%s:%d]",
                       (rs->inhibit) ? "Enabling" : "Adding"
                       , inet_ntoa2(SVR_IP(rs), rsip)
                       , ntohs(SVR_PORT(rs))
@@ -237,7 +287,7 @@ perform_svr_state(int alive, virtual_server * vs, real_server * rs)
                ipvs_cmd(LVS_CMD_ADD_DEST, check_data->vs_group, vs, rs);
                rs->alive = alive;
                if (rs->notify_up) {
-                       syslog(LOG_INFO, "Executing [%s] for service [%s:%d]"
+                       log_message(LOG_INFO, "Executing [%s] for service [%s:%d]"
                               " in VS [%s:%d]"
                               , rs->notify_up
                               , inet_ntoa2(SVR_IP(rs), rsip)
@@ -246,14 +296,35 @@ perform_svr_state(int alive, virtual_server * vs, real_server * rs)
                               , ntohs(SVR_PORT(vs)));
                        notify_exec(rs->notify_up);
                }
+               /* If we have just gained quorum, it's time to consider notify_up. */
+               if (vs->quorum_state == DOWN
+                 && weigh_live_realservers(vs) >= vs->quorum + vs->hysteresis) {
+                       vs->quorum_state = UP;
+                       log_message(LOG_INFO, "Gained quorum %lu+%lu=%lu <= %u for VS [%s:%d]"
+                                   , vs->quorum
+                                   , vs->hysteresis
+                                   , vs->quorum + vs->hysteresis
+                                   , weigh_live_realservers(vs)
+                                   , (vs->vsgname) ? vs->vsgname : inet_ntoa2(SVR_IP(vs), vsip)
+                                   , ntohs(SVR_PORT(vs)));
+                       if (vs->quorum_up) {
+                               log_message(LOG_INFO, "Executing [%s] for VS [%s:%d]"
+                                           , vs->quorum_up
+                                           , (vs->vsgname) ? vs->vsgname : inet_ntoa2(SVR_IP(vs), vsip)
+                                           , ntohs(SVR_PORT(vs)));
+                               notify_exec(vs->quorum_up);
+                       }
+               }
 #ifdef _KRNL_2_2_
                if (vs->nat_mask == HOST_NETMASK)
                        ipfw_cmd(IP_FW_CMD_ADD, vs, rs);
 #endif
+               return;
+       }
 
-       } else {
+       if (ISALIVE(rs) && !alive) {
 
-               syslog(LOG_INFO, "%s service [%s:%d] from VS [%s:%d]",
+               log_message(LOG_INFO, "%s service [%s:%d] from VS [%s:%d]",
                       (rs->inhibit) ? "Disabling" : "Removing"
                       , inet_ntoa2(SVR_IP(rs), rsip)
                       , ntohs(SVR_PORT(rs))
@@ -264,7 +335,7 @@ perform_svr_state(int alive, virtual_server * vs, real_server * rs)
                ipvs_cmd(LVS_CMD_DEL_DEST, check_data->vs_group, vs, rs);
                rs->alive = alive;
                if (rs->notify_down) {
-                       syslog(LOG_INFO, "Executing [%s] for service [%s:%d]"
+                       log_message(LOG_INFO, "Executing [%s] for service [%s:%d]"
                               " in VS [%s:%d]"
                               , rs->notify_down
                               , inet_ntoa2(SVR_IP(rs), rsip)
@@ -279,22 +350,43 @@ perform_svr_state(int alive, virtual_server * vs, real_server * rs)
                        ipfw_cmd(IP_FW_CMD_DEL, vs, rs);
 #endif
 
-               /* if all the realserver pool is down, we add sorry server */
-               if (vs->s_svr && all_realservers_down(vs)) {
-                       syslog(LOG_INFO,
-                              "Adding sorry server [%s:%d] to VS [%s:%d]",
-                              inet_ntoa2(SVR_IP(vs->s_svr), rsip)
-                              , ntohs(SVR_PORT(vs->s_svr))
-                              , (vs->vsgname) ? vs->vsgname : inet_ntoa2(SVR_IP(vs), vsip)
-                              , ntohs(SVR_PORT(vs)));
-
-                       /* the sorry server is now up in the pool, we flag it alive */
-                       ipvs_cmd(LVS_CMD_ADD_DEST, check_data->vs_group, vs, vs->s_svr);
-                       vs->s_svr->alive = 1;
 
-#ifdef _KRNL_2_2_
-                       ipfw_cmd(IP_FW_CMD_ADD, vs, vs->s_svr);
-#endif
+               /* If we have just lost quorum for the VS, we need to consider
+                * VS notify_down and sorry_server cases
+                */
+               if (vs->quorum_state == UP
+                   && weigh_live_realservers(vs) < vs->quorum - vs->hysteresis) {
+                       vs->quorum_state = DOWN;
+                       log_message(LOG_INFO, "Lost quorum %lu-%lu=%lu > %u for VS [%s:%d]"
+                                   , vs->quorum
+                                   , vs->hysteresis
+                                   , vs->quorum - vs->hysteresis
+                                   , weigh_live_realservers(vs)
+                                   , (vs->vsgname) ? vs->vsgname : inet_ntoa2(SVR_IP(vs), vsip)
+                                   , ntohs(SVR_PORT(vs)));
+                       if (vs->quorum_down) {
+                               log_message(LOG_INFO, "Executing [%s] for VS [%s:%d]"
+                                           , vs->quorum_down
+                                           , (vs->vsgname) ? vs->vsgname : inet_ntoa2(SVR_IP(vs), vsip)
+                                           , ntohs(SVR_PORT(vs)));
+                               notify_exec(vs->quorum_down);
+                       }
+                       if (vs->s_svr) {
+                               log_message(LOG_INFO,
+                                           "Adding sorry server [%s:%d] to VS [%s:%d]",
+                                           inet_ntoa2(SVR_IP(vs->s_svr), rsip)
+                                           , ntohs(SVR_PORT(vs->s_svr))
+                                           , (vs->vsgname) ? vs->vsgname : inet_ntoa2(SVR_IP(vs), vsip)
+                                           , ntohs(SVR_PORT(vs)));
+
+                               /* the sorry server is now up in the pool, we flag it alive */
+                               ipvs_cmd(LVS_CMD_ADD_DEST, check_data->vs_group, vs, vs->s_svr);
+                               vs->s_svr->alive = 1;
+
+ #ifdef _KRNL_2_2_
+                               ipfw_cmd(IP_FW_CMD_ADD, vs, vs->s_svr);
+ #endif
+                       }
                }
        }
 }
@@ -306,7 +398,7 @@ update_svr_wgt(int weight, virtual_server * vs, real_server * rs)
        char rsip[16], vsip[16];
 
        if (weight != rs->weight) {
-               syslog(LOG_INFO, "Changing weight from %d to %d for %s service [%s:%d]"
+               log_message(LOG_INFO, "Changing weight from %d to %d for %s service [%s:%d]"
                                 " of VS [%s:%d]"
                                 , rs->weight
                                 , weight
@@ -355,21 +447,27 @@ update_svr_checker_state(int alive, checker_id_t cid, virtual_server *vs, real_s
        list l = rs->failed_checkers;
        checker_id_t *id;
 
-       /* Handle alive state */
-       for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) {
-               id = ELEMENT_DATA(e);
-               if (*id == cid) {
-                       if (alive) {
+       /* Handle alive state. Depopulate failed_checkers and call
+        * perform_svr_state() independently, letting the latter sort
+        * things out itself.
+        */
+       if (alive) {
+               /* Remove the succeeded check from failed_checkers list. */
+               for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) {
+                       id = ELEMENT_DATA(e);
+                       if (*id == cid) {
                                free_list_element(l, e);
-                               if (LIST_SIZE(l) == 0)
-                                       perform_svr_state(alive, vs, rs);
-                       } 
-                       return;
+                               /* If we don't break, the next iteration will trigger
+                                * a SIGSEGV.
+                                */
+                               break;
+                       }
                }
+               if (LIST_SIZE(l) == 0)
+                       perform_svr_state(alive, vs, rs);
        }
-
        /* Handle not alive state */
-       if (!alive) {
+       else {
                id = (checker_id_t *) MALLOC(sizeof(checker_id_t));
                *id = cid;
                list_add(l, id);
@@ -411,7 +509,7 @@ clear_diff_vsge(list old, list new, virtual_server * old_vs)
        for (e = LIST_HEAD(old); e; ELEMENT_NEXT(e)) {
                vsge = ELEMENT_DATA(e);
                if (!vsge_exist(vsge, new)) {
-                       syslog(LOG_INFO, "VS [%s:%d:%d:%d] in group %s"
+                       log_message(LOG_INFO, "VS [%s:%d:%d:%d] in group %s"
                               " no longer exist\n" 
                               , inet_ntop2(vsge->addr_ip)
                               , ntohs(vsge->addr_port)
@@ -558,10 +656,10 @@ clear_diff_rs(virtual_server * old_vs)
                rs = ELEMENT_DATA(e);
                if (!rs_exist(rs, new)) {
                        /* Reset inhibit flag to delete inhibit entries */
-                       syslog(LOG_INFO, "service [%s:%d] no longer exist"
+                       log_message(LOG_INFO, "service [%s:%d] no longer exist"
                               , inet_ntoa2(SVR_IP(rs), rsip)
                               , ntohs(SVR_PORT(rs)));
-                       syslog(LOG_INFO, "Removing service [%s:%d] from VS [%s:%d]"
+                       log_message(LOG_INFO, "Removing service [%s:%d] from VS [%s:%d]"
                               , inet_ntoa2(SVR_IP(rs), rsip)
                               , ntohs(SVR_PORT(rs))
                               , inet_ntoa2(SVR_IP(old_vs), vsip)
@@ -597,10 +695,10 @@ clear_diff_services(void)
                 */
                if (!vs_exist(vs)) {
                        if (vs->vsgname)
-                               syslog(LOG_INFO, "Removing Virtual Server Group [%s]"
+                               log_message(LOG_INFO, "Removing Virtual Server Group [%s]"
                                       , vs->vsgname);
                        else
-                               syslog(LOG_INFO, "Removing Virtual Server [%s:%d]"
+                               log_message(LOG_INFO, "Removing Virtual Server [%s:%d]"
                                       , inet_ntop2(vs->addr_ip)
                                       , ntohs(vs->addr_port));
 
index d56efb5..6e852a2 100644 (file)
@@ -2,7 +2,7 @@
 #
 # Keepalived OpenSource project.
 #
-# Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+# Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
 
 CC      = @CC@
 INCLUDES = -I../include -I../../lib
index c325634..9f2d06b 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Main program structure.
  *
- * Version:     $Id: main.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: main.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #include <syslog.h>
 #include "daemon.h"
+#include "logger.h"
 #include "utils.h"
 
 /* Daemonization function coming from zebra source code */
@@ -35,7 +36,7 @@ xdaemon(int nochdir, int noclose, int exitflag)
        /* In case of fork is error. */
        pid = fork();
        if (pid < 0) {
-               syslog(LOG_INFO, "xdaemon: fork error");
+               log_message(LOG_INFO, "xdaemon: fork error");
                return -1;
        }
 
@@ -50,7 +51,7 @@ xdaemon(int nochdir, int noclose, int exitflag)
        /* Become session leader and get pid. */
        pid = setsid();
        if (pid < -1) {
-               syslog(LOG_INFO, "xdaemon: setsid error");
+               log_message(LOG_INFO, "xdaemon: setsid error");
                return -1;
        }
 
index 21c9f42..a197789 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Dynamic data structure definition.
  *
- * Version:     $Id: global_data.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: global_data.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #include <syslog.h>
@@ -28,6 +28,7 @@
 #include "global_data.h"
 #include "memory.h"
 #include "list.h"
+#include "logger.h"
 #include "utils.h"
 
 /* global vars */
@@ -109,7 +110,7 @@ static void
 dump_email(void *data_obj)
 {
        char *addr = data_obj;
-       syslog(LOG_INFO, " Email notification = %s", addr);
+       log_message(LOG_INFO, " Email notification = %s", addr);
 }
 
 void
@@ -155,20 +156,20 @@ dump_global_data(conf_data * global_data)
 
        if (data->router_id ||
            data->smtp_server || data->smtp_connection_to || data->email_from) {
-               syslog(LOG_INFO, "------< Global definitions >------");
+               log_message(LOG_INFO, "------< Global definitions >------");
        }
        if (data->router_id)
-               syslog(LOG_INFO, " Router ID = %s", data->router_id);
+               log_message(LOG_INFO, " Router ID = %s", data->router_id);
        if (data->plugin_dir)
-               syslog(LOG_INFO, " Plugin dir = %s", data->plugin_dir);
+               log_message(LOG_INFO, " Plugin dir = %s", data->plugin_dir);
        if (data->smtp_server)
-               syslog(LOG_INFO, " Smtp server = %s",
+               log_message(LOG_INFO, " Smtp server = %s",
                       inet_ntop2(data->smtp_server));
        if (data->smtp_connection_to)
-               syslog(LOG_INFO, " Smtp server connection timeout = %lu",
+               log_message(LOG_INFO, " Smtp server connection timeout = %lu",
                       data->smtp_connection_to / TIMER_HZ);
        if (data->email_from) {
-               syslog(LOG_INFO, " Email notification from = %s",
+               log_message(LOG_INFO, " Email notification from = %s",
                       data->email_from);
                dump_list(data->email);
        }
index 3398fac..2522aa5 100644 (file)
@@ -7,7 +7,7 @@
  *              data structure representation the conf file representing
  *              the loadbalanced server pool.
  *  
- * Version:     $Id: global_parser.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: global_parser.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -21,7 +21,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #include "global_parser.h"
index 7c01eb2..e5e43f6 100644 (file)
@@ -6,7 +6,7 @@
  * Part:        Layer4 checkers handling. Register worker threads &
  *              upper layer checkers.
  *
- * Version:     $Id: layer4.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: layer4.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -20,7 +20,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #include "layer4.h"
@@ -93,7 +93,7 @@ tcp_socket_state(int fd, thread * thread_obj, uint32_t addr_ip, uint16_t addr_po
                 int (*func) (struct _thread *))
 {
        int status;
-       int slen;
+       socklen_t slen;
        int ret = 0;
        TIMEVAL timer_min;
 
index 01600de..21c8fd2 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Main program structure.
  *
- * Version:     $Id: main.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: main.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #include "main.h"
 #include "config.h"
 #include "signals.h"
+#include "pidfile.h"
+#include "logger.h"
 
 /* global var */
 char *conf_file = NULL;                /* Configuration file */
@@ -33,6 +35,9 @@ pid_t vrrp_child = -1;                /* VRRP child process ID */
 pid_t checkers_child = -1;     /* Healthcheckers child process ID */
 int daemon_mode = 0;           /* VRRP/CHECK subsystem selection */
 int linkwatch = 0;             /* Use linkwatch kernel netlink reflection */
+char *main_pidfile = KEEPALIVED_PID_FILE;      /* overrule default pidfile */
+char *checkers_pidfile = CHECKERS_PID_FILE;    /* overrule default pidfile */
+char *vrrp_pidfile = VRRP_PID_FILE;    /* overrule default pidfile */
 
 /* Log facility table */
 static struct {
@@ -46,15 +51,16 @@ static struct {
 static void
 stop_keepalived(void)
 {
-       syslog(LOG_INFO, "Stopping " VERSION_STRING);
+       log_message(LOG_INFO, "Stopping " VERSION_STRING);
        /* Just cleanup memory & exit */
+       signal_handler_destroy();
        thread_destroy_master(master);
 
        if (daemon_mode == 3 || !daemon_mode)
-               pidfile_rm(KEEPALIVED_PID_FILE);
+               pidfile_rm(main_pidfile);
        else
-               pidfile_rm((daemon_mode & 1) ? KEEPALIVED_VRRP_PID_FILE :
-                          KEEPALIVED_CHECKERS_PID_FILE);
+               pidfile_rm((daemon_mode & 1) ? vrrp_pidfile :
+                          checkers_pidfile);
 
 #ifdef _DEBUG_
        keepalived_free_final("Parent process");
@@ -79,7 +85,7 @@ start_keepalived(void)
 
 /* SIGHUP handler */
 void
-sighup(int sig)
+sighup(void *v, int sig)
 {
        /* Set the reloading flag */
        SET_RELOAD;
@@ -93,12 +99,12 @@ sighup(int sig)
 
 /* Terminate handler */
 void
-sigend(int sig)
+sigend(void *v, int sig)
 {
        int status;
 
        /* register the terminate thread */
-       syslog(LOG_INFO, "Terminating on signal");
+       log_message(LOG_INFO, "Terminating on signal");
        thread_add_terminate_event(master);
 
        if (vrrp_child > 0) {
@@ -116,11 +122,10 @@ void
 signal_init(void)
 {
        signal_handler_init();
-       signal_set(SIGHUP, sighup);
-       signal_set(SIGINT, sigend);
-       signal_set(SIGTERM, sigend);
+       signal_set(SIGHUP, sighup, NULL);
+       signal_set(SIGINT, sigend, NULL);
+       signal_set(SIGTERM, sigend, NULL);
        signal_ignore(SIGPIPE);
-       signal_noignore_sigchld();
 }
 
 /* Usage function */
@@ -150,9 +155,12 @@ usage(const char *prog)
                "  %s --log-detail         -D    Detailed log messages.\n"
                "  %s --log-facility       -S    0-7 Set syslog facility to LOG_LOCAL[0-7]. (default=LOG_DAEMON)\n"
                "  %s --help               -h    Display this short inlined help screen.\n"
-               "  %s --version            -v    Display the version number\n",
+               "  %s --version            -v    Display the version number\n"
+               "  %s --pid                -p    pidfile\n"
+               "  %s --checkers_pid       -c    checkers pidfile\n"
+               "  %s --vrrp_pid           -r    vrrp pidfile\n",
                prog, prog, prog, prog, prog, prog, prog, prog,
-               prog, prog, prog, prog);
+               prog, prog, prog, prog, prog, prog, prog);
 }
 
 /* Command line parser */
@@ -176,6 +184,9 @@ parse_cmdline(int argc, char **argv)
                {"use-file", 'f', POPT_ARG_STRING, &option_arg, 'f'},
                {"vrrp", 'P', POPT_ARG_NONE, NULL, 'P'},
                {"check", 'C', POPT_ARG_NONE, NULL, 'C'},
+               {"pid", 'p', POPT_ARG_STRING, &option_arg, 'p'},
+               {"checkers_pid", 'c', POPT_ARG_STRING, &option_arg, 'c'},
+               {"vrrp_pid", 'r', POPT_ARG_STRING, &option_arg, 'r'},
                {NULL, 0, 0, NULL, 0}
        };
 
@@ -225,9 +236,19 @@ parse_cmdline(int argc, char **argv)
        case 'C':
                daemon_mode |= 2;
                break;
+       case 'p':
+               main_pidfile = option_arg;
+               break;
+       case 'c':
+               checkers_pidfile = option_arg;
+               break;
+       case 'r':
+               vrrp_pidfile = option_arg;
+               break;
        }
 
        /* the others */
+       /* fixme: why is this duplicated? */
        while ((c = poptGetNextOpt(context)) >= 0) {
                switch (c) {
                case 'l':
@@ -260,6 +281,15 @@ parse_cmdline(int argc, char **argv)
                case 'C':
                        daemon_mode |= 2;
                        break;
+               case 'p':
+                       main_pidfile = option_arg;
+                       break;
+               case 'c':
+                       checkers_pidfile = option_arg;
+                       break;
+               case 'r':
+                       vrrp_pidfile = option_arg;
+                       break;
                }
        }
 
@@ -288,11 +318,11 @@ main(int argc, char **argv)
        parse_cmdline(argc, argv);
 
        openlog(PROG, LOG_PID | (debug & 1) ? LOG_CONS : 0, log_facility);
-       syslog(LOG_INFO, "Starting " VERSION_STRING);
+       log_message(LOG_INFO, "Starting " VERSION_STRING);
 
        /* Check if keepalived is already running */
        if (keepalived_running(daemon_mode)) {
-               syslog(LOG_INFO, "daemon is already running");
+               log_message(LOG_INFO, "daemon is already running");
                goto end;
        }
 
@@ -302,11 +332,11 @@ main(int argc, char **argv)
 
        /* write the pidfile */
        if (daemon_mode == 3 || !daemon_mode) {
-               if (!pidfile_write(KEEPALIVED_PID_FILE, getpid()))
+               if (!pidfile_write(main_pidfile, getpid()))
                        goto end;
        } else {
-               if (!pidfile_write((daemon_mode & 1) ? KEEPALIVED_VRRP_PID_FILE :
-                                   KEEPALIVED_CHECKERS_PID_FILE, getpid()))
+               if (!pidfile_write((daemon_mode & 1) ? vrrp_pidfile :
+                                   checkers_pidfile, getpid()))
                        goto end;
        }
 
index dd039ed..54f2e16 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        pidfile utility.
  *
- * Version:     $Id: pidfile.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: pidfile.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
+#include "logger.h"
 #include "pidfile.h"
+extern char *main_pidfile;
+extern char *checkers_pidfile;
+extern char *vrrp_pidfile;
 
 /* Create the runnnig daemon pidfile */
 int
@@ -31,7 +35,7 @@ pidfile_write(char *pid_file, int pid)
        FILE *pidfile = fopen(pid_file, "w");
 
        if (!pidfile) {
-               syslog(LOG_INFO, "pidfile_write : Can not open %s pidfile",
+               log_message(LOG_INFO, "pidfile_write : Can not open %s pidfile",
                       pid_file);
                return 0;
        }
@@ -63,7 +67,7 @@ process_running(char *pid_file)
 
        /* If no process is attached to pidfile, remove it */
        if (kill(pid, 0)) {
-               syslog(LOG_INFO, "Remove a zombie pid file %s", pid_file);
+               log_message(LOG_INFO, "Remove a zombie pid file %s", pid_file);
                pidfile_rm(pid_file);
                return 0;
        }
@@ -75,14 +79,14 @@ process_running(char *pid_file)
 int
 keepalived_running(int mode)
 {
-       if (process_running(KEEPALIVED_PID_FILE))
+       if (process_running(main_pidfile))
                return 1;
        else if (mode & 1 || mode & 2)
-               return process_running((mode & 1) ? KEEPALIVED_VRRP_PID_FILE :
-                                      KEEPALIVED_CHECKERS_PID_FILE);
+               return process_running((mode & 1) ? vrrp_pidfile :
+                                      checkers_pidfile);
 
-       if (process_running(KEEPALIVED_VRRP_PID_FILE) ||
-           process_running(KEEPALIVED_CHECKERS_PID_FILE))
+       if (process_running(vrrp_pidfile) ||
+           process_running(checkers_pidfile))
                return 1;
        return 0;
 }
@@ -91,12 +95,12 @@ keepalived_running(int mode)
 int
 vrrp_running(void)
 {
-       return process_running(VRRP_PID_FILE);
+       return process_running(vrrp_pidfile);
 }
 
 /* Return VRRP child process state */
 int
 checkers_running(void)
 {
-       return process_running(CHECKERS_PID_FILE);
+       return process_running(checkers_pidfile);
 }
index fcf2684..3f0515f 100644 (file)
@@ -7,7 +7,7 @@
  *              using the smtp protocol according to the RFC 821. A non blocking
  *              timeouted connection is used to handle smtp protocol.
  *
- * Version:     $Id: smtp.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: smtp.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -21,7 +21,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #include <time.h>
@@ -32,6 +32,7 @@
 #include "scheduler.h"
 #include "memory.h"
 #include "list.h"
+#include "logger.h"
 #include "utils.h"
 
 /* SMTP FSM definition */
@@ -96,7 +97,7 @@ connection_error(thread * thread_obj)
 {
        smtp_thread_arg *smtp_arg = THREAD_ARG(thread_obj);
 
-       syslog(LOG_INFO, "SMTP connection ERROR to [%s:%d].",
+       log_message(LOG_INFO, "SMTP connection ERROR to [%s:%d].",
               inet_ntop2(data->smtp_server), SMTP_PORT);
        free_smtp_all(smtp_arg);
        return 0;
@@ -106,7 +107,7 @@ connection_timeout(thread * thread_obj)
 {
        smtp_thread_arg *smtp_arg = THREAD_ARG(thread_obj);
 
-       syslog(LOG_INFO, "Timeout connecting SMTP server [%s:%d].",
+       log_message(LOG_INFO, "Timeout connecting SMTP server [%s:%d].",
               inet_ntop2(data->smtp_server), SMTP_PORT);
        free_smtp_all(smtp_arg);
        return 0;
@@ -137,7 +138,7 @@ connection_success(thread * thread_obj)
 {
        smtp_thread_arg *smtp_arg = THREAD_ARG(thread_obj);
 
-       syslog(LOG_INFO, "Remote SMTP server [%s:%d] connected.",
+       log_message(LOG_INFO, "Remote SMTP server [%s:%d] connected.",
               inet_ntop2(data->smtp_server), SMTP_PORT);
 
        smtp_arg->stage = connect_success;
@@ -159,7 +160,7 @@ smtp_read_thread(thread * thread_obj)
        smtp_arg = THREAD_ARG(thread_obj);
 
        if (thread_obj->type == THREAD_READ_TIMEOUT) {
-               syslog(LOG_INFO,
+               log_message(LOG_INFO,
                       "Timeout reading data to remote SMTP server [%s:%d].",
                       inet_ntop2(data->smtp_server), SMTP_PORT);
                SMTP_FSM_READ(QUIT, thread_obj, 0);
@@ -174,7 +175,7 @@ smtp_read_thread(thread * thread_obj)
        if (rcv_buffer_size == -1) {
                if (errno == EAGAIN)
                        goto end;
-               syslog(LOG_INFO,
+               log_message(LOG_INFO,
                       "Error reading data from remote SMTP server [%s:%d].",
                       inet_ntop2(data->smtp_server), SMTP_PORT);
                SMTP_FSM_READ(QUIT, thread_obj, 0);
@@ -183,7 +184,7 @@ smtp_read_thread(thread * thread_obj)
 
        /* received data overflow buffer size ? */
        if (smtp_arg->buflen >= SMTP_BUFFER_MAX) {
-               syslog(LOG_INFO,
+               log_message(LOG_INFO,
                       "Received buffer from remote SMTP server [%s:%d]"
                       " overflow our get read buffer length.",
                       inet_ntop2(data->smtp_server), SMTP_PORT);
@@ -245,7 +246,7 @@ smtp_read_thread(thread * thread_obj)
                thread_add_write(thread_obj->master, smtp_send_thread, smtp_arg,
                                 smtp_arg->fd, data->smtp_connection_to);
        } else {
-               syslog(LOG_INFO,
+               log_message(LOG_INFO,
                       "Can not read data from remote SMTP server [%s:%d].",
                       inet_ntop2(data->smtp_server), SMTP_PORT);
                SMTP_FSM_READ(QUIT, thread_obj, 0);
@@ -260,7 +261,7 @@ smtp_send_thread(thread * thread_obj)
        smtp_thread_arg *smtp_arg = THREAD_ARG(thread_obj);
 
        if (thread_obj->type == THREAD_WRITE_TIMEOUT) {
-               syslog(LOG_INFO,
+               log_message(LOG_INFO,
                       "Timeout sending data to remote SMTP server [%s:%d].",
                       inet_ntop2(data->smtp_server), SMTP_PORT);
                SMTP_FSM_READ(QUIT, thread_obj, 0);
@@ -280,7 +281,7 @@ smtp_send_thread(thread * thread_obj)
                thread_add_read(thread_obj->master, smtp_read_thread, smtp_arg,
                                thread_obj->u.fd, data->smtp_connection_to);
        } else {
-               syslog(LOG_INFO,
+               log_message(LOG_INFO,
                       "Can not send data to remote SMTP server [%s:%d].",
                       inet_ntop2(data->smtp_server), SMTP_PORT);
                SMTP_FSM_READ(QUIT, thread_obj, 0);
@@ -297,7 +298,7 @@ connection_code(thread * thread_obj, int status)
        if (status == 220) {
                smtp_arg->stage++;
        } else {
-               syslog(LOG_INFO, "Error connecting SMTP server[%s:%d]."
+               log_message(LOG_INFO, "Error connecting SMTP server[%s:%d]."
                       " SMTP status code = %d", inet_ntop2(data->smtp_server),
                       SMTP_PORT, status);
                smtp_arg->stage = ERROR;
@@ -329,7 +330,7 @@ helo_code(thread * thread_obj, int status)
        if (status == 250) {
                smtp_arg->stage++;
        } else {
-               syslog(LOG_INFO,
+               log_message(LOG_INFO,
                       "Error processing HELO cmd on SMTP server [%s:%d]."
                       " SMTP status code = %d", inet_ntop2(data->smtp_server),
                       SMTP_PORT, status);
@@ -362,7 +363,7 @@ mail_code(thread * thread_obj, int status)
        if (status == 250) {
                smtp_arg->stage++;
        } else {
-               syslog(LOG_INFO,
+               log_message(LOG_INFO,
                       "Error processing MAIL cmd on SMTP server [%s:%d]."
                       " SMTP status code = %d", inet_ntop2(data->smtp_server),
                       SMTP_PORT, status);
@@ -407,7 +408,7 @@ rcpt_code(thread * thread_obj, int status)
                if (!fetched_email)
                        smtp_arg->stage++;
        } else {
-               syslog(LOG_INFO,
+               log_message(LOG_INFO,
                       "Error processing RCPT cmd on SMTP server [%s:%d]."
                       " SMTP status code = %d", inet_ntop2(data->smtp_server),
                       SMTP_PORT, status);
@@ -436,7 +437,7 @@ data_code(thread * thread_obj, int status)
        if (status == 354) {
                smtp_arg->stage++;
        } else {
-               syslog(LOG_INFO,
+               log_message(LOG_INFO,
                       "Error processing DATA cmd on SMTP server [%s:%d]."
                       " SMTP status code = %d", inet_ntop2(data->smtp_server),
                       SMTP_PORT, status);
@@ -491,10 +492,10 @@ body_code(thread * thread_obj, int status)
        smtp_thread_arg *smtp_arg = THREAD_ARG(thread_obj);
 
        if (status == 250) {
-               syslog(LOG_INFO, "SMTP alert successfully sent.");
+               log_message(LOG_INFO, "SMTP alert successfully sent.");
                smtp_arg->stage++;
        } else {
-               syslog(LOG_INFO,
+               log_message(LOG_INFO,
                       "Error processing DOT cmd on SMTP server [%s:%d]."
                       " SMTP status code = %d", inet_ntop2(data->smtp_server),
                       SMTP_PORT, status);
diff --git a/keepalived/etc/init.d/keepalived.suse.init b/keepalived/etc/init.d/keepalived.suse.init
new file mode 100644 (file)
index 0000000..94939a3
--- /dev/null
@@ -0,0 +1,131 @@
+#! /bin/sh
+
+### BEGIN INIT INFO
+# Provides:     keepalived
+# Required-Start: $remote_fs $syslog
+# Required-Stop : $remote_fs $syslog
+# Default-Start : 3 5
+# Default-Stop  : 0 1 2 6
+# Description   : Start keepalived to allow XY and provide YZ
+# continued on second line by '#<TAB>'
+### END INIT INFO
+
+
+DAEMON="Keepalived daemon"
+DAEMON_BIN="/usr/local/sbin/keepalived"
+DAEMON_CONF="/etc/keepalived/keepalived.conf"
+DAEMON_PIDFILE="/var/run/keepalived.pid"
+DAEMON_OPT="-d"
+#DAEMON_USER="root"
+SUPPORTS_HUP="yes"    
+# "yes" if exist next values in freshclam.conf
+#       PidFile /var/run/keepalived.pid
+#       DatabaseOwner root
+
+pid_par=${DAEMON_PIDFILE:+"-p $DAEMON_PIDFILE"}
+usr_par=${DAEMON_USER:+"-u $DAEMON_USER"}
+
+test -x $DAEMON_BIN || exit 5
+
+# Shell functions sourced from /etc/rc.status:
+#      rc_check         check and set local and overall rc status
+#      rc_status        check and set local and overall rc status
+#      rc_status -v     ditto but be verbose in local rc status
+#      rc_status -v -r  ditto and clear the local rc status
+#      rc_failed        set local and overall rc status to failed
+#      rc_failed <num>  set local and overall rc status to <num><num>
+#      rc_reset         clear local rc status (overall remains)
+#      rc_exit          exit appropriate to overall rc status
+. /etc/rc.status
+
+# First reset status of this service
+rc_reset
+
+# Return values acc. to LSB for all commands but status:
+# 0 - success
+# 1 - generic or unspecified error
+# 2 - invalid or excess argument(s)
+# 3 - unimplemented feature (e.g. "reload")
+# 4 - insufficient privilege
+# 5 - program is not installed
+# 6 - program is not configured
+# 7 - program is not running
+# 
+# Note that starting an already running service, stopping
+# or restarting a not-running service as well as the restart
+# with force-reload (in case signalling is not supported) are
+# considered a success.
+
+# remove empty pid files to avoid disturbing warnings by checkproc/killproc
+# (these can occur if dhcpd does not start correctly)
+test -e $DAEMON_PIDFILE && ! test -s $DAEMON_PIDFILE && rm $DAEMON_PIDFILE
+
+case "$1" in
+        start)
+               echo -n "Starting $DAEMON "
+               if test ! -f ${DAEMON_CONF}; then
+                   echo -n >&2 "Configuration file, ${DAEMON_CONF} does not exist. "
+                   rc_status -s
+                   exit 6
+               fi
+               checkproc $pid_par ${DAEMON_BIN}
+               case $? in
+                   0) echo -n "- Warning: daemon already running. " ;;
+                   1) echo -n "- Warning: ${DAEMON_PIDFILE} exists. " ;;
+               esac
+#              echo "startproc $usr_par $pid_par ${DAEMON_BIN} ${DAEMON_OPT}"
+               startproc $usr_par $pid_par ${DAEMON_BIN} ${DAEMON_OPT}
+               rc_status -v
+               ;;
+       stop)
+               echo -n "Shutting down $DAEMON "
+               checkproc $pid_par ${DAEMON_BIN} || \
+               echo -n " Warning: daemon not running. "
+               killproc $pid_par -t 10 ${DAEMON_BIN}
+               rc_status -v
+               ;;
+       try-restart|condrestart)
+               if test "$1" = "condrestart"; then
+                       echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
+               fi
+               $0 status
+               if test $? = 0; then
+                       $0 restart
+               else 
+                       rc_reset
+               fi
+               rc_status
+               ;;
+       restart)
+               $0 stop
+               $0 start
+               rc_status
+               ;;
+       force-reload|reload)
+               if test "$SUPPORTS_HUP" = "yes"; then
+                   echo -n "Reload service $DAEMON "
+                   checkproc $pid_par ${DAEMON_BIN} && \
+                       touch ${DAEMON_PIDFILE} || \
+                       echo -n >&2 " Warning: daemon not running. "
+                   killproc $pid_par -HUP ${DAEMON_BIN}
+                    rc_status -v
+               else
+                    $0 stop  &&  sleep 3  &&  $0 start
+                    rc_status
+               fi
+               ;;
+       status)
+               echo -n "Checking for $DAEMON "
+               checkproc $pid_par ${DAEMON_BIN}
+               rc_status -v
+               ;;
+       probe)
+               test ${DAEMON_CONF} -nt ${DAEMON_PIDFILE} && echo reload
+               ;;
+       *)
+               echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
+               exit 1
+               ;;
+esac
+rc_exit
+
index d1a2590..5856f08 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Checkers arguments structures definitions.
  *
- * Version:     $Id: check_api.h,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: check_api.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _CHECK_API_H
index fbafc43..5326fb0 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_daemon.c include file.
  * 
- * Version:     $Id: check_daemon.h,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: check_daemon.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _CHECK_DAEMON_H
index b6cc201..9a63f3d 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Healthcheckers dynamic data structure definition.
  *
- * Version:     $Id: check_data.h,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: check_data.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _CHECK_DATA_H
 /* local includes */
 #include "list.h"
 #include "vector.h"
+#include "timer.h"
 
 /* Typedefs */
 typedef unsigned int checker_id_t;
 
 /* Daemon dynamic data structure definition */
-#define MAX_TIMEOUT_LENGTH     5
-#define KEEPALIVED_DEFAULT_DELAY 60
+#define MAX_TIMEOUT_LENGTH             5
+#define KEEPALIVED_DEFAULT_DELAY       (60 * TIMER_HZ) 
 
 /* SSL specific data */
 typedef struct _ssl_data SSL_DATA;
@@ -123,6 +124,13 @@ typedef struct _virtual_server {
        real_server *s_svr;
        list rs;
        int alive;
+       unsigned alpha;                 /* Alpha mode enabled. */
+       unsigned omega;                 /* Omega mode enabled. */
+       char * quorum_up;               /* A hook to call when the VS gains quorum. */
+       char * quorum_down;             /* A hook to call when the VS loses quorum. */
+       long unsigned quorum;           /* Minimum live RSs to consider VS up. */
+       long unsigned hysteresis;       /* up/down events "lag" WRT quorum. */
+       unsigned quorum_state;          /* Reflects result of the last transition done. */
 } virtual_server;
 
 /* Configuration data root */
index 20ae21b..2244c1c 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_http.c include file.
  *
- * Version:     $Id: check_http.h,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: check_http.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
@@ -20,7 +20,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _CHECK_HTTP_H
index 56ff7fd..dbad4de 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_misc.c include file.
  *
- * Version:     $Id: check_misc.h,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: check_misc.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              Eric Jarman, <ehj38230@cmsu2.cmsu.edu>
@@ -20,7 +20,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _CHECK_MISC_H
index e697694..dfc06f3 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        check_parser.c include file.
  *  
- * Version:     $Id: check_parser.h,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: check_parser.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _CHECK_PARSER_H
index 3859d06..5bde6da 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_smtp.c include file.
  *
- * Version:     $Id: check_smtp.h,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: check_smtp.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              Jeremy Rumpf, <jrumpf@heavyload.net>
@@ -20,7 +20,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _CHECK_SMTP_H
index 76df8cb..91e8abc 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_http.c include file.
  *
- * Version:     $Id: check_http.h,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: check_http.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
@@ -20,7 +20,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _CHECK_SSL_H
index 22c63c7..2e0125c 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_tcp.c include file.
  *
- * Version:     $Id: check_tcp.h,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: check_tcp.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _CHECK_TCP_H
index 7b783b8..02ad719 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Configuration include file.
  *
- * Version:     $Id: config.h.in,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: config.h.in,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Jacob Rief, <jacob.rief@tiscover.com>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _CONFIG_H
index f1d7755..924cc79 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Daemon process handling.
  *
- * Version:     $Id: daemon.h,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: daemon.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _DAEMON_H
index 141a2a2..8c106e2 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Dynamic data structure definition.
  *
- * Version:     $Id: global_data.h,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: global_data.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _GLOBAL_DATA_H
index 04eedff..ade4d47 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        vrrp_parser.c include file.
  *  
- * Version:     $Id: global_parser.h,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: global_parser.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _GLOBAL_PARSER_H
index aa240b8..2333f24 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        ipfwwrapper.c include file.
  *
- * Version:     $Id: ipfwwrapper.h,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: ipfwwrapper.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _IPFWWRAPPER_H
index 77d9085..8e2438f 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        ipvswrapper.c include file.
  *
- * Version:     $Id: ipvswrapper.h,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: ipvswrapper.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _IPVSWRAPPER_H
index 3accba5..850ce57 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        ipwrapper.c include file.
  *
- * Version:     $Id: ipwrapper.h,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: ipwrapper.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _IPWRAPPER_H
index 9e14e99..d0d2a55 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        layer4.c include file.
  *
- * Version:     $Id: layer4.h,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: layer4.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _LAYER4_H
index f205f28..8d2fd26 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Main program include file.
  *
- * Version:     $Id: main.h,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: main.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _MAIN_H
index f5e7296..dea2c3d 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        pidfile.c include file.
  *
- * Version:     $Id: pidfile.h,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: pidfile.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _PIDFILE_H
index 31fe9be..ead7937 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        smtp.c include file.
  *
- * Version:     $Id: smtp.h,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: smtp.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _SMTP_H
index 7edee4a..c2a59f3 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Part:        vrrp.c program include file.
  *
- * Version:     $Id: vrrp.h,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: vrrp.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -20,7 +20,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _VRRP_H
@@ -166,7 +166,6 @@ typedef struct _vrrp_rt {
 #define VRRP_STATE_FAULT               3       /* internal */
 #define VRRP_STATE_GOTO_MASTER         4       /* internal */
 #define VRRP_STATE_LEAVE_MASTER                5       /* internal */
-#define VRRP_STATE_GOTO_FAULT          98      /* internal */
 #define VRRP_DISPATCHER                99      /* internal */
 #define VRRP_MCAST_RETRY               10      /* internal */
 #define VRRP_MAX_FSM_STATE             4       /* internal */
@@ -202,8 +201,12 @@ typedef struct _vrrp_rt {
 
 #define VRRP_PKT_SADDR(V) (((V)->mcast_saddr) ? (V)->mcast_saddr : IF_ADDR((V)->ifp))
 
-#define VRRP_ISUP(V)   ((IF_ISUP((V)->ifp) || (V)->dont_track_primary) & \
-                       ((!LIST_ISEMPTY((V)->track_ifp)) ? TRACK_ISUP((V)->track_ifp) : 1))
+#define VRRP_IF_ISUP(V)        ((IF_ISUP((V)->ifp) || (V)->dont_track_primary) & \
+                               ((!LIST_ISEMPTY((V)->track_ifp)) ? TRACK_ISUP((V)->track_ifp) : 1))
+
+#define VRRP_SCRIPT_ISUP(V)    ((!LIST_ISEMPTY((V)->track_script)) ? SCRIPT_ISUP((V)->track_script) : 1)
+
+#define VRRP_ISUP(V)           (VRRP_IF_ISUP(V) && VRRP_SCRIPT_ISUP(V))
 
 /* prototypes */
 extern int open_vrrp_send_socket(const int proto, const int idx);
@@ -222,6 +225,7 @@ extern int vrrp_ipsecah_len(void);
 extern int vrrp_complete_init(void);
 extern void shutdown_vrrp_instances(void);
 extern void clear_diff_vrrp(void);
+extern void clear_diff_script(void);
 extern void vrrp_restore_interface(vrrp_rt * vrrp, int advF);
 
 #endif
index 74aab26..c9d58de 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_arp.c include file.
  *
- * Version:     $Id: vrrp_arp.h,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: vrrp_arp.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _VRRP_ARP_H
index 832d178..308f20b 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_daemon.c include file.
  * 
- * Version:     $Id: vrrp_daemon.h,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: vrrp_daemon.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _VRRP_DAEMON_H
index 81dc8de..6b0572e 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Dynamic data structure definition.
  *
- * Version:     $Id: vrrp_data.h,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: vrrp_data.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _VRRP_DATA_H
index a2b7b18..5192794 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_if.c include file.
  *
- * Version:     $Id: vrrp_if.h,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: vrrp_if.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _VRRP_IF_H
 /* global includes */
 #include <net/if.h>
 
+/* needed to get correct values for SIOC* */
+#include <linux/sockios.h>
+
 /* local includes */
 #include "scheduler.h"
 #include "list.h"
 
 /* types definition */
 #ifndef SIOCETHTOOL
+/* should not happen, otherwise we have a broken toolchain */
+#warning "SIOCETHTOOL not defined. Defaulting to 0x8946, which is probably wrong !"
 #define SIOCETHTOOL     0x8946
 #endif
 #ifndef SIOCGMIIPHY
+/* should not happen, otherwise we have a broken toolchain */
+#warning "SIOCGMIIPHY not defined. Defaulting to SIOCDEVPRIVATE, which is probably wrong !"
 #define SIOCGMIIPHY (SIOCDEVPRIVATE)   /* Get the PHY in use. */
-#define SIOCGMIIREG (SIOCDEVPRIVATE+1) /* Read a PHY register. */
-#define SIOCSMIIREG (SIOCDEVPRIVATE+2) /* Write a PHY register. */
-#define SIOCGPARAMS (SIOCDEVPRIVATE+3) /* Read operational parameters. */
-#define SIOCSPARAMS (SIOCDEVPRIVATE+4) /* Set operational parameters. */
+#define SIOCGMIIREG (SIOCGMIIPHY+1)    /* Read a PHY register. */
+#endif
+
+/* ethtool.h cannot be included because old versions use kernel-only types
+ * which cannot be included from user-land. We don't need much anyway.
+ */
+#ifndef ETHTOOL_GLINK
+#define ETHTOOL_GLINK   0x0000000a
+/* for passing single values */
+struct ethtool_value {
+        uint32_t   cmd;
+        uint32_t   data;
+};
 #endif
 #define LINK_UP   1
 #define LINK_DOWN 0
index 8efa577..60c360a 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_index.c include file.
  *
- * Version:     $Id: vrrp_index.h,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: vrrp_index.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _VRRP_INDEX_H
index a287b15..bb76ffc 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_ipaddress.c include file.
  *
- * Version:     $Id: vrrp_ipaddress.h,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: vrrp_ipaddress.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _VRRP_IPADDR_H
index 932fc0c..91dabf8 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_iproute.c include file.
  *
- * Version:     $Id: vrrp_iproute.h,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: vrrp_iproute.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _VRRP_IPROUTE_H
@@ -39,9 +39,11 @@ typedef struct _ip_route {
        uint32_t dst;           /* RTA_DST */
        uint8_t dmask;
        uint32_t gw;            /* RTA_GATEWAY */
+       uint32_t gw2;           /* Will use RTA_MULTIPATH */
        uint32_t src;           /* RTA_PREFSRC */
        uint32_t metric;        /* RTA_PRIORITY */
        int index;              /* RTA_OIF */
+       int blackhole;
        int scope;
        int table;
        int set;
index 711ca17..e09f42d 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_ipsecah.c include file.
  * 
- * Version:     $Id: vrrp_ipsecah.h,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: vrrp_ipsecah.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _VRRP_IPSEC_AH_H
index 86a0b30..59031ce 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_netlink.c include file.
  *
- * Version:     $Id: vrrp_netlink.h,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: vrrp_netlink.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _VRRP_NETLINK_H
@@ -56,6 +56,8 @@ extern struct nl_handle nl_cmd;               /* Command channel */
 extern int addattr32(struct nlmsghdr *n, int maxlen, int type, uint32_t data_obj);
 extern int addattr_l(struct nlmsghdr *n, int maxlen, int type, void *data_obj,
                     int alen);
+extern int rta_addattr_l(struct rtattr *rta, int maxlen, int type,
+                        const void *data, int alen);
 extern char *netlink_scope_n2a(int scope);
 extern int netlink_scope_a2n(char *scope);
 extern int netlink_socket(struct nl_handle *nl, unsigned long groups);
index 1c11290..fab2e73 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Part:        vrrp_notify.c include file.
  *
- * Version:     $Id: vrrp_notify.h,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: vrrp_notify.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -20,7 +20,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _VRRP_NOTIFY_H
index 2b7a471..c6078e9 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        vrrp_parser.c include file.
  *  
- * Version:     $Id: vrrp_parser.h,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: vrrp_parser.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _VRRP_PARSER_H
index 305f9d5..404f968 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_scheduler.c include file.
  * 
- * Version:     $Id: vrrp_scheduler.h,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: vrrp_scheduler.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _VRRP_SCHEDULER_H
index 981fe51..3ff0d75 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_sync.c include file.
  * 
- * Version:     $Id: vrrp_sync.h,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: vrrp_sync.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _VRRP_SYNC_H
index c8168c1..5e85901 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_track.c include file.
  *
- * Version:     $Id: vrrp_track.h,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: vrrp_track.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _VRRP_TRACK_H
 
 /* Macro definition */
 #define TRACK_ISUP(L)  (vrrp_tracked_up((L)))
+#define SCRIPT_ISUP(L) (vrrp_script_up((L)))
 
 /* VRRP script tracking defaults */
 #define VRRP_SCRIPT_DI 1       /* external script track interval (in sec) */
-#define VRRP_SCRIPT_DW 2       /* external script default weight */
+#define VRRP_SCRIPT_DW 0       /* external script default weight */
 
 /* VRRP script tracking results */
 #define VRRP_SCRIPT_STATUS_DISABLED  0
 #define VRRP_SCRIPT_STATUS_INIT      1
 #define VRRP_SCRIPT_STATUS_NONE      2
 #define VRRP_SCRIPT_STATUS_GOOD      3
+#define VRRP_SCRIPT_STATUS_INIT_GOOD 4
 
 /* external script we call to track local processes */
 typedef struct _vrrp_script {
@@ -73,6 +75,8 @@ extern void alloc_track_script(list track_list, vector strvec);
 extern int vrrp_tracked_up(list l);
 extern void vrrp_log_tracked_down(list l);
 extern int vrrp_tracked_weight(list l);
+extern int vrrp_script_up(list l);
 extern int vrrp_script_weight(list l);
+extern vrrp_script* find_script_by_name(char *name);
 
 #endif
diff --git a/keepalived/libipfwc/Makefile b/keepalived/libipfwc/Makefile
new file mode 100644 (file)
index 0000000..d0c6824
--- /dev/null
@@ -0,0 +1,18 @@
+# Makefile to make libipfwc.
+
+CC     = gcc
+CFLAGS = -g -O2 -Wall -Wunused
+
+export OBJS += libipfwc.a
+
+all: libipfwc.a
+
+libipfwc.a: libipfwc.a(libipfwc.o)
+
+libipfwc.o: libipfwc.h ipfwc_kernel_headers.h
+
+clean:
+       rm -f *.a *.o *~
+
+distclean: clean
+       rm -f Makefile
index f791c3e..7149e62 100644 (file)
@@ -2,7 +2,7 @@
 #
 # Keepalived OpenSource project.
 #
-# Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+# Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
 
 CC      = @CC@
 INCLUDES = -I../include -I../../lib
index 01e2eb7..07d4fd8 100644 (file)
@@ -8,7 +8,7 @@
  *              master fails, a backup server takes over.
  *              The original implementation has been made by jerome etienne.
  *
- * Version:     $Id: vrrp.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: vrrp.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -22,7 +22,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 /* local include */
@@ -38,6 +38,7 @@
 #include "vrrp_index.h"
 #include "memory.h"
 #include "list.h"
+#include "logger.h"
 #include "main.h"
 #include "utils.h"
 #include "notify.h"
@@ -47,7 +48,7 @@ static int
 vrrp_handle_ipaddress(vrrp_rt * vrrp, int cmd, int type)
 {
        if (debug & 32)
-               syslog(LOG_INFO, "VRRP_Instance(%s) %s protocol %s", vrrp->iname,
+               log_message(LOG_INFO, "VRRP_Instance(%s) %s protocol %s", vrrp->iname,
                       (cmd == IPADDRESS_ADD) ? "setting" : "removing",
                       (type == VRRP_VIP_TYPE) ? "VIPs." : "E-VIPs.");
        netlink_iplist_ipv4((type == VRRP_VIP_TYPE) ? vrrp->vip : vrrp->evip
@@ -60,7 +61,7 @@ static int
 vrrp_handle_iproutes(vrrp_rt * vrrp, int cmd)
 {
        if (debug & 32)
-               syslog(LOG_INFO, "VRRP_Instance(%s) %s protocol Virtual Routes",
+               log_message(LOG_INFO, "VRRP_Instance(%s) %s protocol Virtual Routes",
                       vrrp->iname,
                       (cmd == IPROUTE_ADD) ? "setting" : "removing");
        netlink_rtlist_ipv4(vrrp->vroutes, cmd);
@@ -104,7 +105,7 @@ vrrp_in_chk_ipsecah(vrrp_rt * vrrp, char *buffer)
 
        /* first verify that the SPI value is equal to src IP */
        if (ah->spi != ip->saddr) {
-               syslog(LOG_INFO,
+               log_message(LOG_INFO,
                       "IPSEC AH : invalid IPSEC SPI value. %d and expect %d",
                       ip->saddr, ah->spi);
                return 1;
@@ -119,7 +120,7 @@ vrrp_in_chk_ipsecah(vrrp_rt * vrrp, char *buffer)
        if (ntohl(ah->seq_number) >= vrrp->ipsecah_counter->seq_number || vrrp->sync) {
                vrrp->ipsecah_counter->seq_number = ntohl(ah->seq_number);
        } else {
-               syslog(LOG_INFO,
+               log_message(LOG_INFO,
                       "VRRP_Instance(%s) IPSEC-AH : sequence number %d"
                       " already proceeded. Packet dropped. Local(%d)", vrrp->iname
                       , ntohl(ah->seq_number), vrrp->ipsecah_counter->seq_number);
@@ -140,13 +141,13 @@ vrrp_in_chk_ipsecah(vrrp_rt * vrrp, char *buffer)
        memset(ah->auth_data, 0, sizeof (ah->auth_data));
 
        /* Compute the ICV */
-       hmac_md5(buffer,
+       hmac_md5((unsigned char *) buffer,
                 vrrp_iphdr_len(vrrp) + vrrp_ipsecah_len() + vrrp_hd_len(vrrp)
                 , vrrp->auth_data, sizeof (vrrp->auth_data)
                 , digest);
 
        if (memcmp(backup_auth_data, digest, HMAC_MD5_TRUNC) != 0) {
-               syslog(LOG_INFO, "VRRP_Instance(%s) IPSEC-AH : invalid"
+               log_message(LOG_INFO, "VRRP_Instance(%s) IPSEC-AH : invalid"
                       " IPSEC HMAC-MD5 value. Due to fields mutation"
                       " or bad password !", vrrp->iname);
                return 1;
@@ -200,14 +201,14 @@ vrrp_in_chk(vrrp_rt * vrrp, char *buffer)
 
        /* MUST verify that the IP TTL is 255 */
        if (ip->ttl != VRRP_IP_TTL) {
-               syslog(LOG_INFO, "invalid ttl. %d and expect %d", ip->ttl,
+               log_message(LOG_INFO, "invalid ttl. %d and expect %d", ip->ttl,
                       VRRP_IP_TTL);
                return VRRP_PACKET_KO;
        }
 
        /* MUST verify the VRRP version */
        if ((hd->vers_type >> 4) != VRRP_VERSION) {
-               syslog(LOG_INFO, "invalid version. %d and expect %d",
+               log_message(LOG_INFO, "invalid version. %d and expect %d",
                       (hd->vers_type >> 4), VRRP_VERSION);
                return VRRP_PACKET_KO;
        }
@@ -217,7 +218,7 @@ vrrp_in_chk(vrrp_rt * vrrp, char *buffer)
         * equal to the VRRP header
         */
        if ((ntohs(ip->tot_len) - ihl) <= sizeof (vrrp_pkt)) {
-               syslog(LOG_INFO,
+               log_message(LOG_INFO,
                       "ip payload too short. %d and expect at least %d",
                       ntohs(ip->tot_len) - ihl, sizeof (vrrp_pkt));
                return VRRP_PACKET_KO;
@@ -226,7 +227,7 @@ vrrp_in_chk(vrrp_rt * vrrp, char *buffer)
        /* MUST verify the VRRP checksum */
        if (in_csum((u_short *) hd,
            sizeof(vrrp_pkt) + VRRP_AUTH_LEN + hd->naddr * sizeof(uint32_t), 0)) {
-               syslog(LOG_INFO, "Invalid vrrp checksum");
+               log_message(LOG_INFO, "Invalid vrrp checksum");
                return VRRP_PACKET_KO;
        }
 
@@ -235,7 +236,7 @@ vrrp_in_chk(vrrp_rt * vrrp, char *buffer)
         * check the authentication type
         */
        if (vrrp->auth_type != hd->auth_type) {
-               syslog(LOG_INFO, "receive a %d auth, expecting %d!",
+               log_message(LOG_INFO, "receive a %d auth, expecting %d!",
                       vrrp->auth_type, hd->auth_type);
                return VRRP_PACKET_KO;
        }
@@ -245,14 +246,14 @@ vrrp_in_chk(vrrp_rt * vrrp, char *buffer)
                char *pw = (char *) ip + ntohs(ip->tot_len)
                    - sizeof (vrrp->auth_data);
                if (memcmp(pw, vrrp->auth_data, sizeof(vrrp->auth_data)) != 0) {
-                       syslog(LOG_INFO, "receive an invalid passwd!");
+                       log_message(LOG_INFO, "receive an invalid passwd!");
                        return VRRP_PACKET_KO;
                }
        }
 
        /* MUST verify that the VRID is valid on the receiving interface */
        if (vrrp->vrid != hd->vrid) {
-               syslog(LOG_INFO,
+               log_message(LOG_INFO,
                       "received VRID mismatch. Received %d, Expected %d",
                       hd->vrid, vrrp->vrid);
                return VRRP_PACKET_DROP;
@@ -264,7 +265,7 @@ vrrp_in_chk(vrrp_rt * vrrp, char *buffer)
                 * VRID are valid
                 */
                if (hd->naddr != LIST_SIZE(vrrp->vip)) {
-                       syslog(LOG_INFO,
+                       log_message(LOG_INFO,
                               "receive an invalid ip number count associated with VRID!");
                        return VRRP_PACKET_KO;
                }
@@ -272,17 +273,17 @@ vrrp_in_chk(vrrp_rt * vrrp, char *buffer)
                for (e = LIST_HEAD(vrrp->vip); e; ELEMENT_NEXT(e)) {
                        ipaddress = ELEMENT_DATA(e);
                        if (!vrrp_in_chk_vips(vrrp, ipaddress->addr, vips)) {
-                               syslog(LOG_INFO, "ip address associated with VRID"
+                               log_message(LOG_INFO, "ip address associated with VRID"
                                       " not present in received packet : %d",
                                       ipaddress->addr);
-                               syslog(LOG_INFO,
+                               log_message(LOG_INFO,
                                       "one or more VIP associated with"
                                       " VRID mismatch actual MASTER advert");
                                return VRRP_PACKET_KO;
                        }
                }
        } else if (hd->naddr > 0) {
-               syslog(LOG_INFO,
+               log_message(LOG_INFO,
                       "receive an invalid ip number count associated with VRID!");
                return VRRP_PACKET_KO;
        }
@@ -292,7 +293,7 @@ vrrp_in_chk(vrrp_rt * vrrp, char *buffer)
         * the locally configured for this virtual router
         */
        if (vrrp->adver_int / TIMER_HZ != hd->adver_int) {
-               syslog(LOG_INFO,
+               log_message(LOG_INFO,
                       "advertissement interval mismatch mine=%d rcved=%d",
                       vrrp->adver_int, hd->adver_int);
                /* to prevent concurent VRID running => multiple master in 1 VRID */
@@ -317,7 +318,10 @@ vrrp_build_ip(vrrp_rt * vrrp, char *buffer, int buflen)
        ip->tos = 0;
        ip->tot_len = ip->ihl * 4 + vrrp_hd_len(vrrp);
        ip->tot_len = htons(ip->tot_len);
-       ip->id = ++vrrp->ip_id;
+       ip->id = htons(++vrrp->ip_id);
+       /* kernel will fill in ID if left to 0, so we overflow to 1 */
+       if (vrrp->ip_id == 65535)
+               vrrp->ip_id = 1;
        ip->frag_off = 0;
        ip->ttl = VRRP_IP_TTL;
 
@@ -403,7 +407,7 @@ vrrp_build_ipsecah(vrrp_rt * vrrp, char *buffer, int buflen)
           -- rfc2402.3.3.3.1.1.1 & rfc2401.5
         */
        digest = (unsigned char *) MALLOC(16 * sizeof (unsigned char *));
-       hmac_md5(buffer, buflen, vrrp->auth_data, sizeof (vrrp->auth_data)
+       hmac_md5((unsigned char *) buffer, buflen, vrrp->auth_data, sizeof (vrrp->auth_data)
                 , digest);
        memcpy(ah->auth_data, digest, HMAC_MD5_TRUNC);
 
@@ -553,12 +557,12 @@ vrrp_check_packet(vrrp_rt * vrrp, char *buf, int buflen)
                ret = vrrp_in_chk(vrrp, buf);
 
                if (ret == VRRP_PACKET_DROP) {
-                       syslog(LOG_INFO, "Sync instance needed on %s !!!",
+                       log_message(LOG_INFO, "Sync instance needed on %s !!!",
                               IF_NAME(vrrp->ifp));
                }
 
                if (ret == VRRP_PACKET_KO)
-                       syslog(LOG_INFO, "bogus VRRP packet received on %s !!!",
+                       log_message(LOG_INFO, "bogus VRRP packet received on %s !!!",
                               IF_NAME(vrrp->ifp));
                return ret;
        }
@@ -584,7 +588,7 @@ vrrp_send_gratuitous_arp(vrrp_rt * vrrp)
                        for (e = LIST_HEAD(vrrp->vip); e; ELEMENT_NEXT(e)) {
                                ipaddress = ELEMENT_DATA(e);
                                if (0 == j && debug & 32)
-                                       syslog(LOG_INFO,
+                                       log_message(LOG_INFO,
                                               "VRRP_Instance(%s) Sending gratuitous ARPs "
                                               "on %s for %s",
                                               vrrp->iname,
@@ -596,7 +600,7 @@ vrrp_send_gratuitous_arp(vrrp_rt * vrrp)
                        for (e = LIST_HEAD(vrrp->evip); e; ELEMENT_NEXT(e)) {
                                ipaddress = ELEMENT_DATA(e);
                                if (0 == j && debug & 32)
-                                       syslog(LOG_INFO,
+                                       log_message(LOG_INFO,
                                               "VRRP_Instance(%s) Sending gratuitous ARPs "
                                               "on %s for %s",
                                               vrrp->iname,
@@ -645,7 +649,7 @@ vrrp_state_goto_master(vrrp_rt * vrrp)
        vrrp_send_adv(vrrp, vrrp->effective_priority);
 
        vrrp->state = VRRP_STATE_MAST;
-       syslog(LOG_INFO, "VRRP_Instance(%s) Transition to MASTER STATE",
+       log_message(LOG_INFO, "VRRP_Instance(%s) Transition to MASTER STATE",
               vrrp->iname);
 }
 
@@ -691,22 +695,11 @@ vrrp_state_leave_master(vrrp_rt * vrrp)
        }
 
        /* set the new vrrp state */
-       switch (vrrp->wantstate) {
-       case VRRP_STATE_BACK:
-               syslog(LOG_INFO, "VRRP_Instance(%s) Entering BACKUP STATE",
-                      vrrp->iname);
-               vrrp_restore_interface(vrrp, 0);
-               vrrp->state = vrrp->wantstate;
-               notify_instance_exec(vrrp, VRRP_STATE_BACK);
-               break;
-       case VRRP_STATE_GOTO_FAULT:
-               syslog(LOG_INFO, "VRRP_Instance(%s) Entering FAULT STATE",
-                      vrrp->iname);
-               vrrp_restore_interface(vrrp, 0);
-               vrrp->state = VRRP_STATE_FAULT;
-               notify_instance_exec(vrrp, VRRP_STATE_FAULT);
-               break;
-       }
+       log_message(LOG_INFO, "VRRP_Instance(%s) Entering BACKUP STATE",
+                   vrrp->iname);
+       vrrp_restore_interface(vrrp, 0);
+       vrrp->state = vrrp->wantstate;
+       notify_instance_exec(vrrp, VRRP_STATE_BACK);
 
        /* Set the down timer */
        vrrp->ms_down_timer = 3 * vrrp->adver_int + VRRP_TIMER_SKEW(vrrp);
@@ -735,7 +728,7 @@ vrrp_state_backup(vrrp_rt * vrrp, char *buf, int buflen)
        ret = vrrp_check_packet(vrrp, buf, buflen);
 
        if (ret == VRRP_PACKET_KO || ret == VRRP_PACKET_NULL) {
-               syslog(LOG_INFO,
+               log_message(LOG_INFO,
                       "VRRP_Instance(%s) ignoring received advertisment...",
                       vrrp->iname);
                vrrp->ms_down_timer =
@@ -747,7 +740,7 @@ vrrp_state_backup(vrrp_rt * vrrp, char *buf, int buflen)
                vrrp->ms_down_timer =
                    3 * vrrp->adver_int + VRRP_TIMER_SKEW(vrrp);
        } else if (hd->priority < vrrp->effective_priority) {
-               syslog(LOG_INFO,
+               log_message(LOG_INFO,
                       "VRRP_Instance(%s) forcing a new MASTER election",
                       vrrp->iname);
                vrrp->wantstate = VRRP_STATE_GOTO_MASTER;
@@ -762,7 +755,7 @@ vrrp_state_master_tx(vrrp_rt * vrrp, const int prio)
        int ret = 0;
 
        if (!VRRP_VIP_ISSET(vrrp)) {
-               syslog(LOG_INFO, "VRRP_Instance(%s) Entering MASTER STATE",
+               log_message(LOG_INFO, "VRRP_Instance(%s) Entering MASTER STATE",
                       vrrp->iname);
                vrrp_state_become_master(vrrp);
                ret = 1;
@@ -783,7 +776,7 @@ vrrp_state_master_rx(vrrp_rt * vrrp, char *buf, int buflen)
        ipsec_ah *ah;
 
        /* return on link failure */
-       if (vrrp->wantstate == VRRP_STATE_GOTO_FAULT) {
+       if (vrrp->wantstate == VRRP_STATE_FAULT) {
                vrrp->ms_down_timer =
                    3 * vrrp->adver_int + VRRP_TIMER_SKEW(vrrp);
                vrrp->state = VRRP_STATE_FAULT;
@@ -806,17 +799,17 @@ vrrp_state_master_rx(vrrp_rt * vrrp, char *buf, int buflen)
 
        if (ret == VRRP_PACKET_KO ||
            ret == VRRP_PACKET_NULL || ret == VRRP_PACKET_DROP) {
-               syslog(LOG_INFO,
+               log_message(LOG_INFO,
                       "VRRP_Instance(%s) Dropping received VRRP packet...",
                       vrrp->iname);
                return 0;
        } else if (hd->priority < vrrp->effective_priority) {
                /* We receive a lower prio adv we just refresh remote ARP cache */
-               syslog(LOG_INFO, "VRRP_Instance(%s) Received lower prio advert"
+               log_message(LOG_INFO, "VRRP_Instance(%s) Received lower prio advert"
                       ", forcing new election", vrrp->iname);
                if (iph->protocol == IPPROTO_IPSEC_AH) {
                        ah = (ipsec_ah *) (buf + sizeof(struct iphdr));
-                       syslog(LOG_INFO, "VRRP_Instance(%s) IPSEC-AH : Syncing seq_num"
+                       log_message(LOG_INFO, "VRRP_Instance(%s) IPSEC-AH : Syncing seq_num"
                               " - Increment seq"
                               , vrrp->iname);
                        vrrp->ipsecah_counter->seq_number = ntohl(ah->seq_number) + 1;
@@ -831,12 +824,12 @@ vrrp_state_master_rx(vrrp_rt * vrrp, char *buf, int buflen)
        } else if (hd->priority > vrrp->effective_priority ||
                   (hd->priority == vrrp->effective_priority &&
                    ntohl(iph->saddr) > VRRP_PKT_SADDR(vrrp))) {
-               syslog(LOG_INFO,
+               log_message(LOG_INFO,
                       "VRRP_Instance(%s) Received higher prio advert",
                       vrrp->iname);
                if (iph->protocol == IPPROTO_IPSEC_AH) {
                        ah = (ipsec_ah *) (buf + sizeof(struct iphdr));
-                       syslog(LOG_INFO, "VRRP_Instance(%s) IPSEC-AH : Syncing seq_num"
+                       log_message(LOG_INFO, "VRRP_Instance(%s) IPSEC-AH : Syncing seq_num"
                               " - Decrement seq"
                               , vrrp->iname);
                        vrrp->ipsecah_counter->seq_number = ntohl(ah->seq_number) - 1;
@@ -875,7 +868,7 @@ vrrp_state_fault_rx(vrrp_rt * vrrp, char *buf, int buflen)
 
        if (ret == VRRP_PACKET_KO ||
            ret == VRRP_PACKET_NULL || ret == VRRP_PACKET_DROP) {
-               syslog(LOG_INFO,
+               log_message(LOG_INFO,
                       "VRRP_Instance(%s) Dropping received VRRP packet...",
                       vrrp->iname);
                return 0;
@@ -891,12 +884,12 @@ static int
 chk_min_cfg(vrrp_rt * vrrp)
 {
        if (vrrp->vrid == 0) {
-               syslog(LOG_INFO, "VRRP_Instance(%s) the virtual id must be set!",
+               log_message(LOG_INFO, "VRRP_Instance(%s) the virtual id must be set!",
                       vrrp->iname);
                return 0;
        }
        if (!vrrp->ifp) {
-               syslog(LOG_INFO, "VRRP_Instance(%s) Unknown interface !",
+               log_message(LOG_INFO, "VRRP_Instance(%s) Unknown interface !",
                       vrrp->iname);
                return 0;
        }
@@ -918,7 +911,7 @@ open_vrrp_send_socket(const int proto, const int idx)
        fd = socket(AF_INET, SOCK_RAW, proto);
        if (fd < 0) {
                int err = errno;
-               syslog(LOG_INFO, "cant open raw socket. errno=%d",
+               log_message(LOG_INFO, "cant open raw socket. errno=%d",
                       err);
                return -1;
        }
@@ -945,7 +938,7 @@ open_vrrp_socket(const int proto, const int idx)
        fd = socket(AF_INET, SOCK_RAW, proto);
        if (fd < 0) {
                int err = errno;
-               syslog(LOG_INFO, "cant open raw socket. errno=%d",
+               log_message(LOG_INFO, "cant open raw socket. errno=%d",
                       err);
                return -1;
        }
@@ -1098,6 +1091,42 @@ clear_diff_vrrp_vroutes(vrrp_rt * old_vrrp)
        clear_diff_routes(old_vrrp->vroutes, vrrp->vroutes);
 }
 
+/* Keep the state from before reload */
+static void
+reset_vrrp_state(vrrp_rt * old_vrrp)
+{
+       /* Keep VRRP state, ipsec AH seq_number */
+       vrrp_rt *vrrp = vrrp_exist(old_vrrp);
+       vrrp->state = old_vrrp->state;
+       vrrp->init_state = old_vrrp->state;
+       vrrp->wantstate = old_vrrp->state;
+       memcpy(vrrp->ipsecah_counter, old_vrrp->ipsecah_counter, sizeof(seq_counter));
+
+#ifdef _HAVE_IPVS_SYNCD_
+       if (old_vrrp->lvs_syncd_if)
+               ipvs_syncd_cmd(IPVS_STOPDAEMON, NULL,
+                              (old_vrrp->state == VRRP_STATE_MAST) ? IPVS_MASTER:
+                                                                     IPVS_BACKUP,
+                              old_vrrp->vrid);
+       if (vrrp->lvs_syncd_if)
+               ipvs_syncd_cmd(IPVS_STARTDAEMON, NULL,
+                              (vrrp->state == VRRP_STATE_MAST) ? IPVS_MASTER:
+                                                                 IPVS_BACKUP,
+                              vrrp->vrid);
+#endif
+
+       /* Remember if we had vips up and add new ones if needed */
+       vrrp->vipset = old_vrrp->vipset;
+       if (vrrp->vipset) {
+               if (!LIST_ISEMPTY(vrrp->vip))
+                       vrrp_handle_ipaddress(vrrp, IPADDRESS_ADD, VRRP_VIP_TYPE);
+               if (!LIST_ISEMPTY(vrrp->evip))
+                       vrrp_handle_ipaddress(vrrp, IPADDRESS_ADD, VRRP_EVIP_TYPE);
+               if (!LIST_ISEMPTY(vrrp->vroutes))
+                       vrrp_handle_iproutes(vrrp, IPROUTE_ADD);
+       }
+}
+
 /* Diff when reloading configuration */
 void
 clear_diff_vrrp(void)
@@ -1128,6 +1157,34 @@ clear_diff_vrrp(void)
 
                        /* virtual routes diff */
                        clear_diff_vrrp_vroutes(vrrp);
+
+                       /* reset the state */
+                       reset_vrrp_state(vrrp);
+               }
+       }
+}
+
+/* Set script status to a sensible value on reload */
+void
+clear_diff_script(void)
+{
+       element e;
+       list l = old_vrrp_data->vrrp_script;
+       vrrp_script *vscript, *nvscript;
+
+       if (LIST_ISEMPTY(l))
+               return;
+
+       for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) {
+               vscript = ELEMENT_DATA(e);
+               if (vscript->result == VRRP_SCRIPT_STATUS_GOOD) {
+                       nvscript = find_script_by_name(vscript->sname);
+                       if (nvscript) {
+                               log_message(LOG_INFO, "VRRP_Script(%s) considered successful on reload",
+                                          nvscript->sname);
+                               nvscript->result = VRRP_SCRIPT_STATUS_INIT_GOOD;
+                               break;
+                       }
                }
        }
 }
index 8e9d53b..8c99084 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        ARP primitives.
  *
- * Version:     $Id: vrrp_arp.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: vrrp_arp.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 /* local includes */
 #include "vrrp_arp.h"
+#include "logger.h"
 #include "memory.h"
 #include "utils.h"
 
@@ -44,9 +45,9 @@ void gratuitous_arp_init(void)
        garp_fd = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_RARP));
 
        if (garp_fd > 0)
-               syslog(LOG_INFO, "Registering gratutious ARP shared channel");
+               log_message(LOG_INFO, "Registering gratutious ARP shared channel");
        else
-               syslog(LOG_INFO, "Error while registering gratutious ARP shared channel");
+               log_message(LOG_INFO, "Error while registering gratutious ARP shared channel");
 }
 void gratuitous_arp_close(void)
 {
@@ -71,7 +72,7 @@ static int send_arp(ip_address *ipaddress)
        len = sendto(garp_fd, garp_buffer, sizeof(m_arphdr) + ETHER_HDR_LEN
                     , 0, (struct sockaddr *)&sll, sizeof(sll));
        if (len < 0)
-               syslog(LOG_INFO, "Error sending gratutious ARP on %s for %s"
+               log_message(LOG_INFO, "Error sending gratutious ARP on %s for %s"
                       , IF_NAME(ipaddress->ifp), inet_ntop2(ipaddress->addr));
        return len;
 }
@@ -81,7 +82,7 @@ int send_gratuitous_arp(ip_address *ipaddress)
 {
        struct ether_header *eth = (struct ether_header *) garp_buffer;
        m_arphdr *arph           = (m_arphdr *) (garp_buffer + ETHER_HDR_LEN);
-       char *hwaddr             = IF_HWADDR(ipaddress->ifp);
+       char *hwaddr             = (char *) IF_HWADDR(ipaddress->ifp);
        int len;
 
        /* Ethernet header */
@@ -97,6 +98,7 @@ int send_gratuitous_arp(ip_address *ipaddress)
        arph->ar_op = htons(ARPOP_REQUEST);
        memcpy(arph->__ar_sha, hwaddr, ETH_ALEN);
        memcpy(arph->__ar_sip, &ipaddress->addr, sizeof (ipaddress->addr));
+       memset(arph->__ar_tha, 0xFF, ETH_ALEN);
        memcpy(arph->__ar_tip, &ipaddress->addr, sizeof (ipaddress->addr));
 
        /* Send the ARP message */
index 540a5e0..ac7c548 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        VRRP child process handling.
  *
- * Version:     $Id: vrrp_daemon.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: vrrp_daemon.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #include "vrrp_daemon.h"
@@ -35,6 +35,7 @@
 #include "global_data.h"
 #include "pidfile.h"
 #include "daemon.h"
+#include "logger.h"
 #include "signals.h"
 #ifdef _WITH_LVS_
   #include "ipvswrapper.h"
 #include "memory.h"
 #include "parser.h"
 
+extern char *vrrp_pidfile;
+
 /* Daemon stop sequence */
 static void
 stop_vrrp(void)
 {
        /* Destroy master thread */
+       signal_handler_destroy();
        thread_destroy_master(master);
 
        /* Clear static entries */
@@ -61,7 +65,7 @@ stop_vrrp(void)
        gratuitous_arp_close();
 
        /* Stop daemon */
-       pidfile_rm(VRRP_PID_FILE);
+       pidfile_rm(vrrp_pidfile);
 
        /* Clean data */
        free_global_data(data);
@@ -112,6 +116,7 @@ start_vrrp(void)
                clear_diff_saddresses();
                clear_diff_sroutes();
                clear_diff_vrrp();
+               clear_diff_script();
        }
 
        /* Complete VRRP initialization */
@@ -121,7 +126,7 @@ start_vrrp(void)
        }
 
        /* Post initializations */
-       syslog(LOG_INFO, "Configuration is using : %lu Bytes", mem_allocated);
+       log_message(LOG_INFO, "Configuration is using : %lu Bytes", mem_allocated);
 
        /* Set static entries */
        netlink_iplist_ipv4(vrrp_data->static_addresses, IPADDRESS_ADD);
@@ -175,18 +180,18 @@ reload_vrrp_thread(thread * thread_obj)
 
 /* Reload handler */
 void
-sighup_vrrp(int sig)
+sighup_vrrp(void *v, int sig)
 {
-       syslog(LOG_INFO, "Reloading VRRP child process(%d) on signal",
+       log_message(LOG_INFO, "Reloading VRRP child process(%d) on signal",
               vrrp_child);
        thread_add_event(master, reload_vrrp_thread, NULL, 0);
 }
 
 /* Terminate handler */
 void
-sigend_vrrp(int sig)
+sigend_vrrp(void *v, int sig)
 {
-       syslog(LOG_INFO, "Terminating VRRP child process on signal");
+       log_message(LOG_INFO, "Terminating VRRP child process on signal");
        if (master)
                thread_add_terminate_event(master);
 }
@@ -196,11 +201,10 @@ void
 vrrp_signal_init(void)
 {
        signal_handler_init();
-       signal_set(SIGHUP, sighup_vrrp);
-       signal_set(SIGINT, sigend_vrrp);
-       signal_set(SIGTERM, sigend_vrrp);
+       signal_set(SIGHUP, sighup_vrrp, NULL);
+       signal_set(SIGINT, sigend_vrrp, NULL);
+       signal_set(SIGTERM, sigend_vrrp, NULL);
        signal_ignore(SIGPIPE);
-       signal_noignore_sigchld();
 }
 
 /* VRRP Child respawning thread */
@@ -220,7 +224,7 @@ vrrp_respawn_thread(thread * thread_obj)
        }
 
        /* We catch a SIGCHLD, handle it */
-       syslog(LOG_INFO, "VRRP child process(%d) died: Respawning", pid);
+       log_message(LOG_INFO, "VRRP child process(%d) died: Respawning", pid);
        start_vrrp_child();
        return 0;
 }
@@ -235,7 +239,7 @@ start_vrrp_child(void)
 
        /* Dont start if pid is already running */
        if (vrrp_running()) {
-               syslog(LOG_INFO, "VRRP child process already running");
+               log_message(LOG_INFO, "VRRP child process already running");
                return -1;
        }
 
@@ -244,12 +248,12 @@ start_vrrp_child(void)
        pid = fork();
 
        if (pid < 0) {
-               syslog(LOG_INFO, "VRRP child process: fork error(%s)"
+               log_message(LOG_INFO, "VRRP child process: fork error(%s)"
                               , strerror(errno));
                return -1;
        } else if (pid) {
                vrrp_child = pid;
-               syslog(LOG_INFO, "Starting VRRP child process, pid=%d"
+               log_message(LOG_INFO, "Starting VRRP child process, pid=%d"
                               , pid);
 
                /* Start respawning thread */
@@ -263,13 +267,14 @@ start_vrrp_child(void)
                (log_facility==LOG_DAEMON) ? LOG_LOCAL1 : log_facility);
 
        /* Child process part, write pidfile */
-       if (!pidfile_write(VRRP_PID_FILE, getpid())) {
+       if (!pidfile_write(vrrp_pidfile, getpid())) {
                /* Fatal error */
-               syslog(LOG_INFO, "VRRP child process: cannot write pidfile");
+               log_message(LOG_INFO, "VRRP child process: cannot write pidfile");
                exit(0);
        }
 
        /* Create the new master thread */
+       signal_handler_destroy();
        thread_destroy_master(master);
        master = thread_make_master();
 
index 3e756d7..3e27dbb 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Dynamic data structure definition.
  *
- * Version:     $Id: vrrp_data.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: vrrp_data.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #include "vrrp_data.h"
@@ -29,6 +29,7 @@
 #include "vrrp.h"
 #include "memory.h"
 #include "utils.h"
+#include "logger.h"
 
 /* global vars */
 vrrp_conf_data *vrrp_data = NULL;
@@ -75,26 +76,26 @@ dump_vgroup(void *data)
        int i;
        char *str;
 
-       syslog(LOG_INFO, " VRRP Sync Group = %s, %s", vgroup->gname,
+       log_message(LOG_INFO, " VRRP Sync Group = %s, %s", vgroup->gname,
               (vgroup->state == VRRP_STATE_MAST) ? "MASTER" : "BACKUP");
        for (i = 0; i < VECTOR_SIZE(vgroup->iname); i++) {
                str = VECTOR_SLOT(vgroup->iname, i);
-               syslog(LOG_INFO, "   monitor = %s", str);
+               log_message(LOG_INFO, "   monitor = %s", str);
        }
        if (vgroup->script_backup)
-               syslog(LOG_INFO, "   Backup state transition script = %s",
+               log_message(LOG_INFO, "   Backup state transition script = %s",
                       vgroup->script_backup);
        if (vgroup->script_master)
-               syslog(LOG_INFO, "   Master state transition script = %s",
+               log_message(LOG_INFO, "   Master state transition script = %s",
                       vgroup->script_master);
        if (vgroup->script_fault)
-               syslog(LOG_INFO, "   Fault state transition script = %s",
+               log_message(LOG_INFO, "   Fault state transition script = %s",
                       vgroup->script_fault);
        if (vgroup->script)
-               syslog(LOG_INFO, "   Generic state transition script = '%s'",
+               log_message(LOG_INFO, "   Generic state transition script = '%s'",
                       vgroup->script);
        if (vgroup->smtp_alert)
-               syslog(LOG_INFO, "   Using smtp notification");
+               log_message(LOG_INFO, "   Using smtp notification");
 }
 
 static void
@@ -112,10 +113,10 @@ dump_vscript(void *data)
        vrrp_script *vscript = data;
        char *str;
 
-       syslog(LOG_INFO, " VRRP Script = %s", vscript->sname);
-       syslog(LOG_INFO, "   Command = %s", vscript->script);
-       syslog(LOG_INFO, "   Interval = %d sec", vscript->interval / TIMER_HZ);
-       syslog(LOG_INFO, "   Weight = %d", vscript->weight);
+       log_message(LOG_INFO, " VRRP Script = %s", vscript->sname);
+       log_message(LOG_INFO, "   Command = %s", vscript->script);
+       log_message(LOG_INFO, "   Interval = %d sec", vscript->interval / TIMER_HZ);
+       log_message(LOG_INFO, "   Weight = %d", vscript->weight);
 
        switch (vscript->result) {
        case VRRP_SCRIPT_STATUS_INIT:
@@ -124,11 +125,13 @@ dump_vscript(void *data)
                str = "BAD"; break;
        case VRRP_SCRIPT_STATUS_GOOD:
                str = "GOOD"; break;
+       case VRRP_SCRIPT_STATUS_INIT_GOOD:
+               str = "INIT/GOOD"; break;
        case VRRP_SCRIPT_STATUS_DISABLED:
        default:
                str = "DISABLED"; break;
        }
-       syslog(LOG_INFO, "   Status = %s", str);
+       log_message(LOG_INFO, "   Status = %s", str);
 }
 
 /* Socket pool functions */
@@ -146,7 +149,7 @@ static void
 dump_sock(void *sock_data_obj)
 {
        sock *sock_obj = sock_data_obj;
-       syslog(LOG_INFO, "VRRP sockpool: [ifindex(%d), proto(%d), fd(%d,%d)]",
+       log_message(LOG_INFO, "VRRP sockpool: [ifindex(%d), proto(%d), fd(%d,%d)]",
               sock_obj->ifindex
               , sock_obj->proto
               , sock_obj->fd_in
@@ -189,76 +192,76 @@ dump_vrrp(void *data)
 {
        vrrp_rt *vrrp = data;
 
-       syslog(LOG_INFO, " VRRP Instance = %s", vrrp->iname);
+       log_message(LOG_INFO, " VRRP Instance = %s", vrrp->iname);
        if (vrrp->init_state == VRRP_STATE_BACK)
-               syslog(LOG_INFO, "   Want State = BACKUP");
+               log_message(LOG_INFO, "   Want State = BACKUP");
        else
-               syslog(LOG_INFO, "   Want State = MASTER");
-       syslog(LOG_INFO, "   Runing on device = %s", IF_NAME(vrrp->ifp));
+               log_message(LOG_INFO, "   Want State = MASTER");
+       log_message(LOG_INFO, "   Runing on device = %s", IF_NAME(vrrp->ifp));
        if (vrrp->dont_track_primary)
-               syslog(LOG_INFO, "   VRRP interface tracking disabled");
+               log_message(LOG_INFO, "   VRRP interface tracking disabled");
        if (vrrp->mcast_saddr)
-               syslog(LOG_INFO, "   Using mcast src_ip = %s",
+               log_message(LOG_INFO, "   Using mcast src_ip = %s",
                       inet_ntop2(vrrp->mcast_saddr));
        if (vrrp->lvs_syncd_if)
-               syslog(LOG_INFO, "   Runing LVS sync daemon on interface = %s",
+               log_message(LOG_INFO, "   Runing LVS sync daemon on interface = %s",
                       vrrp->lvs_syncd_if);
        if (vrrp->garp_delay)
-               syslog(LOG_INFO, "   Gratuitous ARP delay = %d",
+               log_message(LOG_INFO, "   Gratuitous ARP delay = %d",
                       vrrp->garp_delay/TIMER_HZ);
-       syslog(LOG_INFO, "   Virtual Router ID = %d", vrrp->vrid);
-       syslog(LOG_INFO, "   Priority = %d", vrrp->base_priority);
-       syslog(LOG_INFO, "   Advert interval = %dsec",
+       log_message(LOG_INFO, "   Virtual Router ID = %d", vrrp->vrid);
+       log_message(LOG_INFO, "   Priority = %d", vrrp->base_priority);
+       log_message(LOG_INFO, "   Advert interval = %dsec",
               vrrp->adver_int / TIMER_HZ);
        if (vrrp->nopreempt)
-               syslog(LOG_INFO, "   Preempt disabled");
+               log_message(LOG_INFO, "   Preempt disabled");
        if (vrrp->preempt_delay)
-               syslog(LOG_INFO, "   Preempt delay = %ld secs",
+               log_message(LOG_INFO, "   Preempt delay = %ld secs",
                       vrrp->preempt_delay / TIMER_HZ);
        if (vrrp->auth_type) {
-               syslog(LOG_INFO, "   Authentication type = %s",
+               log_message(LOG_INFO, "   Authentication type = %s",
                       (vrrp->auth_type ==
                        VRRP_AUTH_AH) ? "IPSEC_AH" : "SIMPLE_PASSWORD");
-               syslog(LOG_INFO, "   Password = %s", vrrp->auth_data);
+               log_message(LOG_INFO, "   Password = %s", vrrp->auth_data);
        }
        if (!LIST_ISEMPTY(vrrp->track_ifp)) {
-               syslog(LOG_INFO, "   Tracked interfaces = %d", LIST_SIZE(vrrp->track_ifp));
+               log_message(LOG_INFO, "   Tracked interfaces = %d", LIST_SIZE(vrrp->track_ifp));
                dump_list(vrrp->track_ifp);
        }
        if (!LIST_ISEMPTY(vrrp->track_script)) {
-               syslog(LOG_INFO, "   Tracked scripts = %d",
+               log_message(LOG_INFO, "   Tracked scripts = %d",
                       LIST_SIZE(vrrp->track_script));
                dump_list(vrrp->track_script);
        }
        if (!LIST_ISEMPTY(vrrp->vip)) {
-               syslog(LOG_INFO, "   Virtual IP = %d", LIST_SIZE(vrrp->vip));
+               log_message(LOG_INFO, "   Virtual IP = %d", LIST_SIZE(vrrp->vip));
                dump_list(vrrp->vip);
        }
        if (!LIST_ISEMPTY(vrrp->evip)) {
-               syslog(LOG_INFO, "   Virtual IP Excluded = %d", LIST_SIZE(vrrp->evip));
+               log_message(LOG_INFO, "   Virtual IP Excluded = %d", LIST_SIZE(vrrp->evip));
                dump_list(vrrp->evip);
        }
        if (!LIST_ISEMPTY(vrrp->vroutes)) {
-               syslog(LOG_INFO, "   Virtual Routes = %d", LIST_SIZE(vrrp->vroutes));
+               log_message(LOG_INFO, "   Virtual Routes = %d", LIST_SIZE(vrrp->vroutes));
                dump_list(vrrp->vroutes);
        }
        if (vrrp->script_backup)
-               syslog(LOG_INFO, "   Backup state transition script = %s",
+               log_message(LOG_INFO, "   Backup state transition script = %s",
                       vrrp->script_backup);
        if (vrrp->script_master)
-               syslog(LOG_INFO, "   Master state transition script = %s",
+               log_message(LOG_INFO, "   Master state transition script = %s",
                       vrrp->script_master);
        if (vrrp->script_fault)
-               syslog(LOG_INFO, "   Fault state transition script = %s",
+               log_message(LOG_INFO, "   Fault state transition script = %s",
                       vrrp->script_fault);
        if (vrrp->script_stop)
-               syslog(LOG_INFO, "   Stop state transition script = %s",
+               log_message(LOG_INFO, "   Stop state transition script = %s",
                       vrrp->script_stop);
        if (vrrp->script)
-               syslog(LOG_INFO, "   Generic state transition script = '%s'",
+               log_message(LOG_INFO, "   Generic state transition script = '%s'",
                       vrrp->script);
        if (vrrp->smtp_alert)
-               syslog(LOG_INFO, "   Using smtp notification");
+               log_message(LOG_INFO, "   Using smtp notification");
 }
 
 void
@@ -324,6 +327,9 @@ void
 alloc_vrrp_vip(vector strvec)
 {
        vrrp_rt *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
+       if (vrrp->ifp == NULL) {
+               log_message(LOG_ERR, "Configuration error: VRRP definition must belong to an interface");
+       }
 
        if (LIST_ISEMPTY(vrrp->vip))
                vrrp->vip = alloc_list(free_ipaddress, dump_ipaddress);
@@ -386,7 +392,7 @@ alloc_vrrp_data(void)
 
        new = (vrrp_conf_data *) MALLOC(sizeof (vrrp_conf_data));
        new->vrrp = alloc_list(free_vrrp, dump_vrrp);
-       new->vrrp_index = alloc_mlist(NULL, NULL, 255);
+       new->vrrp_index = alloc_mlist(NULL, NULL, 255+1);
        new->vrrp_index_fd = alloc_mlist(NULL, NULL, 1024+1);
        new->vrrp_sync_group = alloc_list(free_vgroup, dump_vgroup);
        new->vrrp_script = alloc_list(free_vscript, dump_vscript);
@@ -400,7 +406,7 @@ free_vrrp_data(vrrp_conf_data * vrrp_data_obj)
 {
        free_list(vrrp_data_obj->static_addresses);
        free_list(vrrp_data_obj->static_routes);
-       free_mlist(vrrp_data_obj->vrrp_index, 255);
+       free_mlist(vrrp_data_obj->vrrp_index, 255+1);
        free_mlist(vrrp_data_obj->vrrp_index_fd, 1024+1);
        free_list(vrrp_data_obj->vrrp);
        free_list(vrrp_data_obj->vrrp_sync_group);
@@ -413,23 +419,23 @@ void
 dump_vrrp_data(vrrp_conf_data * vrrp_data_obj)
 {
        if (!LIST_ISEMPTY(vrrp_data_obj->static_addresses)) {
-               syslog(LOG_INFO, "------< Static Addresses >------");
+               log_message(LOG_INFO, "------< Static Addresses >------");
                dump_list(vrrp_data_obj->static_addresses);
        }
        if (!LIST_ISEMPTY(vrrp_data_obj->static_routes)) {
-               syslog(LOG_INFO, "------< Static Routes >------");
+               log_message(LOG_INFO, "------< Static Routes >------");
                dump_list(vrrp_data_obj->static_routes);
        }
        if (!LIST_ISEMPTY(vrrp_data_obj->vrrp)) {
-               syslog(LOG_INFO, "------< VRRP Topology >------");
+               log_message(LOG_INFO, "------< VRRP Topology >------");
                dump_list(vrrp_data_obj->vrrp);
        }
        if (!LIST_ISEMPTY(vrrp_data_obj->vrrp_sync_group)) {
-               syslog(LOG_INFO, "------< VRRP Sync groups >------");
+               log_message(LOG_INFO, "------< VRRP Sync groups >------");
                dump_list(vrrp_data_obj->vrrp_sync_group);
        }
        if (!LIST_ISEMPTY(vrrp_data_obj->vrrp_script)) {
-               syslog(LOG_INFO, "------< VRRP Scripts >------");
+               log_message(LOG_INFO, "------< VRRP Scripts >------");
                dump_list(vrrp_data_obj->vrrp_script);
        }
 }
index ee3ae1b..257efbd 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Interfaces manipulation.
  *
- * Version:     $Id: vrrp_if.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: vrrp_if.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 /* global include */
@@ -55,6 +55,7 @@ typedef __uint8_t u8;
 #include "vrrp_netlink.h"
 #include "memory.h"
 #include "utils.h"
+#include "logger.h"
 
 /* Global vars */
 static list if_queue;
@@ -85,14 +86,17 @@ if_get_by_ifname(const char *ifname)
        interface *ifp;
        element e;
 
-       if (LIST_ISEMPTY(if_queue))
+       if (LIST_ISEMPTY(if_queue)) {
+               log_message(LOG_ERR, "Interface queue is empty");
                return NULL;
+       }
 
        for (e = LIST_HEAD(if_queue); e; ELEMENT_NEXT(e)) {
                ifp = ELEMENT_DATA(e);
                if (!strcmp(ifp->ifname, ifname))
                        return ifp;
        }
+       log_message(LOG_ERR, "No such interface, %s", ifname);
        return NULL;
 }
 
@@ -106,7 +110,7 @@ if_mii_read(const int fd, const int phy_id, int location)
        data[1] = location;
 
        if (ioctl(fd, SIOCGMIIREG, &ifr) < 0) {
-               syslog(LOG_ERR, "SIOCGMIIREG on %s failed: %s", ifr.ifr_name,
+               log_message(LOG_ERR, "SIOCGMIIREG on %s failed: %s", ifr.ifr_name,
                       strerror(errno));
                return -1;
        }
@@ -142,7 +146,7 @@ if_mii_status(const int fd)
 // if_mii_dump(mii_regs, phy_id);
 
        if (mii_regs[0] == 0xffff) {
-               syslog(LOG_ERR, "No MII transceiver present for %s !!!",
+               log_message(LOG_ERR, "No MII transceiver present for %s !!!",
                       ifr.ifr_name);
                return -1;
        }
@@ -249,47 +253,47 @@ dump_if(void *if_data_obj)
 {
        interface *ifp = if_data_obj;
 
-       syslog(LOG_INFO, "------< NIC >------");
-       syslog(LOG_INFO, " Name = %s", ifp->ifname);
-       syslog(LOG_INFO, " index = %d", ifp->ifindex);
-       syslog(LOG_INFO, " address = %s", inet_ntop2(ifp->address));
+       log_message(LOG_INFO, "------< NIC >------");
+       log_message(LOG_INFO, " Name = %s", ifp->ifname);
+       log_message(LOG_INFO, " index = %d", ifp->ifindex);
+       log_message(LOG_INFO, " address = %s", inet_ntop2(ifp->address));
 
        /* FIXME: Harcoded for ethernet */
        if (ifp->hw_type == ARPHRD_ETHER)
-               syslog(LOG_INFO, " MAC = %.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
+               log_message(LOG_INFO, " MAC = %.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
                       ifp->hw_addr[0], ifp->hw_addr[1], ifp->hw_addr[2]
                       , ifp->hw_addr[3], ifp->hw_addr[4], ifp->hw_addr[5]);
 
        if (ifp->flags & IFF_UP)
-               syslog(LOG_INFO, " is UP");
+               log_message(LOG_INFO, " is UP");
 
        if (ifp->flags & IFF_RUNNING)
-               syslog(LOG_INFO, " is RUNNING");
+               log_message(LOG_INFO, " is RUNNING");
 
        if (!(ifp->flags & IFF_UP) && !(ifp->flags & IFF_RUNNING))
-               syslog(LOG_INFO, " is DOWN");
+               log_message(LOG_INFO, " is DOWN");
 
-       syslog(LOG_INFO, " MTU = %d", ifp->mtu);
+       log_message(LOG_INFO, " MTU = %d", ifp->mtu);
 
        switch (ifp->hw_type) {
        case ARPHRD_LOOPBACK:
-               syslog(LOG_INFO, " HW Type = LOOPBACK");
+               log_message(LOG_INFO, " HW Type = LOOPBACK");
                break;
        case ARPHRD_ETHER:
-               syslog(LOG_INFO, " HW Type = ETHERNET");
+               log_message(LOG_INFO, " HW Type = ETHERNET");
                break;
        default:
-               syslog(LOG_INFO, " HW Type = UNKNOWN");
+               log_message(LOG_INFO, " HW Type = UNKNOWN");
                break;
        }
 
        /* MII channel supported ? */
        if (IF_MII_SUPPORTED(ifp))
-               syslog(LOG_INFO, " NIC support MII regs");
+               log_message(LOG_INFO, " NIC support MII regs");
        else if (IF_ETHTOOL_SUPPORTED(ifp))
-               syslog(LOG_INFO, " NIC support EHTTOOL GLINK interface");
+               log_message(LOG_INFO, " NIC support EHTTOOL GLINK interface");
        else
-               syslog(LOG_INFO, " Enabling NIC ioctl refresh polling");
+               log_message(LOG_INFO, " Enabling NIC ioctl refresh polling");
 }
 
 static void
@@ -382,10 +386,10 @@ init_interface_queue(void)
 //     dump_list(if_queue);
        netlink_interface_lookup();
 #ifdef _WITH_LINKWATCH_
-       syslog(LOG_INFO, "Using LinkWatch kernel netlink reflector...");
+         log_message(LOG_INFO, "Using LinkWatch kernel netlink reflector...");
 #else
-       syslog(LOG_INFO, "Using MII-BMSR NIC polling thread...");
-       init_if_linkbeat();
+         log_message(LOG_INFO, "Using MII-BMSR NIC polling thread...");
+         init_if_linkbeat();
 #endif
 }
 
@@ -411,7 +415,7 @@ if_join_vrrp_group(int sd, interface *ifp, int proto)
        ret = setsockopt(sd, IPPROTO_IP, IP_ADD_MEMBERSHIP,
                         (char *) &req_add, sizeof (struct ip_mreqn));
        if (ret < 0) {
-               syslog(LOG_INFO, "cant do IP_ADD_MEMBERSHIP errno=%s (%d)",
+               log_message(LOG_INFO, "cant do IP_ADD_MEMBERSHIP errno=%s (%d)",
                       strerror(errno), errno);
                close(sd);
                return -1;
@@ -438,7 +442,7 @@ if_leave_vrrp_group(int sd, interface *ifp)
        ret = setsockopt(sd, IPPROTO_IP, IP_DROP_MEMBERSHIP,
                         (char *) &req_add, sizeof (struct ip_mreqn));
        if (ret < 0) {
-               syslog(LOG_INFO, "cant do IP_DROP_MEMBERSHIP errno=%s (%d)",
+               log_message(LOG_INFO, "cant do IP_DROP_MEMBERSHIP errno=%s (%d)",
                       strerror(errno), errno);
                return;
        }
@@ -468,7 +472,7 @@ if_setsockopt_bindtodevice(int sd, interface *ifp)
                         , strlen(IF_NAME(ifp)) + 1);
        if (ret < 0) {
                int err = errno;
-               syslog(LOG_INFO,
+               log_message(LOG_INFO,
                       "cant bind to device %s. errno=%d. (try to run it as root)",
                       IF_NAME(ifp), err);
                close(sd);
@@ -488,7 +492,7 @@ if_setsockopt_hdrincl(int sd)
        ret = setsockopt(sd, IPPROTO_IP, IP_HDRINCL, &on, sizeof(on));
        if (ret < 0) {
                int err = errno;
-               syslog(LOG_INFO, "cant set HDRINCL IP option. errno=%d.", err);
+               log_message(LOG_INFO, "cant set HDRINCL IP option. errno=%d.", err);
                close(sd);
                return -1;
        }
@@ -506,7 +510,7 @@ if_setsockopt_mcast_loop(int sd)
        ret = setsockopt(sd, IPPROTO_IP, IP_MULTICAST_LOOP, &loop, sizeof(loop));
        if (ret < 0) {
                int err = errno;
-               syslog(LOG_INFO, "cant set MULTICAST_LOOP IP option. errno=%d.", err);
+               log_message(LOG_INFO, "cant set MULTICAST_LOOP IP option. errno=%d.", err);
                close(sd);
                return -1;
        }
index 062c6ae..243f446 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        VRRP instance index table.
  *
- * Version:     $Id: vrrp_index.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: vrrp_index.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 /* local include */
index c61dc1c..b0974ac 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        NETLINK IPv4 address manipulation.
  *
- * Version:     $Id: vrrp_ipaddress.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: vrrp_ipaddress.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 /* local include */
 #include "vrrp_ipaddress.h"
 #include "vrrp_netlink.h"
 #include "vrrp_data.h"
+#include "logger.h"
 #include "memory.h"
 #include "utils.h"
 
@@ -103,7 +104,7 @@ 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%s%s"
+       log_message(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)
@@ -137,7 +138,7 @@ alloc_ipaddress(list ip_list, vector strvec, interface *ifp)
                if (!strcmp(str, "dev")) {
                        new->ifp = if_get_by_ifname(VECTOR_SLOT(strvec, ++i));
                        if (!new->ifp) {
-                               syslog(LOG_INFO, "VRRP is trying to assign VIP to unknown %s"
+                               log_message(LOG_INFO, "VRRP is trying to assign VIP to unknown %s"
                                       " interface !!! go out and fixe your conf !!!",
                                       (char *)VECTOR_SLOT(strvec, i));
                                FREE(new);
@@ -193,7 +194,7 @@ clear_diff_address(list l, list n)
 
        /* All addresses removed */
        if (LIST_ISEMPTY(n)) {
-               syslog(LOG_INFO, "Removing a VIP|E-VIP block");
+               log_message(LOG_INFO, "Removing a VIP|E-VIP block");
                netlink_iplist_ipv4(l, IPADDRESS_DEL);
                return;
        }
@@ -201,7 +202,7 @@ clear_diff_address(list l, list n)
        for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) {
                ipaddress = ELEMENT_DATA(e);
                if (!address_exist(n, ipaddress) && ipaddress->set) {
-                       syslog(LOG_INFO, "ip address %s/%d dev %s, no longer exist"
+                       log_message(LOG_INFO, "ip address %s/%d dev %s, no longer exist"
                               , inet_ntop2(ipaddress->addr)
                               , ipaddress->mask
                               , IF_NAME(if_get_by_ifindex(ipaddress->ifindex)));
index f1d6e3d..22c2072 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        NETLINK IPv4 routes manipulation.
  *
- * Version:     $Id: vrrp_iproute.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: vrrp_iproute.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 /* local include */
@@ -27,6 +27,7 @@
 #include "vrrp_netlink.h"
 #include "vrrp_if.h"
 #include "vrrp_data.h"
+#include "logger.h"
 #include "memory.h"
 #include "utils.h"
 
@@ -41,6 +42,10 @@ netlink_route_ipv4(ip_route *iproute, int cmd)
                char buf[1024];
        } req;
 
+       char buf[1024];
+       struct rtattr *rta = (void*)buf;
+       struct rtnexthop *rtnh;
+
        memset(&req, 0, sizeof (req));
 
        req.n.nlmsg_len   = NLMSG_LENGTH(sizeof(struct rtmsg));
@@ -55,12 +60,31 @@ netlink_route_ipv4(ip_route *iproute, int cmd)
                req.r.rtm_scope = iproute->scope;
                req.r.rtm_type = RTN_UNICAST;
        }
+       if (iproute->blackhole)
+               req.r.rtm_type = RTN_BLACKHOLE;
 
        /* Set routing entry */
        req.r.rtm_dst_len = iproute->dmask;
        addattr_l(&req.n, sizeof(req), RTA_DST,         &iproute->dst, 4);
-       addattr_l(&req.n, sizeof(req), RTA_GATEWAY,     &iproute->gw,  4);
-       if (iproute->index)
+       if ((!iproute->blackhole) && (!iproute->gw2))
+               addattr_l(&req.n, sizeof(req), RTA_GATEWAY, &iproute->gw,  4);
+       if (iproute->gw2) {
+               rta->rta_type = RTA_MULTIPATH;
+               rta->rta_len = RTA_LENGTH(0);
+               rtnh = RTA_DATA(rta);
+#define MULTIPATH_ADD_GW(x) \
+       memset(rtnh, 0, sizeof(*rtnh)); \
+       rtnh->rtnh_len = sizeof(*rtnh); \
+       if (iproute->index) rtnh->rtnh_ifindex = iproute->index; \
+       rta->rta_len += rtnh->rtnh_len; \
+       rta_addattr_l(rta, 1024, RTA_GATEWAY, x, 4); \
+       rtnh->rtnh_len += sizeof(struct rtattr) + 4; \
+       rtnh = RTNH_NEXT(rtnh);
+               MULTIPATH_ADD_GW(&iproute->gw);
+               MULTIPATH_ADD_GW(&iproute->gw2);
+               addattr_l(&req.n, sizeof(req), RTA_MULTIPATH, RTA_DATA(rta), RTA_PAYLOAD(rta));
+       }
+       if ((iproute->index) && (!iproute->gw2))
                addattr32(&req.n, sizeof(req), RTA_OIF, iproute->index);
        if (iproute->src)
                addattr_l(&req.n, sizeof(req), RTA_PREFSRC, &iproute->src, 4);
@@ -108,6 +132,9 @@ dump_iproute(void *rt_data_obj)
        char *log_msg = MALLOC(150);
        char *tmp = MALLOC(30);
 
+       if (route->blackhole) {
+               strncat(log_msg, "blackhole ", 30);
+       }
        if (route->dst) {
                snprintf(tmp, 30, "%s/%d", inet_ntop2(route->dst), route->dmask);
                strncat(log_msg, tmp, 30);
@@ -116,6 +143,10 @@ dump_iproute(void *rt_data_obj)
                snprintf(tmp, 30, " gw %s", inet_ntop2(route->gw));
                strncat(log_msg, tmp, 30);
        }
+       if (route->gw2) {
+               snprintf(tmp, 30, " or gw %s", inet_ntop2(route->gw2));
+               strncat(log_msg, tmp, 30);
+       }
        if (route->src) {
                snprintf(tmp, 30, " src %s", inet_ntop2(route->src));
                strncat(log_msg, tmp, 30);
@@ -139,7 +170,7 @@ dump_iproute(void *rt_data_obj)
                strncat(log_msg, tmp, 30);
        }
 
-       syslog(LOG_INFO, "     %s", log_msg);
+       log_message(LOG_INFO, "     %s", log_msg);
 
        FREE(tmp);
        FREE(log_msg);
@@ -160,14 +191,19 @@ alloc_route(list rt_list, vector strvec)
                str = VECTOR_SLOT(strvec, i);
 
                /* cmd parsing */
-               if (!strcmp(str, "via") || !strcmp(str, "gw")) {
+               if (!strcmp(str, "blackhole")) {
+                       new->blackhole = 1;
+                       inet_ston(VECTOR_SLOT(strvec, ++i), &new->dst);
+               } else if (!strcmp(str, "via") || !strcmp(str, "gw")) {
                        inet_ston(VECTOR_SLOT(strvec, ++i), &new->gw);
+               } else if (!strcmp(str, "or")) {
+                       inet_ston(VECTOR_SLOT(strvec, ++i), &new->gw2);
                } else if (!strcmp(str, "src")) {
                        inet_ston(VECTOR_SLOT(strvec, ++i), &new->src);
                } else if (!strcmp(str, "dev") || !strcmp(str, "oif")) {
                        ifp = if_get_by_ifname(VECTOR_SLOT(strvec, ++i));
                        if (!ifp) {
-                               syslog(LOG_INFO, "VRRP is trying to assign VROUTE to unknown "
+                               log_message(LOG_INFO, "VRRP is trying to assign VROUTE to unknown "
                                       "%s interface !!! go out and fixe your conf !!!",
                                       (char *)VECTOR_SLOT(strvec, i));
                                FREE(new);
@@ -223,7 +259,7 @@ clear_diff_routes(list l, list n)
 
        /* All Static routes removed */
        if (LIST_ISEMPTY(n)) {
-               syslog(LOG_INFO, "Removing a VirtualRoute block");
+               log_message(LOG_INFO, "Removing a VirtualRoute block");
                netlink_rtlist_ipv4(l, IPROUTE_DEL);
                return;
        }
@@ -231,7 +267,7 @@ clear_diff_routes(list l, list n)
        for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) {
                iproute = ELEMENT_DATA(e);
                if (!route_exist(n, iproute) && iproute->set) {
-                       syslog(LOG_INFO, "ip route %s/%d ... , no longer exist"
+                       log_message(LOG_INFO, "ip route %s/%d ... , no longer exist"
                               , inet_ntop2(iproute->dst), iproute->dmask);
                        netlink_route_ipv4(iproute, IPROUTE_DEL);
                }
index 2caa575..81e028c 100644 (file)
@@ -7,7 +7,7 @@
  *              authentication data encryption using HMAC MD5 according to
  *              RFCs 2085 & 2104.
  *
- * Version:     $Id: vrrp_ipsecah.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: vrrp_ipsecah.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -21,7 +21,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #include "vrrp_ipsecah.h"
index d7375ca..a603840 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        NETLINK kernel command channel.
  *
- * Version:     $Id: vrrp_netlink.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: vrrp_netlink.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 /* global include */
@@ -40,6 +40,7 @@
 #include "check_api.h"
 #include "vrrp_netlink.h"
 #include "vrrp_if.h"
+#include "logger.h"
 #include "memory.h"
 #include "scheduler.h"
 #include "utils.h"
@@ -52,21 +53,21 @@ struct nl_handle nl_cmd;    /* Command channel */
 int
 netlink_socket(struct nl_handle *nl, unsigned long groups)
 {
-       int addr_len;
+       socklen_t addr_len;
        int ret;
 
        memset(nl, 0, sizeof (nl));
 
        nl->fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
        if (nl->fd < 0) {
-               syslog(LOG_INFO, "Netlink: Cannot open netlink socket : (%s)",
+               log_message(LOG_INFO, "Netlink: Cannot open netlink socket : (%s)",
                       strerror(errno));
                return -1;
        }
 
        ret = fcntl(nl->fd, F_SETFL, O_NONBLOCK);
        if (ret < 0) {
-               syslog(LOG_INFO,
+               log_message(LOG_INFO,
                       "Netlink: Cannot set netlink socket flags : (%s)",
                       strerror(errno));
                close(nl->fd);
@@ -79,7 +80,7 @@ netlink_socket(struct nl_handle *nl, unsigned long groups)
 
        ret = bind(nl->fd, (struct sockaddr *) &nl->snl, sizeof (nl->snl));
        if (ret < 0) {
-               syslog(LOG_INFO, "Netlink: Cannot bind netlink socket : (%s)",
+               log_message(LOG_INFO, "Netlink: Cannot bind netlink socket : (%s)",
                       strerror(errno));
                close(nl->fd);
                return -1;
@@ -88,14 +89,14 @@ netlink_socket(struct nl_handle *nl, unsigned long groups)
        addr_len = sizeof (nl->snl);
        ret = getsockname(nl->fd, (struct sockaddr *) &nl->snl, &addr_len);
        if (ret < 0 || addr_len != sizeof (nl->snl)) {
-               syslog(LOG_INFO, "Netlink: Cannot getsockname : (%s)",
+               log_message(LOG_INFO, "Netlink: Cannot getsockname : (%s)",
                       strerror(errno));
                close(nl->fd);
                return -1;
        }
 
        if (nl->snl.nl_family != AF_NETLINK) {
-               syslog(LOG_INFO, "Netlink: Wrong address family %d",
+               log_message(LOG_INFO, "Netlink: Wrong address family %d",
                       nl->snl.nl_family);
                close(nl->fd);
                return -1;
@@ -119,13 +120,13 @@ int
 netlink_set_block(struct nl_handle *nl, int *flags)
 {
        if ((*flags = fcntl(nl->fd, F_GETFL, 0)) < 0) {
-               syslog(LOG_INFO, "Netlink: Cannot F_GETFL socket : (%s)",
+               log_message(LOG_INFO, "Netlink: Cannot F_GETFL socket : (%s)",
                       strerror(errno));
                return -1;
        }
        *flags &= ~O_NONBLOCK;
        if (fcntl(nl->fd, F_SETFL, *flags) < 0) {
-               syslog(LOG_INFO, "Netlink: Cannot F_SETFL socket : (%s)",
+               log_message(LOG_INFO, "Netlink: Cannot F_SETFL socket : (%s)",
                       strerror(errno));
                return -1;
        }
@@ -138,7 +139,7 @@ netlink_set_nonblock(struct nl_handle *nl, int *flags)
 {
        *flags |= O_NONBLOCK;
        if (fcntl(nl->fd, F_SETFL, *flags) < 0) {
-               syslog(LOG_INFO, "Netlink: Cannot F_SETFL socket : (%s)",
+               log_message(LOG_INFO, "Netlink: Cannot F_SETFL socket : (%s)",
                       strerror(errno));
                return -1;
        }
@@ -179,6 +180,23 @@ addattr_l(struct nlmsghdr *n, int maxlen, int type, void *data_obj, int alen)
        return 0;
 }
 
+int rta_addattr_l(struct rtattr *rta, int maxlen, int type,
+                 const void *data, int alen)
+{
+       struct rtattr *subrta;
+       int len = RTA_LENGTH(alen);
+
+       if (RTA_ALIGN(rta->rta_len) + RTA_ALIGN(len) > maxlen) {
+               return -1;
+       }
+       subrta = (struct rtattr*)(((char*)rta) + RTA_ALIGN(rta->rta_len));
+       subrta->rta_type = type;
+       subrta->rta_len = len;
+       memcpy(RTA_DATA(subrta), data, alen);
+       rta->rta_len = NLMSG_ALIGN(rta->rta_len) + RTA_ALIGN(len);
+       return 0;
+}
+
 static void
 parse_rtattr(struct rtattr **tb, int max, struct rtattr *rta, int len)
 {
@@ -245,17 +263,17 @@ netlink_parse_info(int (*filter) (struct sockaddr_nl *, struct nlmsghdr *),
                                continue;
                        if (errno == EWOULDBLOCK || errno == EAGAIN)
                                break;
-                       syslog(LOG_INFO, "Netlink: Received message overrun");
+                       log_message(LOG_INFO, "Netlink: Received message overrun");
                        continue;
                }
 
                if (status == 0) {
-                       syslog(LOG_INFO, "Netlink: EOF");
+                       log_message(LOG_INFO, "Netlink: EOF");
                        return -1;
                }
 
                if (msg.msg_namelen != sizeof snl) {
-                       syslog(LOG_INFO,
+                       log_message(LOG_INFO,
                               "Netlink: Sender address length error: length %d",
                               msg.msg_namelen);
                        return -1;
@@ -282,11 +300,11 @@ netlink_parse_info(int (*filter) (struct sockaddr_nl *, struct nlmsghdr *),
                                }
 
                                if (h->nlmsg_len < NLMSG_LENGTH(sizeof (struct nlmsgerr))) {
-                                       syslog(LOG_INFO,
+                                       log_message(LOG_INFO,
                                               "Netlink: error: message truncated");
                                        return -1;
                                }
-                               syslog(LOG_INFO,
+                               log_message(LOG_INFO,
                                       "Netlink: error: %s, type=(%u), seq=%u, pid=%d",
                                       strerror(-err->error),
                                       err->msg.nlmsg_type,
@@ -297,13 +315,13 @@ netlink_parse_info(int (*filter) (struct sockaddr_nl *, struct nlmsghdr *),
 
                        /* Skip unsolicited messages from cmd channel */
                        if (nl != &nl_cmd && h->nlmsg_pid == nl_cmd.snl.nl_pid) {
-                               syslog(LOG_INFO, "Netlink: skipping nl_cmd msg...");
+                               log_message(LOG_INFO, "Netlink: skipping nl_cmd msg...");
                                continue;
                        }
 
                        error = (*filter) (&snl, h);
                        if (error < 0) {
-                               syslog(LOG_INFO,
+                               log_message(LOG_INFO,
                                       "Netlink: filter function error");
                                ret = error;
                        }
@@ -311,11 +329,11 @@ netlink_parse_info(int (*filter) (struct sockaddr_nl *, struct nlmsghdr *),
 
                /* After error care. */
                if (msg.msg_flags & MSG_TRUNC) {
-                       syslog(LOG_INFO, "Netlink: error: message truncated");
+                       log_message(LOG_INFO, "Netlink: error: message truncated");
                        continue;
                }
                if (status) {
-                       syslog(LOG_INFO, "Netlink: error: data remnant size %d",
+                       log_message(LOG_INFO, "Netlink: error: data remnant size %d",
                               status);
                        return -1;
                }
@@ -328,7 +346,7 @@ netlink_parse_info(int (*filter) (struct sockaddr_nl *, struct nlmsghdr *),
 static int
 netlink_talk_filter(struct sockaddr_nl *snl, struct nlmsghdr *h)
 {
-       syslog(LOG_INFO, "Netlink: ignoring message type 0x%04x",
+       log_message(LOG_INFO, "Netlink: ignoring message type 0x%04x",
               h->nlmsg_type);
        return 0;
 }
@@ -354,7 +372,7 @@ netlink_talk(struct nl_handle *nl, struct nlmsghdr *n)
        /* Send message to netlink interface. */
        status = sendmsg(nl->fd, &msg, 0);
        if (status < 0) {
-               syslog(LOG_INFO, "Netlink: sendmsg() error: %s",
+               log_message(LOG_INFO, "Netlink: sendmsg() error: %s",
                       strerror(errno));
                return -1;
        }
@@ -362,7 +380,7 @@ netlink_talk(struct nl_handle *nl, struct nlmsghdr *n)
        /* Set blocking flag */
        ret = netlink_set_block(nl, &flags);
        if (ret < 0)
-               syslog(LOG_INFO, "Netlink: Warning, couldn't set "
+               log_message(LOG_INFO, "Netlink: Warning, couldn't set "
                       "blocking flag to netlink socket...");
 
        status = netlink_parse_info(netlink_talk_filter, nl);
@@ -398,7 +416,7 @@ netlink_request(struct nl_handle *nl, int family, int type)
        status = sendto(nl->fd, (void *) &req, sizeof (req)
                        , 0, (struct sockaddr *) &snl, sizeof (snl));
        if (status < 0) {
-               syslog(LOG_INFO, "Netlink: sendto() failed: %s",
+               log_message(LOG_INFO, "Netlink: sendto() failed: %s",
                       strerror(errno));
                return -1;
        }
@@ -447,7 +465,7 @@ netlink_if_link_filter(struct sockaddr_nl *snl, struct nlmsghdr *h)
                int hw_addr_len = RTA_PAYLOAD(tb[IFLA_ADDRESS]);
 
                if (hw_addr_len > IF_HWADDR_MAX)
-                       syslog(LOG_ERR, "MAC address for %s is too large: %d",
+                       log_message(LOG_ERR, "MAC address for %s is too large: %d",
                               name, hw_addr_len);
                else {
                        ifp->hw_addr_len = hw_addr_len;
@@ -541,7 +559,7 @@ netlink_interface_lookup(void)
        /* Set blocking flag */
        ret = netlink_set_block(&nlh, &flags);
        if (ret < 0)
-               syslog(LOG_INFO, "Netlink: 1Warning, couldn't set "
+               log_message(LOG_INFO, "Netlink: 1Warning, couldn't set "
                       "blocking flag to netlink socket...");
 
        /* Interface lookup */
@@ -570,7 +588,7 @@ netlink_address_lookup(void)
        /* Set blocking flag */
        ret = netlink_set_block(&nlh, &flags);
        if (ret < 0)
-               syslog(LOG_INFO, "Netlink: 2Warning, couldn't set "
+               log_message(LOG_INFO, "Netlink: 2Warning, couldn't set "
                       "blocking flag to netlink socket...");
 
        /* Address lookup */
@@ -637,7 +655,7 @@ netlink_broadcast_filter(struct sockaddr_nl *snl, struct nlmsghdr *h)
                return netlink_if_address_filter(snl, h);
                break;
        default:
-               syslog(LOG_INFO,
+               log_message(LOG_INFO,
                       "Kernel is reflecting an unknown netlink nlmsg_type: %d",
                       h->nlmsg_type);
                break;
@@ -674,18 +692,18 @@ kernel_netlink_init(void)
        netlink_socket(&nl_kernel, groups);
 
        if (nl_kernel.fd > 0) {
-               syslog(LOG_INFO, "Registering Kernel netlink reflector");
+               log_message(LOG_INFO, "Registering Kernel netlink reflector");
                thread_add_read(master, kernel_netlink, NULL, nl_kernel.fd,
                                NETLINK_TIMER);
        } else
-               syslog(LOG_INFO, "Error while registering Kernel netlink reflector channel");
+               log_message(LOG_INFO, "Error while registering Kernel netlink reflector channel");
 
        /* Prepare netlink command channel. */
        netlink_socket(&nl_cmd, 0);
        if (nl_cmd.fd > 0)
-               syslog(LOG_INFO, "Registering Kernel netlink command channel");
+               log_message(LOG_INFO, "Registering Kernel netlink command channel");
        else
-               syslog(LOG_INFO, "Error while registering Kernel netlink cmd channel");
+               log_message(LOG_INFO, "Error while registering Kernel netlink cmd channel");
 }
 
 void
index ada7efe..7320982 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        VRRP state transition notification scripts handling.
  *
- * Version:     $Id: vrrp_notify.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: vrrp_notify.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 /* system include */
@@ -29,6 +29,7 @@
 #include "vrrp_notify.h"
 #include "memory.h"
 #include "notify.h"
+#include "logger.h"
 
 static char *
 get_iscript(vrrp_rt * vrrp, int state)
@@ -92,9 +93,10 @@ notify_script_name(char *cmdline)
 static int
 script_open_litteral(char *script)
 {
+       log_message(LOG_DEBUG, "Opening script file %s",script);
        FILE *fOut = fopen(script, "r");;
        if (!fOut) {
-               syslog(LOG_INFO, "Can't open %s (errno %d %s)", script,
+               log_message(LOG_INFO, "Can't open %s (errno %d %s)", script,
                       errno, strerror(errno));
                return 0;
        }
index 3131c3c..c27449b 100644 (file)
@@ -7,7 +7,7 @@
  *              data structure representation the conf file representing
  *              the loadbalanced server pool.
  *  
- * Version:     $Id: vrrp_parser.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: vrrp_parser.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -21,7 +21,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #include "vrrp_parser.h"
@@ -32,6 +32,7 @@
 #include "vrrp.h"
 #include "global_data.h"
 #include "global_parser.h"
+#include "logger.h"
 #include "parser.h"
 #include "memory.h"
 
@@ -152,8 +153,8 @@ vrrp_vrid_handler(vector strvec)
        vrrp->vrid = atoi(VECTOR_SLOT(strvec, 1));
 
        if (VRRP_IS_BAD_VID(vrrp->vrid)) {
-               syslog(LOG_INFO, "VRRP Error : VRID not valid !\n");
-               syslog(LOG_INFO,
+               log_message(LOG_INFO, "VRRP Error : VRID not valid !\n");
+               log_message(LOG_INFO,
                       "             must be between 1 & 255. reconfigure !\n");
        } else
                alloc_vrrp_bucket(vrrp);
@@ -165,10 +166,10 @@ vrrp_prio_handler(vector strvec)
        vrrp->effective_priority = vrrp->base_priority = atoi(VECTOR_SLOT(strvec, 1));
 
        if (VRRP_IS_BAD_PRIORITY(vrrp->base_priority)) {
-               syslog(LOG_INFO, "VRRP Error : Priority not valid !\n");
-               syslog(LOG_INFO,
+               log_message(LOG_INFO, "VRRP Error : Priority not valid !\n");
+               log_message(LOG_INFO,
                       "             must be between 1 & 255. reconfigure !\n");
-               syslog(LOG_INFO, "             Using default value : 100\n");
+               log_message(LOG_INFO, "             Using default value : 100\n");
                vrrp->effective_priority = vrrp->base_priority = 100;
        }
 }
@@ -179,10 +180,10 @@ vrrp_adv_handler(vector strvec)
        vrrp->adver_int = atoi(VECTOR_SLOT(strvec, 1));
 
        if (VRRP_IS_BAD_ADVERT_INT(vrrp->adver_int)) {
-               syslog(LOG_INFO, "VRRP Error : Advert interval not valid !\n");
-               syslog(LOG_INFO,
+               log_message(LOG_INFO, "VRRP Error : Advert interval not valid !\n");
+               log_message(LOG_INFO,
                       "             must be between less than 1sec.\n");
-               syslog(LOG_INFO, "             Using default value : 1sec\n");
+               log_message(LOG_INFO, "             Using default value : 1sec\n");
                vrrp->adver_int = 1;
        }
        vrrp->adver_int *= TIMER_HZ;
@@ -194,8 +195,8 @@ vrrp_debug_handler(vector strvec)
        vrrp->debug = atoi(VECTOR_SLOT(strvec, 1));
 
        if (VRRP_IS_BAD_DEBUG_INT(vrrp->debug)) {
-               syslog(LOG_INFO, "VRRP Error : Debug interval not valid !\n");
-               syslog(LOG_INFO, "             must be between 0-4\n");
+               log_message(LOG_INFO, "VRRP Error : Debug interval not valid !\n");
+               log_message(LOG_INFO, "             must be between 0-4\n");
                vrrp->debug = 0;
        }
 }
@@ -218,8 +219,8 @@ vrrp_preempt_delay_handler(vector strvec)
        vrrp->preempt_delay = atoi(VECTOR_SLOT(strvec, 1));
 
        if (VRRP_IS_BAD_PREEMPT_DELAY(vrrp->preempt_delay)) {
-               syslog(LOG_INFO, "VRRP Error : Preempt_delay not valid !\n");
-               syslog(LOG_INFO, "             must be between 0-%d\n",
+               log_message(LOG_INFO, "VRRP Error : Preempt_delay not valid !\n");
+               log_message(LOG_INFO, "             must be between 0-%d\n",
                       TIMER_MAX_SEC);
                vrrp->preempt_delay = 0;
        }
@@ -323,11 +324,11 @@ vrrp_vip_handler(vector strvec)
                        if (VECTOR_SIZE(vec)) {
                                nbvip++;
                                if (nbvip > VRRP_MAX_VIP) {
-                                       syslog(LOG_INFO,
+                                       log_message(LOG_INFO,
                                               "VRRP_Instance(%s) "
                                               "trunc to the first %d VIPs.",
                                               vrrp->iname, VRRP_MAX_VIP);
-                                       syslog(LOG_INFO,
+                                       log_message(LOG_INFO,
                                               "  => Declare others VIPs into"
                                               " the excluded vip block");
                                } else
index 003dd57..1e51787 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Sheduling framework for vrrp code.
  *
- * Version:     $Id: vrrp_scheduler.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: vrrp_scheduler.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #include "vrrp_scheduler.h"
 #include "memory.h"
 #include "notify.h"
 #include "list.h"
+#include "logger.h"
 #include "main.h"
 #include "smtp.h"
+#include "signals.h"
 
 /* VRRP FSM (Finite State Machine) design.
  *
@@ -157,7 +159,7 @@ vrrp_smtp_notifier(vrrp_rt * vrrp)
 static void vrrp_log_int_down(vrrp_rt *vrrp)
 {
        if (!IF_ISUP(vrrp->ifp))
-               syslog(LOG_INFO, "Kernel is reporting: interface %s DOWN",
+               log_message(LOG_INFO, "Kernel is reporting: interface %s DOWN",
                       IF_NAME(vrrp->ifp));
        if (!LIST_ISEMPTY(vrrp->track_ifp))
                vrrp_log_tracked_down(vrrp->track_ifp);
@@ -166,10 +168,10 @@ static void vrrp_log_int_down(vrrp_rt *vrrp)
 static void vrrp_log_int_up(vrrp_rt *vrrp)
 {
        if (IF_ISUP(vrrp->ifp))
-               syslog(LOG_INFO, "Kernel is reporting: interface %s UP",
+               log_message(LOG_INFO, "Kernel is reporting: interface %s UP",
                       IF_NAME(vrrp->ifp));
        if (!LIST_ISEMPTY(vrrp->track_ifp))
-               syslog(LOG_INFO, "Kernel is reporting: tracked interface are UP");
+               log_message(LOG_INFO, "Kernel is reporting: tracked interface are UP");
 }
 
 /*
@@ -218,7 +220,7 @@ vrrp_init_state(list l)
                        }
 
                        if (warning > 0) {
-                               syslog(LOG_INFO, "VRRP_Instance(%s) : ignoring "
+                               log_message(LOG_INFO, "VRRP_Instance(%s) : ignoring "
                                                 "track weights due to SYNC group",
                                       vrrp->iname);
                        }
@@ -248,7 +250,7 @@ vrrp_init_state(list l)
                                               vrrp->lvs_syncd_if, IPVS_BACKUP,
                                               vrrp->vrid);
 #endif
-                       syslog(LOG_INFO, "VRRP_Instance(%s) Entering BACKUP STATE",
+                       log_message(LOG_INFO, "VRRP_Instance(%s) Entering BACKUP STATE",
                               vrrp->iname);
 
                        /* Set BACKUP state */
@@ -299,6 +301,10 @@ vrrp_init_script(list l)
                        vscript->result = VRRP_SCRIPT_STATUS_NONE;
                        thread_add_timer(master, vrrp_script_thread,
                                         vscript, vscript->interval);
+               } else if (vscript->result == VRRP_SCRIPT_STATUS_INIT_GOOD) {
+                       vscript->result = VRRP_SCRIPT_STATUS_GOOD;
+                       thread_add_timer(master, vrrp_script_thread,
+                                        vscript, vscript->interval);
                }
        }
 }
@@ -562,7 +568,7 @@ vrrp_become_master(vrrp_rt * vrrp, char *buffer, int len)
         * with the remote IPSEC AH VRRP instance counter.
         */
        if (iph->protocol == IPPROTO_IPSEC_AH) {
-               syslog(LOG_INFO, "VRRP_Instance(%s) IPSEC-AH : seq_num sync",
+               log_message(LOG_INFO, "VRRP_Instance(%s) IPSEC-AH : seq_num sync",
                       vrrp->iname);
                ah = (ipsec_ah *) (buffer + sizeof (struct iphdr));
                vrrp->ipsecah_counter->seq_number = ntohl(ah->seq_number) + 1;
@@ -579,7 +585,7 @@ vrrp_leave_master(vrrp_rt * vrrp, char *buffer, int len)
 {
        if (!VRRP_ISUP(vrrp)) {
                vrrp_log_int_down(vrrp);
-               vrrp->wantstate = VRRP_STATE_GOTO_FAULT;
+               vrrp->wantstate = VRRP_STATE_FAULT;
                vrrp_state_leave_master(vrrp);
        } else if (vrrp_state_master_rx(vrrp, buffer, len)) {
                vrrp_state_leave_master(vrrp);
@@ -594,7 +600,7 @@ vrrp_ah_sync(vrrp_rt *vrrp)
         * Transition to BACKUP state for AH
         * seq number synchronization.
         */
-       syslog(LOG_INFO, "VRRP_Instance(%s) in FAULT state jump to AH sync",
+       log_message(LOG_INFO, "VRRP_Instance(%s) in FAULT state jump to AH sync",
               vrrp->iname);
        vrrp->wantstate = VRRP_STATE_BACK;
        vrrp_state_leave_master(vrrp);
@@ -609,13 +615,13 @@ vrrp_leave_fault(vrrp_rt * vrrp, char *buffer, int len)
        if (vrrp_state_fault_rx(vrrp, buffer, len)) {
                if (vrrp->sync) {
                        if (vrrp_sync_leave_fault(vrrp)) {
-                               syslog(LOG_INFO,
+                               log_message(LOG_INFO,
                                       "VRRP_Instance(%s) prio is higher than received advert",
                                       vrrp->iname);
                                vrrp_become_master(vrrp, buffer, len);
                        }
                } else {
-                       syslog(LOG_INFO,
+                       log_message(LOG_INFO,
                               "VRRP_Instance(%s) prio is higher than received advert",
                               vrrp->iname);
                        vrrp_become_master(vrrp, buffer, len);
@@ -623,14 +629,14 @@ vrrp_leave_fault(vrrp_rt * vrrp, char *buffer, int len)
        } else {
                if (vrrp->sync) {
                        if (vrrp_sync_leave_fault(vrrp)) {
-                               syslog(LOG_INFO, "VRRP_Instance(%s) Entering BACKUP STATE",
+                               log_message(LOG_INFO, "VRRP_Instance(%s) Entering BACKUP STATE",
                                       vrrp->iname);
                                vrrp->state = VRRP_STATE_BACK;
                                vrrp_smtp_notifier(vrrp);
                                notify_instance_exec(vrrp, VRRP_STATE_BACK);
                        }
                } else {
-                       syslog(LOG_INFO, "VRRP_Instance(%s) Entering BACKUP STATE",
+                       log_message(LOG_INFO, "VRRP_Instance(%s) Entering BACKUP STATE",
                               vrrp->iname);
                        vrrp->state = VRRP_STATE_BACK;
                        vrrp_smtp_notifier(vrrp);
@@ -644,7 +650,7 @@ vrrp_goto_master(vrrp_rt * vrrp)
 {
        if (!VRRP_ISUP(vrrp)) {
                vrrp_log_int_down(vrrp);
-               syslog(LOG_INFO, "VRRP_Instance(%s) Now in FAULT state",
+               log_message(LOG_INFO, "VRRP_Instance(%s) Now in FAULT state",
                       vrrp->iname);
                vrrp->state = VRRP_STATE_FAULT;
                vrrp->ms_down_timer = 3 * vrrp->adver_int + VRRP_TIMER_SKEW(vrrp);
@@ -717,15 +723,15 @@ static void
 vrrp_master(vrrp_rt * vrrp)
 {
        /* Check if interface we are running on is UP */
-       if (vrrp->wantstate != VRRP_STATE_GOTO_FAULT) {
+       if (vrrp->wantstate != VRRP_STATE_FAULT) {
                if (!VRRP_ISUP(vrrp)) {
                        vrrp_log_int_down(vrrp);
-                       vrrp->wantstate = VRRP_STATE_GOTO_FAULT;
+                       vrrp->wantstate = VRRP_STATE_FAULT;
                }
        }
 
        /* Then perform the state transition */
-       if (vrrp->wantstate == VRRP_STATE_GOTO_FAULT ||
+       if (vrrp->wantstate == VRRP_STATE_FAULT ||
            vrrp->wantstate == VRRP_STATE_BACK ||
            vrrp->ipsecah_counter->cycle) {
                vrrp->ms_down_timer =
@@ -735,11 +741,11 @@ vrrp_master(vrrp_rt * vrrp)
                vrrp_state_leave_master(vrrp);
 
                if (vrrp->state == VRRP_STATE_BACK)
-                       syslog(LOG_INFO,
+                       log_message(LOG_INFO,
                               "VRRP_Instance(%s) Now in BACKUP state",
                               vrrp->iname);
                if (vrrp->state == VRRP_STATE_FAULT)
-                       syslog(LOG_INFO, "VRRP_Instance(%s) Now in FAULT state",
+                       log_message(LOG_INFO, "VRRP_Instance(%s) Now in FAULT state",
                               vrrp->iname);
        } else if (vrrp->state == VRRP_STATE_MAST) {
                /*
@@ -922,7 +928,7 @@ vrrp_script_thread(thread * thread_obj)
 
        /* In case of fork is error. */
        if (pid < 0) {
-               syslog(LOG_INFO, "Failed fork process");
+               log_message(LOG_INFO, "Failed fork process");
                return -1;
        }
 
@@ -936,23 +942,12 @@ vrrp_script_thread(thread * thread_obj)
        }
 
        /* Child part */
+       signal_handler_destroy();
        closeall(0);
        open("/dev/null", O_RDWR);
        dup(0);
        dup(0);
 
-       /* Also need to reset the signal state */
-       {
-               sigset_t empty_set;
-               sigemptyset(&empty_set);
-               sigprocmask(SIG_SETMASK, &empty_set, NULL);
-
-               signal(SIGHUP, SIG_DFL);
-               signal(SIGINT, SIG_DFL);
-               signal(SIGTERM, SIG_DFL);
-               signal(SIGKILL, SIG_DFL);
-       }
-
        status = system_call(vscript->script);
 
        if (status < 0 || !WIFEXITED(status))
@@ -988,10 +983,10 @@ vrrp_script_child_thread(thread * thread_obj)
                int status;
                status = WEXITSTATUS(wait_status);
                if (status == 0 && vscript->result != VRRP_SCRIPT_STATUS_GOOD) {
-                       syslog(LOG_INFO, "VRRP_Script(%s) succeeded", vscript->sname);
+                       log_message(LOG_INFO, "VRRP_Script(%s) succeeded", vscript->sname);
                }
                if (status != 0 && vscript->result != VRRP_SCRIPT_STATUS_NONE) {
-                       syslog(LOG_INFO, "VRRP_Script(%s) failed", vscript->sname);
+                       log_message(LOG_INFO, "VRRP_Script(%s) failed", vscript->sname);
                }
                vscript->result = (status == 0) ?  VRRP_SCRIPT_STATUS_GOOD :
                                                   VRRP_SCRIPT_STATUS_NONE;
@@ -1017,7 +1012,7 @@ vrrp_script_child_timeout_thread(thread * thread_obj)
                return 0;
        }
 
-       syslog(LOG_WARNING, "Process [%d] didn't respond to SIGTERM", pid);
+       log_message(LOG_WARNING, "Process [%d] didn't respond to SIGTERM", pid);
        waitpid(pid, NULL, 0);
 
        return 0;
index 5a88be5..b511b32 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        VRRP synchronization framework.
  *
- * Version:     $Id: vrrp_sync.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: vrrp_sync.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #include "vrrp_sync.h"
 #include "vrrp_if.h"
 #include "vrrp_notify.h"
 #include "vrrp_data.h"
+#include "logger.h"
 #include "smtp.h"
 
 /* Compute the new instance sands */
@@ -36,7 +37,7 @@ vrrp_init_instance_sands(vrrp_rt * vrrp)
 
        if (vrrp->state == VRRP_STATE_MAST        ||
            vrrp->state == VRRP_STATE_GOTO_MASTER ||
-           vrrp->state == VRRP_STATE_GOTO_FAULT  ||
+           vrrp->state == VRRP_STATE_FAULT       ||
            vrrp->wantstate == VRRP_STATE_GOTO_MASTER) {
                vrrp->sands.tv_sec = time_now.tv_sec + vrrp->adver_int / TIMER_HZ;
                vrrp->sands.tv_usec = time_now.tv_usec;
@@ -99,7 +100,7 @@ vrrp_sync_group_up(vrrp_sgroup * vgroup)
        }
 
        if (is_up == LIST_SIZE(vgroup->index_list)) {
-               syslog(LOG_INFO, "Kernel is reporting: Group(%s) UP"
+               log_message(LOG_INFO, "Kernel is reporting: Group(%s) UP"
                               , GROUP_NAME(vgroup));
                return 1;
        }
@@ -129,7 +130,7 @@ vrrp_sync_leave_fault(vrrp_rt * vrrp)
        vrrp_sgroup *vgroup = vrrp->sync;
 
        if (vrrp_sync_group_up(vgroup)) {
-               syslog(LOG_INFO, "VRRP_Group(%s) Leaving FAULT state",
+               log_message(LOG_INFO, "VRRP_Group(%s) Leaving FAULT state",
                       GROUP_NAME(vgroup));
                return 1;
        }
@@ -149,7 +150,7 @@ vrrp_sync_master_election(vrrp_rt * vrrp)
        if (GROUP_STATE(vgroup) == VRRP_STATE_FAULT)
                return;
 
-       syslog(LOG_INFO, "VRRP_Group(%s) Transition to MASTER state",
+       log_message(LOG_INFO, "VRRP_Group(%s) Transition to MASTER state",
               GROUP_NAME(vgroup));
 
        /* Perform sync index */
@@ -158,7 +159,7 @@ vrrp_sync_master_election(vrrp_rt * vrrp)
                if (isync != vrrp) {
                        /* Force a new protocol master election */
                        isync->wantstate = VRRP_STATE_GOTO_MASTER;
-                       syslog(LOG_INFO,
+                       log_message(LOG_INFO,
                               "VRRP_Instance(%s) forcing a new MASTER election",
                               isync->iname);
                        vrrp_send_adv(isync, isync->effective_priority);
@@ -177,7 +178,7 @@ vrrp_sync_backup(vrrp_rt * vrrp)
        if (GROUP_STATE(vgroup) == VRRP_STATE_BACK)
                return;
 
-       syslog(LOG_INFO, "VRRP_Group(%s) Syncing instances to BACKUP state",
+       log_message(LOG_INFO, "VRRP_Group(%s) Syncing instances to BACKUP state",
               GROUP_NAME(vgroup));
 
        /* Perform sync index */
@@ -205,7 +206,7 @@ vrrp_sync_master(vrrp_rt * vrrp)
        if (GROUP_STATE(vgroup) == VRRP_STATE_MAST)
                return;
 
-       syslog(LOG_INFO, "VRRP_Group(%s) Syncing instances to MASTER state",
+       log_message(LOG_INFO, "VRRP_Group(%s) Syncing instances to MASTER state",
               GROUP_NAME(vgroup));
 
        /* Perform sync index */
@@ -235,7 +236,7 @@ vrrp_sync_fault(vrrp_rt * vrrp)
        if (GROUP_STATE(vgroup) == VRRP_STATE_FAULT)
                return;
 
-       syslog(LOG_INFO, "VRRP_Group(%s) Syncing instances to FAULT state",
+       log_message(LOG_INFO, "VRRP_Group(%s) Syncing instances to FAULT state",
               GROUP_NAME(vgroup));
 
        /* Perform sync index */
@@ -250,7 +251,7 @@ vrrp_sync_fault(vrrp_rt * vrrp)
                 */
                if (isync != vrrp && isync->state != VRRP_STATE_FAULT) {
                        if (isync->state == VRRP_STATE_MAST)
-                               isync->wantstate = VRRP_STATE_GOTO_FAULT;
+                               isync->wantstate = VRRP_STATE_FAULT;
                        if (isync->state == VRRP_STATE_BACK)
                                isync->state = VRRP_STATE_FAULT;
                }
index 4e5442e..16a731c 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Interface tracking framework.
  *
- * Version:     $Id: vrrp_track.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: vrrp_track.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 /* local include */
 #include "vrrp_track.h"
 #include "vrrp_if.h"
 #include "vrrp_data.h"
+#include "logger.h"
 #include "memory.h"
 
 /* Track interface dump */
@@ -33,7 +34,7 @@ void
 dump_track(void *track_data_obj)
 {
        tracked_if *tip = track_data_obj;
-       syslog(LOG_INFO, "     %s weight %d", IF_NAME(tip->ifp), tip->weight);
+       log_message(LOG_INFO, "     %s weight %d", IF_NAME(tip->ifp), tip->weight);
 }
 void
 alloc_track(list track_list, vector strvec)
@@ -47,7 +48,7 @@ alloc_track(list track_list, vector strvec)
 
        /* Ignoring if no interface found */
        if (!ifp) {
-               syslog(LOG_INFO, "     %s no match, ignoring...", tracked);
+               log_message(LOG_INFO, "     %s no match, ignoring...", tracked);
                return;
        }
 
@@ -55,7 +56,7 @@ alloc_track(list track_list, vector strvec)
            !strcmp(VECTOR_SLOT(strvec, 1), "weight")) {
                weight = atoi(VECTOR_SLOT(strvec, 2));
                if (weight < -254 || weight > 254) {
-                       syslog(LOG_INFO, "     %s: weight must be between "
+                       log_message(LOG_INFO, "     %s: weight must be between "
                                         "[-254..254] inclusive. Ignoring...", tracked);
                        weight = 0;
                }
@@ -68,7 +69,7 @@ alloc_track(list track_list, vector strvec)
        list_add(track_list, tip);
 }
 
-static vrrp_script *
+vrrp_script *
 find_script_by_name(char *name)
 {
        element e;
@@ -90,7 +91,7 @@ void
 dump_track_script(void *track_data_obj)
 {
        tracked_sc *tsc = track_data_obj;
-       syslog(LOG_INFO, "     %s weight %d", tsc->scr->sname, tsc->weight);
+       log_message(LOG_INFO, "     %s weight %d", tsc->scr->sname, tsc->weight);
 }
 void
 alloc_track_script(list track_list, vector strvec)
@@ -104,7 +105,7 @@ alloc_track_script(list track_list, vector strvec)
 
        /* Ignoring if no interface found */
        if (!vsc) {
-               syslog(LOG_INFO, "     %s no match, ignoring...", tracked);
+               log_message(LOG_INFO, "     %s no match, ignoring...", tracked);
                return;
        }
 
@@ -116,7 +117,7 @@ alloc_track_script(list track_list, vector strvec)
                weight = atoi(VECTOR_SLOT(strvec, 2));
                if (weight < -254 || weight > 254) {
                        weight = vsc->weight;
-                       syslog(LOG_INFO, "     %s: weight must be between [-254..254]"
+                       log_message(LOG_INFO, "     %s: weight must be between [-254..254]"
                                         " inclusive, ignoring...",
                               tracked);
                }
@@ -125,8 +126,7 @@ alloc_track_script(list track_list, vector strvec)
        tsc         = (tracked_sc *) MALLOC(sizeof (tracked_sc));
        tsc->scr    = vsc;
        tsc->weight = weight;
-       if (weight != 0)
-               vsc->inuse++;
+       vsc->inuse++;
        list_add(track_list, tsc);
 }
 
@@ -156,7 +156,7 @@ vrrp_log_tracked_down(list l)
        for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) {
                tip = ELEMENT_DATA(e);
                if (!IF_ISUP(tip->ifp))
-                       syslog(LOG_INFO, "Kernel is reporting: interface %s DOWN",
+                       log_message(LOG_INFO, "Kernel is reporting: interface %s DOWN",
                               IF_NAME(tip->ifp));
        }
 }
@@ -189,6 +189,22 @@ vrrp_tracked_weight(list l)
        return weight;
 }
 
+/* Test if all tracked scripts are either OK or weight-tracked */
+int
+vrrp_script_up(list l)
+{
+       element e;
+       tracked_sc *tsc;
+
+       for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) {
+               tsc = ELEMENT_DATA(e);
+               if (!tsc->weight && tsc->scr->result == VRRP_SCRIPT_STATUS_NONE)
+                       return 0;
+       }
+
+       return 1;
+}
+
 /* Returns total weights of all tracked scripts :
  * - a positive weight adds to the global weight when the result is OK
  * - a negative weight subtracts from the global weight when the result is bad
index 4fb2df3..9781426 100644 (file)
@@ -2,7 +2,7 @@
 #
 # Keepalived OpenSource project.
 #
-# Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+# Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
 
 CC      = @CC@
 INCLUDES = -I.
@@ -12,7 +12,7 @@ DEFS   = @DFLAGS@
 COMPILE         = $(CC) $(CFLAGS) $(DEFS)
 
 OBJS =         memory.o utils.o notify.o timer.o scheduler.o \
-       vector.o list.o html.o parser.o signals.o
+       vector.o list.o html.o parser.o signals.o logger.o
 HEADERS = $(OBJS:.o=.h)
 
 .c.o:
@@ -36,3 +36,4 @@ list.o: list.c list.h memory.h
 html.o: html.c html.h memory.h
 parser.o: parser.c parser.h memory.h
 signals.o: signals.c signals.h
+logger.o: logger.c logger.h
index 66f78f0..9b4e673 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        HTML stream parser utility functions.
  *
- * Version:     $Id: html.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: html.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #include <string.h>
index 680d546..4c904b8 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        parser.c include file.
  *
- * Version:     $Id: html.h,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: html.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _HTML_H
index 7fd8931..1af3c13 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        List structure manipulation.
  *  
- * Version:     $Id: list.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: list.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #include "list.h"
index 6884719..bc21dd2 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        list.c include file.
  *  
- * Version:     $Id: list.h,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: list.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _LIST_H
diff --git a/lib/logger.c b/lib/logger.c
new file mode 100644 (file)
index 0000000..2a16a14
--- /dev/null
@@ -0,0 +1,50 @@
+/* 
+ * Soft:        Keepalived is a failover program for the LVS project
+ *              <www.linuxvirtualserver.org>. It monitor & manipulate
+ *              a loadbalanced server pool using multi-layer checks.
+ * 
+ * Part:        logging facility.
+ *  
+ * Version:     $Id: vector.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * 
+ * Author:      Alexandre Cassen, <acassen@linux-vs.org>
+ *              
+ *              This program is distributed in the hope that it will be useful,
+ *              but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *              MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *              See the GNU General Public License for more details.
+ *
+ *              This program is free software; you can redistribute it and/or
+ *              modify it under the terms of the GNU General Public License
+ *              as published by the Free Software Foundation; either version
+ *              2 of the License, or (at your option) any later version.
+ *
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
+ */
+
+#include <syslog.h>
+#include <stdio.h>
+#include <stdarg.h>
+
+/* Boolean flag - send messages to console as well as syslog */
+static int log_console = 0;
+
+void
+enable_console_log(void) {
+       log_console = 1;
+}
+
+void
+log_message(const int facility, const char *format, ...)
+{
+       va_list args;
+
+       va_start(args,format);
+
+       if (log_console) {
+               vfprintf(stderr, format, args);
+               fprintf(stderr,"\n");
+       }
+
+       vsyslog(facility, format, args);
+}
diff --git a/lib/logger.h b/lib/logger.h
new file mode 100644 (file)
index 0000000..77330b2
--- /dev/null
@@ -0,0 +1,31 @@
+/* 
+ * Soft:        Keepalived is a failover program for the LVS project
+ *              <www.linuxvirtualserver.org>. It monitor & manipulate
+ *              a loadbalanced server pool using multi-layer checks.
+ * 
+ * Part:        logging facility.
+ *  
+ * Version:     $Id: vector.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * 
+ * Author:      Alexandre Cassen, <acassen@linux-vs.org>
+ *              
+ *              This program is distributed in the hope that it will be useful,
+ *              but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *              MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *              See the GNU General Public License for more details.
+ *
+ *              This program is free software; you can redistribute it and/or
+ *              modify it under the terms of the GNU General Public License
+ *              as published by the Free Software Foundation; either version
+ *              2 of the License, or (at your option) any later version.
+ *
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
+ */
+
+#ifndef _LOGGER_H
+#define _LOGGER_H
+
+void enable_console_log(void);
+void log_message(int priority, char* format, ...);
+
+#endif
index 0944efc..8646929 100644 (file)
@@ -6,7 +6,7 @@
  * Part:        Memory management framework. This framework is used to
  *              find any memory leak.
  *
- * Version:     $Id: memory.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: memory.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
@@ -21,7 +21,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #include "memory.h"
index 3234994..10137a7 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        memory.c include file.
  *
- * Version:     $Id: memory.h,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: memory.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
@@ -20,7 +20,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _MEMORY_H
index aa90231..5d560a7 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Forked system call to launch an extra script.
  *
- * Version:     $Id: notify.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: notify.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #include <unistd.h>
@@ -27,6 +27,8 @@
 #include <syslog.h>
 #include <fcntl.h>
 #include "notify.h"
+#include "signals.h"
+#include "logger.h"
 
 /* perform a system call */
 int
@@ -38,10 +40,10 @@ system_call(char *cmdline)
 
        if (retval == 127) {
                /* couldn't exec command */
-               syslog(LOG_ALERT, "Couldn't exec command: %s", cmdline);
+               log_message(LOG_ALERT, "Couldn't exec command: %s", cmdline);
        } else if (retval == -1) {
                /* other error */
-               syslog(LOG_ALERT, "Error exec-ing command: %s", cmdline);
+               log_message(LOG_ALERT, "Error exec-ing command: %s", cmdline);
        }
 
        return retval;
@@ -66,7 +68,7 @@ notify_exec(char *cmd)
 
        /* In case of fork is error. */
        if (pid < 0) {
-               syslog(LOG_INFO, "Failed fork process");
+               log_message(LOG_INFO, "Failed fork process");
                return -1;
        }
 
@@ -74,6 +76,7 @@ notify_exec(char *cmd)
        if (pid)
                return 0;
 
+       signal_handler_destroy();
        closeall(0);
 
        open("/dev/null", O_RDWR);
index 95bfaaf..7761ffd 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        notify.c include file.
  *
- * Version:     $Id: notify.h,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: notify.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _NOTIFY_H
index 77eeeaa..3a6d062 100644 (file)
@@ -7,7 +7,7 @@
  *              data structure representation the conf file representing
  *              the loadbalanced server pool.
  *  
- * Version:     $Id: parser.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: parser.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -21,7 +21,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #include <glob.h>
@@ -30,6 +30,7 @@
 #include <errno.h>
 #include "parser.h"
 #include "memory.h"
+#include "logger.h"
 
 /* global vars */
 vector keywords;
@@ -198,10 +199,10 @@ void read_conf_file(char *conf_file)
 
        int i;
        for(i = 0; i < globbuf.gl_pathc; i++){
-               syslog(LOG_INFO, "Opening file '%s'.\n",globbuf.gl_pathv[i]);
+               log_message(LOG_INFO, "Opening file '%s'.\n",globbuf.gl_pathv[i]);
                stream = fopen(globbuf.gl_pathv[i], "r");
                if (!stream) {
-                       syslog(LOG_INFO, "Configuration file '%s' open problem (%s)...\n"
+                       log_message(LOG_INFO, "Configuration file '%s' open problem (%s)...\n"
                                       , globbuf.gl_pathv[i], strerror(errno));
                        return;
                }
index 73824a8..4c4e8cf 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        cfreader.c include file.
  *  
- * Version:     $Id: parser.h,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: parser.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _PARSER_H
index 25da492..54b499f 100644 (file)
@@ -7,7 +7,7 @@
  *              the thread management routine (thread.c) present in the 
  *              very nice zebra project (http://www.zebra.org).
  *
- * Version:     $Id: scheduler.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: scheduler.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #include <signal.h>
 #include <sys/wait.h>
 #include <sys/select.h>
+#include <unistd.h>
 #include "scheduler.h"
 #include "memory.h"
 #include "utils.h"
 #include "signals.h"
+#include "logger.h"
 
 /* global vars */
 thread_master *master = NULL;
@@ -153,6 +155,13 @@ thread_destroy_list(thread_master * m, thread_list thread_list_obj)
                t = thread_obj;
                thread_obj = t->next;
 
+               if (t->type == THREAD_READY_FD ||
+                   t->type == THREAD_READ ||
+                   t->type == THREAD_WRITE ||
+                   t->type == THREAD_READ_TIMEOUT ||
+                   t->type == THREAD_WRITE_TIMEOUT)
+                       close (t->u.fd);
+
                thread_list_delete(&thread_list_obj, t);
                t->type = THREAD_UNUSED;
                thread_add_unuse(m, t);
@@ -224,7 +233,7 @@ thread_add_read(thread_master * m, int (*func) (thread *)
        assert(m != NULL);
 
        if (FD_ISSET(fd, &m->readfd)) {
-               syslog(LOG_WARNING, "There is already read fd [%d]", fd);
+               log_message(LOG_WARNING, "There is already read fd [%d]", fd);
                return NULL;
        }
 
@@ -257,7 +266,7 @@ thread_add_write(thread_master * m, int (*func) (thread *)
        assert(m != NULL);
 
        if (FD_ISSET(fd, &m->writefd)) {
-               syslog(LOG_WARNING, "There is already write fd [%d]", fd);
+               log_message(LOG_WARNING, "There is already write fd [%d]", fd);
                return NULL;
        }
 
@@ -404,6 +413,7 @@ thread_cancel(thread * thread_obj)
                thread_list_delete(&thread_obj->master->event, thread_obj);
                break;
        case THREAD_READY:
+       case THREAD_READY_FD:
                thread_list_delete(&thread_obj->master->ready, thread_obj);
                break;
        default:
@@ -472,14 +482,17 @@ thread_compute_timer(thread_master * m, TIMEVAL * timer_wait)
 
        if (!TIMER_ISNULL(timer_min)) {
                timer_min = timer_sub(timer_min, time_now);
-               if (timer_min.tv_sec < 0 || TIMER_ISNULL(timer_min)) {
-                       timer_min.tv_sec = 0;
-                       timer_min.tv_usec = 10;
+               if (timer_min.tv_sec < 0) {
+                       timer_wait->tv_sec = timer_wait->tv_usec = 0;
+               } else {
+                       timer_wait->tv_sec = timer_min.tv_sec;
+                       timer_wait->tv_usec = timer_min.tv_usec;
                }
-               timer_wait->tv_sec = timer_min.tv_sec;
-               timer_wait->tv_usec = timer_min.tv_usec;
-       } else
-               timer_wait = NULL;
+               return;
+       }
+
+       if (TIMER_ISNULL(*timer_wait))
+               timer_wait->tv_sec = 1;
 }
 
 /* Fetch next ready thread. */
@@ -492,22 +505,10 @@ thread_fetch(thread_master * m, thread * fetch)
        fd_set writefd;
        fd_set exceptfd;
        TIMEVAL timer_wait;
-       int status;
-       sigset_t sigset, dummy_sigset, block_sigset, pending;
+       int signal_fd;
 
        assert(m != NULL);
 
-       /*
-        * Set up the signal mask for select, by removing
-        * SIGCHLD from the set of blocked signals.
-        */
-       sigemptyset(&dummy_sigset);
-       sigprocmask(SIG_BLOCK, &dummy_sigset, &sigset);
-       sigdelset(&sigset, SIGCHLD);
-
-       sigemptyset(&block_sigset);
-       sigaddset(&block_sigset, SIGCHLD);
-
        /* Timer initialization */
        memset(&timer_wait, 0, sizeof (TIMEVAL));
 
@@ -548,83 +549,28 @@ retry:    /* When thread can't fetch try to find next thread again. */
        writefd = m->writefd;
        exceptfd = m->exceptfd;
 
-       /*
-        * Linux doesn't have a pselect syscall. Need to manually
-        * check if we have a signal waiting for us, else we lose the SIGCHLD
-        * when the pselect emulation changes the procmask.
-        * Theres still a small race between the procmask change and the select
-        * call, but it'll be picked up in the next iteration.
-        * Note that we don't use pselect here for portability between glibc
-        * versions. Until/unless linux gets a pselect syscall, this is
-        * equivalent to what glibc does, anyway.
-        */
+       signal_fd = signal_rfd();
+       FD_SET(signal_fd, &readfd);
 
-       sigpending(&pending);
-       if (sigismember(&pending, SIGCHLD)) {
-               /* Clear the pending signal */
-               int sig;
-               sigwait(&block_sigset, &sig);
-
-               ret = -1;
-               errno = EINTR;
-       } else {
-               /* Emulate pselect */
-               sigset_t saveset;
-               sigprocmask(SIG_SETMASK, &sigset, &saveset);
-               ret = select(FD_SETSIZE, &readfd, &writefd, &exceptfd,
-                            (TIMER_ISNULL(timer_wait)) ? NULL : &timer_wait);
-               sigprocmask(SIG_SETMASK, &saveset, NULL);
-       }
+       ret = select(FD_SETSIZE, &readfd, &writefd, &exceptfd,
+                   (TIMER_ISNULL(timer_wait)) ? NULL : &timer_wait);
 
        /* we have to save errno here because the next syscalls will set it */
        old_errno = errno;
 
-       /*
-        * When we receive a signal, we only add it to the signal_mask. This
-        * is so that we can run our handler functions in a safe place and
-        * not in, for example, the middle of a list modification.
-        */
-       if (signal_pending())
+       /* handle signals synchronously, including child reaping */
+       if (FD_ISSET(signal_fd, &readfd))
                signal_run_callback();
 
        /* Update current time */
        set_time_now();
 
        if (ret < 0) {
-               if (old_errno != EINTR) {
-                       /* Real error. */
-                       DBG("select error: %s", strerror(old_errno));
-                       assert(0);
-               } else {
-                       /*
-                        * This is O(n^2), but there will only be a few entries on
-                        * this list.
-                        */
-                       pid_t pid;
-                       while ((pid = waitpid(-1, &status, WNOHANG))) {
-                               if (pid == -1) {
-                                       if (errno == ECHILD)
-                                               goto retry;
-                                       DBG("waitpid error: %s", strerror(errno));
-                                       assert(0);
-                               } else {
-                                       thread_obj = m->child.head;
-                                       while (thread_obj) {
-                                               struct _thread *t;
-                                               t = thread_obj;
-                                               thread_obj = t->next;
-                                               if (pid == t->u.c.pid) {
-                                                       thread_list_delete(&m->child, t);
-                                                       thread_list_add(&m->ready, t);
-                                                       t->u.c.status = status;
-                                                       t->type = THREAD_READY;
-                                                       break;
-                                               }
-                                       }
-                               }
-                       }
-               }
-               goto retry;
+               if (old_errno == EINTR)
+                       goto retry;
+               /* Real error. */
+               DBG("select error: %s", strerror(old_errno));
+               assert(0);
        }
 
        /* Timeout children */
@@ -655,7 +601,7 @@ retry:      /* When thread can't fetch try to find next thread again. */
                        FD_CLR(t->u.fd, &m->readfd);
                        thread_list_delete(&m->read, t);
                        thread_list_add(&m->ready, t);
-                       t->type = THREAD_READY;
+                       t->type = THREAD_READY_FD;
                } else {
                        if (timer_cmp(time_now, t->sands) >= 0) {
                                FD_CLR(t->u.fd, &m->readfd);
@@ -679,7 +625,7 @@ retry:      /* When thread can't fetch try to find next thread again. */
                        FD_CLR(t->u.fd, &m->writefd);
                        thread_list_delete(&m->write, t);
                        thread_list_add(&m->ready, t);
-                       t->type = THREAD_READY;
+                       t->type = THREAD_READY_FD;
                } else {
                        if (timer_cmp(time_now, t->sands) >= 0) {
                                FD_CLR(t->u.fd, &m->writefd);
@@ -721,6 +667,42 @@ retry:     /* When thread can't fetch try to find next thread again. */
        return fetch;
 }
 
+/* Synchronous signal handler to reap child processes */
+void
+thread_child_handler(void * v, int sig) {
+       thread_master * m = v;
+       /*
+        * This is O(n^2), but there will only be a few entries on
+        * this list.
+        */
+       thread *thread_obj;
+       pid_t pid;
+       int status = 77;
+       while ((pid = waitpid(-1, &status, WNOHANG))) {
+               if (pid == -1) {
+                       if (errno == ECHILD)
+                               return;
+                       DBG("waitpid error: %s", strerror(errno));
+                       assert(0);
+               } else {
+                       thread_obj = m->child.head;
+                       while (thread_obj) {
+                               struct _thread *t;
+                               t = thread_obj;
+                               thread_obj = t->next;
+                               if (pid == t->u.c.pid) {
+                                       thread_list_delete(&m->child, t);
+                                       thread_list_add(&m->ready, t);
+                                       t->u.c.status = status;
+                                       t->type = THREAD_READY;
+                                       break;
+                               }
+                       }
+               }
+       }
+}
+
+
 /* Make unique thread id for non pthread version of thread manager. */
 unsigned long int
 thread_get_id(void)
@@ -743,6 +725,8 @@ launch_scheduler(void)
 {
        thread thread_obj;
 
+       signal_set(SIGCHLD, thread_child_handler, master);
+
        /*
         * Processing the master thread queues,
         * return and execute one ready thread.
index 1a144bb..6e7e280 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        scheduler.c include file.
  *
- * Version:     $Id: scheduler.h,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: scheduler.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _SCHEDULER_H
@@ -89,6 +89,7 @@ typedef struct _thread_master {
 #define THREAD_READ_TIMEOUT    8
 #define THREAD_CHILD_TIMEOUT   9
 #define THREAD_TERMINATE       10
+#define THREAD_READY_FD                11
 
 /* MICRO SEC def */
 #define BOOTSTRAP_DELAY TIMER_HZ
@@ -121,6 +122,7 @@ extern thread *thread_add_event(thread_master * m, int (*func) (thread *)
 extern void thread_cancel(thread * thread_obj);
 extern void thread_cancel_event(thread_master * m, void *arg);
 extern thread *thread_fetch(thread_master * m, thread * fetch);
+extern void thread_child_handler(void * v, int sig);
 extern void thread_call(thread * thread_obj);
 extern void launch_scheduler(void);
 
index c0dff8a..f22bd8c 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        Signals framework.
  *  
- * Version:     $Id: signals.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: signals.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  * 
  * Author:      Kevin Lindsay, <kevinl@netnation.com>
  *              Alexandre Cassen, <acassen@linux-vs.org>
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #include <signal.h>
 #include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <errno.h>
+#include <assert.h>
 
 #include "signals.h"
+#include "utils.h"
 
 /* Local Vars */
-static int signal_mask;
-void (*signal_SIGHUP_handler) (int sig);
-void (*signal_SIGINT_handler) (int sig);
-void (*signal_SIGTERM_handler) (int sig);
-void (*signal_SIGCHLD_handler) (int sig);
+void (*signal_SIGHUP_handler) (void *, int sig);
+void *signal_SIGHUP_v;
+void (*signal_SIGINT_handler) (void *, int sig);
+void *signal_SIGINT_v;
+void (*signal_SIGTERM_handler) (void *, int sig);
+void *signal_SIGTERM_v;
+void (*signal_SIGCHLD_handler) (void *, int sig);
+void *signal_SIGCHLD_v;
+
+static int signal_pipe[2] = { -1, -1 };
 
 /* Local signal test */
 int
 signal_pending(void)
 {
-       return (signal_mask) ? 1 : 0;
+       fd_set readset;
+       int rc;
+       struct timeval timeout = { 0, 0 };
+
+       FD_ZERO(&readset);
+       FD_SET(signal_pipe[0], &readset);
+
+       rc = select(signal_pipe[0] + 1, &readset, NULL, NULL, &timeout);
+
+       return rc>0?1:0;
 }
 
 /* Signal flag */
 void
 signal_handler(int sig)
 {
-       switch(sig) {
-       case SIGHUP:
-               signal_mask |= SIGNAL_SIGHUP;
-               break;
-       case SIGINT:
-               signal_mask |= SIGNAL_SIGINT;
-               break;
-       case SIGTERM:
-               signal_mask |= SIGNAL_SIGTERM;
-               break;
-       case SIGCHLD:
-               signal_mask |= SIGNAL_SIGCHLD;
-               break;
+       if (write(signal_pipe[1], &sig, sizeof(int)) != sizeof(int)) {
+               DBG("signal_pipe write error %s", strerror(errno));
+               assert(0);
        }
-}
+}      
 
 /* Signal wrapper */
 void *
-signal_set(int signo, void (*func) (int))
+signal_set(int signo, void (*func) (void *, int), void *v)
 {
        int ret;
        struct sigaction sig;
@@ -82,15 +93,19 @@ signal_set(int signo, void (*func) (int))
        switch(signo) {
        case SIGHUP:
                signal_SIGHUP_handler = func;
+               signal_SIGHUP_v = v;
                break;
        case SIGINT:
                signal_SIGINT_handler = func;
+               signal_SIGINT_v = v;
                break;
        case SIGTERM:
                signal_SIGTERM_handler = func;
+               signal_SIGTERM_v = v;
                break;
        case SIGCHLD:
                signal_SIGCHLD_handler = func;
+               signal_SIGCHLD_v = v;
                break;
        }
 
@@ -104,78 +119,77 @@ signal_set(int signo, void (*func) (int))
 void *
 signal_ignore(int signo)
 {
-       return signal_set(signo, SIG_IGN);
-}
-
-/*
- * SIGCHLD handler. Reap all zombie child.
- * WNOHANG prevent against parent process get
- * stuck waiting child termination.
- */
-void
-dummy_handler(int sig)
-{
-       /* Dummy */
-}
-
-void
-signal_noignore_sigchld(void)
-{
-       struct sigaction sa;
-       sigset_t mask;
-
-       /* Need to remove the NOCHLD flag */
-       sigemptyset(&mask);
-       sa.sa_handler = dummy_handler;
-       sa.sa_mask = mask;
-       sa.sa_flags = 0;
-
-       sigaction(SIGCHLD, &sa, NULL);
-
-       /* Block SIGCHLD so that we only receive it
-        * when required (ie when its unblocked in the
-        * select loop)
-        */
-       sigaddset(&mask, SIGCHLD);
-       sigprocmask(SIG_BLOCK, &mask, NULL);
+       return signal_set(signo, NULL, NULL);
 }
 
 /* Handlers intialization */
 void
 signal_handler_init(void)
 {
-       signal_mask = 0;
+       int n = pipe(signal_pipe);
+       assert(!n);
+
+       fcntl(signal_pipe[0], F_SETFL, O_NONBLOCK | fcntl(signal_pipe[0], F_GETFL));
+       fcntl(signal_pipe[1], F_SETFL, O_NONBLOCK | fcntl(signal_pipe[1], F_GETFL));
+
        signal_SIGHUP_handler = NULL;
        signal_SIGINT_handler = NULL;
        signal_SIGTERM_handler = NULL;
        signal_SIGCHLD_handler = NULL;
 }
 
-/* Handlers callback according to global signal mask */
 void
-signal_run_callback(void)
-{
-       if (SIGNAL_SIGHUP & signal_mask) {
-               signal_mask &= ~SIGNAL_SIGHUP;
-               if (signal_SIGHUP_handler)
-                       signal_SIGHUP_handler(SIGHUP);
-       }
+signal_handler_destroy(void) {
+       struct sigaction sig;
 
-       if (SIGNAL_SIGINT & signal_mask) {
-               signal_mask &= ~SIGNAL_SIGINT;
-               if (signal_SIGINT_handler)
-                       signal_SIGINT_handler(SIGINT);
-       }
+       sig.sa_handler = SIG_DFL;
+       sigemptyset(&sig.sa_mask);
+       sig.sa_flags = 0;
 
-       if (SIGNAL_SIGTERM & signal_mask) {
-               signal_mask &= ~SIGNAL_SIGTERM;
-               if (signal_SIGTERM_handler)
-                       signal_SIGTERM_handler(SIGTERM);
-       }
+       /* First ensure that no more signals happen, then close pipe */
+       sigaction(SIGHUP, &sig, NULL);
+       sigaction(SIGINT, &sig, NULL);
+       sigaction(SIGTERM, &sig, NULL);
+       sigaction(SIGCHLD, &sig, NULL);
+
+       close(signal_pipe[1]);
+       close(signal_pipe[0]);
+       signal_pipe[1] = -1;
+       signal_pipe[0] = -1;
+}      
+
+int
+signal_rfd(void) {
+       return(signal_pipe[0]);
+}
 
-       if (SIGNAL_SIGCHLD & signal_mask) {
-               signal_mask &= ~SIGNAL_SIGCHLD;
-               if (signal_SIGCHLD_handler)
-                       signal_SIGCHLD_handler(SIGCHLD);
+/* Handlers callback  */
+void
+signal_run_callback(void)
+{
+       int sig;
+
+       while(read(signal_pipe[0], &sig, sizeof(int)) == sizeof(int)) {
+               switch(sig) {
+               case SIGHUP:
+                       if (signal_SIGHUP_handler)
+                               signal_SIGHUP_handler(signal_SIGHUP_v, SIGHUP);
+                       break;
+               case SIGINT:
+                       if (signal_SIGINT_handler)
+                               signal_SIGINT_handler(signal_SIGINT_v, SIGINT);
+                       break;
+               case SIGTERM:
+                       if (signal_SIGTERM_handler)
+                               signal_SIGTERM_handler(signal_SIGTERM_v, SIGTERM);
+                       break;  
+               case SIGCHLD:   
+                       if (signal_SIGCHLD_handler)
+                               signal_SIGCHLD_handler(signal_SIGCHLD_v, SIGCHLD);
+                       break;
+               default:
+                       break;
+               }       
        }
 }
+
index c6dfe9f..06aa70a 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        signals.c include file.
  *  
- * Version:     $Id: signals.h,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: signals.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Kevin Lindsay, <kevinl@netnation.com>
  *              Alexandre Cassen, <acassen@linux-vs.org>
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _SIGNALS_H
 #define _SIGNALS_H
 
-/* signals definition */
-#define SIGNAL_SIGHUP  0x02
-#define SIGNAL_SIGINT  0x04
-#define SIGNAL_SIGTERM 0x08
-#define SIGNAL_SIGCHLD 0x10
-
 /* Prototypes */
 extern int signal_pending(void);
-extern void *signal_set(int signo, void (*func) (int));
+extern void *signal_set(int signo, void (*func) (void *, int), void *);
 extern void *signal_ignore(int signo);
-extern void signal_noignore_sigchld(void);
 extern void signal_handler_init(void);
+extern void signal_handler_destroy(void);
 extern void signal_run_callback(void);
 
+extern int signal_rfd(void);
+
 #endif
index b00aa38..7883e2d 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        Timer manipulations.
  *  
- * Version:     $Id: timer.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: timer.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #include <stdio.h>
@@ -93,6 +93,88 @@ timer_add_long(TIMEVAL a, long b)
        return ret;
 }
 
+/* This function is a wrapper for gettimeofday(). It uses local storage to
+ * guarantee that the returned time will always be monotonic. If the time goes
+ * backwards, it returns the same as previous one and readjust its internal
+ * drift. If the time goes forward further than TIME_MAX_FORWARD_US
+ * microseconds since last call, it will bound it to that value. It is designed
+ * to be used as a drop-in replacement of gettimeofday(&now, NULL). It will
+ * normally return 0, unless <now> is NULL, in which case it will return -1 and
+ * set errno to EFAULT.
+ */
+int monotonic_gettimeofday(struct timeval *now)
+{
+       static struct timeval mono_date;
+       static struct timeval drift; /* warning: signed seconds! */
+       struct timeval sys_date, adjusted, deadline;
+
+       if (!now) {
+               errno = EFAULT;
+               return -1;
+       }
+
+       gettimeofday(&sys_date, NULL);
+
+       /* on first call, we set mono_date to system date */
+       if (mono_date.tv_sec == 0) {
+               mono_date = sys_date;
+               drift.tv_sec = drift.tv_usec = 0;
+               *now = mono_date;
+               return 0;
+       }
+
+       /* compute new adjusted time by adding the drift offset */
+       adjusted.tv_sec  = sys_date.tv_sec  + drift.tv_sec;
+       adjusted.tv_usec = sys_date.tv_usec + drift.tv_usec;
+       if (adjusted.tv_usec >= 1000000) {
+               adjusted.tv_usec -= 1000000;
+               adjusted.tv_sec++;
+       }
+
+       /* check for jumps in the past, and bound to last date */
+       if (adjusted.tv_sec  <  mono_date.tv_sec ||
+           (adjusted.tv_sec  == mono_date.tv_sec &&
+            adjusted.tv_usec <  mono_date.tv_usec))
+               goto fixup;
+
+       /* check for jumps too far in the future, and bound them to
+        * TIME_MAX_FORWARD_US microseconds.
+        */
+       deadline.tv_sec  = mono_date.tv_sec  + TIME_MAX_FORWARD_US / 1000000;
+       deadline.tv_usec = mono_date.tv_usec + TIME_MAX_FORWARD_US % 1000000;
+       if (deadline.tv_usec >= 1000000) {
+               deadline.tv_usec -= 1000000;
+               deadline.tv_sec++;
+       }
+
+       if (adjusted.tv_sec  >  deadline.tv_sec ||
+           (adjusted.tv_sec  == deadline.tv_sec &&
+            adjusted.tv_usec >= deadline.tv_usec)) {
+               mono_date = deadline;
+               goto fixup;
+       }
+
+       /* adjusted date is correct */
+       mono_date = adjusted;
+       *now = mono_date;
+       return 0;
+
+ fixup:
+       /* Now we have to recompute the drift between sys_date and
+        * mono_date. Since it can be negative and we don't want to
+        * play with negative carries in all computations, we take
+        * care of always having the microseconds positive.
+        */
+       drift.tv_sec  = mono_date.tv_sec  - sys_date.tv_sec;
+       drift.tv_usec = mono_date.tv_usec - sys_date.tv_usec;
+       if (drift.tv_usec < 0) {
+               drift.tv_usec += 1000000;
+               drift.tv_sec--;
+       }
+       *now = mono_date;
+       return 0;
+}
+
 /* current time */
 TIMEVAL
 timer_now(void)
@@ -102,7 +184,7 @@ timer_now(void)
 
        /* init timer */
        TIMER_RESET(curr_time);
-       gettimeofday(&curr_time, NULL);
+       monotonic_gettimeofday(&curr_time);
        errno = old_errno;
 
        return curr_time;
@@ -116,7 +198,7 @@ set_time_now(void)
 
        /* init timer */
        TIMER_RESET(time_now);
-       gettimeofday(&time_now, NULL);
+       monotonic_gettimeofday(&time_now);
        errno = old_errno;
 
        return time_now;
index dba9f1c..e98c99f 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        timer.c include file.
  *  
- * Version:     $Id: timer.h,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: timer.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _TIMER_H
@@ -33,6 +33,7 @@ typedef struct timeval TIMEVAL;
 extern TIMEVAL time_now;
 
 /* macro utilities */
+#define TIME_MAX_FORWARD_US 2000000
 #define TIMER_HZ      1000000
 #define TIMER_MAX_SEC 1000
 #define TIMER_SEC(T) ((T).tv_sec)
index d2d17f1..b552eaf 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        General program utils.
  *
- * Version:     $Id: utils.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: utils.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #include "utils.h"
index c89c5bd..264854d 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        utils.h include file.
  *
- * Version:     $Id: utils.h,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: utils.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _UTILS_H
index d4683dd..7cc6038 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        Vector structure manipulation.
  *  
- * Version:     $Id: vector.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: vector.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #include "vector.h"
index dd99327..ab1f7c2 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        vector.c include file.
  *  
- * Version:     $Id: vector.h,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
+ * Version:     $Id: vector.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,7 +19,7 @@
  *              as published by the Free Software Foundation; either version
  *              2 of the License, or (at your option) any later version.
  *
- * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
+ * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
  */
 
 #ifndef _VECTOR_H