keepalived-1.1.2 v1.1.2
authorAlexandre Cassen <acassen@freebox.fr>
Sun, 7 Sep 2003 22:08:21 +0000 (00:08 +0200)
committerAlexandre Cassen <acassen@freebox.fr>
Mon, 28 Sep 2009 08:58:58 +0000 (10:58 +0200)
* keepalived-1.1.2 released.
* Dominik Vogt, <dominik.vogt@gmx.de> and I extended checker
  framework to support multiple checkers per realserver.
  Each checker own a uniq id, each realserver own a list
  of checkers id. Realserver is considered down if one of the
  checkers fails.
* Dominik Vogt, <dominik.vogt@gmx.de> extended list library to
  support free_list_element.
* Dominik Vogt, <dominik.vogt@gmx.de> and I extended ipwrapper
  to support multiple checkers test. Created a checker state
  updater helper function to perform realserver state according
  to checker state.
* Dominik Vogt, <dominik.vogt@gmx.de> extended all checkers
  code to support multiple checker design (to not perform
  server state according a single checkers test).
* Tobias Klausmann, <klausman@schwarzvogel.de> and I extended
  layer4 framework to support socket binding to a specific
  ip address before calling connect(). Extended the TCP, HTTP
  and SSL checker to support binding selection, creating
  a new checker keyword named "bindto".
  look at doc/keepalived.conf.SYNOPSIS for more informations.
* VRRP : Extended the ethtool code to be selected only if
  ETHTOOL_GLINK is available. This is useful for s/390 zSeries
  users :) since zSerie 2.4 kernel doesn't support ethtool
  extension.
* VRRP : Gatis Peisenieks, <gatis@mt.lv> fixed IPSEC-AH
  code to exclude ip header id filed while computing AH digest.
  Fixed AH sequence number to be set in network byte order.
* VRRP : Fixed a bug in the static_ipaddress block that caused
  a noisy crashing startup.
* VRRP : Kjetil Torgrim Homme, <kjetilho@ifi.uio.no> and I
  fixed a daemon crash while reloading configuration due to a
  vrrp_buffer not freed.
* VRRP : Review the watchdog calling location. watchdog listener
  is reinitialized during a daemon reload.
* VRRP : Diego Rivera, <lrivera@racsa.co.cr> extended notify
  framework to support simple notify script call. Created a new
  keyword "notify", for both vrrp_instance and vrrp_sync_group.
  If configured, this notify script is called after FSM state
  transition notify scripts.
  look at doc/keepalived.conf.SYNOPSIS for more informations.
* Review the checker watchdog calling location like VRRP.
* Fixed code selection to exclude VRRP dependencies if code is
  configured without VRRP framework.
* Extended memory lib free function to reset memory location to
  NULL.
* Diego Rivera, <lrivera@racsa.co.cr> extended global parser
  to support default handlers for lvs_id, smtp_server,
  smtp_connection_timeout and email_from. default values are :
   o lvs_id : box local name
   o smtp_server : localhost
   o email_from : uid@box_local_name
   o smtp_connection_timeout : 30s

102 files changed:
ChangeLog
VERSION
doc/keepalived.conf.SYNOPSIS
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/check/Makefile.in
keepalived/check/check_api.c
keepalived/check/check_ci.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_ssl.c
keepalived/check/check_tcp.c
keepalived/check/ipfwwrapper.c
keepalived/check/ipvswrapper.c
keepalived/check/ipwrapper.c
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/include/check_api.h
keepalived/include/check_ci.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_ssl.h
keepalived/include/check_tcp.h
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/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/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 df80110..d7c74b2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,58 @@
+2003-09-07  Alexandre Cassen  <acassen@linux-vs.org>
+       * keepalived-1.1.2 released.
+       * Dominik Vogt, <dominik.vogt@gmx.de> and I extended checker
+         framework to support multiple checkers per realserver.
+         Each checker own a uniq id, each realserver own a list
+         of checkers id. Realserver is considered down if one of the
+         checkers fails.
+       * Dominik Vogt, <dominik.vogt@gmx.de> extended list library to
+         support free_list_element.
+       * Dominik Vogt, <dominik.vogt@gmx.de> and I extended ipwrapper
+         to support multiple checkers test. Created a checker state
+         updater helper function to perform realserver state according
+         to checker state.
+       * Dominik Vogt, <dominik.vogt@gmx.de> extended all checkers
+         code to support multiple checker design (to not perform
+         server state according a single checkers test).
+       * Tobias Klausmann, <klausman@schwarzvogel.de> and I extended
+         layer4 framework to support socket binding to a specific
+         ip address before calling connect(). Extended the TCP, HTTP
+         and SSL checker to support binding selection, creating
+         a new checker keyword named "bindto".
+         look at doc/keepalived.conf.SYNOPSIS for more informations.
+       * VRRP : Extended the ethtool code to be selected only if
+         ETHTOOL_GLINK is available. This is useful for s/390 zSeries
+         users :) since zSerie 2.4 kernel doesn't support ethtool
+         extension.
+       * VRRP : Gatis Peisenieks, <gatis@mt.lv> fixed IPSEC-AH
+         code to exclude ip header id filed while computing AH digest.
+         Fixed AH sequence number to be set in network byte order.
+       * VRRP : Fixed a bug in the static_ipaddress block that caused
+         a noisy crashing startup.
+       * VRRP : Kjetil Torgrim Homme, <kjetilho@ifi.uio.no> and I
+         fixed a daemon crash while reloading configuration due to a
+         vrrp_buffer not freed.
+       * VRRP : Review the watchdog calling location. watchdog listener
+         is reinitialized during a daemon reload.
+       * VRRP : Diego Rivera, <lrivera@racsa.co.cr> extended notify
+         framework to support simple notify script call. Created a new
+         keyword "notify", for both vrrp_instance and vrrp_sync_group.
+         If configured, this notify script is called after FSM state
+         transition notify scripts.
+         look at doc/keepalived.conf.SYNOPSIS for more informations.
+       * Review the checker watchdog calling location like VRRP.
+       * Fixed code selection to exclude VRRP dependencies if code is
+         configured without VRRP framework.
+       * Extended memory lib free function to reset memory location to
+         NULL.
+       * Diego Rivera, <lrivera@racsa.co.cr> extended global parser
+         to support default handlers for lvs_id, smtp_server,
+         smtp_connection_timeout and email_from. default values are :
+          o lvs_id : box local name
+          o smtp_server : localhost
+          o email_from : uid@box_local_name
+          o smtp_connection_timeout : 30s
+
 2003-07-24  Alexandre Cassen  <acassen@linux-vs.org>
        * keepalived-1.1.1 released.
        * VRRP : Fixed an issue while reloading configuration. Fixed
diff --git a/VERSION b/VERSION
index 524cb55..45a1b3f 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.1.1
+1.1.2
index f905194..cf52526 100644 (file)
@@ -88,9 +88,21 @@ vrrp_sync_group <STRING> {   # VRRP sync group declaration
     notify_master <STRING>|<QUOTED-STRING> # Script to run during MASTER transit
     notify_backup <STRING>|<QUOTED-STRING> # Script to run during BACKUP transit
     notify_fault <STRING>|<QUOTED-STRING>  # Script to run during FAULT transit
+    notify <STRING>|<QUOTED-STRING>       # Script to run during ANY state transit (1)
     smtp_alert          # Send email notif during state transit
 }
 
+(1) The "notify" script is called AFTER the corresponding notify_* script has
+    been called, and is given exactly 3 arguments (the whole string is interpreted
+    as a litteral filename so don't add parameters!):
+
+    $1 = A string indicating whether it's a "GROUP" or an "INSTANCE"
+    $2 = The name of said group or instance
+    $3 = The state it's transitioning to ("MASTER", "BACKUP" or "FAULT")
+
+    $1 and $3 are ALWAYS sent in uppercase, and the possible strings sent are the
+    same ones listed above ("GROUP"/"INSTANCE", "MASTER"/"BACKUP"/"FAULT").
+
        2.2. VRRP instance
 
        The configuration block looks like :
@@ -134,6 +146,7 @@ vrrp_instance <STRING> {            # VRRP instance declaration
     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
 }
 
@@ -221,6 +234,7 @@ virtual_server group <STRING>      {        # VS group declaration
             }
             ...
             connect_port <PORT>                # TCP port to connect
+            bindto <IP ADDRESS>                # IP address to bind to
             connect_timeout <INTEGER>  # Timeout connection
             nb_get_retry <INTEGER>     # number of get retry
             delay_before_retry <INTEGER> # delay before retry
@@ -235,6 +249,7 @@ virtual_server group <STRING>      {        # VS group declaration
 
         TCP_CHECK {                    # TCP healthchecker
             connect_port <PORT>                # TCP port to connect
+            bindto <IP ADDRESS>                # IP address to bind to
             connect_timeout <INTEGER>  # Timeout connection
         }
     }
index b68d53d..ea23978 100644 (file)
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include <errno.h>
index 6e018f2..504faf4 100644 (file)
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _HTTP_H
index ebe90d0..c2f53e5 100644 (file)
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "layer4.h"
index e5a867b..5ab5519 100644 (file)
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _LAYER4_H
index 491dd42..793543b 100644 (file)
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include <signal.h>
index c7ead3c..6bf0626 100644 (file)
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _MAIN_H
index 02b6fc4..f67f5b2 100644 (file)
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include <string.h>
index 43baa5a..1943353 100644 (file)
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _SOCK_H
index 9bf0304..0fdaa93 100644 (file)
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include <openssl/err.h>
index 9e8b6ec..e785209 100644 (file)
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _SSL_H
index a4ba5b1..084aa98 100644 (file)
@@ -66,7 +66,7 @@ check_ssl.o: check_ssl.c ../include/check_ssl.h ../include/check_api.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
-ipwrapper.o: ipwrapper.c ../include/ipwrapper.h ../../lib/utils.h \
-  ../../lib/notify.h
+ipwrapper.o: ipwrapper.c ../include/ipwrapper.h ../../lib/memory.h \
+  ../../lib/utils.h ../../lib/notify.h
 ipvswrapper.o: ipvswrapper.c ../include/ipvswrapper.h ../../lib/utils.h \
   ../../lib/memory.h
index b2d12f2..7600bc8 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Checkers registration.
  *
- * Version:     $Id: check_api.c,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: check_api.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "check_api.h"
@@ -37,6 +39,9 @@ extern thread_master *master;
 extern check_conf_data *check_data;
 extern unsigned int debug;
 
+/* Global vars */
+static checker_id_t ncheckers = 0;
+
 /* free checker data */
 static void
 free_checker(void *data)
@@ -71,6 +76,7 @@ queue_checker(void (*free) (void *), void (*dump) (void *)
        chk->vs = vs;
        chk->rs = rs;
        chk->data = data;
+       chk->id = ncheckers++;
        chk->enabled = (vs->vfwmark) ? 1 : 0;
 #ifdef _WITHOUT_VRRP_
        chk->enabled = 1;
@@ -102,6 +108,7 @@ void
 free_checkers_queue(void)
 {
        free_list(checkers_queue);
+       ncheckers = 0;
 }
 
 /* register the checker to the global I/O scheduler */
index d36a757..f12834a 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        CI-LINUX checker. Integration to Compaq Cluster Infrastructure.
  *
- * Version:     $Id: check_ci.c,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: check_ci.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Aneesh Kumar K.V, <aneesh.kumar@digital.com>
@@ -19,6 +19,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "check_ci.h"
@@ -174,17 +176,21 @@ ci_check_thread(thread * thread)
 
        switch (status) {
        case UP:
-               if (!ISALIVE(checker->rs)) {
+               if (!svr_checker_up(checker->id, checker->rs)) {
                        smtp_alert(thread->master, checker->rs, NULL, NULL, "UP",
                                   "=> CI-Linux  CHECK succeed on service <=");
-                       perform_svr_state(UP, checker->vs, checker->rs);
+                       update_svr_checker_state(UP, checker->id
+                                                  , checker->vs
+                                                  , checker->rs);
                }
                break;
        case DOWN:
-               if (ISALIVE(checker->rs)) {
+               if (svr_checker_up(checker->id, checker->rs)) {
                        smtp_alert(thread->master, checker->rs, NULL, NULL, "DOWN",
                                   "=> CI-Linux CHECK failed on service <=");
-                       perform_svr_state(DOWN, checker->vs, checker->rs);
+                       update_svr_checker_state(DOWN, checker->id
+                                                    , checker->vs
+                                                    , checker->rs);
                }
                break;
        default:
index 63fa800..2abf68a 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Healthcheckrs child process handling.
  *
- * Version:     $Id: check_daemon.c,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: check_daemon.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "check_daemon.h"
@@ -76,7 +78,9 @@ stop_check(void)
        /* Clean data */
        free_global_data(data);
        free_check_data(check_data);
+#ifdef _WITH_VRRP_
        free_interface_queue();
+#endif
 
 #ifdef _DEBUG_
        keepalived_free_final("Healthcheck child process");
@@ -99,8 +103,10 @@ start_check(void)
 {
        /* Initialize sub-system */
        init_checkers_queue();
+#ifdef _WITH_VRRP_
        init_interface_queue();
        kernel_netlink_init();
+#endif
 
        /* Parse configuration file */
        data = alloc_global_data();
@@ -136,6 +142,9 @@ start_check(void)
                dump_check_data(check_data);
        }
 
+       /* Register healthcheckers software watchdog */
+       check_wdog_sd = wdog_init(WDOG_CHECK);
+
        /* Register checkers thread */
        register_checkers_thread();
 }
@@ -154,6 +163,9 @@ reload_check_thread(thread * thread)
        free_checkers_queue();
        free_ssl();
 
+       /* free watchdog sd */
+       wdog_close(check_wdog_sd, WDOG_CHECK);
+
        /* Save previous conf data */
        old_check_data = check_data;
        check_data = NULL;
@@ -182,7 +194,8 @@ void
 sigend_check(int sig)
 {
        syslog(LOG_INFO, "Terminating Healthchecker child process on signal");
-       thread_add_terminate_event(master);
+       if (master)
+               thread_add_terminate_event(master);
 }
 
 /* VRRP Child signal handling */
@@ -252,9 +265,6 @@ start_check_child(void)
        /* Start Healthcheck daemon */
        start_check();
 
-       /* Register healthcheckers software watchdog */
-       check_wdog_sd = wdog_init(WDOG_CHECK);
-
        /* Launch the scheduling I/O multiplexer */
        launch_scheduler();
 
index 1ac6589..35d60a4 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Healthcheckers dynamic data structure definition.
  *
- * Version:     $Id: check_data.c,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: check_data.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "check_data.h"
@@ -265,6 +267,7 @@ free_rs(void *data)
        real_server *rs = data;
        FREE_PTR(rs->notify_up);
        FREE_PTR(rs->notify_down);
+       free_list(rs->failed_checkers);
        FREE(rs);
 }
 static void
@@ -285,6 +288,12 @@ dump_rs(void *data)
                       rs->notify_down);
 }
 
+static void
+free_failed_checkers(void *data)
+{
+       FREE(data);
+}
+
 void
 alloc_rs(char *ip, char *port)
 {
@@ -296,6 +305,7 @@ alloc_rs(char *ip, char *port)
        inet_ston(ip, &new->addr_ip);
        new->addr_port = htons(atoi(port));
        new->weight = 1;
+       new->failed_checkers = alloc_list(free_failed_checkers, NULL);
 
        if (LIST_ISEMPTY(vs->rs))
                vs->rs = alloc_list(free_rs, dump_rs);
index ca5fbe0..e13dc68 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        WEB CHECK. Common HTTP/SSL checker primitives.
  *
- * Version:     $Id: check_http.c,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: check_http.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
@@ -19,6 +19,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include <openssl/err.h>
@@ -78,6 +80,9 @@ dump_http_get_check(void *data)
        if (http_get_chk->connection_port)
                syslog(LOG_INFO, "   Connection port = %d",
                       ntohs(http_get_chk->connection_port));
+       if (http_get_chk->bindto)
+               syslog(LOG_INFO, "   Bind to = %s",
+                      inet_ntop2(http_get_chk->bindto));
        syslog(LOG_INFO, "   Connection timeout = %d",
               http_get_chk->connection_to);
        syslog(LOG_INFO, "   Nb get retry = %d", http_get_chk->nb_get_retry);
@@ -120,6 +125,13 @@ connect_p_handler(vector strvec)
 }
 
 void
+bindto_handler(vector strvec)
+{
+       http_get_checker *http_get_chk = CHECKER_GET();
+       inet_ston(VECTOR_SLOT(strvec, 1), &http_get_chk->bindto);
+}
+
+void
 connect_to_handler(vector strvec)
 {
        http_get_checker *http_get_chk = CHECKER_GET();
@@ -185,6 +197,7 @@ install_http_check_keyword(void)
        install_keyword("HTTP_GET", &http_get_handler);
        install_sublevel();
        install_keyword("connect_port", &connect_p_handler);
+       install_keyword("bindto", &bindto_handler);
        install_keyword("connect_timeout", &connect_to_handler);
        install_keyword("nb_get_retry", &nb_get_retry_handler);
        install_keyword("delay_before_retry", &delay_before_retry_handler);
@@ -204,6 +217,7 @@ install_ssl_check_keyword(void)
        install_keyword("SSL_GET", &http_get_handler);
        install_sublevel();
        install_keyword("connect_port", &connect_p_handler);
+       install_keyword("bindto", &bindto_handler);
        install_keyword("connect_timeout", &connect_to_handler);
        install_keyword("nb_get_retry", &nb_get_retry_handler);
        install_keyword("delay_before_retry", &delay_before_retry_handler);
@@ -294,7 +308,7 @@ epilog(thread * thread, int method, int t, int c)
         * servers.
         */
        if (http_arg->retry_it > http_get_check->nb_get_retry-1) {
-               if (ISALIVE(checker->rs)) {
+               if (svr_checker_up(checker->id, checker->rs)) {
                        syslog(LOG_INFO, "Check on service [%s:%d] failed after %d retry."
                               , inet_ntop2(CHECKER_RIP(checker))
                               , ntohs(addr_port), http_arg->retry_it);
@@ -302,7 +316,9 @@ epilog(thread * thread, int method, int t, int c)
                                   "DOWN",
                                   "=> CHECK failed on service"
                                   " : MD5 digest mismatch <=");
-                       perform_svr_state(DOWN, checker->vs, checker->rs);
+                       update_svr_checker_state(DOWN, checker->id
+                                                    , checker->vs
+                                                    , checker->rs);
                }
 
                /* Reset it counters */
@@ -355,10 +371,12 @@ timeout_epilog(thread * thread, char *smtp_msg, char *debug_msg)
               , ntohs(addr_port));
 
        /* check if server is currently alive */
-       if (ISALIVE(checker->rs)) {
+       if (svr_checker_up(checker->id, checker->rs)) {
                smtp_alert(thread->master, checker->rs, NULL, NULL,
                           "DOWN", smtp_msg);
-               perform_svr_state(DOWN, checker->vs, checker->rs);
+               update_svr_checker_state(DOWN, checker->id
+                                            , checker->vs
+                                            , checker->rs);
        }
 
        return epilog(thread, 1, 0, 0);
@@ -397,7 +415,7 @@ http_handle_response(thread * thread, unsigned char digest[16]
        if (fetched_url->status_code) {
                if (req->status_code != fetched_url->status_code) {
                        /* check if server is currently alive */
-                       if (ISALIVE(checker->rs)) {
+                       if (svr_checker_up(checker->id, checker->rs)) {
                                syslog(LOG_INFO,
                                       "HTTP status code error to [%s:%d] url(%s)"
                                       ", status_code [%d].",
@@ -408,7 +426,9 @@ http_handle_response(thread * thread, unsigned char digest[16]
                                           "DOWN",
                                           "=> CHECK failed on service"
                                           " : HTTP status code mismatch <=");
-                               perform_svr_state(DOWN, checker->vs, checker->rs);
+                               update_svr_checker_state(DOWN, checker->id
+                                                            , checker->vs
+                                                            , checker->rs);
                        } else {
                                DBG("HTTP Status_code to [%s:%d] url(%d) = [%d].",
                                    inet_ntop2(CHECKER_RIP(checker))
@@ -423,7 +443,7 @@ http_handle_response(thread * thread, unsigned char digest[16]
                        }
                        return epilog(thread, 2, 0, 1);
                } else {
-                       if (!ISALIVE(checker->rs))
+                       if (!svr_checker_up(checker->id, checker->rs))
                                syslog(LOG_INFO,
                                       "HTTP status code success to [%s:%d] url(%d).",
                                       inet_ntop2(CHECKER_RIP(checker))
@@ -444,7 +464,7 @@ http_handle_response(thread * thread, unsigned char digest[16]
 
                if (r) {
                        /* check if server is currently alive */
-                       if (ISALIVE(checker->rs)) {
+                       if (svr_checker_up(checker->id, checker->rs)) {
                                syslog(LOG_INFO,
                                       "MD5 digest error to [%s:%d] url[%s]"
                                       ", MD5SUM [%s].",
@@ -466,7 +486,7 @@ http_handle_response(thread * thread, unsigned char digest[16]
                        FREE(digest_tmp);
                        return epilog(thread, 2, 0, 1);
                } else {
-                       if (!ISALIVE(checker->rs))
+                       if (!svr_checker_up(checker->id, checker->rs))
                                syslog(LOG_INFO, "MD5 digest success to [%s:%d] url(%d).",
                                       inet_ntop2(CHECKER_RIP(checker))
                                       , ntohs(addr_port)
@@ -541,7 +561,7 @@ http_read_thread(thread * thread)
 
                if (r == -1) {
                        /* We have encourred a real read error */
-                       if (ISALIVE(checker->rs)) {
+                       if (svr_checker_up(checker->id, checker->rs)) {
                                syslog(LOG_INFO, "Read error with server [%s:%d]: %s",
                                       inet_ntop2(CHECKER_RIP(checker))
                                       , ntohs(addr_port)
@@ -550,8 +570,9 @@ http_read_thread(thread * thread)
                                           "DOWN",
                                           "=> HTTP CHECK failed on service"
                                           " : cannot receive data <=");
-                               perform_svr_state(DOWN, checker->vs,
-                                                 checker->rs);
+                               update_svr_checker_state(DOWN, checker->id
+                                                            , checker->vs
+                                                            , checker->rs);
                        }
                        return epilog(thread, 1, 0, 0);
                }
@@ -660,12 +681,14 @@ http_request_thread(thread * thread)
                       , ntohs(addr_port));
 
                /* check if server is currently alive */
-               if (ISALIVE(checker->rs)) {
+               if (svr_checker_up(checker->id, checker->rs)) {
                        smtp_alert(thread->master, checker->rs, NULL, NULL,
                                   "DOWN",
                                   "=> CHECK failed on service"
                                   " : cannot send data <=");
-                       perform_svr_state(DOWN, checker->vs, checker->rs);
+                       update_svr_checker_state(DOWN, checker->id
+                                                    , checker->vs
+                                                    , checker->rs);
                }
                return epilog(thread, 1, 0, 0);
        }
@@ -695,7 +718,7 @@ http_check_thread(thread * thread)
        switch (status) {
        case connect_error:
                /* check if server is currently alive */
-               if (ISALIVE(checker->rs)) {
+               if (svr_checker_up(checker->id, checker->rs)) {
                        syslog(LOG_INFO, "Error connecting server [%s:%d].",
                               inet_ntop2(CHECKER_RIP(checker))
                               , ntohs(addr_port));
@@ -703,7 +726,9 @@ http_check_thread(thread * thread)
                                   "DOWN",
                                   "=> CHECK failed on service"
                                   " : connection error <=");
-                       perform_svr_state(DOWN, checker->vs, checker->rs);
+                       update_svr_checker_state(DOWN, checker->id
+                                                    , checker->vs
+                                                    , checker->rs);
                }
                return epilog(thread, 1, 0, 0);
                break;
@@ -779,13 +804,15 @@ http_connect_thread(thread * thread)
                 * Check completed.
                 * check if server is currently alive.
                 */
-               if (!ISALIVE(checker->rs)) {
+               if (!svr_checker_up(checker->id, checker->rs)) {
                        syslog(LOG_INFO, "Remote Web server [%s:%d] succeed on service.",
                               inet_ntop2(CHECKER_RIP(checker))
                               , ntohs(addr_port));
                        smtp_alert(thread->master, checker->rs, NULL, NULL, "UP",
                                   "=> CHECK succeed on service <=");
-                       perform_svr_state(UP, checker->vs, checker->rs);
+                       update_svr_checker_state(UP, checker->id
+                                                  , checker->vs
+                                                  , checker->rs);
                }
                http_arg->req = NULL;
                return epilog(thread, 1, 0, 0) + 1;
@@ -797,7 +824,8 @@ http_connect_thread(thread * thread)
                return 0;
        }
 
-       status = tcp_connect(fd, CHECKER_RIP(checker), addr_port);
+       status = tcp_bind_connect(fd, CHECKER_RIP(checker), addr_port
+                                 , http_get_check->bindto);
 
        /* handle tcp connection status & register check worker thread */
        tcp_connection_state(fd, status, thread, http_check_thread,
index 3f73435..a34d3e1 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.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: check_misc.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Eric Jarman, <ehj38230@cmsu2.cmsu.edu>
@@ -21,6 +21,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "check_misc.h"
@@ -182,14 +184,16 @@ misc_check_child_thread(thread * thread)
                pid = THREAD_CHILD_PID(thread);
 
                /* The child hasn't responded. Kill it off. */
-               if (ISALIVE(checker->rs)) {
+               if (svr_checker_up(checker->id, checker->rs)) {
                        syslog(LOG_INFO, "Misc check to [%s] for [%s] timed out",
                               inet_ntop2(CHECKER_RIP(checker)),
                               misc_chk->path);
                        smtp_alert(thread->master, checker->rs, NULL, NULL,
                                   "DOWN",
                                   "=> MISC CHECK script timeout on service <=");
-                       perform_svr_state(DOWN, checker->vs, checker->rs);
+                       update_svr_checker_state(DOWN, checker->id
+                                                    , checker->vs
+                                                    , checker->rs);
                }
 
                kill(pid, SIGTERM);
@@ -205,24 +209,28 @@ misc_check_child_thread(thread * thread)
                status = WEXITSTATUS(wait_status);
                if (status == 0) {
                        /* everything is good */
-                       if (!ISALIVE(checker->rs)) {
+                       if (!svr_checker_up(checker->id, checker->rs)) {
                                syslog(LOG_INFO, "Misc check to [%s] for [%s] success.",
                                       inet_ntop2(CHECKER_RIP(checker)),
                                       misc_chk->path);
                                smtp_alert(thread->master, checker->rs, NULL, NULL,
                                           "UP",
                                           "=> MISC CHECK succeed on service <=");
-                               perform_svr_state(UP, checker->vs, checker->rs);
+                               update_svr_checker_state(UP, checker->id
+                                                          , checker->vs
+                                                          , checker->rs);
                        }
                } else {
-                       if (ISALIVE(checker->rs)) {
+                       if (svr_checker_up(checker->id, checker->rs)) {
                                syslog(LOG_INFO, "Misc check to [%s] for [%s] failed.",
                                       inet_ntop2(CHECKER_RIP(checker)),
                                       misc_chk->path);
                                smtp_alert(thread->master, checker->rs, NULL, NULL,
                                           "DOWN",
                                           "=> MISC CHECK failed on service <=");
-                               perform_svr_state(DOWN, checker->vs, checker->rs);
+                               update_svr_checker_state(DOWN, checker->id
+                                                            , checker->vs
+                                                            , checker->rs);
                        }
                }
        }
index e30272e..7c0b923 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.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: check_parser.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -20,6 +20,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "check_parser.h"
index ef46640..0fbb5ee 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.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: check_ssl.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
@@ -21,6 +21,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include <openssl/err.h>
@@ -256,13 +258,14 @@ ssl_read_thread(thread * thread)
 
                if (r && !req->extracted) {
                        /* check if server is currently alive */
-                       if (ISALIVE(checker->rs)) {
+                       if (svr_checker_up(checker->id, checker->rs)) {
                                smtp_alert(thread->master, checker->rs, NULL, NULL,
                                           "DOWN",
                                           "=> SSL CHECK failed on service"
                                           " : cannot receive data <=\n\n");
-                               perform_svr_state(DOWN, checker->vs,
-                                                 checker->rs);
+                               update_svr_checker_state(DOWN, checker->id
+                                                            , checker->vs
+                                                            , checker->rs);
                        }
                        return epilog(thread, 1, 0, 0);
                }
index a503c3b..00df1a3 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        TCP checker.
  *
- * Version:     $Id: check_tcp.c,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: check_tcp.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "check_tcp.h"
@@ -50,6 +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));
        syslog(LOG_INFO, "   Connection timeout = %d", tcp_chk->connection_to);
 }
 
@@ -71,6 +75,13 @@ connect_port_handler(vector strvec)
 }
 
 void
+bind_handler(vector strvec)
+{
+       tcp_checker *tcp_chk = CHECKER_GET();
+       inet_ston(VECTOR_SLOT(strvec, 1), &tcp_chk->bindto);
+}
+
+void
 connect_timeout_handler(vector strvec)
 {
        tcp_checker *tcp_chk = CHECKER_GET();
@@ -83,6 +94,7 @@ install_tcp_check_keyword(void)
        install_keyword("TCP_CHECK", &tcp_check_handler);
        install_sublevel();
        install_keyword("connect_port", &connect_port_handler);
+       install_keyword("bindto", &bind_handler);
        install_keyword("connect_timeout", &connect_timeout_handler);
        install_sublevel_end();
 }
@@ -110,26 +122,30 @@ tcp_check_thread(thread * thread)
        if (status == connect_success) {
                close(thread->u.fd);
 
-               if (!ISALIVE(checker->rs)) {
+               if (!svr_checker_up(checker->id, checker->rs)) {
                        syslog(LOG_INFO, "TCP connection to [%s:%d] success.",
                               inet_ntop2(CHECKER_RIP(checker))
                               , ntohs(addr_port));
                        smtp_alert(thread->master, checker->rs, NULL, NULL,
                                   "UP",
                                   "=> TCP CHECK succeed on service <=");
-                       perform_svr_state(UP, checker->vs, checker->rs);
+                       update_svr_checker_state(UP, checker->id
+                                                  , checker->vs
+                                                  , checker->rs);
                }
 
        } else {
 
-               if (ISALIVE(checker->rs)) {
+               if (svr_checker_up(checker->id, checker->rs)) {
                        syslog(LOG_INFO, "TCP connection to [%s:%d] failed !!!",
                               inet_ntop2(CHECKER_RIP(checker))
                               , ntohs(addr_port));
                        smtp_alert(thread->master, checker->rs, NULL, NULL,
                                   "DOWN",
                                   "=> TCP CHECK failed on service <=");
-                       perform_svr_state(DOWN, checker->vs, checker->rs);
+                       update_svr_checker_state(DOWN, checker->id
+                                                    , checker->vs
+                                                    , checker->rs);
                }
 
        }
@@ -144,15 +160,12 @@ tcp_check_thread(thread * thread)
 int
 tcp_connect_thread(thread * thread)
 {
-       checker *checker;
-       tcp_checker *tcp_check;
+       checker *checker = THREAD_ARG(thread);
+       tcp_checker *tcp_check = CHECKER_ARG(checker);
        int fd;
        uint16_t addr_port;
        int status;
 
-       checker = THREAD_ARG(thread);
-       tcp_check = CHECKER_ARG(checker);
-
        /*
         * Register a new checker thread & return
         * if checker is disabled
@@ -171,7 +184,8 @@ tcp_connect_thread(thread * thread)
        addr_port = CHECKER_RPORT(checker);
        if (tcp_check->connection_port)
                addr_port = tcp_check->connection_port;
-       status = tcp_connect(fd, CHECKER_RIP(checker), addr_port);
+       status = tcp_bind_connect(fd, CHECKER_RIP(checker), addr_port
+                                 , tcp_check->bindto);
 
        /* handle tcp connection status & register check worker thread */
        tcp_connection_state(fd, status, thread, tcp_check_thread,
index c928199..8c44438 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.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: ipfwwrapper.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -20,6 +20,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "ipfwwrapper.h"
index 497b151..b8e27ed 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.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: ipvswrapper.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -19,6 +19,8 @@
  *               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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "ipvswrapper.h"
index 945cca6..c285975 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Manipulation functions for IPVS & IPFW wrappers.
  *
- * Version:     $id: ipwrapper.c,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $id: ipwrapper.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "ipwrapper.h"
 #include "ipvswrapper.h"
+#include "memory.h"
 #include "utils.h"
 #include "notify.h"
 
@@ -302,6 +305,59 @@ perform_svr_state(int alive, virtual_server * vs, real_server * rs)
        }
 }
 
+/* Test if realserver is marked UP for a specific checker */
+int
+svr_checker_up(checker_id_t cid, real_server *rs)
+{
+       element e;
+       list l = rs->failed_checkers;
+       checker_id_t *id;
+
+       /*
+        * We assume there is not too much checker per
+        * real server, so we consider this lookup as
+        * o(1).
+        */
+       for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) {
+               id = ELEMENT_DATA(e);
+               if (*id == cid)
+                       return 0;
+       }
+
+       return 1;
+}
+
+/* Update checker's state */
+void
+update_svr_checker_state(int alive, checker_id_t cid, virtual_server *vs, real_server *rs)
+{
+       element e;
+       list l = rs->failed_checkers;
+       checker_id_t *id;
+
+       /* Handle alive state */
+       for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) {
+               id = ELEMENT_DATA(e);
+               if (*id == cid) {
+                       if (alive) {
+                               free_list_element(l, e);
+                               if (LIST_SIZE(l) == 0)
+                                       perform_svr_state(alive, vs, rs);
+                       } 
+                       return;
+               }
+       }
+
+       /* Handle not alive state */
+       if (!alive) {
+               id = (checker_id_t *) MALLOC(sizeof(checker_id_t));
+               *id = cid;
+               list_add(l, id);
+               if (LIST_SIZE(l) == 1)
+                       perform_svr_state(alive, vs, rs);
+       }
+}
+
 /* Check if a vsg entry is in new data */
 static int
 vsge_exist(virtual_server_group_entry *vsg_entry, list l)
index 5bb1650..f478f80 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Main program structure.
  *
- * Version:     $Id: main.c,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: main.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include <syslog.h>
index 928db2f..c6d9549 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Dynamic data structure definition.
  *
- * Version:     $Id: global_data.c,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: global_data.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include <syslog.h>
+#include <unistd.h>
+#include <pwd.h>
 #include "global_data.h"
 #include "memory.h"
 #include "list.h"
 /* External vars */
 extern conf_data *data;
 
+/* Default settings */
+static void
+set_default_lvs_id(conf_data* conf_data)
+{
+       char *new_id = NULL;
+       int len = 0;
+
+       new_id = get_local_name();
+       if (!new_id || !new_id[0]) return;
+
+       len = strlen(new_id);
+       conf_data->lvs_id = MALLOC(len + 1);
+       if (!conf_data->lvs_id) return;
+
+       memcpy(conf_data->lvs_id, new_id, len);
+}
+
+static void
+set_default_email_from(conf_data* conf_data)
+{
+       struct passwd *pwd = NULL;
+       char* hostname = NULL;
+       int len = 0;
+
+       hostname = get_local_name();
+       if (!hostname || !hostname[0]) return;
+
+       pwd = getpwuid(getuid());
+       if (!pwd) return;
+
+       len = strlen(hostname) + strlen(pwd->pw_name) + 2;
+       conf_data->email_from = MALLOC(len);
+       if (!conf_data->email_from) return;
+       
+       snprintf(conf_data->email_from, len, "%s@%s", pwd->pw_name, hostname);
+}
+
+static void
+set_default_smtp_server(conf_data* conf_data)
+{
+       conf_data->smtp_server = htonl(DEFAULT_SMTP_SERVER);
+}
+
+static void
+set_default_smtp_connection_timeout(conf_data* conf_data)
+{
+       conf_data->smtp_connection_to = DEFAULT_SMTP_CONNECTION_TIMEOUT;
+}
+
+static void
+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_smtp_server(conf_data);
+       set_default_smtp_connection_timeout(conf_data);
+       set_default_email_from(conf_data);
+}
+
 /* email facility functions */
 static void
 free_email(void *data)
@@ -63,6 +127,7 @@ alloc_global_data(void)
        new = (conf_data *) MALLOC(sizeof (conf_data));
        new->email = alloc_list(free_email, dump_email);
 
+       set_default_values(new);
        return new;
 }
 
index f60c983..233cb55 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.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: global_parser.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -20,6 +20,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "global_parser.h"
@@ -36,11 +38,13 @@ extern conf_data *data;
 static void
 lvsid_handler(vector strvec)
 {
+       FREE_PTR(data->lvs_id);
        data->lvs_id = set_value(strvec);
 }
 static void
 emailfrom_handler(vector strvec)
 {
+       FREE_PTR(data->email_from);
        data->email_from = set_value(strvec);
 }
 static void
index 3351cf4..d8916ea 100644 (file)
@@ -6,7 +6,7 @@
  * Part:        Layer4 checkers handling. Register worker threads &
  *              upper layer checkers.
  *
- * Version:     $Id: layer4.c,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: layer4.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,6 +19,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "layer4.h"
 #include "utils.h"
 
 enum connect_result
-tcp_connect(int fd, uint32_t addr_ip, uint16_t addr_port)
+tcp_bind_connect(int fd, uint32_t addr_ip, uint16_t addr_port, uint32_t bind_ip)
 {
        struct linger li = { 0 };
        int long_inet;
-       struct sockaddr_in adr_serv;
+       struct sockaddr_in sin;
        int ret;
        int val;
 
@@ -40,18 +42,28 @@ tcp_connect(int fd, uint32_t addr_ip, uint16_t addr_port)
        setsockopt(fd, SOL_SOCKET, SO_LINGER, (char *) &li,
                   sizeof (struct linger));
 
-       long_inet = sizeof (struct sockaddr_in);
-       memset(&adr_serv, 0, long_inet);
-       adr_serv.sin_family = AF_INET;
-       adr_serv.sin_port = addr_port;
-       adr_serv.sin_addr.s_addr = addr_ip;
-
        /* Make socket non-block. */
        val = fcntl(fd, F_GETFL, 0);
        fcntl(fd, F_SETFL, val | O_NONBLOCK);
 
-       /* Call connect function. */
-       ret = connect(fd, (struct sockaddr *) &adr_serv, long_inet);
+       /* Bind socket */
+       long_inet = sizeof (struct sockaddr_in);
+       memset(&sin, 0, long_inet);
+
+       if (bind_ip) {
+               sin.sin_family = AF_INET;
+               sin.sin_addr.s_addr = bind_ip;
+               if (bind(fd, (struct sockaddr *) &sin, sizeof(sin)) != 0)
+                       return connect_error;
+       }
+
+       /* Set remote IP and connect */
+       memset(&sin, 0, long_inet);
+       sin.sin_family = AF_INET;
+       sin.sin_port = addr_port;
+       sin.sin_addr.s_addr = addr_ip;
+
+       ret = connect(fd, (struct sockaddr *) &sin, long_inet);
 
        /* Immediate success */
        if (ret == 0) {
@@ -71,6 +83,12 @@ tcp_connect(int fd, uint32_t addr_ip, uint16_t addr_port)
 }
 
 enum connect_result
+tcp_connect(int fd, uint32_t addr_ip, uint16_t addr_port)
+{
+       return tcp_bind_connect(fd, addr_ip, addr_port, 0);
+}
+
+enum connect_result
 tcp_socket_state(int fd, thread * thread, uint32_t addr_ip, uint16_t addr_port,
                 int (*func) (struct _thread *))
 {
index 9a45fa1..76730ce 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Main program structure.
  *
- * Version:     $Id: main.c,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: main.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "main.h"
index cd18c10..bdafb5e 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        pidfile utility.
  *
- * Version:     $Id: pidfile.c,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: pidfile.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "pidfile.h"
index 17a0386..fcad7cb 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.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: smtp.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -20,6 +20,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "smtp.h"
index 0b6d9e5..b00c135 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Checkers arguments structures definitions.
  *
- * Version:     $Id: check_api.h,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: check_api.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _CHECK_API_H
@@ -35,6 +37,7 @@ typedef struct _checker {
        virtual_server *vs;     /* pointer to the checker thread virtualserver */
        real_server *rs;        /* pointer to the checker thread realserver */
        void *data;
+       checker_id_t id;        /* Checker identifier */
        int enabled;            /* Activation flag */
 } checker;
 
index a4a2003..ec566eb 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_ci.c include file.
  *
- * Version:     $Id: check_ci.h,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: check_ci.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Aneesh Kumar K.V, <aneesh.kumar@digital.com>
@@ -19,6 +19,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _CI_LINUX_H
index 7ab59c2..ee1b6ba 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_daemon.c include file.
  * 
- * Version:     $Id: check_daemon.h,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: check_daemon.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _CHECK_DAEMON_H
index 939b328..d32ec86 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Healthcheckers dynamic data structure definition.
  *
- * Version:     $Id: check_data.h,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: check_data.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _CHECK_DATA_H
@@ -48,6 +50,9 @@
 #include "list.h"
 #include "vector.h"
 
+/* Typedefs */
+typedef unsigned int checker_id_t;
+
 /* Daemon dynamic data structure definition */
 #define MAX_TIMEOUT_LENGTH     5
 #define KEEPALIVED_DEFAULT_DELAY 60
@@ -76,6 +81,7 @@ typedef struct _real_server {
        char *notify_up;        /* Script to launch when RS is added to LVS */
        char *notify_down;      /* Script to launch when RS is removed from LVS */
        int alive;
+       list failed_checkers;   /* List of failed checkers */
        int set;                /* in the IPVS table */
 } real_server;
 
index 9627900..27947ce 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_http.c include file.
  *
- * Version:     $Id: check_http.h,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: check_http.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
@@ -19,6 +19,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _HTTP_H
@@ -64,6 +66,7 @@ typedef struct _url {
 typedef struct _http_get_checker {
        int proto;
        uint16_t connection_port;
+       uint32_t bindto;
        int connection_to;
        int nb_get_retry;
        int delay_before_retry;
index c969f1f..db96709 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_misc.c include file.
  *
- * Version:     $Id: check_misc.h,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: check_misc.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              Eric Jarman, <ehj38230@cmsu2.cmsu.edu>
@@ -19,6 +19,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _MISC_H
index f6b2211..f44dffd 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        check_parser.c include file.
  *  
- * Version:     $Id: check_parser.h,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: check_parser.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _CHECK_PARSER_H
index 7760f25..53f3b40 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_http.c include file.
  *
- * Version:     $Id: check_http.h,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: check_http.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
@@ -19,6 +19,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _SSL_H
index 826f957..420172b 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_tcp.c include file.
  *
- * Version:     $Id: check_tcp.h,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: check_tcp.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _TCP_H
@@ -34,6 +36,7 @@
 /* Checker argument structure  */
 typedef struct _tcp_checker {
        uint16_t connection_port;
+       uint32_t bindto;
        int connection_to;
 } tcp_checker;
 
index 1dd6822..65d5aec 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Daemon process handling.
  *
- * Version:     $Id: daemon.h,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: daemon.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _DAEMON_H
index 3e425a6..856f0e5 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Dynamic data structure definition.
  *
- * Version:     $Id: global_data.h,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: global_data.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _GLOBAL_DATA_H
 /* local includes */
 #include "list.h"
 
+/* constants */
+#define DEFAULT_SMTP_SERVER 0x7f000001
+#define DEFAULT_SMTP_CONNECTION_TIMEOUT 30
+
 /* email link list */
 typedef struct _email {
        char *addr;
index df38ca4..6e10f0f 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        vrrp_parser.c include file.
  *  
- * Version:     $Id: global_parser.h,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: global_parser.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _GLOBAL_PARSER_H
index 42dafc3..f54ff32 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        ipfwwrapper.c include file.
  *
- * Version:     $Id: ipfwwrapper.h,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: ipfwwrapper.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _IPFWWRAPPER_H
index c1b60a0..0f79fc9 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        ipvswrapper.c include file.
  *
- * Version:     $Id: ipvswrapper.h,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: ipvswrapper.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _IPVSWRAPPER_H
index a1696be..7205697 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        ipwrapper.c include file.
  *
- * Version:     $Id: ipwrapper.h,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: ipwrapper.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _IPWRAPPER_H
 
 /* prototypes */
 extern void perform_svr_state(int alive, 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);
 extern int init_services(void);
 extern int clear_services(void);
 extern int clear_diff_services(void);
index a3ced29..a3467a8 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        layer4.c include file.
  *
- * Version:     $Id: layer4.h,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: layer4.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _LAYER4_H
@@ -44,7 +46,10 @@ enum connect_result {
 
 /* Prototypes defs */
 extern enum connect_result
-tcp_connect(int fd, uint32_t, uint16_t);
+tcp_bind_connect(int, uint32_t, uint16_t, uint32_t);
+
+extern enum connect_result
+tcp_connect(int, uint32_t, uint16_t);
 
 extern enum connect_result
 tcp_socket_state(int, thread *, uint32_t, uint16_t,
index 63d9f25..fbe1cd3 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Main program include file.
  *
- * Version:     $Id: main.h,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: main.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _MAIN_H
@@ -53,8 +55,8 @@ conf_data *data;                      /* Global configuration data */
 /* Build version */
 #define PROG    "Keepalived"
 
-#define VERSION_CODE 0x010100
-#define DATE_CODE    0x180703
+#define VERSION_CODE 0x010102
+#define DATE_CODE    0x080903
 
 #define KEEPALIVED_VERSION(version)    \
        (version >> 16) & 0xFF,         \
index fd4a655..242565f 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        pidfile.c include file.
  *
- * Version:     $Id: pidfile.h,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: pidfile.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _PIDFILE_H
index f917f36..b8f860d 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        smtp.c include file.
  *
- * Version:     $Id: smtp.h,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: smtp.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _SMTP_H
index f5dadc3..bafc78a 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Part:        vrrp.c program include file.
  *
- * Version:     $Id: vrrp.h,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: vrrp.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,6 +19,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VRRP_H
@@ -81,6 +83,7 @@ typedef struct _vrrp_sgroup {
        char *script_backup;
        char *script_master;
        char *script_fault;
+       char *script;
        int smtp_alert;
 } vrrp_sgroup;
 
@@ -121,6 +124,7 @@ typedef struct _vrrp_rt {
        char *script_backup;
        char *script_master;
        char *script_fault;
+       char *script;
 
        /* rfc2336.6.2 */
        uint32_t ms_down_timer;
index a345c86..05e2f60 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_arp.c include file.
  *
- * Version:     $Id: vrrp_arp.h,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: vrrp_arp.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VRRP_ARP_H
index 57274d7..ad27fcc 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_daemon.c include file.
  * 
- * Version:     $Id: vrrp_daemon.h,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: vrrp_daemon.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VRRP_DAEMON_H
index 88e2aad..eb07473 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Dynamic data structure definition.
  *
- * Version:     $Id: vrrp_data.h,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: vrrp_data.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VRRP_DATA_H
@@ -56,6 +58,8 @@ extern void alloc_vrrp_track(vector strvec);
 extern void alloc_vrrp_vip(vector strvec);
 extern void alloc_vrrp_evip(vector strvec);
 extern void alloc_vrrp_vroute(vector strvec);
+extern void alloc_vrrp_buffer(void);
+extern void free_vrrp_buffer(void);
 extern vrrp_conf_data *alloc_vrrp_data(void);
 extern void free_vrrp_data(vrrp_conf_data * data);
 extern void dump_vrrp_data(vrrp_conf_data * data);
index dbbc3fb..37d57e7 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_if.c include file.
  *
- * Version:     $Id: vrrp_if.h,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: vrrp_if.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VRRP_IF_H
index 954120f..5314f87 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_index.c include file.
  *
- * Version:     $Id: vrrp_index.h,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: vrrp_index.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VRRP_INDEX_H
index 0ac2835..34c3c3e 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_ipaddress.c include file.
  *
- * Version:     $Id: vrrp_ipaddress.h,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: vrrp_ipaddress.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VRRP_IPADDR_H
index ee04442..a2c11c3 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_iproute.c include file.
  *
- * Version:     $Id: vrrp_iproute.h,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: vrrp_iproute.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VRRP_IPROUTE_H
index 6e1bf86..cb72042 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_ipsecah.c include file.
  * 
- * Version:     $Id: vrrp_ipsecah.h,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: vrrp_ipsecah.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VRRP_IPSEC_AH_H
@@ -50,7 +52,6 @@ typedef struct {              /* rfc2402.2 */
 
 typedef struct {               /* rfc2402.3.3.3.1.1.1 */
        u_int8_t tos;
-       u_int16_t id;
        u_int16_t frag_off;
        u_int16_t check;
 } ICV_mutable_fields;          /* We need to zero this fields to compute the ICV */
index b7c36b8..cef19b2 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_netlink.c include file.
  *
- * Version:     $Id: vrrp_netlink.h,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: vrrp_netlink.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VRRP_NETLINK_H
index 3c98586..b6844e4 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Part:        vrrp_notify.c include file.
  *
- * Version:     $Id: vrrp_notify.h,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: vrrp_notify.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -19,6 +19,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VRRP_NOTIFY_H
index b4e2e92..e6e4d83 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        vrrp_parser.c include file.
  *  
- * Version:     $Id: vrrp_parser.h,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: vrrp_parser.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VRRP_PARSER_H
index 95589a1..c0fdca2 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_scheduler.c include file.
  * 
- * Version:     $Id: vrrp_scheduler.h,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: vrrp_scheduler.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VRRP_SCHEDULER_H
index 2ee72d2..c921681 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_sync.c include file.
  * 
- * Version:     $Id: vrrp_sync.h,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: vrrp_sync.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VRRP_SYNC_H
index 0129ac5..4e59e73 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_track.c include file.
  *
- * Version:     $Id: vrrp_track.h,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: vrrp_track.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VRRP_TRACK_H
index bb7d33f..a0da6f0 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.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: vrrp.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -21,6 +21,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 /* local include */
@@ -149,13 +151,13 @@ vrrp_in_chk_ipsecah(vrrp_rt * vrrp, char *buffer)
         * sender counter.
         */
        vrrp->ipsecah_counter->seq_number++;
-       if (ah->seq_number >= vrrp->ipsecah_counter->seq_number || vrrp->sync) {
-               vrrp->ipsecah_counter->seq_number = ah->seq_number;
+       if (ntohl(ah->seq_number) >= vrrp->ipsecah_counter->seq_number || vrrp->sync) {
+               vrrp->ipsecah_counter->seq_number = ntohl(ah->seq_number);
        } else {
                syslog(LOG_INFO,
                       "VRRP_Instance(%s) IPSEC-AH : sequence number %d"
                       " already proceeded. Packet dropped. Local(%d)", vrrp->iname
-                      , ah->seq_number, vrrp->ipsecah_counter->seq_number);
+                      , ntohl(ah->seq_number), vrrp->ipsecah_counter->seq_number);
                return 1;
        }
 
@@ -167,7 +169,6 @@ vrrp_in_chk_ipsecah(vrrp_rt * vrrp, char *buffer)
 
        /* zero the ip mutable fields */
        ip->tos = 0;
-       ip->id = 0;
        ip->frag_off = 0;
        ip->check = 0;
        memcpy(backup_auth_data, ah->auth_data, sizeof (ah->auth_data));
@@ -390,13 +391,11 @@ vrrp_build_ipsecah(vrrp_rt * vrrp, char *buffer, int buflen)
 
        /* backup the ip mutable fields */
        ip_mutable_fields->tos = ip->tos;
-       ip_mutable_fields->id = ip->id;
        ip_mutable_fields->frag_off = ip->frag_off;
        ip_mutable_fields->check = ip->check;
 
        /* zero the ip mutable fields */
        ip->tos = 0;
-       ip->id = 0;
        ip->frag_off = 0;
        ip->check = 0;
 
@@ -432,7 +431,7 @@ vrrp_build_ipsecah(vrrp_rt * vrrp, char *buffer, int buflen)
                vrrp->ipsecah_counter->seq_number++;
        }
 
-       ah->seq_number = vrrp->ipsecah_counter->seq_number;
+       ah->seq_number = htonl(vrrp->ipsecah_counter->seq_number);
 
        /* Compute the ICV & trunc the digest to 96bits
           => No padding needed.
@@ -445,7 +444,6 @@ vrrp_build_ipsecah(vrrp_rt * vrrp, char *buffer, int buflen)
 
        /* Restore the ip mutable fields */
        ip->tos = ip_mutable_fields->tos;
-       ip->id = ip_mutable_fields->id;
        ip->frag_off = ip_mutable_fields->frag_off;
        ip->check = ip_mutable_fields->check;
 
@@ -840,7 +838,7 @@ vrrp_state_master_rx(vrrp_rt * vrrp, char *buf, int buflen)
                        syslog(LOG_INFO, "VRRP_Instance(%s) IPSEC-AH : Syncing seq_num"
                               " - Increment seq"
                               , vrrp->iname);
-                       vrrp->ipsecah_counter->seq_number = ah->seq_number + 1;
+                       vrrp->ipsecah_counter->seq_number = ntohl(ah->seq_number) + 1;
                        vrrp->ipsecah_counter->cycle = 0;
                }
                vrrp_send_adv(vrrp, vrrp->priority);
@@ -860,7 +858,7 @@ vrrp_state_master_rx(vrrp_rt * vrrp, char *buf, int buflen)
                        syslog(LOG_INFO, "VRRP_Instance(%s) IPSEC-AH : Syncing seq_num"
                               " - Decrement seq"
                               , vrrp->iname);
-                       vrrp->ipsecah_counter->seq_number = ah->seq_number - 1;
+                       vrrp->ipsecah_counter->seq_number = ntohl(ah->seq_number) - 1;
                        vrrp->ipsecah_counter->cycle = 0;
                }
                vrrp->ms_down_timer =
index e6452fd..899115c 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        ARP primitives.
  *
- * Version:     $Id: vrrp_arp.c,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: vrrp_arp.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 /* system includes */
@@ -57,7 +59,7 @@ static int send_arp(ip_address *ipaddress)
        /* Build the dst device */
        memset(&sll, 0, sizeof(sll));
        sll.sll_family = AF_PACKET;
-       strncpy(sll.sll_addr, IF_HWADDR(ipaddress->ifp), sizeof(sll.sll_addr));
+       memcpy(sll.sll_addr, IF_HWADDR(ipaddress->ifp), ETH_ALEN);
        sll.sll_halen = ETHERNET_HW_LEN;
        sll.sll_ifindex = IF_INDEX(ipaddress->ifp);
 
index 0083b72..e39b2da 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        VRRP child process handling.
  *
- * Version:     $Id: vrrp_daemon.c,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: vrrp_daemon.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "vrrp_daemon.h"
@@ -112,6 +114,7 @@ start_vrrp(void)
        /* Parse configuration file */
        data = alloc_global_data();
        vrrp_data = alloc_vrrp_data();
+       alloc_vrrp_buffer();
        init_data(conf_file, vrrp_init_keywords);
        if (!vrrp_data) {
                stop_vrrp();
@@ -143,6 +146,9 @@ start_vrrp(void)
                dump_vrrp_data(vrrp_data);
        }
 
+       /* Register vrrp software watchdog */
+       vrrp_wdog_sd = wdog_init(WDOG_VRRP);
+
        /* Init & start the VRRP packet dispatcher */
        thread_add_event(master, vrrp_dispatcher_init, NULL,
                         VRRP_DISPATCHER);
@@ -160,8 +166,12 @@ reload_vrrp_thread(thread * thread)
        master = thread_make_master();
        free_global_data(data);
        free_interface_queue();
+       free_vrrp_buffer();
        gratuitous_arp_close();
 
+       /* free watchdog sd */
+       wdog_close(vrrp_wdog_sd, WDOG_VRRP);
+
        /* Save previous conf data */
        old_vrrp_data = vrrp_data;
        vrrp_data = NULL;
@@ -190,7 +200,8 @@ void
 sigend_vrrp(int sig)
 {
        syslog(LOG_INFO, "Terminating VRRP child process on signal");
-       thread_add_terminate_event(master);
+       if (master)
+               thread_add_terminate_event(master);
 }
 
 /* VRRP Child signal handling */
@@ -261,9 +272,6 @@ start_vrrp_child(void)
        /* Start VRRP daemon */
        start_vrrp();
 
-       /* Register vrrp software watchdog */
-       vrrp_wdog_sd = wdog_init(WDOG_VRRP);
-
        /* Launch the scheduling I/O multiplexer */
        launch_scheduler();
 
index 9bd067d..aac721d 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Dynamic data structure definition.
  *
- * Version:     $Id: vrrp_data.c,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: vrrp_data.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "vrrp_data.h"
@@ -60,6 +62,7 @@ free_vgroup(void *data)
        FREE_PTR(vgroup->script_backup);
        FREE_PTR(vgroup->script_master);
        FREE_PTR(vgroup->script_fault);
+       FREE_PTR(vgroup->script);
        FREE(vgroup);
 }
 static void
@@ -84,6 +87,9 @@ dump_vgroup(void *data)
        if (vgroup->script_fault)
                syslog(LOG_INFO, "   Fault state transition script = %s",
                       vgroup->script_fault);
+       if (vgroup->script)
+               syslog(LOG_INFO, "   Generic state transition script = '%s'",
+                      vgroup->script);
        if (vgroup->smtp_alert)
                syslog(LOG_INFO, "   Using smtp notification");
 }
@@ -99,6 +105,7 @@ free_vrrp(void *data)
        FREE_PTR(vrrp->script_backup);
        FREE_PTR(vrrp->script_master);
        FREE_PTR(vrrp->script_fault);
+       FREE_PTR(vrrp->script);
        FREE(vrrp->ipsecah_counter);
        free_list(vrrp->track_ifp);
        free_list(vrrp->vip);
@@ -162,6 +169,9 @@ dump_vrrp(void *data)
        if (vrrp->script_fault)
                syslog(LOG_INFO, "   Fault state transition script = %s",
                       vrrp->script_fault);
+       if (vrrp->script)
+               syslog(LOG_INFO, "   Generic state transition script = '%s'",
+                      vrrp->script);
        if (vrrp->smtp_alert)
                syslog(LOG_INFO, "   Using smtp notification");
 }
@@ -245,6 +255,18 @@ alloc_vrrp_vroute(vector strvec)
 }
 
 /* data facility functions */
+void
+alloc_vrrp_buffer(void)
+{
+       vrrp_buffer = (char *) MALLOC(VRRP_PACKET_TEMP_LEN);
+}
+
+void
+free_vrrp_buffer(void)
+{
+       FREE(vrrp_buffer);
+}
+
 vrrp_conf_data *
 alloc_vrrp_data(void)
 {
@@ -255,7 +277,6 @@ alloc_vrrp_data(void)
        new->vrrp_index = alloc_mlist(NULL, NULL, 255);
        new->vrrp_index_fd = alloc_mlist(NULL, NULL, 1024+1);
        new->vrrp_sync_group = alloc_list(free_vgroup, dump_vgroup);
-       vrrp_buffer = (char *) MALLOC(VRRP_PACKET_TEMP_LEN);
 
        return new;
 }
@@ -270,7 +291,6 @@ free_vrrp_data(vrrp_conf_data * vrrp_data)
        free_list(vrrp_data->vrrp);
        free_list(vrrp_data->vrrp_sync_group);
        FREE(vrrp_data);
-       FREE(vrrp_buffer);
 }
 
 void
index 4f30a0d..dd45bf9 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Interfaces manipulation.
  *
- * Version:     $Id: vrrp_if.c,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: vrrp_if.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 /* global include */
@@ -183,7 +185,7 @@ if_mii_probe(const char *ifname)
 static int
 if_ethtool_status(const int fd)
 {
-#ifdef _KRNL_2_4_
+#ifdef ETHTOOL_GLINK
        struct ethtool_value edata;
        int err = 0;
 
index 865446e..7219e86 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        VRRP instance index table.
  *
- * Version:     $Id: vrrp_index.c,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: vrrp_index.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 /* local include */
index 28979ed..d632600 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        NETLINK IPv4 address manipulation.
  *
- * Version:     $Id: vrrp_ipaddress.c,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: vrrp_ipaddress.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 /* local include */
@@ -106,8 +108,13 @@ alloc_ipaddress(list ip_list, vector strvec, interface *ifp)
        int i = 0;
 
        new = (ip_address *) MALLOC(sizeof(ip_address));
-       new->ifp = ifp;
-       new->ifindex = IF_INDEX(ifp);
+       if (ifp) {
+               new->ifp = ifp;
+               new->ifindex = IF_INDEX(ifp);
+       } else {
+               new->ifp = if_get_by_ifname(DFLT_INT);
+               new->ifindex = IF_INDEX(new->ifp);
+       }
 
        /* FMT parse */
        while (i < VECTOR_SIZE(strvec)) {
@@ -127,13 +134,6 @@ alloc_ipaddress(list ip_list, vector strvec, interface *ifp)
                }
                i++;
        }
-
-       /* If index not set then use default interface index */
-       if (!ifp) {
-               new->ifp = ifp;
-               new->ifindex = IF_INDEX(if_get_by_ifname(DFLT_INT));
-       }
-
        list_add(ip_list, new);
 }
 
index 42444f5..7038044 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        NETLINK IPv4 routes manipulation.
  *
- * Version:     $Id: vrrp_iproute.c,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: vrrp_iproute.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 /* local include */
index a463735..ebbb2ab 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.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: vrrp_ipsecah.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -20,6 +20,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "vrrp_ipsecah.h"
index d2acc9f..23e255f 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        NETLINK kernel command channel.
  *
- * Version:     $Id: vrrp_netlink.c,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: vrrp_netlink.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 /* global include */
index d230aaf..c6d9776 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        VRRP state transition notification scripts handling.
  *
- * Version:     $Id: vrrp_notify.c,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: vrrp_notify.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 /* system include */
@@ -43,6 +45,12 @@ get_iscript(vrrp_rt * vrrp, int state)
 }
 
 static char *
+get_igscript(vrrp_rt * vrrp)
+{
+       return vrrp->script;
+}
+
+static char *
 get_gscript(vrrp_sgroup * vgroup, int state)
 {
        if (!vgroup->notify_exec)
@@ -57,6 +65,12 @@ get_gscript(vrrp_sgroup * vgroup, int state)
 }
 
 static char *
+get_ggscript(vrrp_sgroup * vgroup)
+{
+       return vgroup->script;
+}
+
+static char *
 notify_script_name(char *cmdline)
 {
        char *cp = cmdline;
@@ -76,44 +90,108 @@ notify_script_name(char *cmdline)
 }
 
 static int
-script_open(char *script)
+script_open_litteral(char *script)
 {
-       char *script_name = notify_script_name(script);
-       FILE *fOut;
-
-       fOut = fopen(script_name, "r");;
+       FILE *fOut = fopen(script, "r");;
        if (!fOut) {
-               syslog(LOG_INFO, "Can't open %s (errno %d %s)", script_name,
+               syslog(LOG_INFO, "Can't open %s (errno %d %s)", script,
                       errno, strerror(errno));
                return 0;
        }
-       FREE(script_name);
        fclose(fOut);
        return 1;
 }
 
-int
-notify_instance_exec(vrrp_rt * vrrp, int state)
+static int
+script_open(char *script)
 {
-       char *script = get_iscript(vrrp, state);
+       return script_open_litteral(notify_script_name(script));
+}
+
+static int
+notify_script_exec(char* script, char *type, int state_num, char* name)
+{
+       /*
+        * Determine the length of the buffer that we'll need to generate the command
+        * to run:
+        *
+        * "script" {GROUP|INSTANCE} "NAME" {MASTER|BACKUP|FAULT}
+        *
+        * Thus, the length of the buffer will be:
+        *
+        *     ( strlen(script) + 3 ) + ( strlen(type) + 1 ) + ( strlen(state) + 1 ) + ( strlen(name) + 2 ) + 1
+        *
+        * Which is:
+        *     - The length of the script plus two enclosing quotes plus adjacent space
+        *     - The length of the type string plus the adjacent space
+        *     - The length of the state string plus the adjacent space
+        *     - The length of the name of the instance or group, plus two enclosing
+        *       quotes (just in case)
+        *     - The null-terminator
+        *
+        * Which results in:
+        *
+        *     strlen(script) + strlen(type) + strlen(state) + strlen(name) + 8
+        */
 
-       if (!script || !script_open(script))
+       char *state = "{UNKNOWN}";
+       switch (state_num) {
+               case VRRP_STATE_MAST  : state = "MASTER" ; break;
+               case VRRP_STATE_BACK  : state = "BACKUP" ; break;
+               case VRRP_STATE_FAULT : state = "FAULT" ; break;
+       }
+
+       int size = (strlen(script) + strlen(type) + strlen(state) + strlen(name) + 8);
+       char *command_line = MALLOC(size);
+       if (!command_line)
                return 0;
 
        /* Launch the script */
-       notify_exec(script);
+       notify_exec(command_line);
+       FREE(command_line);
        return 1;
 }
 
 int
+notify_instance_exec(vrrp_rt * vrrp, int state)
+{
+       char *script = get_iscript(vrrp, state);
+       char *gscript = get_igscript(vrrp);
+       int ret = 0;
+
+       /* Launch the notify_* script */
+       if (script && script_open(script)) {
+               notify_exec(script);
+               ret = 1;
+       }
+
+       /* Launch the generic notify script */
+       if (gscript && script_open_litteral(gscript)) {
+               notify_script_exec(gscript, "INSTANCE", state, vrrp->iname);
+               ret = 1;
+       }
+
+       return ret;
+}
+
+int
 notify_group_exec(vrrp_sgroup * vgroup, int state)
 {
        char *script = get_gscript(vgroup, state);
+       char *gscript = get_ggscript(vgroup);
+       int ret = 0;
 
-       if (!script || !script_open(script))
-               return 0;
+       /* Launch the notify_* script */
+       if (script && script_open(script)) {
+               notify_exec(script);
+               ret = 1;
+       }
 
-       /* Launch the script */
-       notify_exec(script);
-       return 1;
+       /* Launch the generic notify script */
+       if (gscript && script_open_litteral(gscript)) {
+               notify_script_exec(gscript, "GROUP", state, vgroup->gname);
+               ret = 1;
+       }
+
+       return ret;
 }
index dc6fff4..1b7b1ba 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.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: vrrp_parser.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -20,6 +20,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "vrrp_parser.h"
@@ -85,6 +87,13 @@ vrrp_gnotify_fault_handler(vector strvec)
        vgroup->notify_exec = 1;
 }
 static void
+vrrp_gnotify_handler(vector strvec)
+{
+       vrrp_sgroup *vgroup = LIST_TAIL_DATA(vrrp_data->vrrp_sync_group);
+       vgroup->script = set_value(strvec);
+       vgroup->notify_exec = 1;
+}
+static void
 vrrp_gsmtp_handler(vector strvec)
 {
        vrrp_sgroup *vgroup = LIST_TAIL_DATA(vrrp_data->vrrp_sync_group);
@@ -211,6 +220,13 @@ vrrp_notify_fault_handler(vector strvec)
        vrrp->notify_exec = 1;
 }
 static void
+vrrp_notify_handler(vector strvec)
+{
+       vrrp_rt *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
+       vrrp->script = set_value(strvec);
+       vrrp->notify_exec = 1;
+}
+static void
 vrrp_smtp_handler(vector strvec)
 {
        vrrp_rt *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
@@ -318,6 +334,7 @@ vrrp_init_keywords(void)
        install_keyword("notify_backup", &vrrp_gnotify_backup_handler);
        install_keyword("notify_master", &vrrp_gnotify_master_handler);
        install_keyword("notify_fault", &vrrp_gnotify_fault_handler);
+       install_keyword("notify", &vrrp_gnotify_handler);
        install_keyword("smtp_alert", &vrrp_gsmtp_handler);
        install_keyword_root("vrrp_instance", &vrrp_handler);
        install_keyword("state", &vrrp_state_handler);
@@ -335,6 +352,7 @@ vrrp_init_keywords(void)
        install_keyword("notify_backup", &vrrp_notify_backup_handler);
        install_keyword("notify_master", &vrrp_notify_master_handler);
        install_keyword("notify_fault", &vrrp_notify_fault_handler);
+       install_keyword("notify", &vrrp_notify_handler);
        install_keyword("smtp_alert", &vrrp_smtp_handler);
        install_keyword("lvs_sync_daemon_interface", &vrrp_lvs_syncd_handler);
        install_keyword("garp_master_delay", &vrrp_garp_delay_handler);
index 3207369..224bfc2 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Sheduling framework for vrrp code.
  *
- * Version:     $Id: vrrp_scheduler.c,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: vrrp_scheduler.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "vrrp_scheduler.h"
index a51b034..6ed798b 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        VRRP synchronization framework.
  *
- * Version:     $Id: vrrp_sync.c,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: vrrp_sync.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "vrrp_sync.h"
index 69a38d6..9925944 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Interface tracking framework.
  *
- * Version:     $Id: vrrp_track.c,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: vrrp_track.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 /* local include */
index 52cef00..b157def 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        HTML stream parser utility functions.
  *
- * Version:     $Id: html.c,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: html.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include <string.h>
index ec32fdb..f28827d 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        parser.c include file.
  *
- * Version:     $Id: html.h,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: html.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _HTML_H
index 5afecb6..662ad98 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        List structure manipulation.
  *  
- * Version:     $Id: list.c,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: list.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "list.h"
@@ -126,6 +128,24 @@ free_list(list l)
        FREE(l);
 }
 
+void
+free_list_element(list l, element e)
+{
+       if (!e)
+               return;
+       if (l->head == e)
+               l->head = (e->next == e) ? NULL : e->next;
+       if (l->tail == e)
+               l->tail = (e->prev == e) ? NULL : e->prev;
+       if (e->prev)
+               e->prev->next = e->next;
+       if (e->next)
+               e->next->prev = e->prev;
+       if (l->free)
+               (*l->free) (e->data);
+       l->count--;
+       FREE(e);
+}
 
 /* Multiple list helpers functions */
 list
index 9aa9af0..a3a579e 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        list.c include file.
  *  
- * Version:     $Id: list.h,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: list.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _LIST_H
@@ -52,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_element(list l, element e);
 extern void *list_element(list l, int num);
 extern void dump_list(list l);
 extern void list_add(list l, void *data);
index 1c1efdd..18ed880 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.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: memory.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
@@ -20,6 +20,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "memory.h"
@@ -49,6 +51,7 @@ xfree(void *p)
 {
        mem_allocated -= sizeof (p);
        free(p);
+       p = NULL;
 }
 
 /* KeepAlived memory management. in debug mode,
index e5b82a4..606a183 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        memory.c include file.
  *
- * Version:     $Id: memory.h,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: memory.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
@@ -19,6 +19,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _MEMORY_H
index 80a09cf..7393cd7 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Forked system call to launch an extra script.
  *
- * Version:     $Id: notify.c,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: notify.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include <unistd.h>
index 7c3fdd6..36c1945 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        notify.c include file.
  *
- * Version:     $Id: notify.h,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: notify.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _NOTIFY_H
index ae20844..25af2ed 100644 (file)
@@ -7,7 +7,7 @@
  *              data structure representation the conf file representing
  *              the loadbalanced server pool.
  *  
- * Version:     $Id: parser.c,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: parser.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -20,6 +20,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "parser.h"
index 8dfe7de..9cd04ed 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        cfreader.c include file.
  *  
- * Version:     $Id: parser.h,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: parser.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _PARSER_H
index adcc104..d7c71e5 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.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: scheduler.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -20,6 +20,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include <signal.h>
index 583e4e9..7902046 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        scheduler.c include file.
  *
- * Version:     $Id: scheduler.h,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: scheduler.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _SCHEDULER_H
index b246a6d..ab0e609 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        Timer manipulations.
  *  
- * Version:     $Id: timer.c,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: timer.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include <stdio.h>
index 8232205..8397c27 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        timer.c include file.
  *  
- * Version:     $Id: timer.h,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: timer.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _TIMER_H
index 63368a7..2161465 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        General program utils.
  *
- * Version:     $Id: utils.c,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: utils.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "utils.h"
index e6848fe..92e0a34 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        utils.h include file.
  *
- * Version:     $Id: utils.h,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: utils.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _UTILS_H
index ac167c4..669b78f 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        Vector structure manipulation.
  *  
- * Version:     $Id: vector.c,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: vector.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include "vector.h"
index 8ce1c3f..d540da9 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        vector.c include file.
  *  
- * Version:     $Id: vector.h,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: vector.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _VECTOR_H
index 036429e..2f57ee4 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        Software watchdog framework.
  *  
- * Version:     $Id: watchdog.c,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: watchdog.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #include <unistd.h>
index de92cce..7e14f98 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        watchdog.c include file.
  *  
- * Version:     $Id: watchdog.h,v 1.1.1 2003/07/24 22:36:16 acassen Exp $
+ * Version:     $Id: watchdog.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -18,6 +18,8 @@
  *              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, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
  */
 
 #ifndef _WATCHDOG_H