keepalived-1.1.8 v1.1.8
authorAlexandre Cassen <acassen@freebox.fr>
Tue, 25 Jan 2005 23:40:40 +0000 (00:40 +0100)
committerAlexandre Cassen <acassen@freebox.fr>
Mon, 28 Sep 2009 08:59:00 +0000 (10:59 +0200)
* keepalived-1.1.8 released.
* VRRP : Chris Caputo, <ccaputo@alt.net> added "dont_track_primary"
  vrrp_instance keyword which tells keepalived to ignore VRRP
  interface faults. Can be useful on setup where two routers
  are connected directly to each other on the interface used
  for VRRP.  Without this feature the link down caused
  by one router crashing would also inspire the other router to lose
  (or not gain) MASTER state, since it was also tracking link status.
* VRRP : Chris Caputo, <ccaputo@alt.net> added "nopreempt" which
  overrides the VRRP RFC preemption default. This replaces the
  "preempt" keyword which was not fully implemented. "preempt" is
  kept around for backward compatibility but is deprecated.
* VRRP : Chris Caputo, <ccaputo@alt.net> added "preempt_delay" which
  allows one to specify number of seconds after startup until VRRP
  preemption.  (range 0 to 1,000 seconds) this is useful because
  sometimes when a machine recovers it takes a while for it to become
  usable, such as when it is a router and BGP sessions need to come
  back up.
* Chris Caputo, <ccaputo@alt.net> made it so there is a useful "Date:"
  in SMTP alert emails.
* VRRP : Chris Caputo, <ccaputo@alt.net>. In debug output log
  gratuitous ARPs with actual IP addresses being ARPed.
* VRRP : Chris Caputo, <ccaputo@alt.net>. If started with
  "--dont-release-vrrp" then try to remove addresses even if we didn't
  add them during the current run, when it makes sense to do so.
* VRRP : Chris Caputo, <ccaputo@alt.net> added a missing
  free_vrrp_buffer() during VRRP stop.
* VRRP : Kees Bos, <k.bos@zx.nl> fixed VRRP sanity check to perform
  checksum computation over incoming packet and not local router
  instance memory representation => Better to log 'invalid vip
  count' instead of 'Invalid vrrp checksum' when the number of
  configured vips differ in the master and backup server :)
* VRRP : Release socket pool during daemon stop and reload
* VRRP : Refresh socket pool during reload
* VRRP : Extended netlink framework to support blocking
  operation. During initialization, set blocking netlink channel
  to wait responses from kernel while parsing result. Kernel netlink
  reflection are still handled using non-blocking.
* Jeremy Rumpf, <rumpf.6@osu.edu> added SMTP checker. It take
  a special care of smtp server return code.
* Merged genhash man page
* Chris Caputo, <ccaputo@alt.net> added "misc_dynamic" to a
  MISC_CHECK which makes it so a script can adjust the weight of
  a real server.
* Fixed some assertion issue in memory framework.
* Use router_id instead of lvs_id in the global_def configuration
  block (lvs_id kept for backward compatibility).
* Ronald Wahl <rwa@peppercon.com>, fixed declarations to be only
  in includes files.
* Ronald Wahl <rwa@peppercon.com>, moved the definition of variables
  to C files
* Ronald Wahl <rwa@peppercon.com> and I fixed scanning for header/body
  separator in HTTP protocol
* Ronald Wahl <rwa@peppercon.com> replaced memcpy by memmove where source
  & destination may overlap
* Extended checker API to only register checkers when checker callback
  is defined.
* Jacob Rief, <jacob.rief@tiscover.com> fixed openlog to take care
  of configured log facility.
* Move in_csum to util file.
* Extended libraries to support some new facilities (list and vector).
* Extended scheduler I/O to use timer decalred on the stack.
* Some cosmetics changes.

139 files changed:
CONTRIBUTORS
ChangeLog
VERSION
configure
debian/changelog [new file with mode: 0644]
debian/compat [new file with mode: 0644]
debian/control [new file with mode: 0644]
debian/copyright [new file with mode: 0644]
debian/dirs [new file with mode: 0644]
debian/docs [new file with mode: 0644]
debian/include/net/ip_vs.h [new file with mode: 0644]
debian/init.d [new file with mode: 0644]
debian/manpages [new file with mode: 0644]
debian/rules [new file with mode: 0644]
doc/keepalived.conf.SYNOPSIS
doc/man/man1/genhash.1 [moved from doc/man/man8/genhash.8 with 97% similarity]
doc/man/man5/keepalived.conf.5
doc/samples/keepalived.conf.HTTP_GET.port
doc/samples/keepalived.conf.SMTP_CHECK [new file with mode: 0644]
doc/samples/keepalived.conf.SSL_GET
doc/samples/keepalived.conf.ci-linux [deleted file]
doc/samples/keepalived.conf.fwmark
doc/samples/keepalived.conf.inhibit
doc/samples/keepalived.conf.misc_check
doc/samples/keepalived.conf.misc_check_arg
doc/samples/keepalived.conf.sample
doc/samples/keepalived.conf.status_code
doc/samples/keepalived.conf.track_interface
doc/samples/keepalived.conf.virtual_server_group
doc/samples/keepalived.conf.virtualhost
doc/samples/keepalived.conf.vrrp
doc/samples/keepalived.conf.vrrp.routes
doc/samples/keepalived.conf.vrrp.static_ipaddress
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 [new file with mode: 0644]
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/keepalived/keepalived.conf
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 [new file with mode: 0644]
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/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/memory.c
lib/memory.h
lib/notify.c
lib/notify.h
lib/parser.c
lib/parser.h
lib/scheduler.c
lib/scheduler.h
lib/timer.c
lib/timer.h
lib/utils.c
lib/utils.h
lib/vector.c
lib/vector.h
lib/watchdog.c
lib/watchdog.h

index 066a0d3..bf8c87a 100644 (file)
@@ -9,3 +9,10 @@ Bradley Baetz, <bradley.baetz@optusnet.com.au> :
        o Daemon framework extension to block SIGCHLD
          to only receive it when its unblocked in the
          scheduling select loop.
+
+Jeremy Rumpf, <rumpf.6@osu.edu> :
+       o Added SMTP checker
+
+Chris Caputo, <ccaputo@alt.net> :
+       o Added dont_track_primary, nopreempt,
+         preempt_delay, and misc_dynamic.
index 16bb79a..36739cc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,68 @@
+2005-01-25  Alexandre Cassen  <acassen@linux-vs.org>
+       * keepalived-1.1.8 released.
+       * VRRP : Chris Caputo, <ccaputo@alt.net> added "dont_track_primary"
+         vrrp_instance keyword which tells keepalived to ignore VRRP
+         interface faults. Can be useful on setup where two routers
+         are connected directly to each other on the interface used
+         for VRRP.  Without this feature the link down caused
+         by one router crashing would also inspire the other router to lose
+         (or not gain) MASTER state, since it was also tracking link status.
+       * VRRP : Chris Caputo, <ccaputo@alt.net> added "nopreempt" which
+         overrides the VRRP RFC preemption default. This replaces the
+         "preempt" keyword which was not fully implemented. "preempt" is
+         kept around for backward compatibility but is deprecated.
+       * VRRP : Chris Caputo, <ccaputo@alt.net> added "preempt_delay" which
+         allows one to specify number of seconds after startup until VRRP
+         preemption.  (range 0 to 1,000 seconds) this is useful because
+         sometimes when a machine recovers it takes a while for it to become
+         usable, such as when it is a router and BGP sessions need to come
+         back up.
+       * Chris Caputo, <ccaputo@alt.net> made it so there is a useful "Date:"
+         in SMTP alert emails.
+       * VRRP : Chris Caputo, <ccaputo@alt.net>. In debug output log
+         gratuitous ARPs with actual IP addresses being ARPed.
+       * VRRP : Chris Caputo, <ccaputo@alt.net>. If started with
+         "--dont-release-vrrp" then try to remove addresses even if we didn't
+         add them during the current run, when it makes sense to do so.
+       * VRRP : Chris Caputo, <ccaputo@alt.net> added a missing
+         free_vrrp_buffer() during VRRP stop.
+       * VRRP : Kees Bos, <k.bos@zx.nl> fixed VRRP sanity check to perform
+         checksum computation over incoming packet and not local router
+         instance memory representation => Better to log 'invalid vip
+         count' instead of 'Invalid vrrp checksum' when the number of
+         configured vips differ in the master and backup server :)
+       * VRRP : Release socket pool during daemon stop and reload
+       * VRRP : Refresh socket pool during reload
+       * VRRP : Extended netlink framework to support blocking
+         operation. During initialization, set blocking netlink channel
+         to wait responses from kernel while parsing result. Kernel netlink
+         reflection are still handled using non-blocking.
+       * Jeremy Rumpf, <rumpf.6@osu.edu> added SMTP checker. It take
+         a special care of smtp server return code.
+       * Merged genhash man page
+       * Chris Caputo, <ccaputo@alt.net> added "misc_dynamic" to a
+         MISC_CHECK which makes it so a script can adjust the weight of
+         a real server.
+       * Fixed some assertion issue in memory framework.
+       * Use router_id instead of lvs_id in the global_def configuration
+         block (lvs_id kept for backward compatibility).
+       * Ronald Wahl <rwa@peppercon.com>, fixed declarations to be only
+         in includes files.
+       * Ronald Wahl <rwa@peppercon.com>, moved the definition of variables
+         to C files
+       * Ronald Wahl <rwa@peppercon.com> and I fixed scanning for header/body
+         separator in HTTP protocol 
+       * Ronald Wahl <rwa@peppercon.com> replaced memcpy by memmove where source
+         & destination may overlap
+       * Extended checker API to only register checkers when checker callback
+         is defined.
+       * Jacob Rief, <jacob.rief@tiscover.com> fixed openlog to take care
+         of configured log facility.
+       * Move in_csum to util file.
+       * Extended libraries to support some new facilities (list and vector).
+       * Extended scheduler I/O to use timer decalred on the stack.
+       * Some cosmetics changes.
+
 2004-04-05  Alexandre Cassen  <acassen@linux-vs.org>
        * keepalived-1.1.7 released.
        * Jacob Rief, <jacob.rief@tiscover.com> added target tarball into
diff --git a/VERSION b/VERSION
index 2bf1ca5..18efdb9 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.1.7
+1.1.8
index 8489c48..5ce09b9 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,9 +1,8 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.57.
+# Generated by GNU Autoconf 2.59.
 #
-# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
-# Free Software Foundation, Inc.
+# Copyright (C) 2003 Free Software Foundation, Inc.
 # This configure script is free software; the Free Software Foundation
 # gives unlimited permission to copy, distribute and modify it.
 ## --------------------- ##
@@ -20,9 +19,10 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
 elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
   set -o posix
 fi
+DUALCASE=1; export DUALCASE # for MKS sh
 
 # Support unset when possible.
-if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
   as_unset=unset
 else
   as_unset=false
@@ -41,7 +41,7 @@ for as_var in \
   LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
   LC_TELEPHONE LC_TIME
 do
-  if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then
+  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
@@ -218,16 +218,17 @@ rm -f conf$$ conf$$.exe conf$$.file
 if mkdir -p . 2>/dev/null; then
   as_mkdir_p=:
 else
+  test -d ./-p && rmdir ./-p
   as_mkdir_p=false
 fi
 
 as_executable_p="test -f"
 
 # Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
 
 # Sed expression to map a string onto a valid variable name.
-as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
 
 
 # IFS
@@ -667,7 +668,7 @@ done
 
 # Be sure to have absolute paths.
 for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
-              localstatedir libdir includedir oldincludedir infodir mandir
+             localstatedir libdir includedir oldincludedir infodir mandir
 do
   eval ac_val=$`echo $ac_var`
   case $ac_val in
@@ -707,10 +708,10 @@ if test -z "$srcdir"; then
   # Try the directory containing this script, then its parent.
   ac_confdir=`(dirname "$0") 2>/dev/null ||
 $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-         X"$0" : 'X\(//\)[^/]' \| \
-         X"$0" : 'X\(//\)$' \| \
-         X"$0" : 'X\(/\)' \| \
-         .     : '\(.\)' 2>/dev/null ||
+        X"$0" : 'X\(//\)[^/]' \| \
+        X"$0" : 'X\(//\)$' \| \
+        X"$0" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
 echo X"$0" |
     sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
          /^X\(\/\/\)[^/].*/{ s//\1/; q; }
@@ -802,9 +803,9 @@ _ACEOF
   cat <<_ACEOF
 Installation directories:
   --prefix=PREFIX         install architecture-independent files in PREFIX
-                          [$ac_default_prefix]
+                         [$ac_default_prefix]
   --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
-                          [PREFIX]
+                         [PREFIX]
 
 By default, \`make install' will install all the files in
 \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
@@ -895,12 +896,45 @@ case $srcdir in
     ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
     ac_top_srcdir=$ac_top_builddir$srcdir ;;
 esac
-# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
-# absolute.
-ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
-ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd`
-ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
-ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
+
+# 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
 
     cd $ac_dir
     # Check for guested configure; otherwise get Cygnus style configure.
@@ -911,7 +945,7 @@ ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
       echo
       $SHELL $ac_srcdir/configure  --help=recursive
     elif test -f $ac_srcdir/configure.ac ||
-           test -f $ac_srcdir/configure.in; then
+          test -f $ac_srcdir/configure.in; then
       echo
       $ac_configure --help
     else
@@ -925,8 +959,7 @@ test -n "$ac_init_help" && exit 0
 if $ac_init_version; then
   cat <<\_ACEOF
 
-Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
-Free Software Foundation, Inc.
+Copyright (C) 2003 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it.
 _ACEOF
@@ -938,7 +971,7 @@ 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.57.  Invocation command line was
+generated by GNU Autoconf 2.59.  Invocation command line was
 
   $ $0 $@
 
@@ -1015,19 +1048,19 @@ do
     2)
       ac_configure_args1="$ac_configure_args1 '$ac_arg'"
       if test $ac_must_keep_next = true; then
-        ac_must_keep_next=false # Got value, back to normal.
+       ac_must_keep_next=false # Got value, back to normal.
       else
-        case $ac_arg in
-          *=* | --config-cache | -C | -disable-* | --disable-* \
-          | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
-          | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
-          | -with-* | --with-* | -without-* | --without-* | --x)
-            case "$ac_configure_args0 " in
-              "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
-            esac
-            ;;
-          -* ) ac_must_keep_next=true ;;
-        esac
+       case $ac_arg in
+         *=* | --config-cache | -C | -disable-* | --disable-* \
+         | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+         | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+         | -with-* | --with-* | -without-* | --without-* | --x)
+           case "$ac_configure_args0 " in
+             "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+           esac
+           ;;
+         -* ) ac_must_keep_next=true ;;
+       esac
       fi
       ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
       # Get rid of the leading space.
@@ -1061,12 +1094,12 @@ _ASBOX
     case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
     *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"
+       "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
       ;;
     esac;
 }
@@ -1095,7 +1128,7 @@ _ASBOX
       for ac_var in $ac_subst_files
       do
        eval ac_val=$`echo $ac_var`
-        echo "$ac_var='"'"'$ac_val'"'"'"
+       echo "$ac_var='"'"'$ac_val'"'"'"
       done | sort
       echo
     fi
@@ -1114,7 +1147,7 @@ _ASBOX
       echo "$as_me: caught signal $ac_signal"
     echo "$as_me: exit $exit_status"
   } >&5
-  rm -f core core.* *.core &&
+  rm -f core *.core &&
   rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
     exit $exit_status
      ' 0
@@ -1194,7 +1227,7 @@ fi
 # 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
+              sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; 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"
@@ -1211,13 +1244,13 @@ echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
     ,);;
     *)
       if test "x$ac_old_val" != "x$ac_new_val"; then
-        { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+       { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
-        { echo "$as_me:$LINENO:   former value:  $ac_old_val" >&5
+       { echo "$as_me:$LINENO:   former value:  $ac_old_val" >&5
 echo "$as_me:   former value:  $ac_old_val" >&2;}
-        { echo "$as_me:$LINENO:   current value: $ac_new_val" >&5
+       { echo "$as_me:$LINENO:   current value: $ac_new_val" >&5
 echo "$as_me:   current value: $ac_new_val" >&2;}
-        ac_cache_corrupted=:
+       ac_cache_corrupted=:
       fi;;
   esac
   # Pass precious variables to config.status.
@@ -1605,7 +1638,6 @@ ac_compiler=`set X $ac_compile; echo $2`
   (exit $ac_status); }
 
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -1625,8 +1657,8 @@ 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" >&5
-echo $ECHO_N "checking for C compiler default output... $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
@@ -1646,23 +1678,23 @@ 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.
-        ;;
+       # This is the source file.
+       ;;
     [ab].out )
-        # We found the default executable, but exeext='' is most
-        # certainly right.
-        break;;
+       # 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
-        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
+       break;;
     * )
-        break;;
+       break;;
   esac
 done
 else
@@ -1736,8 +1768,8 @@ for ac_file in conftest.exe conftest conftest.*; do
   case $ac_file in
     *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
     *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
-          export ac_cv_exeext
-          break;;
+         export ac_cv_exeext
+         break;;
     * ) break;;
   esac
 done
@@ -1762,7 +1794,6 @@ if test "${ac_cv_objext+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -1813,7 +1844,6 @@ if test "${ac_cv_c_compiler_gnu+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -1833,11 +1863,21 @@ main ()
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&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'
+        { 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=$?
@@ -1850,7 +1890,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
 ac_compiler_gnu=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 ac_cv_c_compiler_gnu=$ac_compiler_gnu
 
 fi
@@ -1866,7 +1906,6 @@ if test "${ac_cv_prog_cc_g+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -1883,11 +1922,21 @@ main ()
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&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'
+        { 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=$?
@@ -1900,7 +1949,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
 ac_cv_prog_cc_g=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
 echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
@@ -1927,7 +1976,6 @@ else
   ac_cv_prog_cc_stdc=no
 ac_save_CC=$CC
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -1955,6 +2003,16 @@ static char *f (char * (*g) (char **, int), char **p, ...)
   va_end (v);
   return s;
 }
+
+/* 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
+   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.  */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
 int test (int i, double x);
 struct s1 {int (*f) (int a);};
 struct s2 {int (*f) (double a);};
@@ -1981,11 +2039,21 @@ 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>&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'
+        { 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=$?
@@ -1998,7 +2066,7 @@ else
 sed 's/^/| /' conftest.$ac_ext >&5
 
 fi
-rm -f conftest.$ac_objext
+rm -f conftest.err conftest.$ac_objext
 done
 rm -f conftest.$ac_ext conftest.$ac_objext
 CC=$ac_save_CC
@@ -2026,19 +2094,28 @@ cat >conftest.$ac_ext <<_ACEOF
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&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'
+        { 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 \
-   ''\
-   '#include <stdlib.h>' \
+   '' \
    '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 ();' \
@@ -2046,14 +2123,13 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
    'void exit (int);'
 do
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <stdlib.h>
 $ac_declaration
+#include <stdlib.h>
 int
 main ()
 {
@@ -2064,11 +2140,21 @@ exit (42);
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&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'
+        { 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=$?
@@ -2081,9 +2167,8 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
 continue
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -2100,11 +2185,21 @@ exit (42);
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&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'
+        { 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=$?
@@ -2116,7 +2211,7 @@ else
 sed 's/^/| /' conftest.$ac_ext >&5
 
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 done
 rm -f conftest*
 if test -n "$ac_declaration"; then
@@ -2130,7 +2225,7 @@ else
 sed 's/^/| /' conftest.$ac_ext >&5
 
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+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'
@@ -2173,6 +2268,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
 # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
 # 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
@@ -2189,6 +2285,7 @@ do
 case $as_dir/ in
   ./ | .// | /cC/* | \
   /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+  ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
   /usr/ucb/* ) ;;
   *)
     # OSF1 and SCO ODT 3.0 have their own names for install.
@@ -2196,20 +2293,20 @@ 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 $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.
-            :
-          elif test $ac_prog = install &&
-            grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
-            # program-specific install script used by HP pwplus--don't use.
-            :
-          else
-            ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
-            break 3
-          fi
-        fi
+       if $as_executable_p "$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.
+           :
+         elif test $ac_prog = install &&
+           grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+           # program-specific install script used by HP pwplus--don't use.
+           :
+         else
+           ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+           break 3
+         fi
+       fi
       done
     done
     ;;
@@ -2303,7 +2400,6 @@ do
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp. "Syntax error" is here to catch this case.
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -2314,7 +2410,7 @@ cat >>conftest.$ac_ext <<_ACEOF
 #else
 # include <assert.h>
 #endif
-                     Syntax error
+                    Syntax error
 _ACEOF
 if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
@@ -2326,6 +2422,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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
@@ -2346,7 +2443,6 @@ rm -f conftest.err conftest.$ac_ext
   # OK, works on sane cases.  Now check whether non-existent headers
   # can be detected and how.
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -2364,6 +2460,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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
@@ -2410,7 +2507,6 @@ do
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp. "Syntax error" is here to catch this case.
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -2421,7 +2517,7 @@ cat >>conftest.$ac_ext <<_ACEOF
 #else
 # include <assert.h>
 #endif
-                     Syntax error
+                    Syntax error
 _ACEOF
 if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
@@ -2433,6 +2529,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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
@@ -2453,7 +2550,6 @@ rm -f conftest.err conftest.$ac_ext
   # OK, works on sane cases.  Now check whether non-existent headers
   # can be detected and how.
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -2471,6 +2567,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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
@@ -2531,7 +2628,6 @@ if test "${ac_cv_header_stdc+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -2552,11 +2648,21 @@ main ()
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&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'
+        { 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=$?
@@ -2569,12 +2675,11 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
 ac_cv_header_stdc=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f 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.
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -2596,7 +2701,6 @@ fi
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -2621,7 +2725,6 @@ if test $ac_cv_header_stdc = yes; then
   :
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -2633,9 +2736,9 @@ cat >>conftest.$ac_ext <<_ACEOF
 # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
 #else
 # define ISLOWER(c) \
-                   (('a' <= (c) && (c) <= 'i') \
-                     || ('j' <= (c) && (c) <= 'r') \
-                     || ('s' <= (c) && (c) <= 'z'))
+                  (('a' <= (c) && (c) <= 'i') \
+                    || ('j' <= (c) && (c) <= 'r') \
+                    || ('s' <= (c) && (c) <= 'z'))
 # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
 #endif
 
@@ -2646,7 +2749,7 @@ main ()
   int i;
   for (i = 0; i < 256; i++)
     if (XOR (islower (i), ISLOWER (i))
-        || toupper (i) != TOUPPER (i))
+       || toupper (i) != TOUPPER (i))
       exit(2);
   exit (0);
 }
@@ -2671,7 +2774,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 ( exit $ac_status )
 ac_cv_header_stdc=no
 fi
-rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 fi
 fi
@@ -2691,7 +2794,6 @@ if test "${ac_cv_header_sys_wait_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -2718,11 +2820,21 @@ main ()
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&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'
+        { 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=$?
@@ -2735,7 +2847,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
 ac_cv_header_sys_wait_h=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f 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
@@ -2758,7 +2870,7 @@ fi
 
 
 for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
-                  inttypes.h stdint.h unistd.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
@@ -2767,7 +2879,6 @@ if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -2779,11 +2890,21 @@ $ac_includes_default
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&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'
+        { 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=$?
@@ -2796,7 +2917,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
 eval "$as_ac_Header=no"
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f 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
@@ -2831,7 +2952,6 @@ else
 echo "$as_me:$LINENO: checking $ac_header usability" >&5
 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -2842,11 +2962,21 @@ $ac_includes_default
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&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'
+        { 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=$?
@@ -2859,7 +2989,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
 ac_header_compiler=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+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
 
@@ -2867,7 +2997,6 @@ echo "${ECHO_T}$ac_header_compiler" >&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
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -2885,6 +3014,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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
@@ -2904,33 +3034,32 @@ 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 in
-  yes:no )
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
     { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf@gnu.org. ##
-## ------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
     ;;
-  no:yes )
+  no:yes:* )
     { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
     { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
 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 bug-autoconf@gnu.org. ##
-## ------------------------------------ ##
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
 _ASBOX
     ) |
       sed "s/^/$as_me: WARNING:     /" >&2
@@ -2941,7 +3070,7 @@ echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  eval "$as_ac_Header=$ac_header_preproc"
+  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
@@ -2975,7 +3104,6 @@ else
 echo "$as_me:$LINENO: checking $ac_header usability" >&5
 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -2986,11 +3114,21 @@ $ac_includes_default
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&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'
+        { 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=$?
@@ -3003,7 +3141,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
 ac_header_compiler=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+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
 
@@ -3011,7 +3149,6 @@ echo "${ECHO_T}$ac_header_compiler" >&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
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -3029,6 +3166,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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
@@ -3048,33 +3186,32 @@ 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 in
-  yes:no )
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
     { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf@gnu.org. ##
-## ------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
     ;;
-  no:yes )
+  no:yes:* )
     { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
     { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
 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 bug-autoconf@gnu.org. ##
-## ------------------------------------ ##
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
 _ASBOX
     ) |
       sed "s/^/$as_me: WARNING:     /" >&2
@@ -3085,7 +3222,7 @@ echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  eval "$as_ac_Header=$ac_header_preproc"
+  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
@@ -3118,7 +3255,6 @@ else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lcrypto  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -3142,11 +3278,21 @@ MD5_Init ();
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&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 -s conftest$ac_exeext'
+        { 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=$?
@@ -3159,7 +3305,8 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
 ac_cv_lib_crypto_MD5_Init=no
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+      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
@@ -3186,7 +3333,6 @@ else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lssl  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -3210,11 +3356,21 @@ SSL_CTX_new ();
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&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 -s conftest$ac_exeext'
+        { 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=$?
@@ -3227,7 +3383,8 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
 ac_cv_lib_ssl_SSL_CTX_new=no
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+      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
@@ -3254,7 +3411,6 @@ else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lpopt  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -3278,11 +3434,21 @@ poptGetContext ();
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&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 -s conftest$ac_exeext'
+        { 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=$?
@@ -3295,7 +3461,8 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
 ac_cv_lib_popt_poptGetContext=no
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
 echo "$as_me:$LINENO: result: $ac_cv_lib_popt_poptGetContext" >&5
@@ -3325,7 +3492,6 @@ if test "$cross_compiling" = yes; then
 
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -3372,7 +3538,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
     LINUX_PATCH="0"
 
 fi
-rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core 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
@@ -3435,7 +3601,6 @@ else
 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
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -3446,11 +3611,21 @@ $ac_includes_default
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&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'
+        { 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=$?
@@ -3463,7 +3638,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
 ac_header_compiler=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+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
 
@@ -3471,7 +3646,6 @@ echo "${ECHO_T}$ac_header_compiler" >&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
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -3489,6 +3663,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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
@@ -3508,33 +3683,32 @@ 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 in
-  yes:no )
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
     { echo "$as_me:$LINENO: WARNING: net/ip_vs.h: accepted by the compiler, rejected by the preprocessor!" >&5
 echo "$as_me: WARNING: net/ip_vs.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: net/ip_vs.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: net/ip_vs.h: proceeding with the preprocessor's result" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf@gnu.org. ##
-## ------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
+    { echo "$as_me:$LINENO: WARNING: net/ip_vs.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: net/ip_vs.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
     ;;
-  no:yes )
+  no:yes:* )
     { echo "$as_me:$LINENO: WARNING: net/ip_vs.h: present but cannot be compiled" >&5
 echo "$as_me: WARNING: net/ip_vs.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: net/ip_vs.h: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: net/ip_vs.h: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: net/ip_vs.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: net/ip_vs.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: net/ip_vs.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: net/ip_vs.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: net/ip_vs.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: net/ip_vs.h:     section \"Present But Cannot Be Compiled\"" >&2;}
     { echo "$as_me:$LINENO: WARNING: net/ip_vs.h: proceeding with the preprocessor's result" >&5
 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 bug-autoconf@gnu.org. ##
-## ------------------------------------ ##
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
 _ASBOX
     ) |
       sed "s/^/$as_me: WARNING:     /" >&2
@@ -3578,7 +3752,6 @@ echo $ECHO_N "checking for IPVS version... $ECHO_C" >&6
 
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -3625,7 +3798,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
     IPVS_PATCH="0"
 
 fi
-rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+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
@@ -3683,7 +3856,6 @@ echo "${ECHO_T}no" >&6
 
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -3728,7 +3900,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 echo "${ECHO_T}no" >&6
 
 fi
-rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 fi
 
@@ -3752,7 +3924,6 @@ if test "${ac_cv_c_const+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -3815,11 +3986,21 @@ main ()
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&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'
+        { 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=$?
@@ -3832,7 +4013,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
 ac_cv_c_const=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f 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
@@ -3850,7 +4031,6 @@ if test "${ac_cv_type_pid_t+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -3870,11 +4050,21 @@ if (sizeof (pid_t))
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&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'
+        { 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=$?
@@ -3887,7 +4077,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
 ac_cv_type_pid_t=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f 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
@@ -3907,7 +4097,6 @@ if test "${ac_cv_header_time+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -3928,11 +4117,21 @@ return 0;
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&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'
+        { 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=$?
@@ -3945,7 +4144,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
 ac_cv_header_time=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f 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
@@ -3966,7 +4165,6 @@ if test "${ac_cv_prog_gcc_traditional+set}" = set; then
 else
     ac_pattern="Autoconf.*'x'"
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -3986,7 +4184,6 @@ rm -f conftest*
 
   if test $ac_cv_prog_gcc_traditional = no; then
     cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -4019,13 +4216,12 @@ else
   ac_cv_func_memcmp_working=no
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-
+$ac_includes_default
 int
 main ()
 {
@@ -4044,12 +4240,12 @@ main ()
     int i;
     for (i = 0; i < 4; i++)
       {
-        char *a = foo + i;
-        char *b = bar + i;
-        strcpy (a, "--------01111111");
-        strcpy (b, "--------10000000");
-        if (memcmp (a, b, 16) >= 0)
-          exit (1);
+       char *a = foo + i;
+       char *b = bar + i;
+       strcpy (a, "--------01111111");
+       strcpy (b, "--------10000000");
+       if (memcmp (a, b, 16) >= 0)
+         exit (1);
       }
     exit (0);
   }
@@ -4078,12 +4274,19 @@ sed 's/^/| /' conftest.$ac_ext >&5
 ( exit $ac_status )
 ac_cv_func_memcmp_working=no
 fi
-rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core 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 && LIBOBJS="$LIBOBJS memcmp.$ac_objext"
+test $ac_cv_func_memcmp_working = no && case $LIBOBJS in
+    "memcmp.$ac_objext"   | \
+  *" memcmp.$ac_objext"   | \
+    "memcmp.$ac_objext "* | \
+  *" 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
@@ -4091,7 +4294,6 @@ if test "${ac_cv_type_signal+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -4118,11 +4320,21 @@ int i;
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&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'
+        { 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=$?
@@ -4135,7 +4347,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
 ac_cv_type_signal=int
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f 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
@@ -4160,21 +4372,28 @@ if eval "test \"\${$as_ac_var+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func (); below.
     Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
     <limits.h> exists even on freestanding compilers.  */
+
 #ifdef __STDC__
 # include <limits.h>
 #else
 # include <assert.h>
 #endif
+
+#undef $ac_func
+
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
 extern "C"
@@ -4205,11 +4424,21 @@ return f != $ac_func;
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&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 -s conftest$ac_exeext'
+        { 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=$?
@@ -4222,7 +4451,8 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
 eval "$as_ac_var=no"
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+      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
@@ -4278,13 +4508,13 @@ _ACEOF
       # `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"
+       "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"
+       "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
       ;;
     esac;
 } |
@@ -4314,13 +4544,13 @@ test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
 # 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[        ]*=/{
+  ac_vpsub='/^[         ]*VPATH[        ]*=/{
 s/:*\$(srcdir):*/:/;
 s/:*\${srcdir}:*/:/;
 s/:*@srcdir@:*/:/;
-s/^\([^=]*=[   ]*\):*/\1/;
+s/^\([^=]*=[    ]*\):*/\1/;
 s/:*$//;
-s/^[^=]*=[     ]*$//;
+s/^[^=]*=[      ]*$//;
 }'
 fi
 
@@ -4334,13 +4564,13 @@ fi
 cat >confdef2opt.sed <<\_ACEOF
 t clear
 : clear
-s,^[   ]*#[    ]*define[       ][      ]*\([^  (][^    (]*([^)]*)\)[   ]*\(.*\),-D\1=\2,g
+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
 s,\$,$$,g
@@ -4362,7 +4592,7 @@ 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$//'`
+        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'
@@ -4406,9 +4636,10 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
 elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
   set -o posix
 fi
+DUALCASE=1; export DUALCASE # for MKS sh
 
 # Support unset when possible.
-if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
   as_unset=unset
 else
   as_unset=false
@@ -4427,7 +4658,7 @@ for as_var in \
   LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
   LC_TELEPHONE LC_TIME
 do
-  if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then
+  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
@@ -4606,16 +4837,17 @@ rm -f conf$$ conf$$.exe conf$$.file
 if mkdir -p . 2>/dev/null; then
   as_mkdir_p=:
 else
+  test -d ./-p && rmdir ./-p
   as_mkdir_p=false
 fi
 
 as_executable_p="test -f"
 
 # Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
 
 # Sed expression to map a string onto a valid variable name.
-as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
 
 
 # IFS
@@ -4642,7 +4874,7 @@ _ASBOX
 cat >&5 <<_CSEOF
 
 This file was extended by $as_me, which was
-generated by GNU Autoconf 2.57.  Invocation command line was
+generated by GNU Autoconf 2.59.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -4686,7 +4918,7 @@ Usage: $0 [OPTIONS] [FILE]...
   -d, --debug      don't remove temporary files
       --recheck    update $as_me by reconfiguring in the same conditions
   --file=FILE[:TEMPLATE]
-                   instantiate the configuration file FILE
+                  instantiate the configuration file FILE
 
 Configuration files:
 $config_files
@@ -4697,11 +4929,10 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF
 ac_cs_version="\\
 config.status
-configured by $0, generated by GNU Autoconf 2.57,
+configured by $0, generated by GNU Autoconf 2.59,
   with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
 
-Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
-Free Software Foundation, Inc.
+Copyright (C) 2003 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
@@ -4935,9 +5166,9 @@ _ACEOF
       (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"
+       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"
+       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
@@ -4955,21 +5186,21 @@ 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,:.*,,'` ;;
+       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=`echo "$ac_file" | sed 's,:.*,,'` ;;
   * )   ac_file_in=$ac_file.in ;;
   esac
 
   # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
   ac_dir=`(dirname "$ac_file") 2>/dev/null ||
 $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\(//\)[^/]' \| \
+        X"$ac_file" : 'X\(//\)$' \| \
+        X"$ac_file" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
 echo X"$ac_file" |
     sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
          /^X\(\/\/\)[^/].*/{ s//\1/; q; }
@@ -4985,10 +5216,10 @@ echo X"$ac_file" |
       as_dirs="$as_dir $as_dirs"
       as_dir=`(dirname "$as_dir") 2>/dev/null ||
 $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\(//\)[^/]' \| \
+        X"$as_dir" : 'X\(//\)$' \| \
+        X"$as_dir" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
 echo X"$as_dir" |
     sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
          /^X\(\/\/\)[^/].*/{ s//\1/; q; }
@@ -5026,12 +5257,45 @@ case $srcdir in
     ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
     ac_top_srcdir=$ac_top_builddir$srcdir ;;
 esac
-# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
-# absolute.
-ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
-ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd`
-ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
-ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
+
+# 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 $INSTALL in
@@ -5053,7 +5317,7 @@ echo "$as_me: creating $ac_file" >&6;}
     configure_input="$ac_file.  "
   fi
   configure_input=$configure_input"Generated from `echo $ac_file_in |
-                                     sed 's,.*/,,'` by configure."
+                                    sed 's,.*/,,'` by configure."
 
   # First look for the input files in the build tree, otherwise in the
   # src tree.
@@ -5062,24 +5326,24 @@ echo "$as_me: creating $ac_file" >&6;}
       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
+        # 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;;
+        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
+        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;;
+        fi;;
       esac
     done` || { (exit 1); exit 1; }
 _ACEOF
diff --git a/debian/changelog b/debian/changelog
new file mode 100644 (file)
index 0000000..593b43b
--- /dev/null
@@ -0,0 +1,160 @@
+keepalived (1.1.8) unstable; urgency=low
+
+  * Cf ChangeLog
+
+ -- Alexandre Cassen <acassen@linux-vs.org>  Tue, 25 Jan 2005 21:15:22 +0200
+
+keepalived (1.1.7-2) unstable; urgency=low
+
+  * New Maintainer: Alexander Wirt <formorer@debian.org>
+    No Bugs, no problems with this package. Thanks for the good 
+    work Andres, I'm happy to take this package
+
+ -- Alexander Wirt <formorer@debian.org>  Wed, 19 May 2004 20:32:03 +0200
+
+keepalived (1.1.7-1) unstable; urgency=low
+
+  * New upstream release.
+  * 003-genhash_8.patch: drop genhash manpage, as it's been merged upstream.
+  * 001-genhash_1.patch: add new manpage location fix; should be genhash(1).
+
+ -- Andres Salomon <dilinger@voxel.net>  Sun, 02 May 2004 23:44:39 -0400
+
+keepalived (1.1.6-1) unstable; urgency=low
+
+  * New upstream release.
+  * Drop 001-really_distclean.patch and 002-use_destdir.patch; merged 
+    upstream.
+  * 003-genhash_8.patch: add genhash manpage.
+  * Update ip_vs.h to version from 2.6.4-1.  Keepalived now compiles
+    using 2.6 headers.  Update description accordingly.
+  * Update copyright file.
+  * Make init script not check if kernel has IPVS support (closes: #237141).
+
+ -- Andres Salomon <dilinger@voxel.net>  Tue, 30 Mar 2004 22:05:24 -0500
+
+keepalived (1.1.5-2) unstable; urgency=low
+
+  * Can't use kernel-headers package, not all arch have it.  Revert
+    back to storing headers in debian/ subdir.
+
+ -- Andres Salomon <dilinger@voxel.net>  Tue, 10 Feb 2004 02:38:14 -0500
+
+keepalived (1.1.5-1) unstable; urgency=low
+
+  * New upstream release.  (Closes: #231418)
+  * Now that ipvs is in 2.4, use kernel-headers package instead of storing
+    kernel headers in debian/ subdir.  Add appropriate build-dep.
+  * Convert buildsys to cdbs and update standards-version.
+  * 001-really_distclean.patch: clean binaries out of ./bin.
+  * 002-use_destdir.patch: add DESTDIR to makefiles.
+  * Upstream now has manpages for keepalived and keepalived.conf.
+
+ -- Andres Salomon <dilinger@voxel.net>  Fri, 30 Jan 2004 02:51:47 -0500
+
+keepalived (1.0.3-1) unstable; urgency=low
+
+  * New upstream release; I'm going to wait for this release to enter
+    testing before allowing the 1.1.x series into unstable.  (Closes: #199437)
+  * Update maintainer email address.
+  * Update standards-version.
+  * Update kernel headers and scripts.
+
+ -- Andres Salomon <dilinger@voxel.net>  Sat, 26 Jul 2003 01:03:19 -0400
+
+keepalived (1.0.2-1) unstable; urgency=low
+
+  * New upstream release.
+  * Fixed previous changelog entry's year (2002 -> 2003), so it doesn's appear
+    that I time travel.  At the very least, I wouldn't want people discovering
+    my secret, and risk my time machine falling into the wrong hands.
+  * Upstream docs changed location; updated.
+  * Dropped dh_undocumented usage.
+  * Added reload support to the init script.
+
+ -- Andres Salomon <dilinger@mp3revolution.net>  Thu, 17 Apr 2003 00:38:48 -0500
+
+keepalived (1.0.0-1) unstable; urgency=low
+
+  * New upstream release.
+  * Update standards-version to 3.5.8.0.
+  * Update kernel headers for ipvs-1.0.7.
+
+ -- Andres Salomon <dilinger@mp3revolution.net>  Fri, 17 Jan 2003 15:26:38 -0400
+
+keepalived (0.7.6-1) unstable; urgency=low
+
+  * New upstream release.
+  * Several minor description/copyright changes to make new lintian happy.
+  * Add removal of config.log to clean target in debian/rules.
+
+ -- Andres Salomon <dilinger@mp3revolution.net>  Sun,  8 Dec 2002 23:59:17 -0400
+
+keepalived (0.7.1-1) unstable; urgency=low
+
+  * New upstream release.
+  * Update kernel headers for ipvs-1.0.6.
+  * Remove dependance upon gcc-3.0; upstream says 2.95 works fine now,
+    and we should be transitioning to gcc-3.2 soon, anyways (hopefully).
+
+ -- Andres Salomon <dilinger@mp3revolution.net>  Sat, 21 Sep 2002 16:05:52 -0400
+
+keepalived (0.6.10-2) unstable; urgency=low
+
+  * Add OpenSSL exception clause to the copyright file.
+
+ -- Andres Salomon <dilinger@mp3revolution.net>  Thu, 22 Aug 2002 11:48:16 -0400
+
+keepalived (0.6.10-1) unstable; urgency=low
+
+  * New upstream release.
+  * Update kernel headers to 2.4.19 and ipvs-1.0.4.
+
+ -- Andres Salomon <dilinger@mp3revolution.net>  Wed, 14 Aug 2002 23:42:48 -0400
+
+keepalived (0.6.8-1) unstable; urgency=low
+
+  * New upstream release.
+  * Updated description to mention VRRPv2.
+  * Depend upon gcc-3.0, since gcc-2.95 and keepalived have, uh, issues.
+  * Updated various paths to reflect changed build system/layout.
+
+ -- Andres Salomon <dilinger@mp3revolution.net>  Thu, 18 Jul 2002 01:47:42 -0500
+
+keepalived (0.6.2-1) unstable; urgency=low
+
+  * New upstream release, upload to archive.  (Closes: #144100)
+  * Autoconf sanity upstream, remove configure.in/Makefile.in patches.
+  * Fix typo in top level Makefile.in.
+  * Updated URL for keepalived (keepalived.sf.net -> www.keepalived.org).
+  * For easier maintenance of kernel header files, grab scripts from my
+    devmapper package.
+
+ -- Andres Salomon <dilinger@mp3revolution.net>  Sun, 16 Jun 2002 15:47:39 -0500
+
+keepalived (0.5.8-1) unstable; urgency=low
+
+  * New upstream release.
+  * Note the OpenSSL exception clause in the README.
+
+ -- Andres Salomon <dilinger@mp3revolution.net>  Tue, 21 May 2002 15:18:02 -0500
+
+keepalived (0.5.7-1) unstable; urgency=low
+
+  * New upstream release (w/ SSL_GET fixes!).
+  * Moved sample configs to doc directory.
+
+ -- Andres Salomon <dilinger@mp3revolution.net>  Thu,  2 May 2002 20:14:38 -0500
+
+keepalived (0.5.6-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Andres Salomon <dilinger@mp3revolution.net>  Thu, 11 Apr 2002 01:38:19 -0500
+
+keepalived (0.5.5-1) unstable; urgency=low
+
+  * Initial Release.
+
+ -- Andres Salomon <dilinger@mp3revolution.net>  Thu, 11 Apr 2002 01:38:19 -0500
+
diff --git a/debian/compat b/debian/compat
new file mode 100644 (file)
index 0000000..b8626c4
--- /dev/null
@@ -0,0 +1 @@
+4
diff --git a/debian/control b/debian/control
new file mode 100644 (file)
index 0000000..28075a4
--- /dev/null
@@ -0,0 +1,24 @@
+Source: keepalived
+Section: admin
+Priority: optional
+Maintainer: Alexander Wirt <formorer@debian.org>
+Build-Depends: debhelper (>> 4.1.0), libssl-dev, libpopt-dev, textutils, cdbs
+Standards-Version: 3.6.1
+
+Package: keepalived
+Section: admin
+Architecture: any
+Depends: ${shlibs:Depends}, ipvsadm
+Description: Failover and monitoring daemon for LVS clusters
+ keepalived is used for monitoring real servers within a Linux
+ Virtual Server (LVS) cluster.  keepalived can be configured to
+ remove real servers from the cluster pool if it stops responding,
+ as well as send a notification email to make the admin aware of
+ the service failure.
+ .
+ In addition, keepalived implements an independent Virtual Router
+ Redundancy Protocol (VRRPv2; see rfc2338 for additional info)
+ framework for director failover.
+ .
+ Note that keepalived is compiled with the expectations of being
+ used on a Linux 2.4.x or 2.6.x system.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644 (file)
index 0000000..3cb3972
--- /dev/null
@@ -0,0 +1,38 @@
+This package was debianized by Andres Salomon <dilinger@voxel.net> on
+Thu, 11 Apr 2002 01:38:19 -0400.
+
+And is now maintained from Alexander Wirt <formorer@debian.org> on
+Do Mai 20 00:51:09 CEST 2004
+
+It was downloaded from http://www.keepalived.org/
+
+Upstream Author: Alexandre Cassen <acassen@linux-vs.org>
+
+Copyright (C) 2001-2004 Alexandre Cassen <acassen@linux-vs.org>
+
+keepalived 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.
+
+keepalived 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.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
+
+On Debian systems, the full text of the GPL can be found in
+/usr/share/common-licenses/GPL
+
+Additionally, the following clause applies:
+
+In addition, as the copyright holder of Keepalived,
+I, Alexandre Cassen, <acassen@linux-vs.org>,
+grant the following special exception: 
+
+       I, Alexandre Cassen, <acassen@linux-vs.org>, explicitly allow
+       the compilation and distribution of the Keepalived software with
+       the OpenSSL Toolkit.
diff --git a/debian/dirs b/debian/dirs
new file mode 100644 (file)
index 0000000..4cdca10
--- /dev/null
@@ -0,0 +1,4 @@
+usr/bin
+usr/sbin
+etc/keepalived
+usr/share/doc/keepalived/samples
diff --git a/debian/docs b/debian/docs
new file mode 100644 (file)
index 0000000..602f9cc
--- /dev/null
@@ -0,0 +1,6 @@
+AUTHOR
+CONTRIBUTORS
+TODO
+README
+doc/keepalived.conf*
+doc/samples
diff --git a/debian/include/net/ip_vs.h b/debian/include/net/ip_vs.h
new file mode 100644 (file)
index 0000000..9ba2479
--- /dev/null
@@ -0,0 +1,999 @@
+/*
+ *      IP Virtual Server
+ *      data structure and functionality definitions
+ */
+
+#ifndef _IP_VS_H
+#define _IP_VS_H
+
+#include <asm/types.h>         /* For __uXX types */
+
+#define IP_VS_VERSION_CODE     0x010200
+#define NVERSION(version)                      \
+       (version >> 16) & 0xFF,                 \
+       (version >> 8) & 0xFF,                  \
+       version & 0xFF
+
+/*
+ *      Virtual Service Flags
+ */
+#define IP_VS_SVC_F_PERSISTENT 0x0001          /* persistent port */
+#define IP_VS_SVC_F_HASHED     0x0002          /* hashed entry */
+
+/*
+ *      Destination Server Flags
+ */
+#define IP_VS_DEST_F_AVAILABLE 0x0001          /* server is available */
+#define IP_VS_DEST_F_OVERLOAD  0x0002          /* server is overloaded */
+
+/*
+ *      IPVS sync daemon states
+ */
+#define IP_VS_STATE_NONE       0x0000          /* daemon is stopped */
+#define IP_VS_STATE_MASTER     0x0001          /* started as master */
+#define IP_VS_STATE_BACKUP     0x0002          /* started as backup */
+
+/*
+ *      IPVS socket options
+ */
+#define IP_VS_BASE_CTL         (64+1024+64)            /* base */
+
+#define IP_VS_SO_SET_NONE      IP_VS_BASE_CTL          /* just peek */
+#define IP_VS_SO_SET_INSERT    (IP_VS_BASE_CTL+1)
+#define IP_VS_SO_SET_ADD       (IP_VS_BASE_CTL+2)
+#define IP_VS_SO_SET_EDIT      (IP_VS_BASE_CTL+3)
+#define IP_VS_SO_SET_DEL       (IP_VS_BASE_CTL+4)
+#define IP_VS_SO_SET_FLUSH     (IP_VS_BASE_CTL+5)
+#define IP_VS_SO_SET_LIST      (IP_VS_BASE_CTL+6)
+#define IP_VS_SO_SET_ADDDEST   (IP_VS_BASE_CTL+7)
+#define IP_VS_SO_SET_DELDEST   (IP_VS_BASE_CTL+8)
+#define IP_VS_SO_SET_EDITDEST  (IP_VS_BASE_CTL+9)
+#define IP_VS_SO_SET_TIMEOUT   (IP_VS_BASE_CTL+10)
+#define IP_VS_SO_SET_STARTDAEMON (IP_VS_BASE_CTL+11)
+#define IP_VS_SO_SET_STOPDAEMON (IP_VS_BASE_CTL+12)
+#define IP_VS_SO_SET_RESTORE    (IP_VS_BASE_CTL+13)
+#define IP_VS_SO_SET_SAVE       (IP_VS_BASE_CTL+14)
+#define IP_VS_SO_SET_ZERO      (IP_VS_BASE_CTL+15)
+#define IP_VS_SO_SET_MAX       IP_VS_SO_SET_ZERO
+
+#define IP_VS_SO_GET_VERSION   IP_VS_BASE_CTL
+#define IP_VS_SO_GET_INFO      (IP_VS_BASE_CTL+1)
+#define IP_VS_SO_GET_SERVICES  (IP_VS_BASE_CTL+2)
+#define IP_VS_SO_GET_SERVICE   (IP_VS_BASE_CTL+3)
+#define IP_VS_SO_GET_DESTS     (IP_VS_BASE_CTL+4)
+#define IP_VS_SO_GET_DEST      (IP_VS_BASE_CTL+5)      /* not used now */
+#define IP_VS_SO_GET_TIMEOUT   (IP_VS_BASE_CTL+6)
+#define IP_VS_SO_GET_DAEMON    (IP_VS_BASE_CTL+7)
+#define IP_VS_SO_GET_MAX       IP_VS_SO_GET_DAEMON
+
+
+/*
+ *      IPVS Connection Flags
+ */
+#define IP_VS_CONN_F_FWD_MASK  0x0007          /* mask for the fwd methods */
+#define IP_VS_CONN_F_MASQ      0x0000          /* masquerading/NAT */
+#define IP_VS_CONN_F_LOCALNODE 0x0001          /* local node */
+#define IP_VS_CONN_F_TUNNEL    0x0002          /* tunneling */
+#define IP_VS_CONN_F_DROUTE    0x0003          /* direct routing */
+#define IP_VS_CONN_F_BYPASS    0x0004          /* cache bypass */
+#define IP_VS_CONN_F_SYNC      0x0020          /* entry created by sync */
+#define IP_VS_CONN_F_HASHED    0x0040          /* hashed entry */
+#define IP_VS_CONN_F_NOOUTPUT  0x0080          /* no output packets */
+#define IP_VS_CONN_F_INACTIVE  0x0100          /* not established */
+#define IP_VS_CONN_F_OUT_SEQ   0x0200          /* must do output seq adjust */
+#define IP_VS_CONN_F_IN_SEQ    0x0400          /* must do input seq adjust */
+#define IP_VS_CONN_F_SEQ_MASK  0x0600          /* in/out sequence mask */
+#define IP_VS_CONN_F_NO_CPORT  0x0800          /* no client port set yet */
+
+/* Move it to better place one day, for now keep it unique */
+#define NFC_IPVS_PROPERTY      0x10000
+
+#define IP_VS_SCHEDNAME_MAXLEN 16
+#define IP_VS_IFNAME_MAXLEN    16
+
+
+/*
+ *     The struct ip_vs_service_user and struct ip_vs_dest_user are
+ *     used to set IPVS rules through setsockopt.
+ */
+struct ip_vs_service_user {
+       /* virtual service addresses */
+       u_int16_t               protocol;
+       u_int32_t               addr;           /* virtual ip address */
+       u_int16_t               port;
+       u_int32_t               fwmark;         /* firwall mark of service */
+
+       /* virtual service options */
+       char                    sched_name[IP_VS_SCHEDNAME_MAXLEN];
+       unsigned                flags;          /* virtual service flags */
+       unsigned                timeout;        /* persistent timeout in sec */
+       u_int32_t               netmask;        /* persistent netmask */
+};
+
+
+struct ip_vs_dest_user {
+       /* destination server address */
+       u_int32_t               addr;
+       u_int16_t               port;
+
+       /* real server options */
+       unsigned                conn_flags;     /* connection flags */
+       int                     weight;         /* destination weight */
+
+       /* thresholds for active connections */
+       u_int32_t               u_threshold;    /* upper threshold */
+       u_int32_t               l_threshold;    /* lower threshold */
+};
+
+
+/*
+ *     IPVS statistics object (for user space)
+ */
+struct ip_vs_stats_user
+{
+       __u32                   conns;          /* connections scheduled */
+       __u32                   inpkts;         /* incoming packets */
+       __u32                   outpkts;        /* outgoing packets */
+       __u64                   inbytes;        /* incoming bytes */
+       __u64                   outbytes;       /* outgoing bytes */
+
+       __u32                   cps;            /* current connection rate */
+       __u32                   inpps;          /* current in packet rate */
+       __u32                   outpps;         /* current out packet rate */
+       __u32                   inbps;          /* current in byte rate */
+       __u32                   outbps;         /* current out byte rate */
+};
+
+
+/* The argument to IP_VS_SO_GET_INFO */
+struct ip_vs_getinfo {
+       /* version number */
+       unsigned int            version;
+
+       /* size of connection hash table */
+       unsigned int            size;
+
+       /* number of virtual services */
+       unsigned int            num_services;
+};
+
+
+/* The argument to IP_VS_SO_GET_SERVICE */
+struct ip_vs_service_entry {
+       /* which service: user fills in these */
+       u_int16_t               protocol;
+       u_int32_t               addr;           /* virtual address */
+       u_int16_t               port;
+       u_int32_t               fwmark;         /* firwall mark of service */
+
+       /* service options */
+       char                    sched_name[IP_VS_SCHEDNAME_MAXLEN];
+       unsigned                flags;          /* virtual service flags */
+       unsigned                timeout;        /* persistent timeout */
+       u_int32_t               netmask;        /* persistent netmask */
+
+       /* number of real servers */
+       unsigned int            num_dests;
+
+       /* statistics */
+       struct ip_vs_stats_user stats;
+};
+
+
+struct ip_vs_dest_entry {
+       u_int32_t               addr;           /* destination address */
+       u_int16_t               port;
+       unsigned                conn_flags;     /* connection flags */
+       int                     weight;         /* destination weight */
+
+       u_int32_t               u_threshold;    /* upper threshold */
+       u_int32_t               l_threshold;    /* lower threshold */
+
+       u_int32_t               activeconns;    /* active connections */
+       u_int32_t               inactconns;     /* inactive connections */
+       u_int32_t               persistconns;   /* persistent connections */
+
+       /* statistics */
+       struct ip_vs_stats_user stats;
+};
+
+
+/* The argument to IP_VS_SO_GET_DESTS */
+struct ip_vs_get_dests {
+       /* which service: user fills in these */
+       u_int16_t               protocol;
+       u_int32_t               addr;           /* virtual address */
+       u_int16_t               port;
+       u_int32_t               fwmark;         /* firwall mark of service */
+
+       /* number of real servers */
+       unsigned int            num_dests;
+
+       /* the real servers */
+       struct ip_vs_dest_entry entrytable[0];
+};
+
+
+/* The argument to IP_VS_SO_GET_SERVICES */
+struct ip_vs_get_services {
+       /* number of virtual services */
+       unsigned int            num_services;
+
+       /* service table */
+       struct ip_vs_service_entry entrytable[0];
+};
+
+
+/* The argument to IP_VS_SO_GET_TIMEOUT */
+struct ip_vs_timeout_user {
+       int                     tcp_timeout;
+       int                     tcp_fin_timeout;
+       int                     udp_timeout;
+};
+
+
+/* The argument to IP_VS_SO_GET_DAEMON */
+struct ip_vs_daemon_user {
+       /* sync daemon state (master/backup) */
+       int                     state;
+
+       /* multicast interface name */
+       char                    mcast_ifn[IP_VS_IFNAME_MAXLEN];
+
+       /* SyncID we belong to */
+       int                     syncid;
+};
+
+
+#ifdef __KERNEL__
+
+#include <linux/config.h>
+#include <linux/list.h>                 /* for struct list_head */
+#include <linux/spinlock.h>             /* for struct rwlock_t */
+#include <linux/skbuff.h>               /* for struct sk_buff */
+#include <linux/ip.h>                   /* for struct iphdr */
+#include <asm/atomic.h>                 /* for struct atomic_t */
+#include <linux/netdevice.h>           /* for struct neighbour */
+#include <net/dst.h>                   /* for struct dst_entry */
+#include <net/tcp.h>
+#include <net/udp.h>
+#include <linux/compiler.h>
+
+
+#ifdef CONFIG_IP_VS_DEBUG
+extern int ip_vs_get_debug_level(void);
+#define IP_VS_DBG(level, msg...)                       \
+    do {                                               \
+           if (level <= ip_vs_get_debug_level())       \
+                   printk(KERN_DEBUG "IPVS: " msg);    \
+    } while (0)
+#define IP_VS_DBG_RL(msg...)                           \
+    do {                                               \
+           if (net_ratelimit())                        \
+                   printk(KERN_DEBUG "IPVS: " msg);    \
+    } while (0)
+#define IP_VS_DBG_PKT(level, pp, skb, ofs, msg)                \
+    do {                                               \
+           if (level <= ip_vs_get_debug_level())       \
+               pp->debug_packet(pp, skb, ofs, msg);    \
+    } while (0)
+#define IP_VS_DBG_RL_PKT(level, pp, skb, ofs, msg)     \
+    do {                                               \
+           if (level <= ip_vs_get_debug_level() &&     \
+               net_ratelimit())                        \
+               pp->debug_packet(pp, skb, ofs, msg);    \
+    } while (0)
+#else  /* NO DEBUGGING at ALL */
+#define IP_VS_DBG(level, msg...)  do {} while (0)
+#define IP_VS_DBG_RL(msg...)  do {} while (0)
+#define IP_VS_DBG_PKT(level, pp, skb, ofs, msg)                do {} while (0)
+#define IP_VS_DBG_RL_PKT(level, pp, skb, ofs, msg)     do {} while (0)
+#endif
+
+#define IP_VS_BUG() BUG()
+#define IP_VS_ERR(msg...) printk(KERN_ERR "IPVS: " msg)
+#define IP_VS_INFO(msg...) printk(KERN_INFO "IPVS: " msg)
+#define IP_VS_WARNING(msg...) \
+       printk(KERN_WARNING "IPVS: " msg)
+#define IP_VS_ERR_RL(msg...)                           \
+    do {                                               \
+           if (net_ratelimit())                        \
+                   printk(KERN_ERR "IPVS: " msg);      \
+    } while (0)
+
+#ifdef CONFIG_IP_VS_DEBUG
+#define EnterFunction(level)                                           \
+    do {                                                               \
+           if (level <= ip_vs_get_debug_level())                       \
+                   printk(KERN_DEBUG "Enter: %s, %s line %i\n",        \
+                          __FUNCTION__, __FILE__, __LINE__);           \
+    } while (0)
+#define LeaveFunction(level)                                            \
+    do {                                                                \
+           if (level <= ip_vs_get_debug_level())                       \
+                       printk(KERN_DEBUG "Leave: %s, %s line %i\n",    \
+                              __FUNCTION__, __FILE__, __LINE__);       \
+    } while (0)
+#else
+#define EnterFunction(level)   do {} while (0)
+#define LeaveFunction(level)   do {} while (0)
+#endif
+
+#define        IP_VS_WAIT_WHILE(expr)  while (expr) { cpu_relax(); }
+
+
+/*
+ *      The port number of FTP service (in network order).
+ */
+#define FTPPORT  __constant_htons(21)
+#define FTPDATA  __constant_htons(20)
+
+/*
+ *      IPVS sysctl variables under the /proc/sys/net/ipv4/vs/
+ */
+#define NET_IPV4_VS              21
+
+enum {
+       NET_IPV4_VS_DEBUG_LEVEL=1,
+       NET_IPV4_VS_AMEMTHRESH=2,
+       NET_IPV4_VS_AMDROPRATE=3,
+       NET_IPV4_VS_DROP_ENTRY=4,
+       NET_IPV4_VS_DROP_PACKET=5,
+       NET_IPV4_VS_SECURE_TCP=6,
+       NET_IPV4_VS_TO_ES=7,
+       NET_IPV4_VS_TO_SS=8,
+       NET_IPV4_VS_TO_SR=9,
+       NET_IPV4_VS_TO_FW=10,
+       NET_IPV4_VS_TO_TW=11,
+       NET_IPV4_VS_TO_CL=12,
+       NET_IPV4_VS_TO_CW=13,
+       NET_IPV4_VS_TO_LA=14,
+       NET_IPV4_VS_TO_LI=15,
+       NET_IPV4_VS_TO_SA=16,
+       NET_IPV4_VS_TO_UDP=17,
+       NET_IPV4_VS_TO_ICMP=18,
+       NET_IPV4_VS_LBLC_EXPIRE=19,
+       NET_IPV4_VS_LBLCR_EXPIRE=20,
+       NET_IPV4_VS_CACHE_BYPASS=22,
+       NET_IPV4_VS_EXPIRE_NODEST_CONN=23,
+       NET_IPV4_VS_SYNC_THRESHOLD=24,
+       NET_IPV4_VS_NAT_ICMP_SEND=25,
+       NET_IPV4_VS_LAST
+};
+
+/*
+ *      TCP State Values
+ */
+enum {
+       IP_VS_TCP_S_NONE = 0,
+       IP_VS_TCP_S_ESTABLISHED,
+       IP_VS_TCP_S_SYN_SENT,
+       IP_VS_TCP_S_SYN_RECV,
+       IP_VS_TCP_S_FIN_WAIT,
+       IP_VS_TCP_S_TIME_WAIT,
+       IP_VS_TCP_S_CLOSE,
+       IP_VS_TCP_S_CLOSE_WAIT,
+       IP_VS_TCP_S_LAST_ACK,
+       IP_VS_TCP_S_LISTEN,
+       IP_VS_TCP_S_SYNACK,
+       IP_VS_TCP_S_LAST
+};
+
+/*
+ *     UDP State Values
+ */
+enum {
+       IP_VS_UDP_S_NORMAL,
+       IP_VS_UDP_S_LAST,
+};
+
+/*
+ *     ICMP State Values
+ */
+enum {
+       IP_VS_ICMP_S_NORMAL,
+       IP_VS_ICMP_S_LAST,
+};
+
+/*
+ *     Delta sequence info structure
+ *     Each ip_vs_conn has 2 (output AND input seq. changes).
+ *      Only used in the VS/NAT.
+ */
+struct ip_vs_seq {
+       __u32                   init_seq;       /* Add delta from this seq */
+       __u32                   delta;          /* Delta in sequence numbers */
+       __u32                   previous_delta; /* Delta in sequence numbers
+                                                  before last resized pkt */
+};
+
+
+/*
+ *     IPVS statistics object
+ */
+struct ip_vs_stats
+{
+       __u32                   conns;          /* connections scheduled */
+       __u32                   inpkts;         /* incoming packets */
+       __u32                   outpkts;        /* outgoing packets */
+       __u64                   inbytes;        /* incoming bytes */
+       __u64                   outbytes;       /* outgoing bytes */
+
+       __u32                   cps;            /* current connection rate */
+       __u32                   inpps;          /* current in packet rate */
+       __u32                   outpps;         /* current out packet rate */
+       __u32                   inbps;          /* current in byte rate */
+       __u32                   outbps;         /* current out byte rate */
+
+       spinlock_t              lock;           /* spin lock */
+};
+
+struct ip_vs_conn;
+struct ip_vs_app;
+
+struct ip_vs_protocol {
+       struct ip_vs_protocol   *next;
+       char                    *name;
+       __u16                   protocol;
+       int                     dont_defrag;
+       atomic_t                appcnt;         /* counter of proto app incs */
+       int                     *timeout_table; /* protocol timeout table */
+
+       void (*init)(struct ip_vs_protocol *pp);
+
+       void (*exit)(struct ip_vs_protocol *pp);
+
+       int (*conn_schedule)(struct sk_buff *skb,
+                            struct ip_vs_protocol *pp,
+                            int *verdict, struct ip_vs_conn **cpp);
+
+       struct ip_vs_conn *
+       (*conn_in_get)(const struct sk_buff *skb,
+                      struct ip_vs_protocol *pp,
+                      const struct iphdr *iph,
+                      unsigned int proto_off,
+                      int inverse);
+
+       struct ip_vs_conn *
+       (*conn_out_get)(const struct sk_buff *skb,
+                       struct ip_vs_protocol *pp,
+                       const struct iphdr *iph,
+                       unsigned int proto_off,
+                       int inverse);
+
+       int (*snat_handler)(struct sk_buff **pskb,
+                           struct ip_vs_protocol *pp, struct ip_vs_conn *cp);
+
+       int (*dnat_handler)(struct sk_buff **pskb,
+                           struct ip_vs_protocol *pp, struct ip_vs_conn *cp);
+
+       int (*csum_check)(struct sk_buff *skb, struct ip_vs_protocol *pp);
+
+       const char *(*state_name)(int state);
+
+       int (*state_transition)(struct ip_vs_conn *cp, int direction,
+                               const struct sk_buff *skb,
+                               struct ip_vs_protocol *pp);
+
+       int (*register_app)(struct ip_vs_app *inc);
+
+       void (*unregister_app)(struct ip_vs_app *inc);
+
+       int (*app_conn_bind)(struct ip_vs_conn *cp);
+
+       void (*debug_packet)(struct ip_vs_protocol *pp,
+                            const struct sk_buff *skb,
+                            int offset,
+                            const char *msg);
+
+       void (*timeout_change)(struct ip_vs_protocol *pp, int flags);
+
+       int (*set_state_timeout)(struct ip_vs_protocol *pp, char *sname, int to);
+};
+
+extern struct ip_vs_protocol * ip_vs_proto_get(unsigned short proto);
+
+/*
+ *     IP_VS structure allocated for each dynamically scheduled connection
+ */
+struct ip_vs_conn {
+       struct list_head        c_list;         /* hashed list heads */
+
+       /* Protocol, addresses and port numbers */
+       __u32                   caddr;          /* client address */
+       __u32                   vaddr;          /* virtual address */
+       __u32                   daddr;          /* destination address */
+       __u16                   cport;
+       __u16                   vport;
+       __u16                   dport;
+       __u16                   protocol;       /* Which protocol (TCP/UDP) */
+
+       /* counter and timer */
+       atomic_t                refcnt;         /* reference count */
+       struct timer_list       timer;          /* Expiration timer */
+       volatile unsigned long  timeout;        /* timeout */
+
+       /* Flags and state transition */
+       spinlock_t              lock;           /* lock for state transition */
+       volatile __u16          flags;          /* status flags */
+       volatile __u16          state;          /* state info */
+
+       /* Control members */
+       struct ip_vs_conn       *control;       /* Master control connection */
+       atomic_t                n_control;      /* Number of controlled ones */
+       struct ip_vs_dest       *dest;          /* real server */
+       atomic_t                in_pkts;        /* incoming packet counter */
+
+       /* packet transmitter for different forwarding methods.  If it
+          mangles the packet, it must return NF_DROP or better NF_STOLEN,
+          otherwise this must be changed to a sk_buff **.
+        */
+       int (*packet_xmit)(struct sk_buff *skb, struct ip_vs_conn *cp,
+                          struct ip_vs_protocol *pp);
+
+       /* Note: we can group the following members into a structure,
+          in order to save more space, and the following members are
+          only used in VS/NAT anyway */
+       struct ip_vs_app        *app;           /* bound ip_vs_app object */
+       void                    *app_data;      /* Application private data */
+       struct ip_vs_seq        in_seq;         /* incoming seq. struct */
+       struct ip_vs_seq        out_seq;        /* outgoing seq. struct */
+};
+
+
+/*
+ *     The information about the virtual service offered to the net
+ *     and the forwarding entries
+ */
+struct ip_vs_service {
+       struct list_head        s_list;   /* for normal service table */
+       struct list_head        f_list;   /* for fwmark-based service table */
+       atomic_t                refcnt;   /* reference counter */
+       atomic_t                usecnt;   /* use counter */
+
+       __u16                   protocol; /* which protocol (TCP/UDP) */
+       __u32                   addr;     /* IP address for virtual service */
+       __u16                   port;     /* port number for the service */
+       __u32                   fwmark;   /* firewall mark of the service */
+       unsigned                flags;    /* service status flags */
+       unsigned                timeout;  /* persistent timeout in ticks */
+       __u32                   netmask;  /* grouping granularity */
+
+       struct list_head        destinations;  /* real server d-linked list */
+       __u32                   num_dests;     /* number of servers */
+       struct ip_vs_stats      stats;         /* statistics for the service */
+       struct ip_vs_app        *inc;     /* bind conns to this app inc */
+
+       /* for scheduling */
+       struct ip_vs_scheduler  *scheduler;    /* bound scheduler object */
+       rwlock_t                sched_lock;    /* lock sched_data */
+       void                    *sched_data;   /* scheduler application data */
+};
+
+
+/*
+ *     The real server destination forwarding entry
+ *     with ip address, port number, and so on.
+ */
+struct ip_vs_dest {
+       struct list_head        n_list;   /* for the dests in the service */
+       struct list_head        d_list;   /* for table with all the dests */
+
+       __u32                   addr;           /* IP address of the server */
+       __u16                   port;           /* port number of the server */
+       volatile unsigned       flags;          /* dest status flags */
+       atomic_t                conn_flags;     /* flags to copy to conn */
+       atomic_t                weight;         /* server weight */
+
+       atomic_t                refcnt;         /* reference counter */
+       struct ip_vs_stats      stats;          /* statistics */
+
+       /* connection counters and thresholds */
+       atomic_t                activeconns;    /* active connections */
+       atomic_t                inactconns;     /* inactive connections */
+       atomic_t                persistconns;   /* persistent connections */
+       __u32                   u_threshold;    /* upper threshold */
+       __u32                   l_threshold;    /* lower threshold */
+
+       /* for destination cache */
+       spinlock_t              dst_lock;       /* lock of dst_cache */
+       struct dst_entry        *dst_cache;     /* destination cache entry */
+       u32                     dst_rtos;       /* RT_TOS(tos) for dst */
+
+       /* for virtual service */
+       struct ip_vs_service    *svc;           /* service it belongs to */
+       __u16                   protocol;       /* which protocol (TCP/UDP) */
+       __u32                   vaddr;          /* virtual IP address */
+       __u16                   vport;          /* virtual port number */
+       __u32                   vfwmark;        /* firewall mark of service */
+};
+
+
+/*
+ *     The scheduler object
+ */
+struct ip_vs_scheduler {
+       struct list_head        n_list;         /* d-linked list head */
+       char                    *name;          /* scheduler name */
+       atomic_t                refcnt;         /* reference counter */
+       struct module           *module;        /* THIS_MODULE/NULL */
+
+       /* scheduler initializing service */
+       int (*init_service)(struct ip_vs_service *svc);
+       /* scheduling service finish */
+       int (*done_service)(struct ip_vs_service *svc);
+       /* scheduler updating service */
+       int (*update_service)(struct ip_vs_service *svc);
+
+       /* selecting a server from the given service */
+       struct ip_vs_dest* (*schedule)(struct ip_vs_service *svc,
+                                      const struct sk_buff *skb);
+};
+
+
+/*
+ *     The application module object (a.k.a. app incarnation)
+ */
+struct ip_vs_app
+{
+       struct list_head        a_list;         /* member in app list */
+       int                     type;           /* IP_VS_APP_TYPE_xxx */
+       char                    *name;          /* application module name */
+       __u16                   protocol;
+       struct module           *module;        /* THIS_MODULE/NULL */
+       struct list_head        incs_list;      /* list of incarnations */
+
+       /* members for application incarnations */
+       struct list_head        p_list;         /* member in proto app list */
+       struct ip_vs_app        *app;           /* its real application */
+       __u16                   port;           /* port number in net order */
+       atomic_t                usecnt;         /* usage counter */
+
+       /* output hook: return false if can't linearize. diff set for TCP.  */
+       int (*pkt_out)(struct ip_vs_app *, struct ip_vs_conn *,
+                      struct sk_buff **, int *diff);
+
+       /* input hook: return false if can't linearize. diff set for TCP. */
+       int (*pkt_in)(struct ip_vs_app *, struct ip_vs_conn *,
+                     struct sk_buff **, int *diff);
+
+       /* ip_vs_app initializer */
+       int (*init_conn)(struct ip_vs_app *, struct ip_vs_conn *);
+
+       /* ip_vs_app finish */
+       int (*done_conn)(struct ip_vs_app *, struct ip_vs_conn *);
+
+
+       /* not used now */
+       int (*bind_conn)(struct ip_vs_app *, struct ip_vs_conn *,
+                        struct ip_vs_protocol *);
+
+       void (*unbind_conn)(struct ip_vs_app *, struct ip_vs_conn *);
+
+       int *                   timeout_table;
+       int *                   timeouts;
+       int                     timeouts_size;
+
+       int (*conn_schedule)(struct sk_buff *skb, struct ip_vs_app *app,
+                            int *verdict, struct ip_vs_conn **cpp);
+
+       struct ip_vs_conn *
+       (*conn_in_get)(const struct sk_buff *skb, struct ip_vs_app *app,
+                      const struct iphdr *iph, unsigned int proto_off,
+                      int inverse);
+
+       struct ip_vs_conn *
+       (*conn_out_get)(const struct sk_buff *skb, struct ip_vs_app *app,
+                       const struct iphdr *iph, unsigned int proto_off,
+                       int inverse);
+
+       int (*state_transition)(struct ip_vs_conn *cp, int direction,
+                               const struct sk_buff *skb,
+                               struct ip_vs_app *app);
+
+       void (*timeout_change)(struct ip_vs_app *app, int flags);
+};
+
+
+/*
+ *      IPVS core functions
+ *      (from ip_vs_core.c)
+ */
+extern const char *ip_vs_proto_name(unsigned proto);
+extern unsigned int check_for_ip_vs_out(struct sk_buff **skb_p,
+                                       int (*okfn)(struct sk_buff *));
+extern void ip_vs_init_hash_table(struct list_head *table, int rows);
+#define IP_VS_INIT_HASH_TABLE(t) ip_vs_init_hash_table(t, sizeof(t)/sizeof(t[0]))
+
+#define IP_VS_APP_TYPE_UNSPEC  0
+#define IP_VS_APP_TYPE_FTP     1
+
+/*
+ *     ip_vs_conn handling functions
+ *     (from ip_vs_conn.c)
+ */
+
+/*
+ *     IPVS connection entry hash table
+ */
+#ifndef CONFIG_IP_VS_TAB_BITS
+#define CONFIG_IP_VS_TAB_BITS   12
+#endif
+/* make sure that IP_VS_CONN_TAB_BITS is located in [8, 20] */
+#if CONFIG_IP_VS_TAB_BITS < 8
+#define IP_VS_CONN_TAB_BITS    8
+#endif
+#if CONFIG_IP_VS_TAB_BITS > 20
+#define IP_VS_CONN_TAB_BITS    20
+#endif
+#if 8 <= CONFIG_IP_VS_TAB_BITS && CONFIG_IP_VS_TAB_BITS <= 20
+#define IP_VS_CONN_TAB_BITS    CONFIG_IP_VS_TAB_BITS
+#endif
+#define IP_VS_CONN_TAB_SIZE     (1 << IP_VS_CONN_TAB_BITS)
+#define IP_VS_CONN_TAB_MASK     (IP_VS_CONN_TAB_SIZE - 1)
+
+enum {
+       IP_VS_DIR_INPUT = 0,
+       IP_VS_DIR_OUTPUT,
+       IP_VS_DIR_INPUT_ONLY,
+       IP_VS_DIR_LAST,
+};
+
+extern struct ip_vs_conn *ip_vs_conn_in_get
+(int protocol, __u32 s_addr, __u16 s_port, __u32 d_addr, __u16 d_port);
+extern struct ip_vs_conn *ip_vs_conn_out_get
+(int protocol, __u32 s_addr, __u16 s_port, __u32 d_addr, __u16 d_port);
+
+/* put back the conn without restarting its timer */
+static inline void __ip_vs_conn_put(struct ip_vs_conn *cp)
+{
+       atomic_dec(&cp->refcnt);
+}
+extern void ip_vs_conn_put(struct ip_vs_conn *cp);
+extern void ip_vs_conn_fill_cport(struct ip_vs_conn *cp, __u16 cport);
+
+extern struct ip_vs_conn *
+ip_vs_conn_new(int proto, __u32 caddr, __u16 cport, __u32 vaddr, __u16 vport,
+              __u32 daddr, __u16 dport, unsigned flags,
+              struct ip_vs_dest *dest);
+extern void ip_vs_conn_expire_now(struct ip_vs_conn *cp);
+
+extern const char * ip_vs_state_name(__u16 proto, int state);
+
+extern void ip_vs_tcp_conn_listen(struct ip_vs_conn *cp);
+extern int ip_vs_check_template(struct ip_vs_conn *ct);
+extern void ip_vs_secure_tcp_set(int on);
+extern void ip_vs_random_dropentry(void);
+extern int ip_vs_conn_init(void);
+extern void ip_vs_conn_cleanup(void);
+
+static inline void ip_vs_control_del(struct ip_vs_conn *cp)
+{
+       struct ip_vs_conn *ctl_cp = cp->control;
+       if (!ctl_cp) {
+               IP_VS_ERR("request control DEL for uncontrolled: "
+                         "%d.%d.%d.%d:%d to %d.%d.%d.%d:%d\n",
+                         NIPQUAD(cp->caddr),ntohs(cp->cport),
+                         NIPQUAD(cp->vaddr),ntohs(cp->vport));
+               return;
+       }
+
+       IP_VS_DBG(7, "DELeting control for: "
+                 "cp.dst=%d.%d.%d.%d:%d ctl_cp.dst=%d.%d.%d.%d:%d\n",
+                 NIPQUAD(cp->caddr),ntohs(cp->cport),
+                 NIPQUAD(ctl_cp->caddr),ntohs(ctl_cp->cport));
+
+       cp->control = NULL;
+       if (atomic_read(&ctl_cp->n_control) == 0) {
+               IP_VS_ERR("BUG control DEL with n=0 : "
+                         "%d.%d.%d.%d:%d to %d.%d.%d.%d:%d\n",
+                         NIPQUAD(cp->caddr),ntohs(cp->cport),
+                         NIPQUAD(cp->vaddr),ntohs(cp->vport));
+               return;
+       }
+       atomic_dec(&ctl_cp->n_control);
+}
+
+static inline void
+ip_vs_control_add(struct ip_vs_conn *cp, struct ip_vs_conn *ctl_cp)
+{
+       if (cp->control) {
+               IP_VS_ERR("request control ADD for already controlled: "
+                         "%d.%d.%d.%d:%d to %d.%d.%d.%d:%d\n",
+                         NIPQUAD(cp->caddr),ntohs(cp->cport),
+                         NIPQUAD(cp->vaddr),ntohs(cp->vport));
+               ip_vs_control_del(cp);
+       }
+
+       IP_VS_DBG(7, "ADDing control for: "
+                 "cp.dst=%d.%d.%d.%d:%d ctl_cp.dst=%d.%d.%d.%d:%d\n",
+                 NIPQUAD(cp->caddr),ntohs(cp->cport),
+                 NIPQUAD(ctl_cp->caddr),ntohs(ctl_cp->cport));
+
+       cp->control = ctl_cp;
+       atomic_inc(&ctl_cp->n_control);
+}
+
+
+/*
+ *      IPVS application functions
+ *      (from ip_vs_app.c)
+ */
+#define IP_VS_APP_MAX_PORTS  8
+extern int register_ip_vs_app(struct ip_vs_app *app);
+extern void unregister_ip_vs_app(struct ip_vs_app *app);
+extern int ip_vs_bind_app(struct ip_vs_conn *cp, struct ip_vs_protocol *pp);
+extern void ip_vs_unbind_app(struct ip_vs_conn *cp);
+extern int
+register_ip_vs_app_inc(struct ip_vs_app *app, __u16 proto, __u16 port);
+extern int ip_vs_app_inc_get(struct ip_vs_app *inc);
+extern void ip_vs_app_inc_put(struct ip_vs_app *inc);
+
+extern int ip_vs_app_pkt_out(struct ip_vs_conn *, struct sk_buff **pskb);
+extern int ip_vs_app_pkt_in(struct ip_vs_conn *, struct sk_buff **pskb);
+extern int ip_vs_skb_replace(struct sk_buff *skb, int pri,
+                            char *o_buf, int o_len, char *n_buf, int n_len);
+extern int ip_vs_app_init(void);
+extern void ip_vs_app_cleanup(void);
+
+
+/*
+ *     IPVS protocol functions (from ip_vs_proto.c)
+ */
+extern int ip_vs_protocol_init(void);
+extern void ip_vs_protocol_cleanup(void);
+extern void ip_vs_protocol_timeout_change(int flags);
+extern int *ip_vs_create_timeout_table(int *table, int size);
+extern int
+ip_vs_set_state_timeout(int *table, int num, char **names, char *name, int to);
+extern void
+ip_vs_tcpudp_debug_packet(struct ip_vs_protocol *pp, const struct sk_buff *skb,
+                         int offset, const char *msg);
+
+extern struct ip_vs_protocol ip_vs_protocol_tcp;
+extern struct ip_vs_protocol ip_vs_protocol_udp;
+extern struct ip_vs_protocol ip_vs_protocol_icmp;
+extern struct ip_vs_protocol ip_vs_protocol_esp;
+extern struct ip_vs_protocol ip_vs_protocol_ah;
+
+
+/*
+ *      Registering/unregistering scheduler functions
+ *      (from ip_vs_sched.c)
+ */
+extern int register_ip_vs_scheduler(struct ip_vs_scheduler *scheduler);
+extern int unregister_ip_vs_scheduler(struct ip_vs_scheduler *scheduler);
+extern int ip_vs_bind_scheduler(struct ip_vs_service *svc,
+                               struct ip_vs_scheduler *scheduler);
+extern int ip_vs_unbind_scheduler(struct ip_vs_service *svc);
+extern struct ip_vs_scheduler *ip_vs_scheduler_get(const char *sched_name);
+extern void ip_vs_scheduler_put(struct ip_vs_scheduler *scheduler);
+extern struct ip_vs_conn *
+ip_vs_schedule(struct ip_vs_service *svc, const struct sk_buff *skb);
+extern int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb,
+                       struct ip_vs_protocol *pp);
+
+
+/*
+ *      IPVS control data and functions (from ip_vs_ctl.c)
+ */
+extern int sysctl_ip_vs_cache_bypass;
+extern int sysctl_ip_vs_expire_nodest_conn;
+extern int sysctl_ip_vs_sync_threshold[2];
+extern int sysctl_ip_vs_nat_icmp_send;
+extern struct ip_vs_stats ip_vs_stats;
+
+extern struct ip_vs_service *
+ip_vs_service_get(__u32 fwmark, __u16 protocol, __u32 vaddr, __u16 vport);
+
+static inline void ip_vs_service_put(struct ip_vs_service *svc)
+{
+       atomic_dec(&svc->usecnt);
+}
+
+extern struct ip_vs_dest *
+ip_vs_lookup_real_service(__u16 protocol, __u32 daddr, __u16 dport);
+extern int ip_vs_use_count_inc(void);
+extern void ip_vs_use_count_dec(void);
+extern int ip_vs_control_init(void);
+extern void ip_vs_control_cleanup(void);
+
+
+/*
+ *      IPVS sync daemon data and function prototypes
+ *      (from ip_vs_sync.c)
+ */
+extern volatile int ip_vs_sync_state;
+extern volatile int ip_vs_master_syncid;
+extern volatile int ip_vs_backup_syncid;
+extern char ip_vs_master_mcast_ifn[IP_VS_IFNAME_MAXLEN];
+extern char ip_vs_backup_mcast_ifn[IP_VS_IFNAME_MAXLEN];
+extern int start_sync_thread(int state, char *mcast_ifn, __u8 syncid);
+extern int stop_sync_thread(int state);
+extern void ip_vs_sync_conn(struct ip_vs_conn *cp);
+
+
+/*
+ *      IPVS rate estimator prototypes (from ip_vs_est.c)
+ */
+extern int ip_vs_new_estimator(struct ip_vs_stats *stats);
+extern void ip_vs_kill_estimator(struct ip_vs_stats *stats);
+extern void ip_vs_zero_estimator(struct ip_vs_stats *stats);
+
+/*
+ *     Various IPVS packet transmitters (from ip_vs_xmit.c)
+ */
+extern int ip_vs_null_xmit
+(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp);
+extern int ip_vs_bypass_xmit
+(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp);
+extern int ip_vs_nat_xmit
+(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp);
+extern int ip_vs_tunnel_xmit
+(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp);
+extern int ip_vs_dr_xmit
+(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp);
+extern int ip_vs_icmp_xmit
+(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp, int offset);
+extern void ip_vs_dst_reset(struct ip_vs_dest *dest);
+
+
+/*
+ *     This is a simple mechanism to ignore packets when
+ *     we are loaded. Just set ip_vs_drop_rate to 'n' and
+ *     we start to drop 1/rate of the packets
+ */
+extern int ip_vs_drop_rate;
+extern int ip_vs_drop_counter;
+
+static __inline__ int ip_vs_todrop(void)
+{
+       if (!ip_vs_drop_rate) return 0;
+       if (--ip_vs_drop_counter > 0) return 0;
+       ip_vs_drop_counter = ip_vs_drop_rate;
+       return 1;
+}
+
+/*
+ *      ip_vs_fwd_tag returns the forwarding tag of the connection
+ */
+#define IP_VS_FWD_METHOD(cp)  (cp->flags & IP_VS_CONN_F_FWD_MASK)
+
+extern __inline__ char ip_vs_fwd_tag(struct ip_vs_conn *cp)
+{
+       char fwd;
+
+       switch (IP_VS_FWD_METHOD(cp)) {
+       case IP_VS_CONN_F_MASQ:
+               fwd = 'M'; break;
+       case IP_VS_CONN_F_LOCALNODE:
+               fwd = 'L'; break;
+       case IP_VS_CONN_F_TUNNEL:
+               fwd = 'T'; break;
+       case IP_VS_CONN_F_DROUTE:
+               fwd = 'R'; break;
+       case IP_VS_CONN_F_BYPASS:
+               fwd = 'B'; break;
+       default:
+               fwd = '?'; break;
+       }
+       return fwd;
+}
+
+extern int ip_vs_make_skb_writable(struct sk_buff **pskb, int len);
+extern void ip_vs_nat_icmp(struct sk_buff *skb, struct ip_vs_protocol *pp,
+               struct ip_vs_conn *cp, int dir);
+
+extern u16 ip_vs_checksum_complete(struct sk_buff *skb, int offset);
+
+static inline u16 ip_vs_check_diff(u32 old, u32 new, u16 oldsum)
+{
+       u32 diff[2] = { old, new };
+
+       return csum_fold(csum_partial((char *) diff, sizeof(diff),
+                                     oldsum ^ 0xFFFF));
+}
+
+#endif /* __KERNEL__ */
+
+#endif /* _IP_VS_H */
diff --git a/debian/init.d b/debian/init.d
new file mode 100644 (file)
index 0000000..fbb5a8c
--- /dev/null
@@ -0,0 +1,49 @@
+#! /bin/sh
+#
+# keepalived   LVS cluster monitor daemon.
+#
+#              Written by Andres Salomon <dilinger@voxel.net>
+#
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+DAEMON=/usr/sbin/keepalived
+NAME=keepalived
+DESC=keepalived
+
+set -e
+test -f $DAEMON || exit 0
+
+case "$1" in
+  start)
+       echo -n "Starting $DESC: "
+       start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
+               --exec $DAEMON
+       echo "$NAME."
+       ;;
+  stop)
+       echo -n "Stopping $DESC: "
+       start-stop-daemon --oknodo --stop --quiet --pidfile /var/run/$NAME.pid \
+               --exec $DAEMON
+       echo "$NAME."
+       ;;
+  reload|force-reload)
+       echo "Reloading $DESC configuration file."
+       start-stop-daemon --stop --quiet --signal 1 --pidfile \
+               /var/run/$NAME.pid --exec $DAEMON
+       ;;
+  restart)
+       echo -n "Restarting $DESC: "
+       start-stop-daemon --stop --quiet --pidfile \
+               /var/run/$NAME.pid --exec $DAEMON
+       sleep 1
+       start-stop-daemon --start --quiet --pidfile \
+               /var/run/$NAME.pid --exec $DAEMON
+       echo "$NAME."
+       ;;
+  *)
+       echo "Usage: /etc/init.d/$NAME {start|stop|restart|reload|force-reload}" >&2
+       exit 1
+       ;;
+esac
+
+exit 0
diff --git a/debian/manpages b/debian/manpages
new file mode 100644 (file)
index 0000000..3327c3c
--- /dev/null
@@ -0,0 +1 @@
+doc/man/man*/*
diff --git a/debian/rules b/debian/rules
new file mode 100644 (file)
index 0000000..b6ee605
--- /dev/null
@@ -0,0 +1,13 @@
+#!/usr/bin/make -f
+
+include /usr/share/cdbs/1/rules/debhelper.mk
+include /usr/share/cdbs/1/rules/simple-patchsys.mk
+include /usr/share/cdbs/1/class/autotools.mk
+
+DEB_CONFIGURE_EXTRA_FLAGS := --with-kernel-dir=$(CURDIR)/debian
+
+binary-install/keepalived::
+       rm -rf $(DEB_DESTDIR)/etc/keepalived/samples
+       rm -rf $(DEB_DESTDIR)/etc/init.d/keepalived.init
+       rm -rf $(DEB_DESTDIR)/usr/man
+
index 0c57230..069d8ee 100644 (file)
@@ -31,7 +31,7 @@ global_defs {                         # Block identification
     smtp_server <IP ADDRESS>              # SMTP server IP address
     smtp_connect_timeout <INTEGER>        # Number of seconds timeout connect
                                           #  remote SMTP server
-    lvs_id <STRING>                       # String identifying router
+    router_id <STRING>                    # String identifying router
 }
 
        1.2. Static addresses
@@ -115,6 +115,8 @@ vrrp_instance <STRING> {            # VRRP instance declaration
       <STRING>
       ...
     }
+    dont_track_primary                  # (default unset) ignore VRRP interface faults.
+                                        #  useful for cross-connect VRRP config.
     mcast_src_ip <IP ADDRESS>          # src_ip to use into the VRRP packets
     lvs_sync_daemon_interface <STRING> # Binding interface for lvs syncd
     garp_master_delay <INTEGER>                # delay for gratuitous ARP after MASTER
@@ -131,23 +133,25 @@ vrrp_instance <STRING> {          # VRRP instance declaration
         <IP ADDRESS>/<MASK> brd <IP ADDRESS> dev <STRING> scope <SCOPE>
         ...
     }
-    virtual_ipaddress_excluded {                       # VRRP IP excluded from VRRP
+    virtual_ipaddress_excluded {               # VRRP IP excluded from VRRP
         <IP ADDRESS>/<MASK> brd <IP ADDRESS> dev <STRING> scope <SCOPE>        # packets
         <IP ADDRESS>/<MASK> brd <IP ADDRESS> dev <STRING> scope <SCOPE>
         ...
     }
-    virtual_routes {                    # VRRP virtual routes
+    virtual_routes {                   # VRRP virtual routes
        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
         ...
     }
-    preempt                            # VRRP preempt mode (default set)
-    debug                              # Debug level
-    notify_master <STRING>|<QUOTED-STRING> # Same as vrrp_sync_group
-    notify_backup <STRING>|<QUOTED-STRING> # Same as vrrp_sync_group
-    notify_fault <STRING>|<QUOTED-STRING>  # Same as vrrp_sync_group
-    notify <STRING>|<QUOTED-STRING>       # Same as vrrp_sync_group
-    smtp_alert                            # Same as vrrp_sync_group
+    nopreempt                                  # Override VRRP RFC preemption default
+    preempt_delay                              # Seconds after startup until
+                                               #  preemption. 0 (default) to 1,000
+    debug                                      # Debug level
+    notify_master <STRING>|<QUOTED-STRING>     # Same as vrrp_sync_group
+    notify_backup <STRING>|<QUOTED-STRING>     # Same as vrrp_sync_group
+    notify_fault <STRING>|<QUOTED-STRING>      # Same as vrrp_sync_group
+    notify <STRING>|<QUOTED-STRING>            # Same as vrrp_sync_group
+    smtp_alert                                 # Same as vrrp_sync_group
 }
 
 SCOPE can take the following values :
@@ -197,8 +201,8 @@ virtual_server <IP ADDRESS> <PORT> {        # VS IP/PORT declaration
 virtual_server fwmark <INTEGER>    {   # VS fwmark declaration
 virtual_server group <STRING>      {   # VS group declaration
     delay_loop <INTEGER>               # delay timer for service polling
-    lb_algo rr|wrr|lc|wlc|lblc|sh|dh   # LVS scheduler used
-    lb_kind NAT|DR|TUN                 # LVS method used
+    lvs_sched rr|wrr|lc|wlc|lblc|sh|dh # LVS scheduler used
+    lvs_method NAT|DR|TUN              # LVS method used
     persistence_timeout <INTEGER>      # LVS persistence timeout
     persistence_granularity <NETMASK>  # LVS granularity mask
     protocol TCP                       # Only TCP is implemented
@@ -260,9 +264,46 @@ virtual_server group <STRING>      {       # VS group declaration
         notify_up <STRING>|<QUOTED-STRING> # Idem
         notify_down <STRING>|<QUOTED-STRING> # Idem
 
+        SMTP_CHECK {                   # SMTP healthchecker
+            host {                      # Optional additional host/port to check
+                connect_ip <IP ADDRESS> # IP address to connect to
+                connect_port <PORT>     # Port to connect to
+                bindto <IP ADDRESS>     # IP address to bind to
+
+            }
+            host {
+                connect_ip <IP ADDRESS>
+                connect_port <PORT>
+                bindto <IP ADDRESS>
+            }
+            ...
+            connect_timeout <INTEGER>  # Connection and read/write timeout
+            retry <INTEGER>             # Number of times to retry a failed check
+            delay_before_retry <INTEGER> # Delay in seconds before retrying
+            helo_name <STRING>|<QUOTED-STRING> # Host to use for the HELO request
+        }
+    }
+
+    real_server <IP ADDRESS> <PORT> {  # Idem
+        weight <INTEGER>               # Idem
+        inhibit_on_failure             # Idem
+        notify_up <STRING>|<QUOTED-STRING> # Idem
+        notify_down <STRING>|<QUOTED-STRING> # Idem
+
         MISC_CHECK {                           # MISC healthchecker
             misc_path <STRING>|<QUOTED-STRING> # External system script or program
             misc_timeout <INTEGER>             # Script execution timeout
+
+            # If set, exit code from healthchecker is used
+            # to dynamically adjust the weight as follows:
+            #   exit status 0: svc check success, weight
+            #     unchanged.
+            #   exit status 1: svc check failed.
+            #   exit status 2-255: svc check success, weight
+            #     changed to 2 less than exit status.
+            #   (for example: exit status of 255 would set
+            #     weight to 253)
+            misc_dynamic
         }
     }
 }
similarity index 97%
rename from doc/man/man8/genhash.8
rename to doc/man/man1/genhash.1
index 0faf2ab..045d77f 100644 (file)
@@ -1,8 +1,8 @@
 .\"
-.\" genhash(8)
+.\" genhash(1)
 .\"
 .\" Copyright (C) 2004 Andres Salomon
-.TH genhash 8 "Feb 2004"
+.TH genhash 1 "Feb 2004"
 .SH NAME
 genhash \- md5 hash generation tool for remote web pages
 .SH SYNOPSIS
index 64aaccf..79b3119 100644 (file)
@@ -38,7 +38,7 @@ and
  notification_email_from admin@example.com \r
  smtp_server 127.0.0.1   # IP\r
  smtp_connect_timeout 30 # integer, seconds\r
- lvs_id my_hostname      # string identifying the machine,\r
+ router_id my_hostname   # string identifying the machine,\r
                          # (doesn't have to be hostname).\r
  }\r
 \r
@@ -150,6 +150,9 @@ which will transition together on any state change.
     # interface for inside_network, bound by vrrp\r
     interface eth0\r
 \r
+    # Ignore VRRP interface faults (default unset)\r
+    dont_track_primary\r
+\r
     # optional, monitor these as well. \r
     # go to FAULT state if any of these go down.\r
     track_interface {\r
@@ -222,13 +225,11 @@ which will transition together on any state change.
         192.168.112.0/24 via 192.168.100.254\r
     }\r
     \r
-    #VRRP preempt mode (default set), \r
-    #Normally failover toggles, ie the backup\r
-    #stays as master, after the old master comes\r
-    #back on line.\r
-    #preempt allows the old master to resume\r
-    #the master role when it comes back online.\r
-    preempt \r
+    #VRRP will normally preempt a backup when the\r
+    #original master comes back on line.\r
+    #nopreempt allows the backup to maintain the\r
+    #master role.\r
+    nopreempt\r
 \r
     # Debug level, not implemented yet.\r
     debug\r
@@ -335,7 +336,7 @@ A virtual_server can be a declaration of one of
            notify_down <STRING>|<QUOTED-STRING> \r
    \r
            # pick one healthchecker\r
-           # HTTP_GET|SSL_GET|TCP_CHECK|MISC_CHECK\r
+           # HTTP_GET|SSL_GET|TCP_CHECK|SMTP_CHECK|MISC_CHECK\r
    \r
            # HTTP and SSL healthcheckers\r
            HTTP_GET|SSL_GET \r
@@ -372,7 +373,35 @@ A virtual_server can be a declaration of one of
                bindto <IPADDR>\r
                connect_timeout <INT> \r
            } #TCP_CHECK\r
-   \r
+\r
+           # SMTP healthchecker\r
+           SMTP_CHECK\r
+           {\r
+               # An optional host interface to check.\r
+               # If no host directives are present, only\r
+               # the ip address of the real server will\r
+               # be checked.\r
+               host {\r
+                 # IP address to connect to\r
+                 connect_ip <IP ADDRESS>\r
+                 # Optional port to connect to if not\r
+                 # the default of 25\r
+                 connect_port <PORT>\r
+                 # Optional interface to use to\r
+                 # originate the connection\r
+                 bindto <IP ADDRESS>\r
+              }\r
+              # Connection and read/write timeout\r
+              # in seconds\r
+              connect_timeout <INTEGER>\r
+              # Number of times to retry a failed check\r
+              retry <INTEGER>\r
+              # Delay in seconds before retrying\r
+              delay_before_retry <INTEGER>\r
+              # Optional string to use for the smtp HELO request\r
+              helo_name <STRING>|<QUOTED-STRING>\r
+           } #SMTP_CHECK\r
+\r
            #MISC healthchecker, run a program\r
            MISC_CHECK \r
            {\r
@@ -380,6 +409,17 @@ A virtual_server can be a declaration of one of
                misc_path <STRING>|<QUOTED-STRING>\r
                # Script execution timeout\r
                misc_timeout <INT>\r
+\r
+               # If set, exit code from healthchecker is used\r
+               # to dynamically adjust the weight as follows:\r
+               #   exit status 0: svc check success, weight\r
+               #     unchanged.\r
+               #   exit status 1: svc check failed.\r
+               #   exit status 2-255: svc check success, weight\r
+               #     changed to 2 less than exit status.\r
+               #   (for example: exit status of 255 would set\r
+               #     weight to 253)\r
+               misc_dynamic\r
            }\r
        } # realserver defn\r
     } # virtual service\r
index 78a22d2..fd3d563 100644 (file)
@@ -7,7 +7,7 @@ global_defs {
    notification_email_from Alexandre.Cassen@firewall.loc
    smtp_server 192.168.200.1
    smtp_connect_timeout 30
-   lvs_id LVS_DEVEL
+   router_id LVS_DEVEL
 }
 
 virtual_server 192.168.200.100 443 {
diff --git a/doc/samples/keepalived.conf.SMTP_CHECK b/doc/samples/keepalived.conf.SMTP_CHECK
new file mode 100644 (file)
index 0000000..898aacc
--- /dev/null
@@ -0,0 +1,114 @@
+! Configuration File for keepalived
+!
+! The SMTP_CHECK connects to a smtp server
+! and checks with the following dialogue:
+!
+! 220 mta1.somecompany.com ESMTP
+! HELO foo.bar.com
+! 250 mta1.somecompany.com Hello foo.bar.com [192.168.1.45], pleased to meet you
+! QUIT
+! 221 2.0.0 mta1.somecompany.com closing connection
+!
+! It specifically checks the numeric codes returned (220, 250, and 221).
+!
+
+global_defs {
+   notification_email {
+     acassen
+   }
+   notification_email_from Alexandre.Cassen@firewall.loc
+   smtp_server 192.168.200.1
+   smtp_connect_timeout 30
+   lvs_id LVS_DEVEL
+}
+
+virtual_server 192.168.200.100 25 {
+    delay_loop 60
+    lb_algo rr
+    lb_kind NAT
+    protocol TCP
+
+! In this real_server example we will simply check
+! the ip address of the real_server. This could be
+! the case where the real server only has a single
+! interface that keepalived is balancing traffic
+! to.
+
+    real_server 172.16.1.10 25 {
+        weight 1
+        SMTP_CHECK {
+            connect_timeout 30
+            retry 2
+            delay_before_retry 5
+            helo_name "foo.bar.com"
+        }
+    }
+
+! In this complex example, the real_server has
+! multiple interfaces. Keepalived is sending traffic
+! to 172.16.1.11 but the smtp server also routes
+! traffic to some additional subnets. We do not
+! want to dispatch traffic unless all the interfaces
+! appear to be up. Note: The main ip of the real
+! server that we are dipatching traffic to must
+! explicitly be checked by a host directive.
+
+    real_server 172.16.1.11 25 {
+        weight 1
+        SMTP_CHECK {
+            connect_timeout 10
+            retry 2
+            delay_before_retry 5
+            helo_name foo.bar.com
+
+            host {
+                connect_ip 172.16.1.11
+            }
+
+            host {
+                connect_ip  192.168.155.10
+            }
+
+            host {
+                connect_ip  64.233.167.99
+            }
+        }
+    }
+
+
+! Final example showing some of the more extended
+! features.
+!
+! Use connect_port to provide an alternate port
+! other than the default 25.
+!
+! Use bindto to force the connection to originate
+! from a specific interface.
+
+    real_server 172.16.1.12 25 {
+        weight 1
+        SMTP_CHECK {
+            connect_timeout 10
+            retry 2
+            delay_before_retry 5
+            helo_name "foo.bar.com"
+
+            host {
+                connect_ip 172.16.1.12
+                connect_port 25
+                bindto 172.16.1.2
+            }
+
+            host {
+                connect_ip  192.168.155.11
+                connect_port 25
+                bindto 192.168.155.2
+            }
+
+            host {
+                connect_ip  64.233.167.100
+                connect_port 587
+            }
+        }
+    }
+}
index 3f03d03..c7f0367 100644 (file)
@@ -7,7 +7,7 @@ global_defs {
    notification_email_from Alexandre.Cassen@firewall.loc
    smtp_server 192.168.200.1
    smtp_connect_timeout 30
-   lvs_id LVS_DEVEL
+   router_id LVS_DEVEL
 }
 
 vrrp_instance VI_1 {
diff --git a/doc/samples/keepalived.conf.ci-linux b/doc/samples/keepalived.conf.ci-linux
deleted file mode 100644 (file)
index 7828359..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-! Configuration File for keepalived
-! CI-LINUX configuration sample
-
-global_defs {
-   notification_email {
-     lvs-alert@domain.com
-   }
-   notification_email_from email@domain.com
-   smtp_server 192.168.200.1
-   smtp_connect_timeout 30
-   lvs_id CI-LNX
-}
-
-virtual_server 192.168.200.10 80 {
-    delay_loop 10
-    lb_algo wrr 
-    lb_kind NAT
-    protocol TCP
-
-    sorry_server 192.168.200.200 80
-
-    real_server 192.168.200.2 80 {
-        weight 1
-        CI-LINUX
-    }
-
-    real_server 192.168.200.3 80 {
-        weight 1
-        CI-LINUX
-    }
-    real_server 192.168.200.4 80 {
-        weight 1
-        CI-LINUX
-    }
-    real_server 192.168.200.5 80 {
-        weight 1
-        CI-LINUX
-    }
-}
index 64e8081..83b4f18 100644 (file)
@@ -1,7 +1,7 @@
 ! Sample configuration for use Linux FWMARK
 
 global_defs {
-  lvs_id io
+  router_id io
 }
 
 virtual_server fwmark 1 {
index 7182728..abbe493 100644 (file)
@@ -7,7 +7,7 @@ global_defs {
    notification_email_from Alexandre.Cassen@firewall.loc
    smtp_server 192.168.200.1
    smtp_connect_timeout 30
-   lvs_id LVS_DEVEL
+   router_id LVS_DEVEL
 }
 
 virtual_server 10.10.10.2 1358 {
index 79ac075..e41f6b2 100644 (file)
@@ -7,7 +7,7 @@ global_defs {
    notification_email_from Alexandre.Cassen@firewall.loc
    smtp_server 192.168.200.1
    smtp_connect_timeout 30
-   lvs_id LVS_DEVEL
+   router_id LVS_DEVEL
 }
 
 virtual_server 10.10.10.2 1358 {
@@ -22,6 +22,7 @@ virtual_server 10.10.10.2 1358 {
         weight 1
         MISC_CHECK {
           misc_path /usr/local/bin/script.sh
+!          misc_dynamic
         }
     }
 
index 3ebee9d..e27092e 100644 (file)
@@ -7,7 +7,7 @@ global_defs {
    notification_email_from Alexandre.Cassen@firewall.loc
    smtp_server 192.168.200.1
    smtp_connect_timeout 30
-   lvs_id LVS_DEVEL
+   router_id LVS_DEVEL
 }
 
 virtual_server 10.10.10.2 1358 {
index 022cd27..223326b 100644 (file)
@@ -7,13 +7,13 @@ global_defs {
    notification_email_from Alexandre.Cassen@firewall.loc
    smtp_server 192.168.200.1
    smtp_connect_timeout 30
-   lvs_id LVS_DEVEL
+   router_id LVS_DEVEL
 }
 
 vrrp_instance VI_1 {
     interface eth0
     virtual_router_id 50
-    preempt
+    nopreempt
     priority 100
     advert_int 1
     virtual_ipaddress {
index a0cb03b..049c71d 100644 (file)
@@ -7,7 +7,7 @@ global_defs {
    notification_email_from Alexandre.Cassen@firewall.loc
    smtp_server 192.168.200.1
    smtp_connect_timeout 30
-   lvs_id LVS_DEVEL
+   router_id LVS_DEVEL
 }
 
 virtual_server 192.168.200.100 443 {
index bc7c2cf..2e658b4 100644 (file)
@@ -1,7 +1,7 @@
 ! Configuration File for keepalived
 
 global_defs {
-   lvs_id LVS_DEVEL
+   router_id LVS_DEVEL
 }
 
 static_route {
index a01a329..6aa949c 100644 (file)
@@ -7,7 +7,7 @@ global_defs {
    notification_email_from Alexandre.Cassen@firewall.loc
    smtp_server 192.168.200.1
    smtp_connect_timeout 30
-   lvs_id LVS_DEVEL
+   router_id LVS_DEVEL
 }
 
 virtual_server_group VSG_1 {
index f899887..ee6f3ca 100644 (file)
@@ -7,7 +7,7 @@ global_defs {
    notification_email_from Alexandre.Cassen@firewall.loc
    smtp_server 192.168.200.1
    smtp_connect_timeout 30
-   lvs_id LVS_DEVEL
+   router_id LVS_DEVEL
 }
 
 virtual_server 192.168.200.100 80 {
index 3b7374a..95a5a47 100644 (file)
@@ -7,7 +7,7 @@ global_defs {
    notification_email_from Alexandre.Cassen@firewall.loc
    smtp_server 192.168.200.1
    smtp_connect_timeout 30
-   lvs_id LVS_DEVEL
+   router_id LVS_DEVEL
 }
 
 
index 9243d4b..17412f6 100644 (file)
@@ -1,7 +1,7 @@
 ! Configuration File for keepalived
 
 global_defs {
-   lvs_id LVS_DEVEL
+   router_id LVS_DEVEL
 }
 
 static_routes {
index baab1f1..a282a81 100644 (file)
@@ -1,7 +1,7 @@
 ! Configuration File for keepalived
 
 global_defs {
-   lvs_id LVS_DEVEL
+   router_id LVS_DEVEL
 }
 
 static_ipaddress {
index 2defe39..736d3e9 100644 (file)
@@ -1,6 +1,6 @@
 # Makefile.in
 #
-# Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
+# Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
 
 EXEC = genhash
 BIN  = ../bin
@@ -36,13 +36,13 @@ distclean: clean
 
 uninstall:
        rm -f $(DESTDIR)$(bindir)/$(EXEC)
-       rm -f $(DESTDIR)$(prefix)/man/man8/genhash.8
+       rm -f $(DESTDIR)@mandir@/man/man1/genhash.1
 
 install:
        install -d $(DESTDIR)$(bindir)
        install -m 755 $(BIN)/$(EXEC) $(DESTDIR)$(bindir)/
-       install -d $(DESTDIR)$(prefix)/man/man8
-       install -m 644 ../doc/man/man8/genhash.8 $(DESTDIR)$(prefix)/man/man8
+       install -d $(DESTDIR)@mandir@/man/man1
+       install -m 644 ../doc/man/man1/genhash.1 $(DESTDIR)@mandir@/man/man1
 
 mrproper: clean distclean
        rm -f config.*
index ed042ed..caff470 100644 (file)
@@ -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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include <errno.h>
@@ -32,9 +32,6 @@
 #include "html.h"
 #include "timer.h"
 
-/* extern variables */
-extern REQ *req;
-
 /* 
  * The global design of this checker is the following :
  * 
@@ -99,7 +96,7 @@ finalize(thread * thread)
        if (req->verbose) {
                printf("\n");
                printf(HTML_MD5);
-               print_buffer(16, digest);
+               dump_buffer(digest, 16);
 
                printf(HTML_MD5_FINAL);
        }
@@ -113,6 +110,19 @@ finalize(thread * thread)
        return 0;
 }
 
+/* Dump HTTP header */
+static void
+http_dump_header(char *buffer, int size)
+{
+       int r;
+
+       dump_buffer(buffer, size);
+       printf(HTTP_HEADER_ASCII);
+       for (r = 0; r < size; r++)
+               printf("%c", buffer[r]);
+       printf("\n");
+}
+
 /* Process incoming stream */
 int
 http_process_stream(SOCK * sock, int r)
@@ -124,36 +134,34 @@ http_process_stream(SOCK * sock, int r)
                if (req->verbose)
                        printf(HTTP_HEADER_HEXA);
                if ((sock->extracted = extract_html(sock->buffer, sock->size))) {
-                       if (req->verbose) {
-                               print_buffer(sock->extracted - sock->buffer,
-                                            sock->buffer);
-                               printf(HTTP_HEADER_ASCII);
-                               for (r = 0; r < sock->extracted - sock->buffer;
-                                    r++)
-                                       printf("%c", sock->buffer[r]);
-                               printf("\n");
-                               printf(HTML_HEADER_HEXA);
-                       }
+                       if (req->verbose)
+                               http_dump_header(sock->buffer,
+                                                sock->extracted - sock->buffer);
                        r = sock->size - (sock->extracted - sock->buffer);
                        if (r) {
-                               if (req->verbose)
-                                       print_buffer(r, sock->extracted);
-                               memcpy(sock->buffer, sock->extracted, r);
+                               if (req->verbose) {
+                                       printf(HTML_HEADER_HEXA);
+                                       dump_buffer(sock->extracted, r);
+                               }
+                               memmove(sock->buffer, sock->extracted, r);
                                MD5_Update(&sock->context, sock->buffer, r);
                                r = 0;
                        }
                        sock->size = r;
                } else {
+                       if (req->verbose)
+                               http_dump_header(sock->buffer, sock->size);
+
                        /* minimize buffer using no 2*CR/LF found yet */
-                       if (sock->size > 3) {
-                               memcpy(sock->buffer,
-                                      sock->buffer + sock->size - 3, 3);
-                               sock->size = 3;
+                       if (sock->size > 4) {
+                               memmove(sock->buffer,
+                                       sock->buffer + sock->size - 4, 4);
+                               sock->size = 4;
                        }
                }
        } else if (sock->size) {
                if (req->verbose)
-                       print_buffer(r, sock->buffer);
+                       dump_buffer(sock->buffer, r);
                MD5_Update(&sock->context, sock->buffer, sock->size);
                sock->size = 0;
        }
@@ -174,7 +182,8 @@ http_read_thread(thread * thread)
 
        /* read the HTTP stream */
        memset(sock->buffer, 0, MAX_BUFFER_LENGTH);
-       r = read(thread->u.fd, sock->buffer, MAX_BUFFER_LENGTH);
+       r = read(thread->u.fd, sock->buffer + sock->size,
+                MAX_BUFFER_LENGTH - sock->size);
 
        DBG(" [l:%d,fd:%d]\n", r, sock->fd);
 
index b24376c..864b336 100644 (file)
@@ -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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _HTTP_H
index 3005b6e..ec2226e 100644 (file)
@@ -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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "layer4.h"
index e4be9ba..1cb3a3c 100644 (file)
@@ -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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _LAYER4_H
index 5fe0791..f74cc84 100644 (file)
@@ -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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include <signal.h>
@@ -30,8 +30,7 @@
 #include "sock.h"
 
 /* global var */
-thread_master *master = NULL;
-SOCK *sock = NULL;
+REQ *req = NULL;
 
 /* Terminate handler */
 void
index 33d2741..7f825ea 100644 (file)
@@ -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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _MAIN_H
@@ -71,8 +71,8 @@ typedef struct {
 } REQ;
 
 /* Global variables */
-REQ *req;                      /* Cmd line arguments */
-unsigned int debug;
+extern thread_master *master;
+extern REQ *req;               /* Cmd line arguments */
 
 /* Data buffer length description */
 #define BUFSIZE             1024
index 2d6ea62..2c5ca22 100644 (file)
@@ -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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include <string.h>
@@ -31,9 +31,8 @@
 #include "ssl.h"
 #include "main.h"
 
-/* extern var */
-extern thread_master *master;
-extern SOCK *sock;
+/* global var */
+SOCK *sock = NULL;
 
 /* Close the descriptor */
 static void
index c5f6ef5..6b368cd 100644 (file)
@@ -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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _SOCK_H
@@ -43,6 +43,9 @@ typedef struct {
        int total_size;
 } SOCK;
 
+/* global vars exported */
+extern SOCK *sock;
+
 /* Prototypes */
 extern void free_sock(SOCK * sock);
 extern void init_sock(void);
index e7043fc..dbb0452 100644 (file)
@@ -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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include <openssl/err.h>
index 9bfb33d..6afdc3e 100644 (file)
@@ -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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _SSL_H
index 78b9ae0..fadd71d 100644 (file)
@@ -18,7 +18,7 @@ init_script = etc/init.d/keepalived.init
 conf_file   = etc/keepalived/keepalived.conf
 
 CC = @CC@
-LDFLAGS = @LIBS@ @LDFLAGS@
+LDFLAGS = @LIBS@ @LDFLAGS@ -ldl
 SUBDIRS = core
 
 ifeq ($(IPVS_FLAG),_WITH_LVS_)
@@ -90,8 +90,8 @@ uninstall:
        rm -f $(DESTDIR)$(sbindir)/$(EXEC)
        rm -rf $(DESTDIR)$(sysconfdir)/keepalived
        rm -f $(DESTDIR)$(init_dir)/$(init_script)
-       rm -f $(DESTDIR)$(prefix)/man/man5/keepalived.conf.5
-       rm -f $(DESTDIR)$(prefix)/man/man8/keepalived.8
+       rm -f $(DESTDIR)$(prefix)@mandir@/man/man5/keepalived.conf.5
+       rm -f $(DESTDIR)$(prefix)@mandir@/man/man8/keepalived.8
 
 install:
        install -d $(DESTDIR)$(sbindir)
@@ -101,7 +101,7 @@ install:
        install -d $(DESTDIR)$(sysconfdir)/keepalived/samples
        install -m 644 $(conf_file) $(DESTDIR)$(sysconfdir)/keepalived/
        install -m 644 ../doc/samples/* $(DESTDIR)$(sysconfdir)/keepalived/samples/
-       install -d $(DESTDIR)$(prefix)/man/man5
-       install -d $(DESTDIR)$(prefix)/man/man8
-       install -m 644 ../doc/man/man5/keepalived.conf.5 $(DESTDIR)$(prefix)/man/man5
-       install -m 644 ../doc/man/man8/keepalived.8 $(DESTDIR)$(prefix)/man/man8
+       install -d $(DESTDIR)$(prefix)@mandir@/man/man5
+       install -d $(DESTDIR)$(prefix)@mandir@/man/man8
+       install -m 644 ../doc/man/man5/keepalived.conf.5 $(DESTDIR)$(prefix)@mandir@/man/man5
+       install -m 644 ../doc/man/man8/keepalived.8 $(DESTDIR)$(prefix)@mandir@/man/man8
index c27c7ae..4b4ae40 100644 (file)
@@ -2,19 +2,19 @@
 #
 # Keepalived OpenSource project.
 #
-# Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
+# Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
 
 KERNEL   = @KERN@
 CC      = @CC@
 INCLUDES = -I../include -I../../lib
 CFLAGS  = @CFLAGS@ @CPPFLAGS@ $(INCLUDES) \
           -Wall -Wunused -Wstrict-prototypes
-DEFS    = -D$(KERNEL) -D@IPVS_SUPPORT@ -D@IPVS_SYNCD@ -D@VRRP_SUPPORT@ @DFLAGS@ $(CIFLAGS)
+DEFS    = -D$(KERNEL) -D@IPVS_SUPPORT@ -D@IPVS_SYNCD@ -D@VRRP_SUPPORT@ @DFLAGS@
 COMPILE         = $(CC) $(CFLAGS) $(DEFS)
 
 OBJS =         check_daemon.o check_data.o check_parser.o \
        check_api.o check_tcp.o check_http.o check_ssl.o \
-       check_misc.o ipwrapper.o ipvswrapper.o
+       check_smtp.o check_misc.o ipwrapper.o ipvswrapper.o
 
 ifeq ($(KERNEL),_KRNL_2_2_)
   OBJS += ipfwwrapper.o
@@ -58,6 +58,9 @@ check_http.o: check_http.c ../include/check_http.h ../include/check_ssl.h \
 check_ssl.o: check_ssl.c ../include/check_ssl.h ../include/check_api.h \
   ../../lib/memory.h ../../lib/parser.h ../include/smtp.h \
   ../../lib/utils.h
+check_smtp.o: check_smtp.c ../include/check_smtp.h ../include/check_api.h \
+  ../../lib/memory.h ../include/ipwrapper.h ../include/smtp.h \
+  ../../lib/utils.h ../../lib/notify.h ../../lib/parser.h ../include/daemon.h
 check_misc.o: check_misc.c ../include/check_misc.h ../include/check_api.h \
   ../../lib/memory.h ../include/ipwrapper.h ../include/smtp.h \
   ../../lib/utils.h ../../lib/notify.h ../../lib/parser.h ../include/daemon.h
index d5a7466..d44b05f 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Checkers registration.
  *
- * Version:     $Id: check_api.c,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: check_api.c,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
+#include <dirent.h>
+#include <dlfcn.h>
 #include "check_api.h"
+#include "main.h"
 #include "parser.h"
 #include "memory.h"
 #include "utils.h"
+#include "global_data.h"
 #include "check_misc.h"
+#include "check_smtp.h"
 #include "check_tcp.h"
 #include "check_http.h"
 #include "check_ssl.h"
 
-/* External vars */
-extern thread_master *master;
-extern check_conf_data *check_data;
-extern unsigned int debug;
-
 /* Global vars */
 static checker_id_t ncheckers = 0;
+list checkers_queue;
 
 /* free checker data */
 static void
@@ -57,7 +58,7 @@ dump_checker(void *data)
        (*checker->dump) (checker);
 }
 
-/* Queue a checker to the checkers_queue */
+/* Queue a checker into the checkers_queue */
 void
 queue_checker(void (*free) (void *), void (*dump) (void *)
              , int (*launch) (struct _thread *)
@@ -108,7 +109,7 @@ free_checkers_queue(void)
        ncheckers = 0;
 }
 
-/* register the checker to the global I/O scheduler */
+/* register checkers to the global I/O scheduler */
 void
 register_checkers_thread(void)
 {
@@ -122,8 +123,9 @@ register_checkers_thread(void)
                       inet_ntop2(CHECKER_RIP(checker)),
                       ntohs(CHECKER_RPORT(checker)));
                CHECKER_ENABLE(checker);
-               thread_add_timer(master, checker->launch, checker,
-                                BOOTSTRAP_DELAY);
+               if (checker->launch)
+                       thread_add_timer(master, checker->launch, checker,
+                                        BOOTSTRAP_DELAY);
        }
 }
 
@@ -164,6 +166,7 @@ void
 install_checkers_keyword(void)
 {
        install_misc_check_keyword();
+       install_smtp_check_keyword();
        install_tcp_check_keyword();
        install_http_check_keyword();
        install_ssl_check_keyword();
index a33c760..0d02b32 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Healthcheckrs child process handling.
  *
- * Version:     $Id: check_daemon.c,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: check_daemon.c,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "check_daemon.h"
 #include "check_parser.h"
 #include "check_data.h"
+#include "check_ssl.h"
 #include "check_api.h"
 #include "global_data.h"
 #include "ipwrapper.h"
@@ -32,6 +33,7 @@
 #include "pidfile.h"
 #include "daemon.h"
 #include "list.h"
+#include "main.h"
 #include "memory.h"
 #include "parser.h"
 #include "watchdog.h"
 #include "vrrp_if.h"
 
 /* Global vars */
-check_conf_data *check_data;
-check_conf_data *old_check_data;
-int check_wdog_sd = -1;
+static int check_wdog_sd = -1;
 
 /* Healthchecker watchdog data */
-wdog_data check_wdog_data = {
+static wdog_data check_wdog_data = {
        "Healthcheck Child",
        WDOG_CHECK,
        -1,
@@ -52,16 +52,6 @@ wdog_data check_wdog_data = {
        start_check_child
 };
 
-/* Externals vars */
-extern thread_master *master;
-extern conf_data *data;
-extern unsigned int debug;
-extern int reload;
-extern pid_t checkers_child;
-extern char *conf_file;
-extern int init_ssl_ctx(void);
-extern int wdog_delay_check;
-
 /* Daemon stop sequence */
 static void
 stop_check(void)
@@ -202,7 +192,7 @@ sigend_check(int sig)
                thread_add_terminate_event(master);
 }
 
-/* VRRP Child signal handling */
+/* CHECK Child signal handling */
 void
 check_signal_init(void)
 {
@@ -213,7 +203,7 @@ check_signal_init(void)
        signal_noignore_sigchld();
 }
 
-/* Register VRRP thread */
+/* Register CHECK thread */
 int
 start_check_child(void)
 {
@@ -244,8 +234,9 @@ start_check_child(void)
                return 0;
        }
 
-       /* Opening local VRRP syslog channel */
-       openlog(PROG_CHECK, LOG_PID | (debug & 1) ? LOG_CONS : 0, LOG_LOCAL2);
+       /* Opening local CHECK syslog channel */
+       openlog(PROG_CHECK, LOG_PID | (debug & 1) ? LOG_CONS : 0, 
+               (log_facility==LOG_DAEMON) ? LOG_LOCAL2 : log_facility);
 
        /* Child process part, write pidfile */
        if (!pidfile_write(CHECKERS_PID_FILE, getpid())) {
index 3b771b8..0220c74 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Healthcheckers dynamic data structure definition.
  *
- * Version:     $Id: check_data.c,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: check_data.c,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "check_data.h"
@@ -27,8 +27,9 @@
 #include "memory.h"
 #include "utils.h"
 
-/* Externals vars */
-extern check_conf_data *check_data;
+/* global vars */
+check_conf_data *check_data = NULL;
+check_conf_data *old_check_data = NULL;
 
 /* SSL facility functions */
 SSL_DATA *
index c1a70ad..23bd46c 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        WEB CHECK. Common HTTP/SSL checker primitives.
  *
- * Version:     $Id: check_http.c,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: check_http.c,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include <openssl/err.h>
@@ -510,18 +510,17 @@ http_process_response(REQ *req, int r)
                        req->status_code = extract_status_code(req->buffer, req->len);
                        r = req->len - (req->extracted - req->buffer);
                        if (r) {
-                               memcpy(req->buffer, req->extracted, r);
-                               MD5_Update(&req->context, req->buffer,
-                                          r);
+                               memmove(req->buffer, req->extracted, r);
+                               MD5_Update(&req->context, req->buffer, r);
                                r = 0;
                        }
                        req->len = r;
                } else {
                        /* minimize buffer using no 2*CR/LF found yet */
-                       if (req->len > 3) {
-                               memcpy(req->buffer,
-                                      req->buffer + req->len - 3, 3);
-                               req->len = 3;
+                       if (req->len > 4) {
+                               memmove(req->buffer,
+                                       req->buffer + req->len - 4, 4);
+                               req->len = 4;
                        }
                }
        } else if (req->len) {
index 00adb99..0237a9e 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.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: check_misc.c,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Eric Jarman, <ehj38230@cmsu2.cmsu.edu>
@@ -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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "check_misc.h"
@@ -54,10 +54,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");
 }
 
 void
@@ -85,12 +85,20 @@ misc_timeout_handler(vector strvec)
 }
 
 void
+misc_dynamic_handler(vector strvec)
+{
+       misc_checker *misc_chk = CHECKER_GET();
+       misc_chk->dynamic = 1;
+}
+
+void
 install_misc_check_keyword(void)
 {
        install_keyword("MISC_CHECK", &misc_check_handler);
        install_sublevel();
        install_keyword("misc_path", &misc_path_handler);
        install_keyword("misc_timeout", &misc_timeout_handler);
+       install_keyword("misc_dynamic", &misc_dynamic_handler);
        install_sublevel_end();
 }
 
@@ -207,7 +215,16 @@ misc_check_child_thread(thread * thread)
        if (WIFEXITED(wait_status)) {
                int status;
                status = WEXITSTATUS(wait_status);
-               if (status == 0) {
+               if (status == 0 ||
+                    (misc_chk->dynamic == 1 && status >= 2 && status <= 255)) {
+                       /*
+                        * The actual weight set when using misc_dynamic is two less than
+                        * the exit status returned.  Effective range is 0..253.
+                        * Catch legacy case of status being 0 but misc_dynamic being set.
+                        */
+                       if (misc_chk->dynamic == 1 && status != 0)
+                               update_svr_wgt(status - 2, checker->vs, checker->rs);
+
                        /* everything is good */
                        if (!svr_checker_up(checker->id, checker->rs)) {
                                syslog(LOG_INFO, "Misc check to [%s] for [%s] success.",
index 09937c9..3d1a6a8 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.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: check_parser.c,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "check_parser.h"
 #include "memory.h"
 #include "utils.h"
 
-/* global defs */
-extern check_conf_data *check_data;
-extern unsigned long mem_allocated;
-
 /* SSL handlers */
 static void
 ssl_handler(vector strvec)
@@ -202,8 +198,6 @@ notify_down_handler(vector strvec)
 vector
 check_init_keywords(void)
 {
-       keywords = vector_alloc();
-
        /* global definitions mapping */
        global_init_keywords();
 
diff --git a/keepalived/check/check_smtp.c b/keepalived/check/check_smtp.c
new file mode 100644 (file)
index 0000000..d815f69
--- /dev/null
@@ -0,0 +1,813 @@
+/*
+ * 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:        SMTP CHECK. Check an SMTP-server.
+ *
+ * Version:     $Id: check_smtp.c,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ *
+ * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
+ *              Jeremy Rumpf, <jrumpf@heavyload.net>
+ *
+ *              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-2005 Alexandre Cassen, <acassen@linux-vs.org>
+ */
+
+#include <ctype.h>
+
+#include "check_smtp.h"
+#include "check_api.h"
+#include "memory.h"
+#include "ipwrapper.h"
+#include "utils.h"
+#include "parser.h"
+#include "daemon.h"
+
+int smtp_connect_thread(thread *);
+
+/* module variables */
+static smtp_host *default_host = NULL;
+
+/*
+ * Used as a callback from free_list() to free all
+ * the list elements in smtp_checker->host before we
+ * free smtp_checker itself.
+ */
+void
+smtp_free_host(void *data)
+{
+        FREE(data);
+}
+
+/* Used as a callback from the checker api, queue_checker(),
+ * to free up a checker entry and all its associated data.
+ */
+void
+free_smtp_check(void *data)
+{
+       smtp_checker *smtp_chk = CHECKER_DATA(data);
+       free_list(smtp_chk->host);
+       FREE(smtp_chk->helo_name);
+       FREE(smtp_chk);
+       FREE(data);
+}
+
+/*
+ * Used as a callback from dump_list() to print out all
+ * the list elements in smtp_checker->host.
+ */
+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));
+       if (smtp_hst->bindto)
+               syslog(LOG_INFO, "           bindto = %s", inet_ntop2(smtp_hst->bindto));
+}
+
+/* 
+ * Callback for whenever we've been requested to dump our
+ * configuration.
+ */
+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);
+       dump_list(smtp_chk->host);
+}
+
+/* Allocates a default host structure */
+smtp_host *
+smtp_alloc_host(void)
+{
+       checker *chk = LIST_TAIL_DATA(checkers_queue);
+       smtp_host *new;
+
+       /* Allocate the new host data structure */
+       new = (smtp_host *)MALLOC(sizeof(smtp_host));
+
+       /* 
+        * By default we set the ip to connect to as the same ip as the current real server
+        * in the rs config. This might be overridden later on by a "connect_ip" keyword.
+        */
+       new->ip = CHECKER_RIP(chk);
+       new->port = htons(SMTP_DEFAULT_PORT);
+       return new;
+}
+
+/* 
+ * Callback for whenever an SMTP_CHECK keyword is encountered
+ * in the config file. 
+ */
+void
+smtp_check_handler(vector strvec)
+{
+       smtp_checker *smtp_chk = (smtp_checker *)MALLOC(sizeof(smtp_checker));
+
+       /* 
+        * Set something sane for the default HELO banner
+        * May be overridden by a "helo_name" keyword later.
+        */
+       smtp_chk->helo_name = (char *)MALLOC(strlen(SMTP_DEFAULT_HELO) + 1);
+       memcpy(smtp_chk->helo_name, SMTP_DEFAULT_HELO, strlen(SMTP_DEFAULT_HELO) + 1);
+
+       /* some other sane values */
+       smtp_chk->timeout = 5 * TIMER_HZ;
+       smtp_chk->db_retry = 1 * TIMER_HZ;
+       smtp_chk->retry = 1;
+
+       /*
+        * Have the checker queue code put our checker into the checkers_queue
+        * list.
+        *
+        * queue_checker(void (*free) (void *), void (*dump) (void *),
+        *               int (*launch) (struct _thread *),
+        *               void *data)
+        */
+       queue_checker(free_smtp_check, dump_smtp_check, smtp_connect_thread,
+                     smtp_chk);
+
+       /* 
+        * Last, allocate/setup the list that will hold all the per host 
+        * configuration structures. We'll set a "default host", which
+        * is the same ip as the real server. If there are additional "host"
+        * sections in the config, the default will be deleted and overridden.
+        * This must come after queue_checker()!
+        */
+       smtp_chk->host = alloc_list(smtp_free_host, smtp_dump_host);
+       if (!default_host)
+               default_host = smtp_alloc_host();
+       list_add(smtp_chk->host, default_host);
+}
+
+/* 
+ * Callback for whenever the "host" keyword is encountered
+ * in the config file. 
+ */
+void
+smtp_host_handler(vector strvec)
+{
+        smtp_checker *smtp_chk = CHECKER_GET();
+
+       /*
+        * If the default host is still allocated, delete it
+        * before we stick user defined hosts in the list.
+        */
+       if (default_host) {
+               list_del(smtp_chk->host, default_host);
+               FREE(default_host);
+               default_host = NULL;
+       }
+
+        /* add an empty host to the list, smtp_checker->host */
+        list_add(smtp_chk->host, smtp_alloc_host());
+}
+
+/* "connect_ip" keyword */
+void
+smtp_ip_handler(vector strvec)
+{
+       smtp_checker *smtp_chk = CHECKER_GET();
+       smtp_host *smtp_hst = LIST_TAIL_DATA(smtp_chk->host);
+       inet_ston(VECTOR_SLOT(strvec, 1), &smtp_hst->ip);
+}
+
+/* "connect_port" keyword */
+void
+smtp_port_handler(vector strvec)
+{
+       smtp_checker *smtp_chk = CHECKER_GET();
+       smtp_host *smtp_hst = LIST_TAIL_DATA(smtp_chk->host);
+       smtp_hst->port = htons(CHECKER_VALUE_INT(strvec)); 
+}
+
+/* "helo_name" keyword */
+void
+smtp_helo_name_handler(vector strvec)
+{
+       smtp_checker *smtp_chk = CHECKER_GET();
+       smtp_chk->helo_name = CHECKER_VALUE_STRING(strvec);
+}
+
+/* "connect_timeout" keyword */
+void
+smtp_timeout_handler(vector strvec)
+{
+       smtp_checker *smtp_chk = CHECKER_GET();
+       smtp_chk->timeout = CHECKER_VALUE_INT(strvec) * TIMER_HZ;
+}
+
+/* "retry" keyword */
+void
+smtp_retry_handler(vector strvec)
+{
+        smtp_checker *smtp_chk = CHECKER_GET();
+       smtp_chk->retry = CHECKER_VALUE_INT(strvec);
+}
+
+/* "delay_before_retry" keyword */
+void
+smtp_db_retry_handler(vector strvec)
+{
+        smtp_checker *smtp_chk = CHECKER_GET();
+       smtp_chk->db_retry = CHECKER_VALUE_INT(strvec) * TIMER_HZ;
+}
+
+/* "bindto" keyword */
+void
+smtp_bindto_handler(vector strvec)
+{
+        smtp_checker *smtp_chk = CHECKER_GET();
+       smtp_host *smtp_hst = LIST_TAIL_DATA(smtp_chk->host);
+        inet_ston(VECTOR_SLOT(strvec, 1), &smtp_hst->bindto);
+}
+
+/* Config callback installer */
+void
+install_smtp_check_keyword(void)
+{
+        /* 
+         * Notify the config log parser that we need to be notified via
+        * callbacks when the following keywords are encountered in the
+        * keepalive.conf file.
+         */
+       install_keyword("SMTP_CHECK", &smtp_check_handler);
+       install_sublevel();
+       install_keyword("helo_name", &smtp_helo_name_handler);
+       install_keyword("connect_timeout", &smtp_timeout_handler);
+       install_keyword("delay_before_retry", &smtp_db_retry_handler);
+       install_keyword("retry", &smtp_retry_handler);
+       install_keyword("host", &smtp_host_handler);
+       install_sublevel();
+       install_keyword("connect_ip", &smtp_ip_handler);
+       install_keyword("connect_port", &smtp_port_handler);
+       install_keyword("bindto", &smtp_bindto_handler);
+       install_sublevel_end();
+       install_sublevel_end();
+}
+
+/*
+ * Final handler. Determines if we need a retry or not. 
+ * Also has to make a decision if we need to bring the resulting
+ * service down in case of error.
+ */
+int
+smtp_final(thread *thread, int error, const char *format, ...)
+{
+       checker *chk = THREAD_ARG(thread);
+       smtp_checker *smtp_chk = CHECKER_ARG(chk);
+       char error_buff[512];
+       char smtp_buff[542];
+       va_list varg_list;
+
+       /* Error or no error we should always have to close the socket */
+       close(thread->u.fd);
+
+       /* If we're here, an attempt HAS been made already for the current host */
+       smtp_chk->attempts++;
+       
+       if (error) {
+               /* Always syslog the error when the real server is up */
+                if (svr_checker_up(chk->id, chk->rs)) {
+                       if (format != NULL) {
+                               memcpy(error_buff, "SMTP_CHECK ", 11);
+                               va_start(varg_list, format);
+                               vsnprintf(error_buff + 11, 512 - 11, format, varg_list);
+                               va_end(varg_list);
+                               error_buff[512 - 1] = '\0';
+
+                               syslog(LOG_INFO, error_buff);
+                       } else {
+                               syslog(LOG_INFO, "SMTP_CHECK Unknown error");
+                       }
+               }
+
+               /*
+                * If we still have retries left, try this host again by
+                * scheduling the main thread to check it again after the
+                * configured backoff delay. Otherwise down the RS.
+                */
+               if (smtp_chk->attempts < smtp_chk->retry) {
+                       thread_add_timer(thread->master, smtp_connect_thread, chk,
+                                        smtp_chk->db_retry);
+                       return 0;
+               }
+
+               /*
+                * No more retries, pull the real server from the virtual server.
+                * Only smtp_alert if it wasn't previously down. It should
+                * be noted that smtp_alert makes a copy of the string arguments, so
+                * we don't have to keep them statically allocated.
+                */
+                if (svr_checker_up(chk->id, chk->rs)) {
+                       if (format != NULL) {
+                               snprintf(smtp_buff, 542, "=> CHECK failed on service : %s <=",
+                                        error_buff + 11);
+                       } else {
+                               snprintf(smtp_buff, 542, "=> CHECK failed on service <=");
+                       }
+
+                       smtp_buff[542 - 1] = '\0';
+                       smtp_alert(thread->master, chk->rs, NULL, NULL, "DOWN", smtp_buff);
+               }
+
+               update_svr_checker_state(DOWN, chk->id, chk->vs, chk->rs);
+
+               /* Reset everything back to the first host in the list */
+               smtp_chk->attempts = 0;
+               smtp_chk->host_ctr = 0;
+
+               /* Reschedule the main thread using the configured delay loop */;
+               thread_add_timer(thread->master, smtp_connect_thread, chk, chk->vs->delay_loop);
+
+               return 0;
+       }       
+
+       /*
+        * Ok this host was successful, increment to the next host in the list
+        * and reset the attempts counter. We'll then reschedule the main thread again.
+        * If host_ctr exceeds the number of hosts in the list, http_main_thread will
+        * take note and bring up the real server as well as inject the delay_loop.
+        */
+       smtp_chk->attempts = 0;
+       smtp_chk->host_ctr++;
+
+       thread_add_timer(thread->master, smtp_connect_thread, chk, 1);
+       return 0;
+}
+
+/* 
+ * Zeros out the rx/tx buffer
+ */
+void
+smtp_clear_buff(thread *thread)
+{
+        checker *chk = THREAD_ARG(thread);
+        smtp_checker *smtp_chk = CHECKER_ARG(chk);
+       memset(smtp_chk->buff, 0, SMTP_BUFF_MAX);
+       smtp_chk->buff_ctr = 0;
+}
+
+/*
+ * One thing to note here is we do a very cheap check for a newline.
+ * We could receive two lines (with two newline characters) in a
+ * single packet, but we don't care. We are only looking at the
+ * SMTP response codes at the beginning anyway.
+ */
+int
+smtp_get_line_cb(thread *thread)
+{
+       checker *chk = THREAD_ARG(thread);
+       smtp_checker *smtp_chk = CHECKER_ARG(chk);
+       smtp_host *smtp_hst = smtp_chk->host_ptr;
+       int f, r, x;
+
+        /* Handle read timeout */
+        if (thread->type == THREAD_READ_TIMEOUT) {
+               smtp_final(thread, 1, "Read timeout from server [%s:%d]",
+                          inet_ntop2(smtp_hst->ip), ntohs(smtp_hst->port));
+               return 0;
+       }
+
+       /* 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]. "
+                      "Increase SMTP_BUFF_MAX in smtp_check.h",
+                      inet_ntop2(smtp_hst->ip), ntohs(smtp_hst->port));
+               smtp_clear_buff(thread);
+       }
+
+       /* Set descriptor non blocking */
+        f = fcntl(thread->u.fd, F_GETFL, 0);
+        fcntl(thread->u.fd, F_SETFL, f | O_NONBLOCK);
+
+        /* read the data */
+        r = read(thread->u.fd, smtp_chk->buff + smtp_chk->buff_ctr,
+                 SMTP_BUFF_MAX - smtp_chk->buff_ctr);
+
+       if (r > 0) 
+               smtp_chk->buff_ctr += r;
+
+       if (r == -1 && (errno == EAGAIN || errno == EINTR)) {
+               thread_add_read(thread->master, smtp_get_line_cb, chk,
+                               thread->u.fd, smtp_chk->timeout);
+               fcntl(thread->u.fd, F_SETFL, f);
+               return 0;
+       }
+
+        /* restore descriptor flags */
+        fcntl(thread->u.fd, F_SETFL, f);
+
+       /* check if we have a newline, if so, callback */
+       for (x = 0; x < SMTP_BUFF_MAX; x++) {
+               if (smtp_chk->buff[x] == '\n') {
+                       smtp_chk->buff[SMTP_BUFF_MAX - 1] = '\0';
+                       
+                       DBG("SMTP_CHECK [%s:%d] < %s", inet_ntop2(smtp_hst->ip),
+                           ntohs(smtp_hst->port), smtp_chk->buff);
+
+                       (smtp_chk->buff_cb)(thread);
+
+                       return 0;
+               }
+       }
+
+       /*
+        * If the connection was closed or there was
+        * some sort of error, notify smtp_final()
+        */
+       if (r <= 0) {
+               smtp_final(thread, 1, "Read failure from server [%s:%d]",
+                          inet_ntop2(smtp_hst->ip), ntohs(smtp_hst->port));
+               return 0;
+       }
+
+       /*
+        * Last case, we haven't read enough data yet
+        * to pull a newline. Schedule ourselves for
+        * another round.
+        */
+       thread_add_read(thread->master, smtp_get_line_cb, chk,
+                       thread->u.fd, smtp_chk->timeout);
+       return 0;
+}
+
+/* 
+ * Ok a caller has asked us to asyncronously schedule a single line
+ * to be received from the server. They have also passed us a call back
+ * function that we'll call once we have the newline. If something bad
+ * happens, the caller assumes we'll pass the error off to smtp_final(),
+ * which will either down the real server or schedule a retry. The
+ * function smtp_get_line_cb is what does the dirty work since the
+ * sceduler can only accept a single *thread argument.
+ */
+void
+smtp_get_line(thread *thread, int (*callback) (struct _thread *))
+{
+       checker *chk = THREAD_ARG(thread);
+       smtp_checker *smtp_chk = CHECKER_ARG(chk);
+
+       /* clear the buffer */
+       smtp_clear_buff(thread);
+
+       /* set the callback */
+       smtp_chk->buff_cb = callback;
+
+       /* schedule the I/O with our helper function  */
+       thread_add_read(thread->master, smtp_get_line_cb, chk,
+               thread->u.fd, smtp_chk->timeout);
+       return;
+}
+
+/*
+ * The scheduler function that puts the data out on the wire.
+ * All our data will fit into one packet, so we only check if
+ * the current write would block or not. If it wants to block,
+ * we'll return to the scheduler and try again later. 
+ */
+int
+smtp_put_line_cb(thread *thread)
+{
+       checker *chk = THREAD_ARG(thread);
+       smtp_checker *smtp_chk = CHECKER_ARG(chk);
+       smtp_host *smtp_hst = smtp_chk->host_ptr;
+       int f, w;
+
+
+        /* Handle read timeout */
+        if (thread->type == THREAD_WRITE_TIMEOUT) {
+               smtp_final(thread, 1, "Write timeout to server [%s:%d]",
+                          inet_ntop2(smtp_hst->ip), ntohs(smtp_hst->port));
+               return 0;
+       }
+
+       /* Set descriptor non blocking */
+        f = fcntl(thread->u.fd, F_GETFL, 0);
+        fcntl(thread->u.fd, F_SETFL, f | O_NONBLOCK);
+
+        /* write the data */
+        w = write(thread->u.fd, smtp_chk->buff, smtp_chk->buff_ctr);
+
+       if (w == -1 && (errno == EAGAIN || errno == EINTR)) {
+               thread_add_write(thread->master, smtp_put_line_cb, chk,
+                                thread->u.fd, smtp_chk->timeout);
+               fcntl(thread->u.fd, F_SETFL, f);
+               return 0;
+       }
+
+       DBG("SMTP_CHECK [%s:%d] > %s", inet_ntop2(smtp_hst->ip),
+           ntohs(smtp_hst->port), smtp_chk->buff);
+
+        /* restore descriptor flags */
+        fcntl(thread->u.fd, F_SETFL, f);
+
+       /*
+        * If the connection was closed or there was
+        * some sort of error, notify smtp_final()
+        */
+       if (w <= 0) {
+               smtp_final(thread, 1, "Write failure to server [%s:%d]",
+                          inet_ntop2(smtp_hst->ip), ntohs(smtp_hst->port));
+               return 0;
+       }
+
+       /* Execute the callback */
+       (smtp_chk->buff_cb)(thread);
+       return 0;
+}
+
+/* 
+ * This is the same as smtp_get_line() except that we're sending a
+ * line of data instead of receiving one.
+ */
+void
+smtp_put_line(thread *thread, int (*callback) (struct _thread *))
+{
+       checker *chk = THREAD_ARG(thread);
+       smtp_checker *smtp_chk = CHECKER_ARG(chk);
+
+       smtp_chk->buff[SMTP_BUFF_MAX - 1] = '\0';
+       smtp_chk->buff_ctr = strlen(smtp_chk->buff);
+
+       /* set the callback */
+       smtp_chk->buff_cb = callback;
+
+       /* schedule the I/O with our helper function  */
+       thread_add_write(thread->master, smtp_put_line_cb, chk,
+                        thread->u.fd, smtp_chk->timeout);
+       return;
+}
+
+/*
+ * Ok, our goal here is to snag the status code out of the
+ * buffer and return it as an integer. If it's not legible,
+ * return -1.
+ */
+int
+smtp_get_status(thread *thread)
+{
+       checker *chk = THREAD_ARG(thread);
+       smtp_checker *smtp_chk = CHECKER_ARG(chk);
+       char *buff = smtp_chk->buff;
+
+       /* First make sure they're all digits */        
+       if (isdigit(buff[0]) && isdigit(buff[1]) &&
+           isdigit(buff[2])) {
+               /* Truncate the string and convert */   
+               buff[3] = '\0';
+               return atoi(buff);
+       }
+
+       return -1;
+}
+
+/* 
+ * We have a connected socket and are ready to begin 
+ * the conversation. This function schedules itself to 
+ * be called via callbacks and tracking state in 
+ * smtp_chk->state. Upon first calling, smtp_chk->state 
+ * should be set to SMTP_START.
+ */
+int
+smtp_engine_thread(thread *thread)
+{
+       checker *chk = THREAD_ARG(thread);
+       smtp_checker *smtp_chk = CHECKER_ARG(chk);
+       smtp_host *smtp_hst = smtp_chk->host_ptr;
+
+       switch (smtp_chk->state) {
+
+               /* First step, schedule to receive the greeting banner */
+               case SMTP_START:
+
+                       /*
+                        * Ok, if smtp_get_line schedules us back, we will
+                        * have data to analyze. Otherwise, smtp_get_line
+                        * will defer directly to smtp_final.
+                        */
+                       smtp_chk->state = SMTP_HAVE_BANNER;
+                       smtp_get_line(thread, smtp_engine_thread);
+                       return 0;
+                       break;
+
+               /* Second step, analyze banner, send HELO */
+               case SMTP_HAVE_BANNER:
+
+                       /* Check for "220 some.mailserver.com" in the greeting */
+                       if (smtp_get_status(thread) != 220) {
+                               smtp_final(thread, 1, "Bad greeting banner from server [%s:%d]",
+                                       inet_ntop2(smtp_hst->ip), ntohs(smtp_hst->port));
+
+                               return 0;
+                       }
+
+                       /*
+                        * Schedule to send the HELO, smtp_put_line will
+                        * defer directly to smtp_final on error.
+                        */
+                       smtp_chk->state = SMTP_SENT_HELO;
+                       snprintf(smtp_chk->buff, SMTP_BUFF_MAX, "HELO %s\r\n",
+                                smtp_chk->helo_name);
+                       smtp_put_line(thread, smtp_engine_thread);
+                       return 0;
+                       break;
+
+               /* Third step, schedule to read the HELO response */
+               case SMTP_SENT_HELO:
+                       smtp_chk->state = SMTP_RECV_HELO;
+                       smtp_get_line(thread, smtp_engine_thread);
+                       return 0;
+                       break;
+
+               /* Fourth step, analyze HELO return, send QUIT */
+               case SMTP_RECV_HELO:
+                       /* Check for "250 Please to meet you..." */
+                       if (smtp_get_status(thread) != 250) {
+                               smtp_final(thread, 1, "Bad HELO response from server [%s:%d]",
+                                       inet_ntop2(smtp_hst->ip), ntohs(smtp_hst->port));
+
+                               return 0;
+                       }
+
+                       smtp_chk->state = SMTP_SENT_QUIT;
+                       snprintf(smtp_chk->buff, SMTP_BUFF_MAX, "QUIT\r\n");
+                       smtp_put_line(thread, smtp_engine_thread);
+                       return 0;
+                       break;
+
+               /* Fifth step, schedule to receive QUIT confirmation */
+               case SMTP_SENT_QUIT:
+
+                       smtp_chk->state = SMTP_RECV_QUIT;
+                       smtp_get_line(thread, smtp_engine_thread);
+                       return 0;
+                       break;
+
+               /* Sixth step, wrap up success to smtp_final */
+               case SMTP_RECV_QUIT:
+                       smtp_final(thread, 0, NULL);
+                       return 0;
+                       break;
+       }
+
+       /* We shouldn't be here */
+       smtp_final(thread, 1, "Unknown smtp engine state encountered");
+       return 0;
+}
+               
+/* 
+ * Second step in the process. Here we'll see if the connection
+ * to the host we're checking was successful or not.
+ */
+int
+smtp_check_thread(thread *thread)
+{
+       checker *chk = THREAD_ARG(thread);
+       smtp_checker *smtp_chk = CHECKER_ARG(chk);
+       smtp_host *smtp_hst = smtp_chk->host_ptr;
+       int status;
+
+       status = tcp_socket_state(thread->u.fd, thread, smtp_hst->ip,
+                                 smtp_hst->port, smtp_check_thread);
+       switch (status) {
+               case connect_error:
+                       smtp_final(thread, 1, "Error connecting to server [%s:%d]",
+                                  inet_ntop2(smtp_hst->ip), ntohs(smtp_hst->port));
+                       return 0;
+                       break;
+
+               case connect_timeout:
+                       smtp_final(thread, 1, "Connection timeout to server [%s:%d]",
+                                  inet_ntop2(smtp_hst->ip), ntohs(smtp_hst->port));
+                       return 0;
+                       break;
+
+               case connect_success:
+                       DBG("SMTP_CHECK Remote SMTP server [%s:%d] connected",
+                           inet_ntop2(smtp_hst->ip), ntohs(smtp_hst->port));
+
+                       /* Enter the engine at SMTP_START */
+                       smtp_chk->state = SMTP_START;
+                       smtp_engine_thread(thread);
+                       return 0;
+                       break;
+       }
+
+       /* we shouldn't be here */              
+       smtp_final(thread, 1, "Unknown connection error to server [%s:%d]",
+                  inet_ntop2(smtp_hst->ip), ntohs(smtp_hst->port));
+       return 0;
+}
+
+/* 
+ * This is the main thread, where all the action starts.
+ * When the check daemon comes up, it goes down the checkers_queue
+ * and launches a thread for each checker that got registered.
+ * This is the callback/event function for that initial thread.
+ *
+ * It should be noted that we ARE responsible for sceduling 
+ * ourselves to run again. It doesn't have to be right here,
+ * but eventually has to happen.
+ */
+int
+smtp_connect_thread(thread *thread)
+{
+       checker *chk = THREAD_ARG(thread);
+       smtp_checker *smtp_chk = CHECKER_ARG(chk);
+       smtp_host *smtp_hst;
+       enum connect_result status;
+       int sock;
+
+       /* Let's review our data structures.
+        *
+        * Thread is the structure used by the sceduler
+        * for sceduling many types of events. thread->arg in this
+        * case points to a checker structure. The checker
+        * structure holds data about the vs and rs configurations
+        * as well as the delay loop, etc. Each real server 
+         * defined in the keepalived.conf will more than likely have
+        * a checker structure assigned to it. Each checker structure
+         * has a data element that is meant to hold per checker 
+        * configurations. So thread->arg(checker)->data points to
+        * a smtp_checker structure. In the smtp_checker structure
+        * we hold global configuration data for the smtp check.
+        * Smtp_checker has a list of per host (smtp_host) configuration
+        * data in smtp_checker->host.
+        *
+        * So this whole thing looks like this:
+        * thread->arg(checker)->data(smtp_checker)->host(smtp_host)
+        * 
+        * To make life simple, we'll break the structures out so
+        * that "chk" always points to the current checker structure,
+        * "smtp_chk" points to the current smtp_checker structure, 
+        * and "smtp_hst" points to the current smtp_host structure.
+        */
+
+       /*
+        * If we're disabled, we'll do nothing at all.
+        * But we still have to register ourselves again so
+        * we don't fall of the face of the earth.
+        */
+       if (!CHECKER_ENABLED(chk)) {
+               thread_add_timer(thread->master, smtp_connect_thread, chk,
+                                chk->vs->delay_loop);
+               return 0;
+       }
+
+       /*
+        * Set the internal host pointer to the host that well be 
+        * working on. If it's NULL, we've successfully tested all hosts.
+        * We'll bring the service up (if it's not already), reset the host list,
+        * and insert the delay loop. When we get scheduled again the host list
+        * will be reset and we will continue on checking them one by one.
+        */
+       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.",
+                              inet_ntop2(CHECKER_RIP(chk)), ntohs(CHECKER_RPORT(chk)));
+
+                       smtp_alert(thread->master, chk->rs, NULL, NULL, "UP",
+                                  "=> CHECK succeed on service <=");
+                       update_svr_checker_state(UP, chk->id, chk->vs, chk->rs);
+               }
+
+               smtp_chk->attempts = 0;
+               smtp_chk->host_ctr = 0;
+               smtp_chk->host_ptr = list_element(smtp_chk->host, 0);
+
+               thread_add_timer(thread->master, smtp_connect_thread, chk, chk->vs->delay_loop);
+               return 0;
+       }
+
+       smtp_hst = smtp_chk->host_ptr;
+
+       /* Create the socket, failling here should be an oddity */
+       if ((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) {
+               DBG("SMTP_CHECK connection failed to create socket.");
+               thread_add_timer(thread->master, smtp_connect_thread, chk,
+                                chk->vs->delay_loop);
+               return 0;
+       }
+
+       status = tcp_bind_connect(sock, smtp_hst->ip, smtp_hst->port, smtp_hst->bindto);
+
+       /* handle tcp connection status & register callback the next setp in the process */
+       tcp_connection_state(sock, status, thread, smtp_check_thread, smtp_chk->timeout);
+       return 0;
+}
index 667afa5..5627a5a 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.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: check_ssl.c,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
@@ -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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include <openssl/err.h>
@@ -34,9 +34,6 @@
 #include "utils.h"
 #include "html.h"
 
-/* External vars */
-extern check_conf_data *check_data;
-
 /* SSL primitives */
 /* Free an SSL context */
 void
index 075306a..e5cde53 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        TCP checker.
  *
- * Version:     $Id: check_tcp.c,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: check_tcp.c,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "check_tcp.h"
@@ -52,8 +52,8 @@ dump_tcp_check(void *data)
        if (tcp_chk->connection_port)
                syslog(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));
+       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);
 }
 
index 4be489f..bb9cb2c 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.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: ipfwwrapper.c,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "ipfwwrapper.h"
index 976a9a3..17a5fd6 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.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: ipvswrapper.c,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "ipvswrapper.h"
@@ -108,7 +108,8 @@ ipvs_cmd(int cmd, list vs_group, virtual_server * vs, real_server * rs)
 
        /* SVR specific */
        if (ctl.m_cmd == IP_MASQ_CMD_ADD_DEST
-           || ctl.m_cmd == IP_MASQ_CMD_DEL_DEST) {
+           || ctl.m_cmd == IP_MASQ_CMD_DEL_DEST
+           || ctl.m_cmd == IP_MASQ_CMD_SET_DEST) {
                ctl.u.vs_user.weight = rs->weight;
                ctl.u.vs_user.daddr = SVR_IP(rs);
                ctl.u.vs_user.dport = SVR_PORT(rs);
@@ -325,7 +326,9 @@ ipvs_set_rule(int cmd, virtual_server * vs, real_server * rs)
 
        /* SVR specific */
        if (rs) {
-               if (cmd == IP_VS_SO_SET_ADDDEST || cmd == IP_VS_SO_SET_DELDEST) {
+               if (cmd == IP_VS_SO_SET_ADDDEST
+                   || cmd == IP_VS_SO_SET_DELDEST
+                   || cmd == IP_VS_SO_SET_EDITDEST) {
                        urule->weight = rs->weight;
                        urule->daddr = SVR_IP(rs);
                        urule->dport = SVR_PORT(rs);
index 0d65422..ec23a0e 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Manipulation functions for IPVS & IPFW wrappers.
  *
- * Version:     $id: ipwrapper.c,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $id: ipwrapper.c,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "ipwrapper.h"
 #include "utils.h"
 #include "notify.h"
 
-/* extern global vars */
-extern check_conf_data *check_data;
-extern check_conf_data *old_check_data;
-
 /* Remove a realserver IPVS rule */
 static int
 clear_service_rs(list vs_group, virtual_server * vs, list l)
@@ -300,7 +296,32 @@ perform_svr_state(int alive, virtual_server * vs, real_server * rs)
                        ipfw_cmd(IP_FW_CMD_ADD, vs, vs->s_svr);
 #endif
                }
+       }
+}
 
+/* Store new weight in real_server struct and then update kernel. */
+void
+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]"
+                                " of VS [%s:%d]"
+                                , rs->weight
+                                , weight
+                                , ISALIVE(rs) ? "active" : "inactive"
+                                , inet_ntoa2(SVR_IP(rs), rsip)
+                                , ntohs(SVR_PORT(rs))
+                                , (vs->vsgname) ? vs->vsgname : inet_ntoa2(SVR_IP(vs), vsip)
+                                , ntohs(SVR_PORT(vs)));
+               rs->weight = weight;
+               /*
+                * Have weight change take effect now only if rs is alive.
+                * If not, it will take effect later when it becomes alive.
+                */
+               if (ISALIVE(rs))
+                       ipvs_cmd(LVS_CMD_EDIT_DEST, check_data->vs_group, vs, rs);
        }
 }
 
index c78e5aa..c6b228e 100644 (file)
@@ -2,7 +2,7 @@
 #
 # Keepalived OpenSource project.
 #
-# Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
+# Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
 
 CC      = @CC@
 INCLUDES = -I../include -I../../lib
index 9a5319c..f37b62e 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Main program structure.
  *
- * Version:     $Id: main.c,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: main.c,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include <syslog.h>
index fbc918d..0d524fa 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Dynamic data structure definition.
  *
- * Version:     $Id: global_data.c,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: global_data.c,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include <syslog.h>
 #include "list.h"
 #include "utils.h"
 
-/* External vars */
-extern conf_data *data;
+/* global vars */
+conf_data *data = NULL;
 
 /* Default settings */
 static void
-set_default_lvs_id(conf_data * conf_data)
+set_default_router_id(conf_data * conf_data)
 {
        char *new_id = NULL;
        int len = 0;
@@ -45,11 +45,11 @@ set_default_lvs_id(conf_data * conf_data)
                return;
 
        len = strlen(new_id);
-       conf_data->lvs_id = MALLOC(len + 1);
-       if (!conf_data->lvs_id)
+       conf_data->router_id = MALLOC(len + 1);
+       if (!conf_data->router_id)
                return;
 
-       memcpy(conf_data->lvs_id, new_id, len);
+       memcpy(conf_data->router_id, new_id, len);
 }
 
 static void
@@ -93,7 +93,7 @@ set_default_values(conf_data * conf_data)
        /* No global data so don't default */
        if (!conf_data)
                return;
-       set_default_lvs_id(conf_data);
+       set_default_router_id(conf_data);
        set_default_smtp_server(conf_data);
        set_default_smtp_connection_timeout(conf_data);
        set_default_email_from(conf_data);
@@ -141,7 +141,8 @@ void
 free_global_data(conf_data * data)
 {
        free_list(data->email);
-       FREE_PTR(data->lvs_id);
+       FREE_PTR(data->router_id);
+       FREE_PTR(data->plugin_dir);
        FREE_PTR(data->email_from);
        FREE(data);
 }
@@ -152,12 +153,14 @@ dump_global_data(conf_data * data)
        if (!data)
                return;
 
-       if (data->lvs_id ||
+       if (data->router_id ||
            data->smtp_server || data->smtp_connection_to || data->email_from) {
                syslog(LOG_INFO, "------< Global definitions >------");
        }
-       if (data->lvs_id)
-               syslog(LOG_INFO, " LVS ID = %s", data->lvs_id);
+       if (data->router_id)
+               syslog(LOG_INFO, " Router ID = %s", data->router_id);
+       if (data->plugin_dir)
+               syslog(LOG_INFO, " Plugin dir = %s", data->plugin_dir);
        if (data->smtp_server)
                syslog(LOG_INFO, " Smtp server = %s",
                       inet_ntop2(data->smtp_server));
index 6467131..6043b57 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.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: global_parser.c,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "global_parser.h"
 #include "global_data.h"
+#include "check_data.h"
 #include "parser.h"
 #include "memory.h"
 #include "utils.h"
 
-/* External vars */
-extern conf_data *data;
-
 /* data handlers */
 /* Global def handlers */
 static void
-lvsid_handler(vector strvec)
+routerid_handler(vector strvec)
+{
+       FREE_PTR(data->router_id);
+       data->router_id = set_value(strvec);
+}
+static void
+plugin_handler(vector strvec)
 {
-       FREE_PTR(data->lvs_id);
-       data->lvs_id = set_value(strvec);
+       data->plugin_dir = set_value(strvec);
 }
 static void
 emailfrom_handler(vector strvec)
@@ -77,7 +80,8 @@ global_init_keywords(void)
 {
        /* global definitions mapping */
        install_keyword_root("global_defs", NULL);
-       install_keyword("lvs_id", &lvsid_handler);
+       install_keyword("router_id", &routerid_handler);
+       install_keyword("plugin_dir", &plugin_handler);
        install_keyword("notification_email_from", &emailfrom_handler);
        install_keyword("smtp_server", &smtpip_handler);
        install_keyword("smtp_connect_timeout", &smtpto_handler);
index 5abe484..fe95722 100644 (file)
@@ -6,7 +6,7 @@
  * Part:        Layer4 checkers handling. Register worker threads &
  *              upper layer checkers.
  *
- * Version:     $Id: layer4.c,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: layer4.c,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "layer4.h"
index d5739f7..b05fc25 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Main program structure.
  *
- * Version:     $Id: main.c,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: main.c,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "main.h"
 #include "watchdog.h"
 #include "config.h"
 
+/* global var */
+char *conf_file = NULL;                /* Configuration file */
+int log_facility = LOG_DAEMON; /* Optional logging facilities */
+pid_t vrrp_child = -1;         /* VRRP child process ID */
+pid_t checkers_child = -1;     /* Healthcheckers child process ID */
+long wdog_delay_vrrp = 0;      /* VRRP child polling delay */
+long wdog_delay_check = 0;     /* Healthchecker child polling delay */
+int daemon_mode = 0;           /* VRRP/CHECK subsystem selection */
+int linkwatch = 0;             /* Use linkwatch kernel netlink reflection */
+
 /* Log facility table */
-struct {
+static struct {
        int facility;
 } LOG_FACILITY[LOG_FACILITY_MAX + 1] = {
        {LOG_LOCAL0}, {LOG_LOCAL1}, {LOG_LOCAL2}, {LOG_LOCAL3},
index 2f564be..cba1362 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        pidfile utility.
  *
- * Version:     $Id: pidfile.c,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: pidfile.c,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "pidfile.h"
index d0f1287..c768892 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.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: smtp.c,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
+#include <time.h>
+
 #include "smtp.h"
 #include "global_data.h"
+#include "check_data.h"
+#include "scheduler.h"
 #include "memory.h"
 #include "list.h"
 #include "utils.h"
 
-/* External vars */
-extern conf_data *data;
-extern thread_master *master;
-
 /* SMTP FSM definition */
 static int connection_error(thread *);
 static int connection_in_progress(thread *);
@@ -455,11 +455,16 @@ body_cmd(thread * thread)
 {
        smtp_thread_arg *smtp_arg = THREAD_ARG(thread);
        char *buffer;
+       char rfc822[80];
+       time_t tm;
 
        buffer = (char *) MALLOC(SMTP_BUFFER_MAX);
 
+       time(&tm);
+       strftime(rfc822, sizeof(rfc822), "%a, %d %b %Y %H:%M:%S %z", gmtime(&tm));
+
        snprintf(buffer, SMTP_BUFFER_MAX, SMTP_HEADERS_CMD,
-                data->email_from, smtp_arg->subject);
+                rfc822, data->email_from, smtp_arg->subject);
 
        /* send the subject field */
        if (send(thread->u.fd, buffer, strlen(buffer), 0) == -1)
@@ -561,20 +566,20 @@ smtp_alert(thread_master * master, real_server * rs, vrrp_rt * vrrp,
                if (rs)
                        snprintf(smtp_arg->subject, MAX_HEADERS_LENGTH,
                                 "[%s] Realserver %s:%d - %s",
-                                data->lvs_id, inet_ntop2(SVR_IP(rs))
+                                data->router_id, inet_ntop2(SVR_IP(rs))
                                 , ntohs(SVR_PORT(rs))
                                 , subject);
                else if (vrrp)
                        snprintf(smtp_arg->subject, MAX_HEADERS_LENGTH,
                                 "[%s] VRRP Instance %s - %s",
-                                data->lvs_id, vrrp->iname, subject);
+                                data->router_id, vrrp->iname, subject);
                else if (vgroup)
                        snprintf(smtp_arg->subject, MAX_HEADERS_LENGTH,
                                 "[%s] VRRP Group %s - %s",
-                                data->lvs_id, vgroup->gname, subject);
-               else if (data->lvs_id)
+                                data->router_id, vgroup->gname, subject);
+               else if (data->router_id)
                        snprintf(smtp_arg->subject, MAX_HEADERS_LENGTH,
-                                "[%s] %s", data->lvs_id, subject);
+                                "[%s] %s", data->router_id, subject);
                else
                        snprintf(smtp_arg->subject, MAX_HEADERS_LENGTH, "%s",
                                 subject);
index c13930a..4c11472 100644 (file)
@@ -9,7 +9,7 @@ global_defs {
    notification_email_from Alexandre.Cassen@firewall.loc
    smtp_server 192.168.200.1
    smtp_connect_timeout 30
-   lvs_id LVS_DEVEL
+   router_id LVS_DEVEL
 }
 
 vrrp_instance VI_1 {
index 733958e..a55bb42 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Checkers arguments structures definitions.
  *
- * Version:     $Id: check_api.h,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: check_api.h,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _CHECK_API_H
@@ -34,6 +34,7 @@ typedef struct _checker {
        void (*free) (void *);
        void (*dump) (void *);
        int (*launch) (struct _thread *);
+       int (*plugin_launch) (void *);
        virtual_server *vs;     /* pointer to the checker thread virtualserver */
        real_server *rs;        /* pointer to the checker thread realserver */
        void *data;
@@ -42,7 +43,7 @@ typedef struct _checker {
 } checker;
 
 /* Checkers queue */
-list checkers_queue;
+extern list checkers_queue;
 
 /* utility macro */
 #define CHECKER_ARG(X) ((X)->data)
index 24538db..8b04d7e 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_daemon.c include file.
  * 
- * Version:     $Id: check_daemon.h,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: check_daemon.h,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _CHECK_DAEMON_H
index 4991f89..d1b60b5 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Healthcheckers dynamic data structure definition.
  *
- * Version:     $Id: check_data.h,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: check_data.h,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _CHECK_DATA_H
@@ -155,6 +155,10 @@ typedef struct _check_conf_data {
                         (X)->addr_port == (Y)->addr_port &&    \
                         (X)->weight    == (Y)->weight)
 
+/* Global vars exported */
+extern check_conf_data *check_data;
+extern check_conf_data *old_check_data;
+
 /* prototypes */
 extern SSL_DATA *alloc_ssl(void);
 extern void free_ssl(void);
index de7288c..1ee8e78 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_http.c include file.
  *
- * Version:     $Id: check_http.h,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: check_http.h,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
-#ifndef _HTTP_H
-#define _HTTP_H
+#ifndef _CHECK_HTTP_H
+#define _CHECK_HTTP_H
 
 /* system includes */
 #include <stdio.h>
index 97cf49f..caded65 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_misc.c include file.
  *
- * Version:     $Id: check_misc.h,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: check_misc.h,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
  *
  * Author:      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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
-#ifndef _MISC_H
-#define _MISC_H
+#ifndef _CHECK_MISC_H
+#define _CHECK_MISC_H
 
 /* system includes */
 #include <stdlib.h>
@@ -36,6 +36,7 @@
 typedef struct _misc_checker {
        char *path;
        long timeout;
+       int dynamic;  /* 0: old-style, 1: exit code from checker affects weight */
 } misc_checker;
 
 /* Prototypes defs */
index 0be8a3c..3066eeb 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        check_parser.c include file.
  *  
- * Version:     $Id: check_parser.h,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: check_parser.h,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _CHECK_PARSER_H
diff --git a/keepalived/include/check_smtp.h b/keepalived/include/check_smtp.h
new file mode 100644 (file)
index 0000000..5cd3495
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * 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:        check_smtp.c include file.
+ *
+ * Version:     $Id: check_smtp.h,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ *
+ * Author:      Alexandre Cassen, <acassen@linux-vs.org>
+ *              Jeremy Rumpf, <jrumpf@heavyload.net>
+ *
+ *              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-2005 Alexandre Cassen, <acassen@linux-vs.org>
+ */
+
+#ifndef _CHECK_SMTP_H
+#define _CHECK_SMTP_H
+
+/* system includes */
+#include <stdlib.h>
+
+/* local includes */
+#include "check_data.h"
+#include "scheduler.h"
+#include "list.h"
+
+#define SMTP_BUFF_MAX          512
+
+#define SMTP_START             1
+#define SMTP_HAVE_BANNER       2
+#define SMTP_SENT_HELO         3
+#define SMTP_RECV_HELO         4
+#define SMTP_SENT_QUIT         5
+#define SMTP_RECV_QUIT         6
+
+#define SMTP_DEFAULT_HELO      "smtpchecker.keepalived.org"
+#define SMTP_DEFAULT_PORT      25
+
+/* Per host configuration structure  */
+typedef struct _smtp_host {
+       uint16_t port;
+       uint32_t ip;
+       uint32_t bindto;
+} smtp_host;
+
+/* Checker argument structure  */
+typedef struct _smtp_checker {
+       /* non per host config data goes here */
+       char *helo_name;
+       long timeout;
+       long db_retry;
+       int retry;
+       int attempts;
+       int  host_ctr;
+       smtp_host *host_ptr;
+
+       /* data buffer */
+       char buff[SMTP_BUFF_MAX];
+       int buff_ctr;
+       int (*buff_cb) (struct _thread *);
+
+       int state;
+
+       /* list holding the host config data */
+       list host;
+} smtp_checker;
+
+/* Prototypes defs */
+extern void install_smtp_check_keyword(void);
+
+#endif
index aea5c3e..0f151ed 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_http.c include file.
  *
- * Version:     $Id: check_http.h,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: check_http.h,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
-#ifndef _SSL_H
-#define _SSL_H
+#ifndef _CHECK_SSL_H
+#define _CHECK_SSL_H
 
 /* local includes */
 #include "check_http.h"
index e563358..2732b0d 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_tcp.c include file.
  *
- * Version:     $Id: check_tcp.h,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: check_tcp.h,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
-#ifndef _TCP_H
-#define _TCP_H
+#ifndef _CHECK_TCP_H
+#define _CHECK_TCP_H
 
 /* system includes */
 #include <unistd.h>
index de491b2..faa9808 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Configuration include file.
  *
- * Version:     $Id: config.h.in,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: config.h.in,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _CONFIG_H
index 1b1a30a..1272077 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Daemon process handling.
  *
- * Version:     $Id: daemon.h,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: daemon.h,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _DAEMON_H
index 389afab..23a3318 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Dynamic data structure definition.
  *
- * Version:     $Id: global_data.h,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: global_data.h,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _GLOBAL_DATA_H
@@ -37,6 +37,7 @@
 /* constants */
 #define DEFAULT_SMTP_SERVER 0x7f000001
 #define DEFAULT_SMTP_CONNECTION_TIMEOUT (30 * TIMER_HZ)
+#define DEFAULT_PLUGIN_DIR "/etc/keepalived/plugins"
 
 /* email link list */
 typedef struct _email {
@@ -45,13 +46,17 @@ typedef struct _email {
 
 /* Configuration data root */
 typedef struct _conf_data {
-       char *lvs_id;
+       char *router_id;
+       char *plugin_dir;
        char *email_from;
        uint32_t smtp_server;
        long smtp_connection_to;
        list email;
 } conf_data;
 
+/* Global vars exported */
+extern conf_data *data;                /* Global configuration data */
+
 /* Prototypes */
 extern void alloc_email(char *addr);
 extern conf_data *alloc_global_data(void);
index 86c47af..720df3a 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        vrrp_parser.c include file.
  *  
- * Version:     $Id: global_parser.h,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: global_parser.h,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _GLOBAL_PARSER_H
index 5b9f089..459cb59 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        ipfwwrapper.c include file.
  *
- * Version:     $Id: ipfwwrapper.h,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: ipfwwrapper.h,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _IPFWWRAPPER_H
index 4aac828..a08247f 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        ipvswrapper.c include file.
  *
- * Version:     $Id: ipvswrapper.h,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: ipvswrapper.h,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _IPVSWRAPPER_H
@@ -75,8 +75,6 @@
 #define IPVS_BACKUP            4
 #endif
 
-extern thread_master *master;
-
 /* Macro */
 #define IPVS_ALIVE(X,Y,Z)      (((X) == IP_VS_SO_SET_ADD && !(Y)->alive)       || \
                                 ((X) == IP_VS_SO_SET_DEL && (Y)->alive)        || \
index 0557ff2..31f1f44 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        ipwrapper.c include file.
  *
- * Version:     $Id: ipwrapper.h,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: ipwrapper.h,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _IPWRAPPER_H
@@ -60,6 +60,7 @@
 
 /* prototypes */
 extern void perform_svr_state(int alive, virtual_server * vs, real_server * rs);
+extern void update_svr_wgt(int weight, virtual_server * vs, real_server * rs);
 extern int svr_checker_up(checker_id_t cid, real_server * rs);
 extern void update_svr_checker_state(int alive, checker_id_t cid,
                                     virtual_server * vs, real_server * rs);
index d9d974c..dd48935 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        layer4.c include file.
  *
- * Version:     $Id: layer4.h,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: layer4.h,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _LAYER4_H
index 78c043d..0b26c41 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Main program include file.
  *
- * Version:     $Id: main.h,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: main.h,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _MAIN_H
 #include "check_daemon.h"
 #include "global_data.h"
 
-/* global var */
-thread_master *master = NULL;  /* Scheduling master thread */
-char *conf_file = NULL;                /* Configuration file */
-int log_facility = LOG_DAEMON; /* Optional logging facilities */
-int reload = 0;                        /* Global reloading flag */
-unsigned int debug;            /* Debugging flags */
-pid_t vrrp_child = -1;         /* VRRP child process ID */
-pid_t checkers_child = -1;     /* Healthcheckers child process ID */
-long wdog_delay_vrrp = 0;      /* VRRP child polling delay */
-long wdog_delay_check = 0;     /* Healthchecker child polling delay */
-conf_data *data;               /* Global configuration data */
-int daemon_mode = 0;           /* VRRP/CHECK subsystem selection */
-int linkwatch = 0;             /* Use linkwatch kernel netlink reflection */
+/* Global vars exported */
+extern char *conf_file;                /* Configuration file */
+extern int log_facility;       /* Optional logging facilities */
+extern pid_t vrrp_child;       /* VRRP child process ID */
+extern pid_t checkers_child;   /* Healthcheckers child process ID */
+extern long wdog_delay_vrrp;   /* VRRP child polling delay */
+extern long wdog_delay_check;  /* Healthchecker child polling delay */
+extern int daemon_mode;                /* VRRP/CHECK subsystem selection */
+extern int linkwatch;          /* Use linkwatch kernel netlink reflection */
 
 #endif
index 962aac6..0df5287 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        pidfile.c include file.
  *
- * Version:     $Id: pidfile.h,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: pidfile.h,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _PIDFILE_H
index 68b948a..36dfd7e 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        smtp.c include file.
  *
- * Version:     $Id: smtp.h,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: smtp.h,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _SMTP_H
@@ -84,9 +84,9 @@ typedef struct _smtp_thread_arg {
 #define SMTP_MAIL_CMD    "MAIL FROM:<%s>\r\n"
 #define SMTP_RCPT_CMD    "RCPT TO:<%s>\r\n"
 #define SMTP_DATA_CMD    "DATA\r\n"
-#define SMTP_HEADERS_CMD "From: %s\r\nSubject: %s\r\n" \
+#define SMTP_HEADERS_CMD "Date: %s\r\nFrom: %s\r\nSubject: %s\r\n" \
                         "X-Mailer: Keepalived\r\n\r\n"
-#define SMTP_BODY_CMD    "\r\n\r\n%s\r\n\r\n"
+#define SMTP_BODY_CMD    "%s\r\n"
 #define SMTP_SEND_CMD    "\r\n.\r\n"
 #define SMTP_QUIT_CMD    "QUIT\r\n"
 
index cafd0f5..c452aba 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Part:        vrrp.c program include file.
  *
- * Version:     $Id: vrrp.h,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: vrrp.h,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VRRP_H
@@ -65,7 +65,6 @@ typedef struct {              /* rfc2338.5.1 */
 #define VRRP_AUTH_PASS 1       /* password authentification -- rfc2338.5.3.6 */
 #define VRRP_AUTH_AH   2       /* AH(IPSec) authentification - rfc2338.5.3.6 */
 #define VRRP_ADVER_DFL 1       /* advert. interval (in sec) -- rfc2338.5.3.7 */
-#define VRRP_PREEMPT_DFL 1     /* rfc2338.6.1.2.Preempt_Mode */
 #define VRRP_GARP_DELAY (5 * TIMER_HZ) /* Default delay to launch gratuitous arp */
 
 /*
@@ -92,6 +91,7 @@ typedef struct _vrrp_rt {
        char *iname;            /* Instance Name */
        vrrp_sgroup *sync;      /* Sync group we belong to */
        interface *ifp;         /* Interface we belong to */
+       int dont_track_primary; /* If set ignores ifp faults */
        list track_ifp;         /* Interface state we monitor */
        uint32_t mcast_saddr;   /* Src IP address to use in VRRP IP header */
        char *lvs_syncd_if;     /* handle LVS sync daemon state using this
@@ -109,7 +109,12 @@ typedef struct _vrrp_rt {
                                 */
        list vroutes;           /* list of virtual routes */
        int adver_int;          /* delay between advertisements(in sec) */
-       int preempt;            /* true if a higher prio preempt a lower one */
+       int nopreempt;          /* true if higher prio does not preempt lower */
+       long preempt_delay;     /* Seconds*TIMER_HZ after startup until
+                                * preemption based on higher prio over lower
+                                * prio is allowed.  0 means no delay.
+                                */
+       TIMEVAL preempt_time;   /* Time after which preemption can happen */
        int state;              /* internal state (init/backup/master) */
        int init_state;         /* the initial state of the instance */
        int wantstate;          /* user explicitly wants a state (back/mast) */
@@ -182,6 +187,7 @@ typedef struct _vrrp_rt {
 #define VRRP_IS_BAD_PRIORITY(p)                ((p)<1 || (p)>255)      /* rfc2338.6.1.prio */
 #define VRRP_IS_BAD_ADVERT_INT(d)      ((d)<1)
 #define VRRP_IS_BAD_DEBUG_INT(d)       ((d)<0 || (d)>4)
+#define VRRP_IS_BAD_PREEMPT_DELAY(d)   ((d)<0 || (d)>TIMER_MAX_SEC)
 #define VRRP_SEND_BUFFER(V)            ((V)->send_buffer)
 #define VRRP_SEND_BUFFER_SIZE(V)       ((V)->send_buffer_size)
 
@@ -193,7 +199,7 @@ 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) & \
+#define VRRP_ISUP(V)   ((IF_ISUP((V)->ifp) || (V)->dont_track_primary) & \
                        ((!LIST_ISEMPTY((V)->track_ifp)) ? TRACK_ISUP((V)->track_ifp) : 1))
 
 /* prototypes */
@@ -213,5 +219,6 @@ 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 vrrp_restore_interface(vrrp_rt * vrrp, int advF);
 
 #endif
index 12ad3ea..2c3325b 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_arp.c include file.
  *
- * Version:     $Id: vrrp_arp.h,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: vrrp_arp.h,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VRRP_ARP_H
@@ -52,9 +52,9 @@ typedef struct _m_arphdr {
        unsigned char __ar_tip[4];      /* Target IP address.  */
 } m_arphdr;
 
-/* Global var */
-char *garp_buffer;
-int garp_fd;
+/* Global vars exported */
+extern char *garp_buffer;
+extern int garp_fd;
 
 /* prototypes */
 extern void gratuitous_arp_init(void);
index e4a7e23..a0a7725 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_daemon.c include file.
  * 
- * Version:     $Id: vrrp_daemon.h,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: vrrp_daemon.h,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VRRP_DAEMON_H
index cbb60e8..7d0fb9c 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Dynamic data structure definition.
  *
- * Version:     $Id: vrrp_data.h,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: vrrp_data.h,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VRRP_DATA_H
@@ -44,10 +44,13 @@ typedef struct _vrrp_conf_data {
        list vrrp;
        list vrrp_index;
        list vrrp_index_fd;
+       list vrrp_socket_pool;
 } vrrp_conf_data;
 
-/* Global Vars */
-char *vrrp_buffer;
+/* Global Vars exported */
+extern vrrp_conf_data *vrrp_data;
+extern vrrp_conf_data *old_vrrp_data;
+extern char *vrrp_buffer;
 
 /* prototypes */
 extern void alloc_saddress(vector strvec);
index e7d89af..714d9a0 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_if.c include file.
  *
- * Version:     $Id: vrrp_if.h,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: vrrp_if.h,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VRRP_IF_H
@@ -70,9 +70,6 @@ typedef struct _interface {
        int linkbeat;           /* LinkBeat from MII BMSR req */
 } interface;
 
-/* Global interface queue */
-list if_queue;
-
 /* Macros */
 #define IF_NAME(X) ((X)->ifname)
 #define IF_INDEX(X) ((X)->ifindex)
@@ -91,6 +88,9 @@ list if_queue;
                     if_linkbeat(X))
 #endif
 
+/* Global vars exported */
+extern list if_queue;
+
 /* prototypes */
 extern interface *if_get_by_ifindex(const int ifindex);
 extern interface *if_get_by_ifname(const char *ifname);
index ac1d28d..86ce0d4 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_index.c include file.
  *
- * Version:     $Id: vrrp_index.h,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: vrrp_index.h,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VRRP_INDEX_H
index 6befd19..0270c91 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_ipaddress.c include file.
  *
- * Version:     $Id: vrrp_ipaddress.h,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: vrrp_ipaddress.h,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VRRP_IPADDR_H
index 4ed3c6d..c207672 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_iproute.c include file.
  *
- * Version:     $Id: vrrp_iproute.h,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: vrrp_iproute.h,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VRRP_IPROUTE_H
index 131b5bc..c68c4fb 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_ipsecah.c include file.
  * 
- * Version:     $Id: vrrp_ipsecah.h,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: vrrp_ipsecah.h,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VRRP_IPSEC_AH_H
index 103f279..ab94098 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_netlink.c include file.
  *
- * Version:     $Id: vrrp_netlink.h,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: vrrp_netlink.h,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VRRP_NETLINK_H
@@ -48,9 +48,9 @@ struct nl_handle {
 /* Define types */
 #define NETLINK_TIMER (30 * TIMER_HZ)
 
-/* Our global netlink handler */
-struct nl_handle nl_kernel;    /* Kernel reflection channel */
-struct nl_handle nl_cmd;       /* Command channel */
+/* Global vars exported */
+extern struct nl_handle nl_kernel;     /* Kernel reflection channel */
+extern struct nl_handle nl_cmd;                /* Command channel */
 
 /* prototypes */
 extern int addattr32(struct nlmsghdr *n, int maxlen, int type, uint32_t data);
index 121dc7b..c8c435e 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Part:        vrrp_notify.c include file.
  *
- * Version:     $Id: vrrp_notify.h,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: vrrp_notify.h,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VRRP_NOTIFY_H
index 82e76dd..af1eaa3 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        vrrp_parser.c include file.
  *  
- * Version:     $Id: vrrp_parser.h,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: vrrp_parser.h,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VRRP_PARSER_H
index 12aba6d..8c2734f 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_scheduler.c include file.
  * 
- * Version:     $Id: vrrp_scheduler.h,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: vrrp_scheduler.h,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VRRP_SCHEDULER_H
@@ -34,6 +34,7 @@
 
 /* local includes */
 #include "scheduler.h"
+#include "vrrp_data.h"
 
 /*
  * Our instance dispatcher use a socket pool.
@@ -70,6 +71,7 @@ do {                                          \
 } while (0)
 
 /* extern prototypes */
+extern void vrrp_dispatcher_release(vrrp_conf_data * data);
 extern int vrrp_dispatcher_init(thread * thread);
 extern int vrrp_read_dispatcher_thread(thread * thread);
 
index bc998ee..b8ef06a 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_sync.c include file.
  * 
- * Version:     $Id: vrrp_sync.h,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: vrrp_sync.h,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VRRP_SYNC_H
index 00921b0..a464379 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_track.c include file.
  *
- * Version:     $Id: vrrp_track.h,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: vrrp_track.h,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VRRP_TRACK_H
index c82704a..3b1c4fd 100644 (file)
@@ -2,7 +2,7 @@
 #
 # Keepalived OpenSource project.
 #
-# Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
+# Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
 
 CC      = @CC@
 INCLUDES = -I../include -I../../lib
@@ -43,7 +43,7 @@ vrrp_parser.o: vrrp_parser.c ../include/vrrp_parser.h \
 vrrp.o: vrrp.c ../include/vrrp.h ../include/vrrp_scheduler.h \
   ../include/vrrp_notify.h ../include/ipvswrapper.h ../../lib/memory.h \
   ../../lib/list.h ../include/vrrp_data.h ../include/vrrp_sync.h ../include/vrrp_index.h \
-  ../include/vrrp_arp.h
+  ../include/vrrp_arp.h ../../lib/utils.h
 vrrp_notify.o: vrrp_notify.c ../include/vrrp_notify.h ../../lib/memory.h \
   ../../lib/notify.h
 vrrp_scheduler.o: vrrp_scheduler.c ../include/vrrp_scheduler.h \
index 3ee17cc..5129174 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.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: vrrp.c,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 /* local include */
 #include "vrrp_index.h"
 #include "memory.h"
 #include "list.h"
-
-/* extern global vars */
-extern vrrp_conf_data *vrrp_data;
-extern vrrp_conf_data *old_vrrp_data;
-extern unsigned int debug;
-
-/* compute checksum */
-static u_short
-in_csum(u_short * addr, int len, u_short csum)
-{
-       register int nleft = len;
-       const u_short *w = addr;
-       register u_short answer;
-       register int sum = csum;
-
-       /*
-        *  Our algorithm is simple, using a 32 bit accumulator (sum),
-        *  we add sequential 16 bit words to it, and at the end, fold
-        *  back all the carry bits from the top 16 bits into the lower
-        *  16 bits.
-        */
-       while (nleft > 1) {
-               sum += *w++;
-               nleft -= 2;
-       }
-
-       /* mop up an odd byte, if necessary */
-       if (nleft == 1)
-               sum += htons(*(u_char *) w << 8);
-
-       /*
-        * add back carry outs from top 16 bits to low 16 bits
-        */
-       sum = (sum >> 16) + (sum & 0xffff);     /* add hi 16 to low 16 */
-       sum += (sum >> 16);                     /* add carry */
-       answer = ~sum;                          /* truncate to 16 bits */
-       return (answer);
-}
+#include "main.h"
+#include "utils.h"
 
 /* add/remove Virtual IP addresses */
 static int
@@ -259,7 +223,8 @@ vrrp_in_chk(vrrp_rt * vrrp, char *buffer)
        }
 
        /* MUST verify the VRRP checksum */
-       if (in_csum((u_short *) hd, vrrp_hd_len(vrrp), 0)) {
+       if (in_csum((u_short *) hd,
+           sizeof(vrrp_pkt) + VRRP_AUTH_LEN + hd->naddr * sizeof(uint32_t), 0)) {
                syslog(LOG_INFO, "Invalid vrrp checksum");
                return VRRP_PACKET_KO;
        }
@@ -424,7 +389,6 @@ vrrp_build_ipsecah(vrrp_rt * vrrp, char *buffer, int buflen)
           In the current implementation if counter has cycled, we stop sending adverts and 
           become BACKUP. If all the master are down we reset the counter for becoming MASTER.
         */
-//  if (vrrp->ipsecah_counter->seq_number > 5) {
        if (vrrp->ipsecah_counter->seq_number > 0xFFFFFFFD) {
                vrrp->ipsecah_counter->cycle = 1;
        } else {
@@ -614,19 +578,29 @@ vrrp_send_gratuitous_arp(vrrp_rt * vrrp)
                return;
 
        /* send gratuitous arp for each virtual ip */
-       if (debug & 32)
-               syslog(LOG_INFO, "VRRP_Instance(%s) Sending gratuitous ARP on %s",
-                      vrrp->iname, IF_NAME(vrrp->ifp));
-
        for (j = 0; j < 5; j++) {
                if (!LIST_ISEMPTY(vrrp->vip))
                        for (e = LIST_HEAD(vrrp->vip); e; ELEMENT_NEXT(e)) {
                                ipaddress = ELEMENT_DATA(e);
+                               if (0 == j && debug & 32)
+                                       syslog(LOG_INFO,
+                                              "VRRP_Instance(%s) Sending gratuitous ARPs "
+                                              "on %s for %s",
+                                              vrrp->iname,
+                                              IF_NAME(ipaddress->ifp),
+                                              inet_ntop2(ipaddress->addr));
                                send_gratuitous_arp(ipaddress);
                        }
                if (!LIST_ISEMPTY(vrrp->evip))
                        for (e = LIST_HEAD(vrrp->evip); e; ELEMENT_NEXT(e)) {
                                ipaddress = ELEMENT_DATA(e);
+                               if (0 == j && debug & 32)
+                                       syslog(LOG_INFO,
+                                              "VRRP_Instance(%s) Sending gratuitous ARPs "
+                                              "on %s for %s",
+                                              vrrp->iname,
+                                              IF_NAME(ipaddress->ifp),
+                                              inet_ntop2(ipaddress->addr));
                                send_gratuitous_arp(ipaddress);
                        }
        }
@@ -675,11 +649,16 @@ vrrp_state_goto_master(vrrp_rt * vrrp)
 }
 
 /* leaving master state */
-static void
+void
 vrrp_restore_interface(vrrp_rt * vrrp, int advF)
 {
-       /* remove the ip addresses */
-       if (VRRP_VIP_ISSET(vrrp)) {
+       /*
+        * Remove the ip addresses.
+        *
+        * If started with "--dont-release-vrrp" (debug & 8) then try to remove
+        * addresses even if we didn't add them during this run.
+        */
+       if (debug & 8 || VRRP_VIP_ISSET(vrrp)) {
                if (!LIST_ISEMPTY(vrrp->vip))
                        vrrp_handle_ipaddress(vrrp, IPADDRESS_DEL,
                                              VRRP_VIP_TYPE);
@@ -761,7 +740,8 @@ vrrp_state_backup(vrrp_rt * vrrp, char *buf, int buflen)
                    3 * vrrp->adver_int + VRRP_TIMER_SKEW(vrrp);
        } else if (hd->priority == 0) {
                vrrp->ms_down_timer = VRRP_TIMER_SKEW(vrrp);
-       } else if (!vrrp->preempt || hd->priority >= vrrp->priority) {
+       } else if (vrrp->nopreempt || hd->priority >= vrrp->priority ||
+                  timer_cmp(vrrp->preempt_time, timer_now()) > 0) {
                vrrp->ms_down_timer =
                    3 * vrrp->adver_int + VRRP_TIMER_SKEW(vrrp);
        } else if (hd->priority < vrrp->priority) {
@@ -959,10 +939,6 @@ open_vrrp_socket(const int proto, const int index)
        /* Retreive interface */
        ifp = if_get_by_ifindex(index);
 
-       /* Simply return if interface is shut */
-       if (!IF_ISUP(ifp))
-               return fd;
-
        /* open the socket */
        fd = socket(AF_INET, SOCK_RAW, proto);
        if (fd < 0) {
@@ -1040,8 +1016,6 @@ vrrp_complete_instance(vrrp_rt * vrrp)
                vrrp->adver_int = VRRP_ADVER_DFL * TIMER_HZ;
        if (!vrrp->priority)
                vrrp->priority = VRRP_PRIO_DFL;
-       if (!vrrp->preempt)
-               vrrp->preempt = VRRP_PREEMPT_DFL;
 
        return (chk_min_cfg(vrrp));
 }
index faae428..0ca5915 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        ARP primitives.
  *
- * Version:     $Id: vrrp_arp.c,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: vrrp_arp.c,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 /* system includes */
 #include "memory.h"
 #include "utils.h"
 
+/* global vars */
+char *garp_buffer;
+int garp_fd;
+
 /* Make shared socket */
 void gratuitous_arp_init(void)
 {
index 47ff7af..94d045a 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        VRRP child process handling.
  *
- * Version:     $Id: vrrp_daemon.c,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: vrrp_daemon.c,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "vrrp_daemon.h"
   #include "ipvswrapper.h"
 #endif
 #include "list.h"
+#include "main.h"
 #include "memory.h"
 #include "parser.h"
 #include "watchdog.h"
 
 /* Global vars */
-vrrp_conf_data *vrrp_data;
-vrrp_conf_data *old_vrrp_data;
-int vrrp_wdog_sd = -1;
+static int vrrp_wdog_sd = -1;
 
 /* VRRP watchdog data */
-wdog_data vrrp_wdog_data = {
+static wdog_data vrrp_wdog_data = {
        "VRRP Child",
        WDOG_VRRP,
        -1,
@@ -57,15 +56,6 @@ wdog_data vrrp_wdog_data = {
        start_vrrp_child
 };
 
-/* Externals vars */
-extern thread_master *master;
-extern conf_data *data;
-extern unsigned int debug;
-extern int reload;
-extern pid_t vrrp_child;
-extern char *conf_file;
-extern int wdog_delay_vrrp;
-
 /* Daemon stop sequence */
 static void
 stop_vrrp(void)
@@ -87,7 +77,9 @@ stop_vrrp(void)
 
        /* Clean data */
        free_global_data(data);
+       vrrp_dispatcher_release(vrrp_data);
        free_vrrp_data(vrrp_data);
+       free_vrrp_buffer();
 
 #ifdef _WITH_LVS_
        /* Clean ipvs related */
@@ -197,6 +189,7 @@ reload_vrrp_thread(thread * thread)
        start_vrrp();
 
        /* free backup data */
+       vrrp_dispatcher_release(old_vrrp_data);
        free_vrrp_data(old_vrrp_data);
        UNSET_RELOAD;
 
@@ -263,7 +256,8 @@ start_vrrp_child(void)
        }
 
        /* Opening local VRRP syslog channel */
-       openlog(PROG_VRRP, LOG_PID | (debug & 1) ? LOG_CONS : 0, LOG_LOCAL1);
+       openlog(PROG_VRRP, LOG_PID | (debug & 1) ? LOG_CONS : 0,
+               (log_facility==LOG_DAEMON) ? LOG_LOCAL1 : log_facility);
 
        /* Child process part, write pidfile */
        if (!pidfile_write(VRRP_PID_FILE, getpid())) {
index 197bad9..6744f8a 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Dynamic data structure definition.
  *
- * Version:     $Id: vrrp_data.c,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: vrrp_data.c,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "vrrp_data.h"
 #include "memory.h"
 #include "utils.h"
 
-/* Externals vars */
-extern vrrp_conf_data *vrrp_data;
+/* global vars */
+vrrp_conf_data *vrrp_data = NULL;
+vrrp_conf_data *old_vrrp_data = NULL;
+char *vrrp_buffer;
 
 /* Static addresses facility function */
 void
@@ -124,6 +126,8 @@ dump_vrrp(void *data)
        else
                syslog(LOG_INFO, "   Want State = MASTER");
        syslog(LOG_INFO, "   Runing on device = %s", IF_NAME(vrrp->ifp));
+       if (vrrp->dont_track_primary)
+               syslog(LOG_INFO, "   VRRP interface tracking disabled");
        if (vrrp->mcast_saddr)
                syslog(LOG_INFO, "   Using mcast src_ip = %s",
                       inet_ntop2(vrrp->mcast_saddr));
@@ -137,8 +141,11 @@ dump_vrrp(void *data)
        syslog(LOG_INFO, "   Priority = %d", vrrp->priority);
        syslog(LOG_INFO, "   Advert interval = %dsec",
               vrrp->adver_int / TIMER_HZ);
-       if (vrrp->preempt)
-               syslog(LOG_INFO, "   Preempt Active");
+       if (vrrp->nopreempt)
+               syslog(LOG_INFO, "   Preempt disabled");
+       if (vrrp->preempt_delay)
+               syslog(LOG_INFO, "   Preempt delay = %ld secs",
+                      vrrp->preempt_delay / TIMER_HZ);
        if (vrrp->auth_type) {
                syslog(LOG_INFO, "   Authentication type = %s",
                       (vrrp->auth_type ==
@@ -291,6 +298,7 @@ free_vrrp_data(vrrp_conf_data * vrrp_data)
        free_mlist(vrrp_data->vrrp_index_fd, 1024+1);
        free_list(vrrp_data->vrrp);
        free_list(vrrp_data->vrrp_sync_group);
+       free_list(vrrp_data->vrrp_socket_pool);
        FREE(vrrp_data);
 }
 
index e2bc0c0..497b861 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Interfaces manipulation.
  *
- * Version:     $Id: vrrp_if.c,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: vrrp_if.c,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 /* global include */
@@ -57,8 +57,7 @@ typedef __uint8_t u8;
 #include "utils.h"
 
 /* Global vars */
-extern thread_master *master;
-extern vrrp_conf_data *vrrp_data;
+list if_queue;
 static struct ifreq ifr;
 
 /* Helper functions */
index 5f66448..45c4fe4 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        VRRP instance index table.
  *
- * Version:     $Id: vrrp_index.c,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: vrrp_index.c,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 /* local include */
@@ -29,9 +29,6 @@
 #include "memory.h"
 #include "list.h"
 
-/* Externals vars */
-extern vrrp_conf_data *vrrp_data;
-
 /* VRID hash table */
 void
 alloc_vrrp_bucket(vrrp_rt *vrrp)
@@ -93,13 +90,36 @@ void set_vrrp_fd_bucket(int old_fd, vrrp_rt *vrrp)
 {
        vrrp_rt *vrrp_ptr;
        element e;
+       element next;
        list l = &vrrp_data->vrrp_index_fd[old_fd%1024 + 1];
 
-       for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) {
+       for (e = LIST_HEAD(l); e; e = next) {
+               next = e->next;
                vrrp_ptr =  ELEMENT_DATA(e);
-               if (IF_INDEX(vrrp_ptr->ifp) == IF_INDEX(vrrp->ifp)) {
+               if (vrrp_ptr->fd_in == old_fd) {
                        vrrp_ptr->fd_in = vrrp->fd_in;
                        vrrp_ptr->fd_out = vrrp->fd_out;
+
+                       /* Re-hash fd */
+                       alloc_vrrp_fd_bucket(vrrp_ptr);
+
+                       /* Release element */
+                       if (e->prev)
+                               e->prev->next = e->next;
+                       else
+                               l->head = e->next;
+
+                       if (e->next)
+                               e->next->prev = e->prev;
+                       else
+                               l->tail = e->prev;
+                       l->count--;
+                       FREE(e);
                }
        }
+
+       if (LIST_ISEMPTY(l)) {
+               l->head = NULL;
+               l->tail = NULL;
+       }
 }
index 627b31f..ec236c6 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        NETLINK IPv4 address manipulation.
  *
- * Version:     $Id: vrrp_ipaddress.c,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: vrrp_ipaddress.c,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 /* local include */
 #include "memory.h"
 #include "utils.h"
 
-/* extern global vars */
-extern vrrp_conf_data *vrrp_data;
-extern vrrp_conf_data *old_vrrp_data;
-
 /* Add/Delete IP address to a specific interface */
 int
 netlink_address_ipv4(ip_address *ipaddr, int cmd)
@@ -74,10 +70,14 @@ netlink_iplist_ipv4(list ip_list, int cmd)
        if (LIST_ISEMPTY(ip_list))
                return;
 
+       /*
+        * If "--dont-release-vrrp" (debug & 8) is set then try to release
+        * addresses that may be there, even if we didn't set them.
+        */
        for (e = LIST_HEAD(ip_list); e; ELEMENT_NEXT(e)) {
                ipaddress = ELEMENT_DATA(e);
                if ((cmd && !ipaddress->set) ||
-                   (!cmd && ipaddress->set)) {
+                   (!cmd && (ipaddress->set || debug & 8))) {
                        if (netlink_address_ipv4(ipaddress, cmd) > 0)
                                ipaddress->set = (cmd) ? 1 : 0;
                        else
index 0193493..38890a3 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        NETLINK IPv4 routes manipulation.
  *
- * Version:     $Id: vrrp_iproute.c,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: vrrp_iproute.c,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 /* local include */
 #include "memory.h"
 #include "utils.h"
 
-/* extern global vars */
-extern vrrp_conf_data *vrrp_data;
-extern vrrp_conf_data *old_vrrp_data;
-
 /* Add/Delete IP route to/from a specific interface */
 int
 netlink_route_ipv4(ip_route *iproute, int cmd)
index dc7630c..589c437 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.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: vrrp_ipsecah.c,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "vrrp_ipsecah.h"
index bffa1ed..310253a 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        NETLINK kernel command channel.
  *
- * Version:     $Id: vrrp_netlink.c,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: vrrp_netlink.c,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 /* global include */
@@ -45,7 +45,8 @@
 #include "utils.h"
 
 /* Global vars */
-extern thread_master *master;
+struct nl_handle nl_kernel;    /* Kernel reflection channel */
+struct nl_handle nl_cmd;       /* Command channel */
 
 /* Create a socket to netlink interface */
 int
@@ -113,6 +114,44 @@ netlink_close(struct nl_handle *nl)
        return 0;
 }
 
+/* Set netlink socket channel as blocking */
+int
+netlink_set_block(struct nl_handle *nl, int *flags)
+{
+       int ret;
+
+       ret = fcntl(nl->fd, F_GETFL, 0);
+       if (ret < 0) {
+               syslog(LOG_INFO, "Netlink: Cannot F_GETFL socket : (%s)",
+                      strerror(errno));
+               return -1;
+       }
+       *flags &= ~O_NONBLOCK;
+       ret = fcntl(nl->fd, F_SETFL, *flags);
+       if (ret < 0) {
+               syslog(LOG_INFO, "Netlink: Cannot F_SETFL socket : (%s)",
+                      strerror(errno));
+               return -1;
+       }
+       return 0;
+}
+
+/* Set netlink socket channel as non-blocking */
+int
+netlink_set_nonblock(struct nl_handle *nl, int *flags)
+{
+       int ret;
+
+       *flags |= O_NONBLOCK;
+       ret = fcntl(nl->fd, F_SETFL, *flags);
+       if (ret < 0) {
+               syslog(LOG_INFO, "Netlink: Cannot F_SETFL socket : (%s)",
+                      strerror(errno));
+               return -1;
+       }
+       return 0;
+}
+
 /* iproute2 utility function */
 int
 addattr32(struct nlmsghdr *n, int maxlen, int type, uint32_t data)
@@ -211,7 +250,7 @@ netlink_parse_info(int (*filter) (struct sockaddr_nl *, struct nlmsghdr *),
                if (status < 0) {
                        if (errno == EINTR)
                                continue;
-                       if (errno == EWOULDBLOCK)
+                       if (errno == EWOULDBLOCK || errno == EAGAIN)
                                break;
                        syslog(LOG_INFO, "Netlink: Received message overrun");
                        continue;
@@ -237,10 +276,19 @@ netlink_parse_info(int (*filter) (struct sockaddr_nl *, struct nlmsghdr *),
 
                        /* Error handling. */
                        if (h->nlmsg_type == NLMSG_ERROR) {
-                               struct nlmsgerr *err =
-                                   (struct nlmsgerr *) NLMSG_DATA(h);
-                               if (h->nlmsg_len <
-                                   NLMSG_LENGTH(sizeof (struct nlmsgerr))) {
+                               struct nlmsgerr *err = (struct nlmsgerr *) NLMSG_DATA(h);
+
+                               /*
+                                * If error == 0 then this is a netlink ACK.
+                                * return if not related to multipart message.
+                                */
+                               if (err->error == 0) {
+                                       if (!(h->nlmsg_flags & NLM_F_MULTI))
+                                               return 0;
+                                       continue;
+                               }
+
+                               if (h->nlmsg_len < NLMSG_LENGTH(sizeof (struct nlmsgerr))) {
                                        syslog(LOG_INFO,
                                               "Netlink: error: message truncated");
                                        return -1;
@@ -254,6 +302,12 @@ netlink_parse_info(int (*filter) (struct sockaddr_nl *, struct nlmsghdr *),
                                return -1;
                        }
 
+                       /* 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...");
+                               continue;
+                       }
+
                        error = (*filter) (&snl, h);
                        if (error < 0) {
                                syslog(LOG_INFO,
@@ -291,6 +345,7 @@ int
 netlink_talk(struct nl_handle *nl, struct nlmsghdr *n)
 {
        int status;
+       int ret, flags;
        struct sockaddr_nl snl;
        struct iovec iov = { (void *) n, n->nlmsg_len };
        struct msghdr msg = { (void *) &snl, sizeof snl, &iov, 1, NULL, 0, 0 };
@@ -300,6 +355,9 @@ netlink_talk(struct nl_handle *nl, struct nlmsghdr *n)
 
        n->nlmsg_seq = ++nl->seq;
 
+       /* Request Netlink acknowledgement */
+       n->nlmsg_flags |= NLM_F_ACK;
+
        /* Send message to netlink interface. */
        status = sendmsg(nl->fd, &msg, 0);
        if (status < 0) {
@@ -308,7 +366,17 @@ netlink_talk(struct nl_handle *nl, struct nlmsghdr *n)
                return -1;
        }
 
+       /* Set blocking flag */
+       ret = netlink_set_block(nl, &flags);
+       if (ret < 0)
+               syslog(LOG_INFO, "Netlink: Warning, couldn't set "
+                      "blocking flag to netlink socket...");
+
        status = netlink_parse_info(netlink_talk_filter, nl);
+
+       /* Restore previous flags */
+       if (ret == 0)
+               netlink_set_nonblock(nl, &flags);
        return status;
 }
 
@@ -472,10 +540,17 @@ netlink_interface_lookup(void)
 {
        struct nl_handle nlh;
        int status = 0;
+       int ret, flags;
 
        if (netlink_socket(&nlh, 0) < 0)
                return -1;
 
+       /* Set blocking flag */
+       ret = netlink_set_block(&nlh, &flags);
+       if (ret < 0)
+               syslog(LOG_INFO, "Netlink: 1Warning, couldn't set "
+                      "blocking flag to netlink socket...");
+
        /* Interface lookup */
        if (netlink_request(&nlh, AF_PACKET, RTM_GETLINK) < 0) {
                status = -1;
@@ -494,10 +569,17 @@ netlink_address_lookup(void)
 {
        struct nl_handle nlh;
        int status = 0;
+       int ret, flags;
 
        if (netlink_socket(&nlh, 0) < 0)
                return -1;
 
+       /* Set blocking flag */
+       ret = netlink_set_block(&nlh, &flags);
+       if (ret < 0)
+               syslog(LOG_INFO, "Netlink: 2Warning, couldn't set "
+                      "blocking flag to netlink socket...");
+
        /* Address lookup */
        if (netlink_request(&nlh, AF_INET, RTM_GETADDR) < 0) {
                status = -1;
@@ -576,8 +658,7 @@ kernel_netlink(thread * thread)
        int status = 0;
 
        if (thread->type != THREAD_READ_TIMEOUT)
-               status =
-                   netlink_parse_info(netlink_broadcast_filter, &nl_kernel);
+               status = netlink_parse_info(netlink_broadcast_filter, &nl_kernel);
        thread_add_read(master, kernel_netlink, NULL, nl_kernel.fd,
                        NETLINK_TIMER);
        return 0;
index a2a1452..dfdffa8 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        VRRP state transition notification scripts handling.
  *
- * Version:     $Id: vrrp_notify.c,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: vrrp_notify.c,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 /* system include */
index a12161d..a3e5bdc 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.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: vrrp_parser.c,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "vrrp_parser.h"
 #include "parser.h"
 #include "memory.h"
 
-/* global defs */
-extern vrrp_conf_data *vrrp_data;
-extern unsigned long mem_allocated;
-
 /* Static addresses handler */
 static void
 static_addresses_handler(vector strvec)
@@ -133,6 +129,12 @@ vrrp_track_int_handler(vector strvec)
        alloc_value_block(strvec, alloc_vrrp_track);
 }
 static void
+vrrp_dont_track_handler(vector strvec)
+{
+       vrrp_rt *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
+       vrrp->dont_track_primary = 1;
+}
+static void
 vrrp_mcastip_handler(vector strvec)
 {
        vrrp_rt *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
@@ -172,7 +174,7 @@ 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 intervall not valid !\n");
+               syslog(LOG_INFO, "VRRP Error : Advert interval not valid !\n");
                syslog(LOG_INFO,
                       "             must be between less than 1sec.\n");
                syslog(LOG_INFO, "             Using default value : 1sec\n");
@@ -187,16 +189,37 @@ 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 intervall not valid !\n");
+               syslog(LOG_INFO, "VRRP Error : Debug interval not valid !\n");
                syslog(LOG_INFO, "             must be between 0-4\n");
                vrrp->debug = 0;
        }
 }
 static void
+vrrp_nopreempt_handler(vector strvec)
+{
+       vrrp_rt *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
+       vrrp->nopreempt = 1;
+}
+static void    /* backwards compatibility */
 vrrp_preempt_handler(vector strvec)
 {
        vrrp_rt *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
-       vrrp->preempt = !vrrp->preempt;
+       vrrp->nopreempt = 0;
+}
+static void
+vrrp_preempt_delay_handler(vector strvec)
+{
+       vrrp_rt *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
+       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",
+                      TIMER_MAX_SEC);
+               vrrp->preempt_delay = 0;
+       }
+       vrrp->preempt_delay *= TIMER_HZ;
+       vrrp->preempt_time = timer_add_long(timer_now(), vrrp->preempt_delay);
 }
 static void
 vrrp_notify_backup_handler(vector strvec)
@@ -319,8 +342,6 @@ vrrp_vroutes_handler(vector strvec)
 vector
 vrrp_init_keywords(void)
 {
-       keywords = vector_alloc();
-
        /* global definitions mapping */
        global_init_keywords();
 
@@ -339,6 +360,7 @@ vrrp_init_keywords(void)
        install_keyword_root("vrrp_instance", &vrrp_handler);
        install_keyword("state", &vrrp_state_handler);
        install_keyword("interface", &vrrp_int_handler);
+       install_keyword("dont_track_primary", &vrrp_dont_track_handler);
        install_keyword("track_interface", &vrrp_track_int_handler);
        install_keyword("mcast_src_ip", &vrrp_mcastip_handler);
        install_keyword("virtual_router_id", &vrrp_vrid_handler);
@@ -348,6 +370,8 @@ vrrp_init_keywords(void)
        install_keyword("virtual_ipaddress_excluded", &vrrp_evip_handler);
        install_keyword("virtual_routes", &vrrp_vroutes_handler);
        install_keyword("preempt", &vrrp_preempt_handler);
+       install_keyword("nopreempt", &vrrp_nopreempt_handler);
+       install_keyword("preempt_delay", &vrrp_preempt_delay_handler);
        install_keyword("debug", &vrrp_debug_handler);
        install_keyword("notify_backup", &vrrp_notify_backup_handler);
        install_keyword("notify_master", &vrrp_notify_master_handler);
index aca6498..ef0f076 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Sheduling framework for vrrp code.
  *
- * Version:     $Id: vrrp_scheduler.c,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: vrrp_scheduler.c,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "vrrp_scheduler.h"
 #include "ipvswrapper.h"
 #include "memory.h"
 #include "list.h"
+#include "main.h"
 #include "smtp.h"
 
-/* Externals vars */
-extern thread_master *master;
-extern vrrp_conf_data *vrrp_data;
-extern unsigned int debug;
-
 /* VRRP FSM (Finite State Machine) design.
  *
  * The state transition diagram implemented is :
@@ -206,6 +202,7 @@ vrrp_init_state(list l)
                               vrrp->iname);
 
                        /* Set BACKUP state */
+                       vrrp_restore_interface(vrrp, 0);
                        vrrp->state = VRRP_STATE_BACK;
                        vrrp_smtp_notifier(vrrp);
                        notify_instance_exec(vrrp, VRRP_STATE_BACK);
@@ -343,6 +340,10 @@ already_exist_sock(list l, int ifindex, int proto)
 void
 free_sock(void *data)
 {
+       sock *sock = data;
+       interface *ifp = if_get_by_ifindex(sock->ifindex);
+       if_leave_vrrp_group(sock->fd_in, ifp);
+       close(sock->fd_out);
        FREE(data);
 }
 
@@ -457,31 +458,33 @@ vrrp_set_fds(list l)
 int
 vrrp_dispatcher_init(thread * thread)
 {
-       list pool;
-
        /* allocate the sockpool */
-       pool = alloc_list(free_sock, dump_sock);
+       vrrp_data->vrrp_socket_pool = alloc_list(free_sock, dump_sock);
 
        /* create the VRRP socket pool list */
-       vrrp_create_sockpool(pool);
+       vrrp_create_sockpool(vrrp_data->vrrp_socket_pool);
 
        /* open the VRRP socket pool */
-       vrrp_open_sockpool(pool);
+       vrrp_open_sockpool(vrrp_data->vrrp_socket_pool);
 
        /* set VRRP instance fds to sockpool */
-       vrrp_set_fds(pool);
+       vrrp_set_fds(vrrp_data->vrrp_socket_pool);
 
        /* register read dispatcher worker thread */
-       vrrp_register_workers(pool);
+       vrrp_register_workers(vrrp_data->vrrp_socket_pool);
 
-       /* cleanup the temp socket pool */
+       /* Dump socket pool */
        if (debug & 32)
-               dump_list(pool);
-       free_list(pool);
-
+               dump_list(vrrp_data->vrrp_socket_pool);
        return 1;
 }
 
+void
+vrrp_dispatcher_release(vrrp_conf_data *data)
+{
+       free_list(data->vrrp_socket_pool);
+}
+
 static void
 vrrp_backup(vrrp_rt * vrrp, char *vrrp_buffer, int len)
 {
@@ -490,10 +493,8 @@ vrrp_backup(vrrp_rt * vrrp, char *vrrp_buffer, int len)
 
        if (iph->protocol == IPPROTO_IPSEC_AH) {
                ah = (ipsec_ah *) (vrrp_buffer + sizeof (struct iphdr));
-               if (ah->seq_number >= vrrp->ipsecah_counter->seq_number) {
-//                     vrrp->ipsecah_counter->seq_number = ah->seq_number + 10;
+               if (ntohl(ah->seq_number) >= vrrp->ipsecah_counter->seq_number)
                        vrrp->ipsecah_counter->cycle = 0;
-               }
        }
 
        vrrp_state_backup(vrrp, vrrp_buffer, len);
@@ -513,7 +514,7 @@ vrrp_become_master(vrrp_rt * vrrp, char *vrrp_buffer, int len)
                syslog(LOG_INFO, "VRRP_Instance(%s) IPSEC-AH : seq_num sync",
                       vrrp->iname);
                ah = (ipsec_ah *) (vrrp_buffer + sizeof (struct iphdr));
-               vrrp->ipsecah_counter->seq_number = ah->seq_number + 1;
+               vrrp->ipsecah_counter->seq_number = ntohl(ah->seq_number) + 1;
                vrrp->ipsecah_counter->cycle = 0;
        }
 
@@ -671,10 +672,7 @@ vrrp_fault(vrrp_rt * vrrp)
        vrrp_sgroup *vgroup = vrrp->sync;
 
        if (vgroup) {
-               if (vrrp_sync_leave_fault(vrrp)) {
-                       if (vgroup->state == VRRP_STATE_FAULT)
-                               vgroup->state = vrrp->init_state;
-               } else
+               if (!vrrp_sync_leave_fault(vrrp))
                        return;
        } else if (VRRP_ISUP(vrrp))
                vrrp_log_int_up(vrrp);
index 6b60bc1..a967f5b 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        VRRP synchronization framework.
  *
- * Version:     $Id: vrrp_sync.c,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: vrrp_sync.c,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "vrrp_sync.h"
 #include "vrrp_data.h"
 #include "smtp.h"
 
-/* Externals vars */
-extern thread_master *master;
-extern vrrp_conf_data *vrrp_data;
-
 /* Compute the new instance sands */
 void
 vrrp_init_instance_sands(vrrp_rt * vrrp)
index 827e572..ca652bf 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Interface tracking framework.
  *
- * Version:     $Id: vrrp_track.c,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: vrrp_track.c,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 /* local include */
index 893db3a..4c3864a 100644 (file)
@@ -2,7 +2,7 @@
 #
 # Keepalived OpenSource project.
 #
-# Copyright (C) 2001-2004 Alexandre Cassen, <acassen@linux-vs.org>
+# Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
 
 CC      = @CC@
 INCLUDES = -I.
index b4633ba..9ead08f 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        HTML stream parser utility functions.
  *
- * Version:     $Id: html.c,v 1.1.7 2004/04/04 23:28:05 ACAssen Exp $
+ * Version:     $Id: html.c,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include <string.h>
@@ -85,12 +85,11 @@ int extract_status_code(char *buffer, int size)
 char *extract_html(char *buffer, int size_buffer)
 {
        char *end = buffer + size_buffer;
+       char *cur;
 
-       while (buffer < end &&
-              !(*buffer++ == '\n' &&
-               (*buffer == '\n' || (*buffer++ == '\r' && *buffer == '\n')))) ;
-
-       if (*buffer == '\n')
-               return buffer + 1;
+       for (cur = buffer; cur + 4 < end; cur++)
+               if (*cur == '\r' && *(cur+1) == '\n'
+                   && *(cur+2) == '\r' && *(cur+3) == '\n')
+                       return cur + 4;
        return NULL;
 }
index cecb219..207536f 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        parser.c include file.
  *
- * Version:     $Id: html.h,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: html.h,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _HTML_H
index b5495ff..3fddaae 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        List structure manipulation.
  *  
- * Version:     $Id: list.c,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: list.c,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "list.h"
@@ -89,7 +89,6 @@ list_element(list l, int num)
        for (i = 0; i < num; i++)
                if (e)
                        ELEMENT_NEXT(e);
-
        if (e)
                return ELEMENT_DATA(e);
        return NULL;
@@ -115,11 +114,27 @@ free_element(list l)
                next = e->next;
                if (l->free)
                        (*l->free) (e->data);
+               l->count--;
                FREE(e);
        }
 }
 
 void
+free_list_elements(list l)
+{
+       element e;
+       element next;
+       
+       for (e = LIST_HEAD(l); e; e = next) {
+               next = e->next;
+               l->count--;
+               FREE(e);
+       }
+       l->head = NULL;
+       l->tail = NULL;
+}
+
+void
 free_list(list l)
 {
        if (!l)
@@ -160,10 +175,28 @@ alloc_mlist(void (*free_func) (void *), void (*dump_func) (void *), int size)
 void
 dump_mlist(list l, int size)
 {
+       element e;
        int i;
 
-       for (i = 0; i < size; i++)
-               dump_list(&l[i]);
+       for (i = 0; i < size; i++) {
+               for (e = LIST_HEAD(&l[i]); e; ELEMENT_NEXT(e))
+                       if (l->dump)
+                               (*l->dump) (e->data);
+       }
+}
+
+void
+free_melement(list l, void (*free_func) (void *))
+{
+       element e;
+       element next;
+
+       for (e = LIST_HEAD(l); e; e = next) {
+               next = e->next;
+               if (free_func)
+                       (*free_func) (e->data);
+               FREE(e);
+       }
 }
 
 void
@@ -175,6 +208,6 @@ free_mlist(list l, int size)
                return;
 
        for (i = 0; i < size; i++)
-               free_element(&l[i]);
+               free_melement(&l[i], l->free);
        FREE(l);
 }
index 9ba0a35..3eb232b 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        list.c include file.
  *  
- * Version:     $Id: list.h,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: list.h,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _LIST_H
@@ -54,6 +54,7 @@ struct _list {
 /* Prototypes */
 extern list alloc_list(void (*free_func) (void *), void (*dump_func) (void *));
 extern void free_list(list l);
+extern void free_list_elements(list l);
 extern void free_list_element(list l, element e);
 extern void *list_element(list l, int num);
 extern void dump_list(list l);
index 599a536..6909729 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.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: memory.c,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "memory.h"
 
+/* Global var */
+unsigned long mem_allocated;   /* Total memory used in Bytes */
+
 void *
 xalloc(unsigned long size)
 {
@@ -74,7 +77,7 @@ xfree(void *p)
  */
 
 #ifdef _DEBUG_
-extern void print_buffer(int, char *);
+extern void dump_buffer(char *, int);
 
 typedef struct {
        int type;
@@ -95,28 +98,6 @@ static int n = 0;            /* Alloc list pointer */
 static int f = 0;              /* Free list pointer */
 static int s = 0;              /* Indent counter */
 
-static char *
-nspace(int n)
-{
-
-       return "";
-
-/*
- static char buf[64];
- int start = 0; 
- char *p;
- p = buf;
- while ( n-- > start ) {       
-  *p++ = ' '; 
- }
- *p=0;
-
- return buf;
-*/
-
-}
-
 char *
 keepalived_malloc(unsigned long size, char *file, char *function, int line)
 {
@@ -138,7 +119,7 @@ keepalived_malloc(unsigned long size, char *file, char *function, int line)
        if (i == number_alloc_list)
                number_alloc_list++;
 
-       assert(number_alloc_list > MAX_ALLOC_LIST);
+       assert(number_alloc_list < MAX_ALLOC_LIST);
 
        alloc_list[i].ptr = buf;
        alloc_list[i].size = size;
@@ -149,8 +130,8 @@ keepalived_malloc(unsigned long size, char *file, char *function, int line)
        alloc_list[i].type = 9;
 
        if (debug & 1)
-               printf("%szalloc[%3d:%3d], %p, %4ld at %s, %3d, %s\n",
-                      nspace(s++), i, number_alloc_list, buf, size, file, line,
+               printf("zalloc[%3d:%3d], %p, %4ld at %s, %3d, %s\n",
+                      i, number_alloc_list, buf, size, file, line,
                       function);
 
        n++;
@@ -167,8 +148,8 @@ keepalived_free(void *buffer, char *file, char *function, int line)
        if (buffer == NULL) {
                i = number_alloc_list++;
 
-               assert(number_alloc_list > MAX_ALLOC_LIST);
-               
+               assert(number_alloc_list < MAX_ALLOC_LIST);
+
                alloc_list[i].ptr = buffer;
                alloc_list[i].size = 0;
                alloc_list[i].file = file;
@@ -176,7 +157,7 @@ keepalived_free(void *buffer, char *file, char *function, int line)
                alloc_list[i].line = line;
                alloc_list[i].type = 2;
                if (debug & 1)
-                       printf("%sfree NULL in %s, %3d, %s\n", nspace(s), file,
+                       printf("free NULL in %s, %3d, %s\n", file,
                               line, function);
 
                debug |= 512;   /* Memory Error detect */
@@ -195,18 +176,15 @@ keepalived_free(void *buffer, char *file, char *function, int line)
                        else {
                                alloc_list[i].type = 1; /* Overrun */
                                if (debug & 1) {
-                                       printf
-                                           ("%sfree corrupt, buffer overrun [%3d:%3d], %p, %4ld at %s, %3d, %s\n",
-                                            nspace(--s), i, number_alloc_list,
-                                            buf, alloc_list[i].size, file,
-                                            line, function);
-                                       print_buffer(alloc_list[i].size +
-                                                    sizeof (long),
-                                                    alloc_list[i].ptr);
-                                       printf("%sCheck_sum\n", nspace(i));
-                                       print_buffer(sizeof (long),
-                                                    (char *) &alloc_list[i].
-                                                    csum);
+                                       printf("free corrupt, buffer overrun [%3d:%3d], %p, %4ld at %s, %3d, %s\n",
+                                              i, number_alloc_list,
+                                              buf, alloc_list[i].size, file,
+                                              line, function);
+                                       dump_buffer(alloc_list[i].ptr,
+                                                   alloc_list[i].size + sizeof (long));
+                                       printf("Check_sum\n");
+                                       dump_buffer((char *) &alloc_list[i].csum,
+                                                   sizeof(long));
 
                                        debug |= 512;   /* Memory Error detect */
                                }
@@ -221,7 +199,7 @@ keepalived_free(void *buffer, char *file, char *function, int line)
                printf("Free ERROR %p\n", buffer);
                number_alloc_list++;
 
-               assert(number_alloc_list > MAX_ALLOC_LIST);
+               assert(number_alloc_list < MAX_ALLOC_LIST);
 
                alloc_list[i].ptr = buf;
                alloc_list[i].size = 0;
@@ -238,8 +216,8 @@ keepalived_free(void *buffer, char *file, char *function, int line)
                xfree(buffer);
 
        if (debug & 1)
-               printf("%sfree  [%3d:%3d], %p, %4ld at %s, %3d, %s\n",
-                      nspace(--s), i, number_alloc_list, buf,
+               printf("free  [%3d:%3d], %p, %4ld at %s, %3d, %s\n",
+                      i, number_alloc_list, buf,
                       alloc_list[i].size, file, line, function);
 
        free_list[f].file = file;
@@ -345,7 +323,7 @@ keepalived_realloc(void *buffer, unsigned long size, char *file, char *function,
                printf("realloc %p %s, %3d %s\n", buffer, file, line, function);
                i = number_alloc_list++;
 
-               assert(number_alloc_list > MAX_ALLOC_LIST);
+               assert(number_alloc_list < MAX_ALLOC_LIST);
 
                alloc_list[i].ptr = NULL;
                alloc_list[i].size = 0;
@@ -371,7 +349,7 @@ keepalived_realloc(void *buffer, unsigned long size, char *file, char *function,
                printf("realloc ERROR no matching zalloc %p \n", buffer);
                number_alloc_list++;
 
-               assert(number_alloc_list > MAX_ALLOC_LIST);
+               assert(number_alloc_list < MAX_ALLOC_LIST);
 
                alloc_list[i].ptr = buf;
                alloc_list[i].size = 0;
@@ -396,12 +374,11 @@ keepalived_realloc(void *buffer, unsigned long size, char *file, char *function,
        alloc_list[i].csum = check;
 
        if (debug & 1)
-               printf
-                   ("%srealloc [%3d:%3d] %p, %4ld %s %d %s -> %p %4ld %s %d %s\n",
-                    nspace(s), i, number_alloc_list, alloc_list[i].ptr,
-                    alloc_list[i].size, file, line, function, buf, size,
-                    alloc_list[i].file, alloc_list[i].line,
-                    alloc_list[i].func);
+               printf("realloc [%3d:%3d] %p, %4ld %s %d %s -> %p %4ld %s %d %s\n",
+                      i, number_alloc_list, alloc_list[i].ptr,
+                      alloc_list[i].size, file, line, function, buf, size,
+                      alloc_list[i].file, alloc_list[i].line,
+                      alloc_list[i].func);
 
        alloc_list[i].ptr = buf;
        alloc_list[i].size = size;
index 0fdba18..4a14c74 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        memory.c include file.
  *
- * Version:     $Id: memory.h,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: memory.h,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _MEMORY_H
 #include <string.h>
 #include <assert.h>
 
-/* Global var */
-unsigned long mem_allocated;   /* Total memory used in Bytes */
-
 /* extern types */
-extern unsigned int debug;
 extern unsigned long mem_allocated;
 extern void *xalloc(unsigned long size);
 extern void *zalloc(unsigned long size);
@@ -49,7 +45,7 @@ extern void xfree(void *p);
 /* Local defines */
 #ifdef _DEBUG_
 
-#define MAX_ALLOC_LIST 1024
+#define MAX_ALLOC_LIST 2048
 
 #define MALLOC(n)    ( keepalived_malloc((n), \
                       (__FILE__), (__FUNCTION__), (__LINE__)) )
index 01e7e58..643b220 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Forked system call to launch an extra script.
  *
- * Version:     $Id: notify.c,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: notify.c,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include <unistd.h>
index b8e0da0..2fe8bdc 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        notify.c include file.
  *
- * Version:     $Id: notify.h,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: notify.h,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _NOTIFY_H
index 3811076..7140222 100644 (file)
@@ -7,7 +7,7 @@
  *              data structure representation the conf file representing
  *              the loadbalanced server pool.
  *  
- * Version:     $Id: parser.c,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: parser.c,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "parser.h"
 #include "memory.h"
 
+/* global vars */
+vector keywords;
+FILE *stream;
+
 /* local vars */
 static int sublevel = 0;
 
@@ -45,25 +49,7 @@ keyword_alloc(vector keywords, char *string, void (*handler) (vector))
 }
 
 void
-install_keyword_root(char *string, void (*handler) (vector))
-{
-       keyword_alloc(keywords, string, handler);
-}
-
-void
-install_sublevel(void)
-{
-       sublevel++;
-}
-
-void
-install_sublevel_end(void)
-{
-       sublevel--;
-}
-
-void
-install_keyword(char *string, void (*handler) (vector))
+keyword_alloc_sub(vector keywords, char *string, void (*handler) (vector))
 {
        int i = 0;
        struct keyword *keyword;
@@ -84,6 +70,31 @@ install_keyword(char *string, void (*handler) (vector))
        keyword_alloc(keyword->sub, string, handler);
 }
 
+/* Exported helpers */
+void
+install_sublevel(void)
+{
+       sublevel++;
+}
+
+void
+install_sublevel_end(void)
+{
+       sublevel--;
+}
+
+void
+install_keyword_root(char *string, void (*handler) (vector))
+{
+       keyword_alloc(keywords, string, handler);
+}
+
+void
+install_keyword(char *string, void (*handler) (vector))
+{
+       keyword_alloc_sub(keywords, string, handler);
+}
+
 void
 dump_keywords(vector keydump, int level)
 {
@@ -350,12 +361,12 @@ init_data(char *conf_file, vector (*init_keywords) (void))
        }
 
        /* Init Keywords structure */
+       keywords = vector_alloc();
        (*init_keywords) ();
 
-/* Dump configuration *
-  vector_dump(keywords);
-  dump_keywords(keywords, 0);
-*/
+/* Dump configuration */
+vector_dump(keywords);
+dump_keywords(keywords, 0);
 
        /* Stream handling */
        process_stream(keywords);
index 7766c61..8b35057 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        cfreader.c include file.
  *  
- * Version:     $Id: parser.h,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: parser.h,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _PARSER_H
@@ -53,12 +53,13 @@ struct keyword {
 #define UNSET_RELOAD    (reload = 0)
 #define RELOAD_DELAY    5
 
-/* global var exported */
-vector keywords;
-FILE *stream;
+/* global vars exported */
+extern vector keywords;
+extern FILE *stream;
 
 /* Prototypes */
 extern void keyword_alloc(vector keywords, char *string, void (*handler) (vector));
+extern void keyword_alloc_sub(vector keywords, char *string, void (*handler) (vector));
 extern void install_keyword_root(char *string, void (*handler) (vector));
 extern void install_sublevel(void);
 extern void install_sublevel_end(void);
index 6ef17b8..b184100 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.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: scheduler.c,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include <signal.h>
@@ -31,6 +31,9 @@
 #include "memory.h"
 #include "utils.h"
 
+/* global vars */
+thread_master *master = NULL;
+
 /* Make thread master. */
 thread_master *
 thread_make_master(void)
@@ -432,7 +435,7 @@ thread_cancel_event(thread_master * m, void *arg)
 }
 
 /* Compute the wait timer. Take care of timeouted fd */
-TIMEVAL *
+static void
 thread_compute_timer(thread_master * m, TIMEVAL * timer_wait)
 {
        TIMEVAL timer_min;
@@ -476,8 +479,6 @@ thread_compute_timer(thread_master * m, TIMEVAL * timer_wait)
                timer_wait->tv_usec = timer_min.tv_usec;
        } else
                timer_wait = NULL;
-
-       return timer_wait;
 }
 
 /* Fetch next ready thread. */
@@ -489,7 +490,7 @@ thread_fetch(thread_master * m, thread * fetch)
        fd_set readfd;
        fd_set writefd;
        fd_set exceptfd;
-       TIMEVAL *timer_wait;
+       TIMEVAL timer_wait;
        int status;
        sigset_t sigset, dummy_sigset, block_sigset, pending;
 
@@ -506,15 +507,14 @@ thread_fetch(thread_master * m, thread * fetch)
        sigemptyset(&block_sigset);
        sigaddset(&block_sigset, SIGCHLD);
 
-       /* Timer allocation */
-       timer_wait = (TIMEVAL *) MALLOC(sizeof (TIMEVAL));
+       /* Timer initialization */
+       memset(&timer_wait, 0, sizeof (TIMEVAL));
 
 retry: /* When thread can't fetch try to find next thread again. */
 
        /* If there is event process it first. */
        while ((thread = thread_trim_head(&m->event))) {
                *fetch = *thread;
-               FREE_PTR(timer_wait);
 
                /* If daemon hanging event is received return NULL pointer */
                if (thread->type == THREAD_TERMINATE) {
@@ -532,7 +532,6 @@ retry:      /* When thread can't fetch try to find next thread again. */
                *fetch = *thread;
                thread->type = THREAD_UNUSED;
                thread_add_unuse(m, thread);
-               FREE_PTR(timer_wait);
                return fetch;
        }
 
@@ -541,7 +540,7 @@ retry:      /* When thread can't fetch try to find next thread again. */
         * Calculate select wait timer. Take care of timeouted fd.
         */
        set_time_now();
-       timer_wait = thread_compute_timer(m, timer_wait);
+       thread_compute_timer(m, &timer_wait);
 
        /* Call select function. */
        readfd = m->readfd;
@@ -571,7 +570,8 @@ retry:      /* When thread can't fetch try to find next thread again. */
                /* Emulate pselect */
                sigset_t saveset;
                sigprocmask(SIG_SETMASK, &sigset, &saveset);
-               ret = select(FD_SETSIZE, &readfd, &writefd, &exceptfd, timer_wait);
+               ret = select(FD_SETSIZE, &readfd, &writefd, &exceptfd,
+                            (TIMER_ISNULL(timer_wait)) ? NULL : &timer_wait);
                sigprocmask(SIG_SETMASK, &saveset, NULL);
        }
 
@@ -706,7 +706,6 @@ retry:      /* When thread can't fetch try to find next thread again. */
        thread->type = THREAD_UNUSED;
        thread_add_unuse(m, thread);
 
-       FREE(timer_wait);
        return fetch;
 }
 
@@ -727,8 +726,6 @@ thread_call(thread * thread)
 }
 
 /* Our infinite scheduling loop */
-extern thread_master *master;
-extern unsigned int debug;
 void
 launch_scheduler(void)
 {
index bba00f7..ff50374 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        scheduler.c include file.
  *
- * Version:     $Id: scheduler.h,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: scheduler.h,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _SCHEDULER_H
@@ -101,6 +101,9 @@ typedef struct _thread_master {
 #define THREAD_CHILD_PID(X) ((X)->u.c.pid)
 #define THREAD_CHILD_STATUS(X) ((X)->u.c.status)
 
+/* global vars exported */
+extern thread_master *master;
+
 /* Prototypes. */
 extern thread_master *thread_make_master(void);
 extern thread *thread_add_terminate_event(thread_master * m);
index 8a5871f..4da9a6a 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        Timer manipulations.
  *  
- * Version:     $Id: timer.c,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: timer.c,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include <stdio.h>
index 93acace..3853d75 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        timer.c include file.
  *  
- * Version:     $Id: timer.h,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: timer.h,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _TIMER_H
index 69e6559..b0e6588 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        General program utils.
  *
- * Version:     $Id: utils.c,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: utils.c,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "utils.h"
 
+/* global vars */
+int debug = 0;
+
 /* Display a buffer into a HEXA formated output */
 void
-print_buffer(int count, char *buff)
+dump_buffer(char *buff, int count)
 {
        int i, j, c;
        int printnext = 1;
@@ -67,6 +70,39 @@ print_buffer(int count, char *buff)
        }
 }
 
+/* Compute a checksum */
+u_short
+in_csum(u_short * addr, int len, u_short csum)
+{
+       register int nleft = len;
+       const u_short *w = addr;
+       register u_short answer;
+       register int sum = csum;
+
+       /*
+        *  Our algorithm is simple, using a 32 bit accumulator (sum),
+        *  we add sequential 16 bit words to it, and at the end, fold
+        *  back all the carry bits from the top 16 bits into the lower
+        *  16 bits.
+        */
+       while (nleft > 1) {
+               sum += *w++;
+               nleft -= 2;
+       }
+
+       /* mop up an odd byte, if necessary */
+       if (nleft == 1)
+               sum += htons(*(u_char *) w << 8);
+
+       /*
+        * add back carry outs from top 16 bits to low 16 bits
+        */
+       sum = (sum >> 16) + (sum & 0xffff);     /* add hi 16 to low 16 */
+       sum += (sum >> 16);                     /* add carry */
+       answer = ~sum;                          /* truncate to 16 bits */
+       return (answer);
+}
+
 /* IP network to ascii representation */
 char *
 inet_ntop2(uint32_t ip)
@@ -168,6 +204,29 @@ inet_ston(const char *addr, uint32_t * dst)
        return 1;
 }
 
+/*
+ * Return broadcast address from network and netmask.
+ */
+uint32_t
+inet_broadcast(uint32_t network, uint32_t netmask)
+{
+       return 0xffffffff - netmask + network;
+}
+
+/*
+ * Convert CIDR netmask notation to long notation.
+ */
+uint32_t
+inet_cidrtomask(uint8_t cidr)
+{
+       uint32_t mask = 0;
+       int b;
+
+       for (b = 0; b < cidr; b++)
+               mask |= (1 << (31 - b));
+       return ntohl(mask);
+}
+
 /* Getting localhost official canonical name */
 char *
 get_local_name(void)
index 639a66a..bb6084f 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        utils.h include file.
  *
- * Version:     $Id: utils.h,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: utils.h,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _UTILS_H
 #define DBG(fmt, msg...)
 #endif
 
+/* global vars exported */
+extern int debug;
+
 /* Prototypes defs */
-extern void print_buffer(int count, char *buff);
+extern void dump_buffer(char *buff, int count);
+extern u_short in_csum(u_short * addr, int len, u_short csum);
 extern char *inet_ntop2(uint32_t ip);
 extern char *inet_ntoa2(uint32_t ip, char *buf);
 extern uint8_t inet_stom(char *addr);
 extern uint8_t inet_stor(char *addr);
-extern int inet_ston(const char *addr, uint32_t * dst);
+extern int inet_ston(const char *addr, uint32_t *dst);
+uint32_t inet_broadcast(uint32_t network, uint32_t netmask);
+uint32_t inet_cidrtomask(uint8_t cidr);
 extern char *get_local_name(void);
 
 #endif
index 1cd1594..485171e 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        Vector structure manipulation.
  *  
- * Version:     $Id: vector.c,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: vector.c,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "vector.h"
@@ -47,6 +47,40 @@ vector_alloc_slot(vector v)
                v->slot = (void *) MALLOC(sizeof (void *) * v->allocated);
 }
 
+/* Insert a value into a specific slot */
+void
+vector_insert_slot(vector v, int slot, void *value)
+{
+       int i;
+
+       vector_alloc_slot(v);
+       for (i = (v->allocated / VECTOR_DEFAULT_SIZE) - 2; i >= slot; i--)
+               v->slot[i + 1] = v->slot[i];
+       v->slot[slot] = value;
+}
+
+/* Del a slot */
+void
+vector_del_slot(vector v, int slot)
+{
+       int i;
+
+       if (!v->allocated)
+               return;
+
+       for (i = slot + 1; i < (v->allocated / VECTOR_DEFAULT_SIZE); i++)
+               v->slot[i - 1] = v->slot[i];
+
+       v->allocated -= VECTOR_DEFAULT_SIZE;
+
+       if (!v->allocated)
+               v->slot = NULL;
+       else
+               v->slot = (void *) MALLOC(sizeof (void *) * v->allocated);
+
+       v = REALLOC(v->slot, sizeof (void *) * v->allocated);
+}
+
 /* Free memory vector allocation */
 void
 vector_free(vector v)
index 4b0dd44..c0687f8 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        vector.c include file.
  *  
- * Version:     $Id: vector.h,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: vector.h,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VECTOR_H
@@ -36,12 +36,17 @@ typedef struct _vector *vector;
 #define VECTOR_SLOT(V,E) ((V)->slot[(E)])
 #define VECTOR_SIZE(V)   ((V)->allocated)
 
+#define vector_foreach_slot(v,p,i) \
+       for (i = 0; i < (v)->allocated && ((p) = (v)->slot[i]); i++)
+
 /* Prototypes */
 extern vector vector_alloc(void);
 extern void vector_alloc_slot(vector v);
 extern void vector_free(vector v);
 extern void free_strvec(vector strvec);
 extern void vector_set_slot(vector v, void *value);
+extern void vector_del_slot(vector v, int slot);
+extern void vector_insert_slot(vector v, int slot, void *value);
 extern void vector_dump(vector v);
 extern void dump_strvec(vector strvec);
 
index db0f7c0..c9f9f00 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        Software watchdog framework.
  *  
- * Version:     $Id: watchdog.c,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: watchdog.c,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include <unistd.h>
@@ -35,9 +35,8 @@
 #include "memory.h"
 #include "parser.h"
 
-/* Extern vars */
-extern thread_master *master;
-extern int reload;
+/* global vars */
+int reload = 0;
 
 /* Watchdog connection reader */
 static int
index c1a46c6..6a58510 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        watchdog.c include file.
  *  
- * Version:     $Id: watchdog.h,v 1.1.7 2004/04/04 23:28:05 acassen Exp $
+ * Version:     $Id: watchdog.h,v 1.1.8 2005/01/25 23:20:11 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-2004 Alexandre Cassen, <acassen@linux-vs.org>
+ * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _WATCHDOG_H
@@ -43,6 +43,9 @@ typedef struct _wdog_data {
 #define WATCHDOG_STRING                "hello"
 #define WDOG_READ_BUFSIZ       32
 
+/* gloabal vars exported */
+extern int reload;
+
 /* Prototypes */
 extern int wdog_init(char *path);
 extern void wdog_close(int sd, char *path);