keepalived-1.1.9 v1.1.9
authorAlexandre Cassen <acassen@freebox.fr>
Mon, 7 Feb 2005 02:31:20 +0000 (03:31 +0100)
committerAlexandre Cassen <acassen@freebox.fr>
Mon, 28 Sep 2009 08:59:00 +0000 (10:59 +0200)
* keepalived-1.1.9 released.
* VRRP : Chris Caputo, <ccaputo@alt.net> updated keepalived manpage
  for nopreempt and preempt_delay.
* VRRP : Fixed an issue while releasing vrrp socket pool... Just
  release pool one time !
* VRRP : Fixed netlink framework to properly save netlink socket flags
  while setting blocking flags.
* VRRP : Fixed a regression introduced with previous release while
  hashing vrrp fd bucket into fd hash index.
* Patrick Boutilier, <boutilpj@ednet.ns.ca> fixed an issue in the
  extract_html function. Read the full html header.
* Chris Caputo, <ccaputo@alt.net> and I fixed compilation issue
  while using --enable-debug configuration option.
* Extended both VRRP and Healthchecker framework to support
  debugging flags.
* Removed the watchdog framework. Since scheduling framework
  support child, we register a child thread for both process
  VRRP & Healthcheck. When child die or stop prematuraly this
  launch scheduling callback previously registered. Watchdog
  is now handled by signaling.
  (credit goes to Kevin Lindsay, <kevinl@netnation.com> for nice
  idea).
* Some cosmetics cleanup.

101 files changed:
ChangeLog
VERSION
debian/changelog
doc/man/man5/keepalived.conf.5
keepalived.spec.in
keepalived/Makefile.in
keepalived/check/Makefile.in
keepalived/check/check_api.c
keepalived/check/check_daemon.c
keepalived/check/check_data.c
keepalived/check/check_http.c
keepalived/check/check_misc.c
keepalived/check/check_parser.c
keepalived/check/check_smtp.c
keepalived/check/check_ssl.c
keepalived/check/check_tcp.c
keepalived/check/ipfwwrapper.c
keepalived/check/ipvswrapper.c
keepalived/check/ipwrapper.c
keepalived/core/Makefile.in
keepalived/core/daemon.c
keepalived/core/global_data.c
keepalived/core/global_parser.c
keepalived/core/layer4.c
keepalived/core/main.c
keepalived/core/pidfile.c
keepalived/core/smtp.c
keepalived/include/check_api.h
keepalived/include/check_daemon.h
keepalived/include/check_data.h
keepalived/include/check_http.h
keepalived/include/check_misc.h
keepalived/include/check_parser.h
keepalived/include/check_smtp.h
keepalived/include/check_ssl.h
keepalived/include/check_tcp.h
keepalived/include/config.h.in
keepalived/include/daemon.h
keepalived/include/global_data.h
keepalived/include/global_parser.h
keepalived/include/ipfwwrapper.h
keepalived/include/ipvswrapper.h
keepalived/include/ipwrapper.h
keepalived/include/layer4.h
keepalived/include/main.h
keepalived/include/pidfile.h
keepalived/include/smtp.h
keepalived/include/vrrp.h
keepalived/include/vrrp_arp.h
keepalived/include/vrrp_daemon.h
keepalived/include/vrrp_data.h
keepalived/include/vrrp_if.h
keepalived/include/vrrp_index.h
keepalived/include/vrrp_ipaddress.h
keepalived/include/vrrp_iproute.h
keepalived/include/vrrp_ipsecah.h
keepalived/include/vrrp_netlink.h
keepalived/include/vrrp_notify.h
keepalived/include/vrrp_parser.h
keepalived/include/vrrp_scheduler.h
keepalived/include/vrrp_sync.h
keepalived/include/vrrp_track.h
keepalived/libipvs-2.6/libipvs.c
keepalived/libipvs-2.6/libipvs.h
keepalived/vrrp/Makefile.in
keepalived/vrrp/vrrp.c
keepalived/vrrp/vrrp_arp.c
keepalived/vrrp/vrrp_daemon.c
keepalived/vrrp/vrrp_data.c
keepalived/vrrp/vrrp_if.c
keepalived/vrrp/vrrp_index.c
keepalived/vrrp/vrrp_ipaddress.c
keepalived/vrrp/vrrp_iproute.c
keepalived/vrrp/vrrp_ipsecah.c
keepalived/vrrp/vrrp_netlink.c
keepalived/vrrp/vrrp_notify.c
keepalived/vrrp/vrrp_parser.c
keepalived/vrrp/vrrp_scheduler.c
keepalived/vrrp/vrrp_sync.c
keepalived/vrrp/vrrp_track.c
lib/Makefile.in
lib/html.c
lib/html.h
lib/list.c
lib/list.h
lib/memory.c
lib/memory.h
lib/notify.c
lib/notify.h
lib/parser.c
lib/parser.h
lib/scheduler.c
lib/scheduler.h
lib/timer.c
lib/timer.h
lib/utils.c
lib/utils.h
lib/vector.c
lib/vector.h
lib/watchdog.c [deleted file]
lib/watchdog.h [deleted file]

index 36739cc..cccecca 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+2005-02-07  Alexandre Cassen  <acassen@linux-vs.org>
+       * keepalived-1.1.9 released.
+       * VRRP : Chris Caputo, <ccaputo@alt.net> updated keepalived manpage
+         for nopreempt and preempt_delay.
+       * VRRP : Fixed an issue while releasing vrrp socket pool... Just
+         release pool one time !
+       * VRRP : Fixed netlink framework to properly save netlink socket flags
+         while setting blocking flags.
+       * VRRP : Fixed a regression introduced with previous release while
+         hashing vrrp fd bucket into fd hash index.
+       * Patrick Boutilier, <boutilpj@ednet.ns.ca> fixed an issue in the
+         extract_html function. Read the full html header.
+       * Chris Caputo, <ccaputo@alt.net> and I fixed compilation issue
+         while using --enable-debug configuration option.
+       * Extended both VRRP and Healthchecker framework to support
+         debugging flags.
+       * Removed the watchdog framework. Since scheduling framework
+         support child, we register a child thread for both process
+         VRRP & Healthcheck. When child die or stop prematuraly this
+         launch scheduling callback previously registered. Watchdog
+         is now handled by signaling.
+         (credit goes to Kevin Lindsay, <kevinl@netnation.com> for nice
+         idea).
+       * Some cosmetics cleanup.
+
 2005-01-25  Alexandre Cassen  <acassen@linux-vs.org>
        * keepalived-1.1.8 released.
        * VRRP : Chris Caputo, <ccaputo@alt.net> added "dont_track_primary"
diff --git a/VERSION b/VERSION
index 18efdb9..512a1fa 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.1.8
+1.1.9
index 593b43b..11959a9 100644 (file)
@@ -1,3 +1,9 @@
+keepalived (1.1.9) unstable; urgency=low
+
+  * Cf ChangeLog
+
+ -- Alexandre Cassen <acassen@linux-vs.org>  Tue, 07 Feb 2005 03:17:15 +0200
+
 keepalived (1.1.8) unstable; urgency=low
 
   * Cf ChangeLog
index 79b3119..59a2d7a 100644 (file)
@@ -224,13 +224,23 @@ which will transition together on any state change.
         192.168.111.0/24 dev eth2\r
         192.168.112.0/24 via 192.168.100.254\r
     }\r
-    \r
-    #VRRP will normally preempt a backup when the\r
-    #original master comes back on line.\r
-    #nopreempt allows the backup to maintain the\r
-    #master role.\r
+\r
+    # VRRP will normally preempt a lower priority\r
+    # machine when a higher priority machine comes\r
+    # online.  "nopreempt" allows the lower priority\r
+    # machine to maintain the master role, even when\r
+    # a higher priority machine comes back online.\r
+    # NOTE: For this to work, the initial state of this\r
+    # entry must be BACKUP.\r
     nopreempt\r
 \r
+    # Seconds after startup until preemption\r
+    # (if not disabled by "nopreempt").\r
+    # Range: 0 (default) to 1,000\r
+    # NOTE: For this to work, the initial state of this\r
+    # entry must be BACKUP.\r
+    preempt_delay 300    # waits 5 minutes\r
+\r
     # Debug level, not implemented yet.\r
     debug\r
 \r
index 8919afb..a89bfc2 100644 (file)
@@ -18,6 +18,7 @@ rm -rf %{buildroot}
 %setup -q
 
 %build
+export CFLAGS=-D__KERNGLUE__
 ./configure --prefix=%{buildroot} --exec-prefix=%{buildroot} --sysconfdir=%{buildroot}/etc
 make
 
index fadd71d..1da241c 100644 (file)
@@ -56,7 +56,7 @@ debug:
        for i in $(SUBDIRS); do \
        $(MAKE) -C $$i || exit 1; done && \
        echo "Building $(BIN)/$(EXEC)" && \
-       $(CC) -o $(BIN)/$(EXEC) `find $(SUBDIRS) ../lib -name '*.[oa]'` $(LDFLAGS)
+       $(CC) -o $(BIN)/$(EXEC) `find $(SUBDIRS) ../lib -name '*.[oa]'` $(LDFLAGS) -ggdb
        @echo ""
        @echo "Make complete"
 
index 4b4ae40..5fd71c0 100644 (file)
@@ -38,7 +38,7 @@ check_daemon.o: check_daemon.c ../include/check_daemon.h \
   ../include/check_parser.h ../include/check_data.h ../include/check_api.h \
   ../include/global_data.h ../include/ipwrapper.h ../include/ipwrapper.h \
   ../include/pidfile.h ../include/daemon.h ../../lib/list.h ../../lib/memory.h \
-  ../../lib/parser.h ../../lib/watchdog.h ../include/vrrp_netlink.h \
+  ../../lib/parser.h ../include/vrrp_netlink.h \
   ../include/vrrp_if.h
 check_data.o: check_data.c ../include/check_data.h \
   ../include/check_api.h ../../lib/memory.h ../../lib/utils.h
index d44b05f..4b91ec9 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Checkers registration.
  *
- * Version:     $Id: check_api.c,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: check_api.c,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 0d02b32..d7fe036 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Healthcheckrs child process handling.
  *
- * Version:     $Id: check_daemon.c,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: check_daemon.c,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
 #include "main.h"
 #include "memory.h"
 #include "parser.h"
-#include "watchdog.h"
 #include "vrrp_netlink.h"
 #include "vrrp_if.h"
 
-/* Global vars */
-static int check_wdog_sd = -1;
-
-/* Healthchecker watchdog data */
-static wdog_data check_wdog_data = {
-       "Healthcheck Child",
-       WDOG_CHECK,
-       -1,
-       -1,
-       start_check_child
-};
-
 /* Daemon stop sequence */
 static void
 stop_check(void)
@@ -78,9 +65,6 @@ stop_check(void)
        keepalived_free_final("Healthcheck child process");
 #endif
 
-       /* free watchdog sd */
-       wdog_close(check_wdog_sd, WDOG_CHECK);
-
        /*
         * Reached when terminate signal catched.
         * finally return to parent process.
@@ -135,9 +119,6 @@ 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();
 }
@@ -157,9 +138,6 @@ reload_check_thread(thread * thread)
        free_ssl();
        ipvs_stop();
 
-       /* free watchdog sd */
-       wdog_close(check_wdog_sd, WDOG_CHECK);
-
        /* Save previous conf data */
        old_check_data = check_data;
        check_data = NULL;
@@ -179,7 +157,8 @@ reload_check_thread(thread * thread)
 void
 sighup_check(int sig)
 {
-       syslog(LOG_INFO, "Reloading Healthchecker child process on signal");
+       syslog(LOG_INFO, "Reloading Healthchecker child processi(%d) on signal",
+              checkers_child);
        thread_add_event(master, reload_check_thread, NULL, 0);
 }
 
@@ -203,6 +182,28 @@ check_signal_init(void)
        signal_noignore_sigchld();
 }
 
+/* CHECK Child respawning thread */
+int
+check_respawn_thread(thread * thread)
+{
+       pid_t pid;
+
+       /* Fetch thread args */
+       pid = THREAD_CHILD_PID(thread);
+
+       /* Restart respawning thread */
+       if (thread->type == THREAD_CHILD_TIMEOUT) {
+               thread_add_child(master, check_respawn_thread, NULL,
+                                pid, RESPAWN_TIMER);
+               return 0;
+       }
+
+       /* We catch a SIGCHLD, handle it */
+       syslog(LOG_INFO, "Healthcheck child process(%d) died: Respawning", pid);
+       start_check_child();
+       return 0;
+}
+
 /* Register CHECK thread */
 int
 start_check_child(void)
@@ -215,6 +216,7 @@ start_check_child(void)
                return -1;
        }
 
+#ifndef _DEBUG_
        /* Initialize child process */
        pid = fork();
 
@@ -223,14 +225,13 @@ start_check_child(void)
                               , strerror(errno));
                return -1;
        } else if (pid) {
-               long poll_delay = (wdog_delay_check) ? wdog_delay_check : WATCHDOG_DELAY;
                checkers_child = pid;
                syslog(LOG_INFO, "Starting Healthcheck child process, pid=%d"
                               , pid);
-               /* Connect child watchdog */
-               check_wdog_data.wdog_pid = pid;
-               thread_add_timer(master, wdog_boot_thread, &check_wdog_data,
-                                poll_delay);
+
+               /* Start respawning thread */
+               thread_add_child(master, check_respawn_thread, NULL,
+                                pid, RESPAWN_TIMER);
                return 0;
        }
 
@@ -248,14 +249,15 @@ start_check_child(void)
        thread_destroy_master(master);
        master = thread_make_master();
 
-       /* Signal handling initialization */
-       check_signal_init();
-
        /* change to / dir */
        chdir("/");
 
        /* Set mask */
        umask(0);
+#endif
+
+       /* Signal handling initialization */
+       check_signal_init();
 
        /* Start Healthcheck daemon */
        start_check();
index 0220c74..5419776 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Healthcheckers dynamic data structure definition.
  *
- * Version:     $Id: check_data.c,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: check_data.c,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 23bd46c..16148fb 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        WEB CHECK. Common HTTP/SSL checker primitives.
  *
- * Version:     $Id: check_http.c,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: check_http.c,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
index 0237a9e..bd512e2 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.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: check_misc.c,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Eric Jarman, <ehj38230@cmsu2.cmsu.edu>
index 3d1a6a8..e5e6f45 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.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: check_parser.c,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -85,6 +85,10 @@ lbalgo_handler(vector strvec)
        virtual_server *vs = LIST_TAIL_DATA(check_data->vs);
        char *str = VECTOR_SLOT(strvec, 1);
        int size = sizeof (vs->sched);
+       int str_len = strlen(str);
+
+       if (size > str_len)
+               size = str_len;
 
        memcpy(vs->sched, str, size);
 }
@@ -124,6 +128,10 @@ pto_handler(vector strvec)
        virtual_server *vs = LIST_TAIL_DATA(check_data->vs);
        char *str = VECTOR_SLOT(strvec, 1);
        int size = sizeof (vs->timeout_persistence);
+       int str_len = strlen(str);
+
+       if (size > str_len)
+               size = str_len;
 
        memcpy(vs->timeout_persistence, str, size);
 }
index d815f69..415a61a 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        SMTP CHECK. Check an SMTP-server.
  *
- * Version:     $Id: check_smtp.c,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: check_smtp.c,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jeremy Rumpf, <jrumpf@heavyload.net>
index 5627a5a..63450ff 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.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: check_ssl.c,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
index e5cde53..9477080 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        TCP checker.
  *
- * Version:     $Id: check_tcp.c,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: check_tcp.c,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index bb9cb2c..3548ceb 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.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: ipfwwrapper.c,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 17a5fd6..f5f47e2 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.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: ipvswrapper.c,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
index ec23a0e..22a05a7 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Manipulation functions for IPVS & IPFW wrappers.
  *
- * Version:     $id: ipwrapper.c,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: ipwrapper.c,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index c6b228e..c82f80a 100644 (file)
@@ -27,7 +27,7 @@ distclean: clean
        rm -f Makefile
 
 
-main.o: main.c ../include/main.h ../../lib/watchdog.h ../include/config.h
+main.o: main.c ../include/main.h ../include/config.h
 daemon.o: daemon.c ../include/daemon.h ../../lib/utils.h
 pidfile.o: pidfile.c ../include/pidfile.h
 layer4.o: layer4.c ../include/layer4.h ../include/check_api.h ../../lib/utils.h
index f37b62e..545a809 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Main program structure.
  *
- * Version:     $Id: main.c,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: main.c,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 0d524fa..0fa2f71 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Dynamic data structure definition.
  *
- * Version:     $Id: global_data.c,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: global_data.c,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 6043b57..71d2dcb 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.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: global_parser.c,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
index fe95722..cba278b 100644 (file)
@@ -6,7 +6,7 @@
  * Part:        Layer4 checkers handling. Register worker threads &
  *              upper layer checkers.
  *
- * Version:     $Id: layer4.c,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: layer4.c,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index b05fc25..19fb136 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Main program structure.
  *
- * Version:     $Id: main.c,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: main.c,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -23,7 +23,6 @@
  */
 
 #include "main.h"
-#include "watchdog.h"
 #include "config.h"
 
 /* global var */
@@ -31,8 +30,6 @@ char *conf_file = NULL;               /* Configuration file */
 int log_facility = LOG_DAEMON; /* Optional logging facilities */
 pid_t vrrp_child = -1;         /* VRRP child process ID */
 pid_t checkers_child = -1;     /* Healthcheckers child process ID */
-long wdog_delay_vrrp = 0;      /* VRRP child polling delay */
-long wdog_delay_check = 0;     /* Healthchecker child polling delay */
 int daemon_mode = 0;           /* VRRP/CHECK subsystem selection */
 int linkwatch = 0;             /* Use linkwatch kernel netlink reflection */
 
@@ -157,15 +154,13 @@ usage(const char *prog)
                "  %s --dont-fork          -n    Dont fork the daemon process.\n"
                "  %s --use-file           -f    Use the specified configuration file.\n"
                "                                Default is /etc/keepalived/keepalived.conf.\n"
-               "  %s --wdog-vrrp          -R    Define VRRP watchdog polling delay. (default=5s)\n"
-               "  %s --wdog-check         -H    Define checkers watchdog polling delay. (default=5s)\n"
                "  %s --dump-conf          -d    Dump the configuration data.\n"
                "  %s --log-console        -l    Log message to local console.\n"
                "  %s --log-detail         -D    Detailed log messages.\n"
                "  %s --log-facility       -S    0-7 Set syslog facility to LOG_LOCAL[0-7]. (default=LOG_DAEMON)\n"
                "  %s --help               -h    Display this short inlined help screen.\n"
                "  %s --version            -v    Display the version number\n",
-               prog, prog, prog, prog, prog, prog, prog, prog, prog, prog,
+               prog, prog, prog, prog, prog, prog, prog, prog,
                prog, prog, prog, prog);
 }
 
@@ -188,8 +183,6 @@ parse_cmdline(int argc, char **argv)
                {"dont-fork", 'n', POPT_ARG_NONE, NULL, 'n'},
                {"dump-conf", 'd', POPT_ARG_NONE, NULL, 'd'},
                {"use-file", 'f', POPT_ARG_STRING, &optarg, 'f'},
-               {"wdog-vrrp", 'R', POPT_ARG_STRING, &optarg, 'R'},
-               {"wdog-check", 'H', POPT_ARG_STRING, &optarg, 'H'},
                {"vrrp", 'P', POPT_ARG_NONE, NULL, 'P'},
                {"check", 'C', POPT_ARG_NONE, NULL, 'C'},
                {NULL, 0, 0, NULL, 0}
@@ -235,12 +228,6 @@ parse_cmdline(int argc, char **argv)
        case 'f':
                conf_file = optarg;
                break;
-       case 'R':
-               wdog_delay_vrrp = atoi(optarg) * TIMER_HZ;
-               break;
-       case 'H':
-               wdog_delay_check = atoi(optarg) * TIMER_HZ;
-               break;
        case 'P':
                daemon_mode |= 1;
                break;
@@ -276,12 +263,6 @@ parse_cmdline(int argc, char **argv)
                case 'f':
                        conf_file = optarg;
                        break;
-               case 'R':
-                       wdog_delay_vrrp = atoi(optarg) * TIMER_HZ;
-                       break;
-               case 'H':
-                       wdog_delay_check = atoi(optarg) * TIMER_HZ;
-                       break;
                case 'P':
                        daemon_mode |= 1;
                        break;
@@ -338,8 +319,10 @@ main(int argc, char **argv)
                        goto end;
        }
 
+#ifndef _DEBUG_
        /* Signal handling initialization  */
        signal_init();
+#endif
 
        /* Create the master thread */
        master = thread_make_master();
@@ -347,11 +330,13 @@ main(int argc, char **argv)
        /* Init daemon */
        start_keepalived();
 
+#ifndef _DEBUG_
        /* Launch the scheduling I/O multiplexer */
        launch_scheduler();
 
        /* Finish daemon process */
        stop_keepalived();
+#endif
 
        /*
         * Reached when terminate signal catched.
index cba1362..345b374 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        pidfile utility.
  *
- * Version:     $Id: pidfile.c,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: pidfile.c,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index c768892..50bf8fa 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.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: smtp.c,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index a55bb42..b71f6cc 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Checkers arguments structures definitions.
  *
- * Version:     $Id: check_api.h,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: check_api.h,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 8b04d7e..1a75b28 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_daemon.c include file.
  * 
- * Version:     $Id: check_daemon.h,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: check_daemon.h,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
index d1b60b5..3d6c04f 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Healthcheckers dynamic data structure definition.
  *
- * Version:     $Id: check_data.h,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: check_data.h,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 1ee8e78..90f1d3f 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_http.c include file.
  *
- * Version:     $Id: check_http.h,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: check_http.h,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
index caded65..e29687a 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_misc.c include file.
  *
- * Version:     $Id: check_misc.h,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: check_misc.h,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              Eric Jarman, <ehj38230@cmsu2.cmsu.edu>
index 3066eeb..635b4a2 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        check_parser.c include file.
  *  
- * Version:     $Id: check_parser.h,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: check_parser.h,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 5cd3495..0db2836 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_smtp.c include file.
  *
- * Version:     $Id: check_smtp.h,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: check_smtp.h,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              Jeremy Rumpf, <jrumpf@heavyload.net>
index 0f151ed..c5c5b5c 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_http.c include file.
  *
- * Version:     $Id: check_http.h,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: check_http.h,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
index 2732b0d..634e677 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_tcp.c include file.
  *
- * Version:     $Id: check_tcp.h,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: check_tcp.h,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index faa9808..2f705c8 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Configuration include file.
  *
- * Version:     $Id: config.h.in,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: config.h.in,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Jacob Rief, <jacob.rief@tiscover.com>
  *
index 1272077..2936c55 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Daemon process handling.
  *
- * Version:     $Id: daemon.h,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: daemon.h,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 23a3318..8c53c94 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Dynamic data structure definition.
  *
- * Version:     $Id: global_data.h,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: global_data.h,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 720df3a..c8d019c 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        vrrp_parser.c include file.
  *  
- * Version:     $Id: global_parser.h,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: global_parser.h,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 459cb59..dfded02 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        ipfwwrapper.c include file.
  *
- * Version:     $Id: ipfwwrapper.h,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: ipfwwrapper.h,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index a08247f..f7bc348 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        ipvswrapper.c include file.
  *
- * Version:     $Id: ipvswrapper.h,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: ipvswrapper.h,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 31f1f44..a02baa5 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        ipwrapper.c include file.
  *
- * Version:     $Id: ipwrapper.h,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: ipwrapper.h,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index dd48935..6481039 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        layer4.c include file.
  *
- * Version:     $Id: layer4.h,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: layer4.h,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 0b26c41..60decb5 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Main program include file.
  *
- * Version:     $Id: main.h,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: main.h,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -46,8 +46,6 @@ extern char *conf_file;               /* Configuration file */
 extern int log_facility;       /* Optional logging facilities */
 extern pid_t vrrp_child;       /* VRRP child process ID */
 extern pid_t checkers_child;   /* Healthcheckers child process ID */
-extern long wdog_delay_vrrp;   /* VRRP child polling delay */
-extern long wdog_delay_check;  /* Healthchecker child polling delay */
 extern int daemon_mode;                /* VRRP/CHECK subsystem selection */
 extern int linkwatch;          /* Use linkwatch kernel netlink reflection */
 
index 0df5287..42abdfd 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        pidfile.c include file.
  *
- * Version:     $Id: pidfile.h,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: pidfile.h,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 36dfd7e..7242f0b 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        smtp.c include file.
  *
- * Version:     $Id: smtp.h,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: smtp.h,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index c452aba..9e83e78 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Part:        vrrp.c program include file.
  *
- * Version:     $Id: vrrp.h,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: vrrp.h,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 2c3325b..db4324f 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_arp.c include file.
  *
- * Version:     $Id: vrrp_arp.h,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: vrrp_arp.h,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index a0a7725..e86567e 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_daemon.c include file.
  * 
- * Version:     $Id: vrrp_daemon.h,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: vrrp_daemon.h,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
index 7d0fb9c..40496f8 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Dynamic data structure definition.
  *
- * Version:     $Id: vrrp_data.h,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: vrrp_data.h,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
 #include "list.h"
 #include "vector.h"
 
+/*
+ * Our instance dispatcher use a socket pool.
+ * That way we handle VRRP protocol type per
+ * physical interface.
+ */
+typedef struct {
+       int ifindex;
+       int proto;
+       int fd_in;
+       int fd_out;
+} sock;
+
 /* Configuration data root */
 typedef struct _vrrp_conf_data {
        list static_addresses;
index 714d9a0..0af387b 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_if.c include file.
  *
- * Version:     $Id: vrrp_if.h,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: vrrp_if.h,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -88,9 +88,6 @@ typedef struct _interface {
                     if_linkbeat(X))
 #endif
 
-/* Global vars exported */
-extern list if_queue;
-
 /* prototypes */
 extern interface *if_get_by_ifindex(const int ifindex);
 extern interface *if_get_by_ifname(const char *ifname);
index 86ce0d4..0b14924 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_index.c include file.
  *
- * Version:     $Id: vrrp_index.h,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: vrrp_index.h,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 0270c91..7d6fc79 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_ipaddress.c include file.
  *
- * Version:     $Id: vrrp_ipaddress.h,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: vrrp_ipaddress.h,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index c207672..cb81186 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_iproute.c include file.
  *
- * Version:     $Id: vrrp_iproute.h,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: vrrp_iproute.h,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index c68c4fb..34dd4f6 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_ipsecah.c include file.
  * 
- * Version:     $Id: vrrp_ipsecah.h,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: vrrp_ipsecah.h,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
index ab94098..1851819 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_netlink.c include file.
  *
- * Version:     $Id: vrrp_netlink.h,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: vrrp_netlink.h,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index c8c435e..7142744 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Part:        vrrp_notify.c include file.
  *
- * Version:     $Id: vrrp_notify.h,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: vrrp_notify.h,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index af1eaa3..e990268 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        vrrp_parser.c include file.
  *  
- * Version:     $Id: vrrp_parser.h,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: vrrp_parser.h,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 8c2734f..596e1c2 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_scheduler.c include file.
  * 
- * Version:     $Id: vrrp_scheduler.h,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: vrrp_scheduler.h,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
 #include "scheduler.h"
 #include "vrrp_data.h"
 
-/*
- * Our instance dispatcher use a socket pool.
- * That way we handle VRRP protocol type per
- * physical interface.
- */
-typedef struct {
-       int ifindex;
-       int proto;
-       int fd_in;
-       int fd_out;
-} sock;
-
 /* VRRP FSM Macro */
 #define VRRP_FSM_READ_TO(V)                    \
 do {                                           \
index b8ef06a..5fd3228 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_sync.c include file.
  * 
- * Version:     $Id: vrrp_sync.h,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: vrrp_sync.h,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
index a464379..e49e2b0 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_track.c include file.
  *
- * Version:     $Id: vrrp_track.h,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: vrrp_track.h,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index fb0f038..14fed3d 100644 (file)
@@ -32,7 +32,6 @@ static int sockfd = -1;
 static void* ipvs_func = NULL;
 struct ip_vs_getinfo ipvs_info;
 
-
 int ipvs_init(void)
 {
        socklen_t len;
@@ -157,7 +156,6 @@ extern int ipvs_stop_daemon(ipvs_daemon_t *dm)
                          (char *)dm, sizeof(*dm));
 }
 
-
 struct ip_vs_get_services *ipvs_get_services(void)
 {
        struct ip_vs_get_services *get;
index 9ebdfb4..47182da 100644 (file)
@@ -86,7 +86,6 @@ extern int ipvs_start_daemon(ipvs_daemon_t *dm);
 /* stop a connection synchronizaiton daemon (master/backup) */
 extern int ipvs_stop_daemon(ipvs_daemon_t *dm);
 
-
 /* get all the ipvs services */
 extern struct ip_vs_get_services *ipvs_get_services(void);
 
index 3b1c4fd..8bef115 100644 (file)
@@ -32,7 +32,7 @@ vrrp_daemon.o: vrrp_daemon.c ../include/vrrp_daemon.h ../include/vrrp_scheduler.
   ../include/vrrp_if.h ../include/vrrp_arp.h ../include/vrrp_netlink.h ../include/vrrp_iproute.h \
   ../include/vrrp_iproute.h ../include/vrrp_parser.h ../include/vrrp_data.h \
   ../include/vrrp.h ../include/global_data.h ../include/pidfile.h ../include/daemon.h \
-  ../include/ipvswrapper.h ../../lib/list.h ../../lib/memory.h ../../lib/parser.h ../../lib/watchdog.h
+  ../include/ipvswrapper.h ../../lib/list.h ../../lib/memory.h ../../lib/parser.h
 vrrp_data.o: vrrp_data.c ../include/vrrp_data.h \
   ../include/vrrp_sync.h ../include/vrrp_index.h ../include/vrrp.h ../../lib/memory.h \
   ../../lib/utils.h
index 5129174..abf6107 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.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: vrrp.c,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -1000,9 +1000,16 @@ shutdown_vrrp_instances(void)
                        vrrp_restore_interface(vrrp, 1);
 
 #ifdef _HAVE_IPVS_SYNCD_
-               /* Stop stalled syncd */
+               /*
+                * Stop stalled syncd. IPVS syncd state is the
+                * same as VRRP instance one. We need here to
+                * stop stalled syncd thread according to last
+                * VRRP instance state.
+                */
                if (vrrp->lvs_syncd_if)
-                       ipvs_syncd_cmd(IPVS_STOPDAEMON, NULL, 0);
+                       ipvs_syncd_cmd(IPVS_STOPDAEMON, NULL,
+                                      (vrrp->state == VRRP_STATE_MAST) ? IPVS_MASTER:
+                                                                         IPVS_BACKUP);
 #endif
        }
 }
index 0ca5915..fda6bfc 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        ARP primitives.
  *
- * Version:     $Id: vrrp_arp.c,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: vrrp_arp.c,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 94d045a..864088f 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        VRRP child process handling.
  *
- * Version:     $Id: vrrp_daemon.c,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: vrrp_daemon.c,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
 #include "main.h"
 #include "memory.h"
 #include "parser.h"
-#include "watchdog.h"
-
-/* Global vars */
-static int vrrp_wdog_sd = -1;
-
-/* VRRP watchdog data */
-static wdog_data vrrp_wdog_data = {
-       "VRRP Child",
-       WDOG_VRRP,
-       -1,
-       -1,
-       start_vrrp_child
-};
 
 /* Daemon stop sequence */
 static void
@@ -77,7 +64,6 @@ stop_vrrp(void)
 
        /* Clean data */
        free_global_data(data);
-       vrrp_dispatcher_release(vrrp_data);
        free_vrrp_data(vrrp_data);
        free_vrrp_buffer();
 
@@ -90,9 +76,6 @@ stop_vrrp(void)
        keepalived_free_final("VRRP Child process");
 #endif
 
-       /* free watchdog sd */
-       wdog_close(vrrp_wdog_sd, WDOG_VRRP);
-
        /*
         * Reached when terminate signal catched.
         * finally return to parent process.
@@ -149,9 +132,6 @@ 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);
@@ -172,9 +152,6 @@ reload_vrrp_thread(thread * thread)
        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;
@@ -189,7 +166,6 @@ reload_vrrp_thread(thread * thread)
        start_vrrp();
 
        /* free backup data */
-       vrrp_dispatcher_release(old_vrrp_data);
        free_vrrp_data(old_vrrp_data);
        UNSET_RELOAD;
 
@@ -200,7 +176,8 @@ reload_vrrp_thread(thread * thread)
 void
 sighup_vrrp(int sig)
 {
-       syslog(LOG_INFO, "Reloading VRRP child process on signal");
+       syslog(LOG_INFO, "Reloading VRRP child process(%d) on signal",
+              vrrp_child);
        thread_add_event(master, reload_vrrp_thread, NULL, 0);
 }
 
@@ -224,11 +201,35 @@ vrrp_signal_init(void)
        signal_noignore_sigchld();
 }
 
+/* VRRP Child respawning thread */
+int
+vrrp_respawn_thread(thread * thread)
+{
+       pid_t pid;
+
+       /* Fetch thread args */
+       pid = THREAD_CHILD_PID(thread);
+
+       /* Restart respawning thread */
+       if (thread->type == THREAD_CHILD_TIMEOUT) {
+               thread_add_child(master, vrrp_respawn_thread, NULL,
+                                pid, RESPAWN_TIMER);
+               return 0;
+       }
+
+       /* We catch a SIGCHLD, handle it */
+       syslog(LOG_INFO, "VRRP child process(%d) died: Respawning", pid);
+       start_vrrp_child();
+       return 0;
+}
+
 /* Register VRRP thread */
 int
 start_vrrp_child(void)
 {
+#ifndef _DEBUG_
        pid_t pid;
+#endif
 
        /* Dont start if pid is already running */
        if (vrrp_running()) {
@@ -236,6 +237,7 @@ start_vrrp_child(void)
                return -1;
        }
 
+#ifndef _DEBUG_
        /* Initialize child process */
        pid = fork();
 
@@ -244,14 +246,13 @@ start_vrrp_child(void)
                               , strerror(errno));
                return -1;
        } else if (pid) {
-               long poll_delay = (wdog_delay_vrrp) ? wdog_delay_vrrp : WATCHDOG_DELAY;
                vrrp_child = pid;
                syslog(LOG_INFO, "Starting VRRP child process, pid=%d"
                               , pid);
-               /* Connect child watchdog */
-               vrrp_wdog_data.wdog_pid = pid;
-               thread_add_timer(master, wdog_boot_thread, &vrrp_wdog_data,
-                                poll_delay);
+
+               /* Start respawning thread */
+               thread_add_child(master, vrrp_respawn_thread, NULL,
+                                pid, RESPAWN_TIMER);
                return 0;
        }
 
@@ -270,14 +271,15 @@ start_vrrp_child(void)
        thread_destroy_master(master);
        master = thread_make_master();
 
-       /* Signal handling initialization */
-       vrrp_signal_init();
-
        /* change to / dir */
        chdir("/");
 
        /* Set mask */
        umask(0);
+#endif
+
+       /* Signal handling initialization */
+       vrrp_signal_init();
 
        /* Start VRRP daemon */
        start_vrrp();
index 6744f8a..77b7917 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Dynamic data structure definition.
  *
- * Version:     $Id: vrrp_data.c,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: vrrp_data.c,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -96,6 +96,28 @@ dump_vgroup(void *data)
                syslog(LOG_INFO, "   Using smtp notification");
 }
 
+/* Socket pool functions */
+void
+free_sock(void *data)
+{
+       sock *sock = data;
+       interface *ifp = if_get_by_ifindex(sock->ifindex);
+       if_leave_vrrp_group(sock->fd_in, ifp);
+       close(sock->fd_out);
+       FREE(data);
+}
+
+void
+dump_sock(void *data)
+{
+       sock *sock = data;
+       syslog(LOG_INFO, "VRRP sockpool: [ifindex(%d), proto(%d), fd(%d,%d)]",
+              sock->ifindex
+              , sock->proto
+              , sock->fd_in
+              , sock->fd_out);
+}
+
 static void
 free_vrrp(void *data)
 {
@@ -285,6 +307,7 @@ 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);
+       new->vrrp_socket_pool = alloc_list(free_sock, dump_sock);
 
        return new;
 }
index 497b861..85da6ad 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Interfaces manipulation.
  *
- * Version:     $Id: vrrp_if.c,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: vrrp_if.c,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -57,7 +57,7 @@ typedef __uint8_t u8;
 #include "utils.h"
 
 /* Global vars */
-list if_queue;
+static list if_queue;
 static struct ifreq ifr;
 
 /* Helper functions */
@@ -68,6 +68,9 @@ if_get_by_ifindex(const int ifindex)
        interface *ifp;
        element e;
 
+       if (LIST_ISEMPTY(if_queue))
+               return NULL;
+
        for (e = LIST_HEAD(if_queue); e; ELEMENT_NEXT(e)) {
                ifp = ELEMENT_DATA(e);
                if (ifp->ifindex == ifindex)
@@ -82,6 +85,9 @@ if_get_by_ifname(const char *ifname)
        interface *ifp;
        element e;
 
+       if (LIST_ISEMPTY(if_queue))
+               return NULL;
+
        for (e = LIST_HEAD(if_queue); e; ELEMENT_NEXT(e)) {
                ifp = ELEMENT_DATA(e);
                if (!strcmp(ifp->ifname, ifname))
@@ -421,7 +427,7 @@ if_leave_vrrp_group(int sd, interface *ifp)
        int ret = 0;
 
        /* If fd is -1 then we add a membership trouble */
-       if (sd < 0)
+       if (sd < 0 || !ifp)
                return;
 
        /* Leaving the VRRP multicast group */
index 45c4fe4..2a0df2a 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        VRRP instance index table.
  *
- * Version:     $Id: vrrp_index.c,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: vrrp_index.c,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -90,36 +90,13 @@ void set_vrrp_fd_bucket(int old_fd, vrrp_rt *vrrp)
 {
        vrrp_rt *vrrp_ptr;
        element e;
-       element next;
        list l = &vrrp_data->vrrp_index_fd[old_fd%1024 + 1];
 
-       for (e = LIST_HEAD(l); e; e = next) {
-               next = e->next;
+       for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) {
                vrrp_ptr =  ELEMENT_DATA(e);
-               if (vrrp_ptr->fd_in == old_fd) {
+               if (IF_INDEX(vrrp_ptr->ifp) == IF_INDEX(vrrp->ifp)) {
                        vrrp_ptr->fd_in = vrrp->fd_in;
                        vrrp_ptr->fd_out = vrrp->fd_out;
-
-                       /* Re-hash fd */
-                       alloc_vrrp_fd_bucket(vrrp_ptr);
-
-                       /* Release element */
-                       if (e->prev)
-                               e->prev->next = e->next;
-                       else
-                               l->head = e->next;
-
-                       if (e->next)
-                               e->next->prev = e->prev;
-                       else
-                               l->tail = e->prev;
-                       l->count--;
-                       FREE(e);
                }
        }
-
-       if (LIST_ISEMPTY(l)) {
-               l->head = NULL;
-               l->tail = NULL;
-       }
 }
index ec236c6..32f40e4 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        NETLINK IPv4 address manipulation.
  *
- * Version:     $Id: vrrp_ipaddress.c,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: vrrp_ipaddress.c,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 38890a3..a080061 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        NETLINK IPv4 routes manipulation.
  *
- * Version:     $Id: vrrp_iproute.c,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: vrrp_iproute.c,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 589c437..d3228f1 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.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: vrrp_ipsecah.c,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 310253a..4328b68 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        NETLINK kernel command channel.
  *
- * Version:     $Id: vrrp_netlink.c,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: vrrp_netlink.c,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -118,17 +118,13 @@ netlink_close(struct nl_handle *nl)
 int
 netlink_set_block(struct nl_handle *nl, int *flags)
 {
-       int ret;
-
-       ret = fcntl(nl->fd, F_GETFL, 0);
-       if (ret < 0) {
+       if ((*flags = fcntl(nl->fd, F_GETFL, 0)) < 0) {
                syslog(LOG_INFO, "Netlink: Cannot F_GETFL socket : (%s)",
                       strerror(errno));
                return -1;
        }
        *flags &= ~O_NONBLOCK;
-       ret = fcntl(nl->fd, F_SETFL, *flags);
-       if (ret < 0) {
+       if (fcntl(nl->fd, F_SETFL, *flags) < 0) {
                syslog(LOG_INFO, "Netlink: Cannot F_SETFL socket : (%s)",
                       strerror(errno));
                return -1;
@@ -140,11 +136,8 @@ netlink_set_block(struct nl_handle *nl, int *flags)
 int
 netlink_set_nonblock(struct nl_handle *nl, int *flags)
 {
-       int ret;
-
        *flags |= O_NONBLOCK;
-       ret = fcntl(nl->fd, F_SETFL, *flags);
-       if (ret < 0) {
+       if (fcntl(nl->fd, F_SETFL, *flags) < 0) {
                syslog(LOG_INFO, "Netlink: Cannot F_SETFL socket : (%s)",
                       strerror(errno));
                return -1;
index dfdffa8..6d99a5b 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        VRRP state transition notification scripts handling.
  *
- * Version:     $Id: vrrp_notify.c,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: vrrp_notify.c,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index a3e5bdc..72f1e0e 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.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: vrrp_parser.c,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
index ef0f076..e441e54 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Sheduling framework for vrrp code.
  *
- * Version:     $Id: vrrp_scheduler.c,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: vrrp_scheduler.c,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -336,28 +336,6 @@ already_exist_sock(list l, int ifindex, int proto)
        return 0;
 }
 
-/* sockpool list primitives */
-void
-free_sock(void *data)
-{
-       sock *sock = data;
-       interface *ifp = if_get_by_ifindex(sock->ifindex);
-       if_leave_vrrp_group(sock->fd_in, ifp);
-       close(sock->fd_out);
-       FREE(data);
-}
-
-void
-dump_sock(void *data)
-{
-       sock *sock = data;
-       syslog(LOG_INFO, "VRRP sockpool: [ifindex(%d), proto(%d), fd(%d,%d)]",
-              sock->ifindex
-              , sock->proto
-              , sock->fd_in
-              , sock->fd_out);
-}
-
 void
 alloc_sock(list l, int ifindex, int proto)
 {
@@ -458,9 +436,6 @@ vrrp_set_fds(list l)
 int
 vrrp_dispatcher_init(thread * thread)
 {
-       /* allocate the sockpool */
-       vrrp_data->vrrp_socket_pool = alloc_list(free_sock, dump_sock);
-
        /* create the VRRP socket pool list */
        vrrp_create_sockpool(vrrp_data->vrrp_socket_pool);
 
index a967f5b..9d3df18 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        VRRP synchronization framework.
  *
- * Version:     $Id: vrrp_sync.c,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: vrrp_sync.c,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index ca652bf..9ee0b23 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Interface tracking framework.
  *
- * Version:     $Id: vrrp_track.c,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: vrrp_track.c,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 4c3864a..4c42fd2 100644 (file)
@@ -12,7 +12,7 @@ DEFS   = @DFLAGS@
 COMPILE         = $(CC) $(CFLAGS) $(DEFS)
 
 OBJS =         memory.o utils.o notify.o timer.o scheduler.o \
-       vector.o list.o html.o parser.o watchdog.o
+       vector.o list.o html.o parser.o
 HEADERS = $(OBJS:.o=.h)
 
 .c.o:
@@ -26,7 +26,7 @@ clean:
 distclean: clean
        rm -f Makefile
 
-memory.o: memory.c memory.h
+memory.o: memory.c memory.h utils.h
 utils.o: utils.c utils.h
 notify.o: notify.c notify.h
 timer.o: timer.c timer.h
@@ -35,4 +35,3 @@ vector.o: vector.c vector.h memory.h
 list.o: list.c list.h memory.h
 html.o: html.c html.h memory.h
 parser.o: parser.c parser.h memory.h
-watchdog.o: watchdog.c watchdog.h scheduler.h memory.h parser.h
index 9ead08f..2f07e94 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        HTML stream parser utility functions.
  *
- * Version:     $Id: html.c,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: html.c,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -87,7 +87,7 @@ char *extract_html(char *buffer, int size_buffer)
        char *end = buffer + size_buffer;
        char *cur;
 
-       for (cur = buffer; cur + 4 < end; cur++)
+       for (cur = buffer; cur + 3 < end; cur++)
                if (*cur == '\r' && *(cur+1) == '\n'
                    && *(cur+2) == '\r' && *(cur+3) == '\n')
                        return cur + 4;
index 207536f..ed68254 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        parser.c include file.
  *
- * Version:     $Id: html.h,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: html.h,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *
index 3fddaae..2948c10 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        List structure manipulation.
  *  
- * Version:     $Id: list.c,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: list.c,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
index 3eb232b..09d03e8 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        list.c include file.
  *  
- * Version:     $Id: list.h,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: list.h,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 6909729..7f43352 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.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: memory.c,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
@@ -25,6 +25,7 @@
  */
 
 #include "memory.h"
+#include "utils.h"
 
 /* Global var */
 unsigned long mem_allocated;   /* Total memory used in Bytes */
@@ -77,7 +78,6 @@ xfree(void *p)
  */
 
 #ifdef _DEBUG_
-extern void dump_buffer(char *, int);
 
 typedef struct {
        int type;
@@ -96,7 +96,6 @@ static MEMCHECK alloc_list[MAX_ALLOC_LIST];
 static int number_alloc_list = 0;
 static int n = 0;              /* Alloc list pointer */
 static int f = 0;              /* Free list pointer */
-static int s = 0;              /* Indent counter */
 
 char *
 keepalived_malloc(unsigned long size, char *file, char *function, int line)
index 4a14c74..ff20f3f 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        memory.c include file.
  *
- * Version:     $Id: memory.h,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: memory.h,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
@@ -48,11 +48,11 @@ extern void xfree(void *p);
 #define MAX_ALLOC_LIST 2048
 
 #define MALLOC(n)    ( keepalived_malloc((n), \
-                      (__FILE__), (__FUNCTION__), (__LINE__)) )
+                      (__FILE__), (char *)(__FUNCTION__), (__LINE__)) )
 #define FREE(b)      ( keepalived_free((b), \
-                      (__FILE__), (__FUNCTION__), (__LINE__)) )
+                      (__FILE__), (char *)(__FUNCTION__), (__LINE__)) )
 #define REALLOC(b,n) ( keepalived_realloc((b), (n), \
-                      (__FILE__), (__FUNCTION__), (__LINE__)) )
+                      (__FILE__), (char *)(__FUNCTION__), (__LINE__)) )
 
 /* Memory debug prototypes defs */
 extern char *keepalived_malloc(unsigned long, char *, char *, int);
index 643b220..758177d 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Forked system call to launch an extra script.
  *
- * Version:     $Id: notify.c,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: notify.c,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 2fe8bdc..31dfb1b 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        notify.c include file.
  *
- * Version:     $Id: notify.h,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: notify.h,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 7140222..e966dde 100644 (file)
@@ -7,7 +7,7 @@
  *              data structure representation the conf file representing
  *              the loadbalanced server pool.
  *  
- * Version:     $Id: parser.c,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: parser.c,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -30,6 +30,7 @@
 /* global vars */
 vector keywords;
 FILE *stream;
+int reload = 0;
 
 /* local vars */
 static int sublevel = 0;
@@ -364,9 +365,10 @@ init_data(char *conf_file, vector (*init_keywords) (void))
        keywords = vector_alloc();
        (*init_keywords) ();
 
-/* Dump configuration */
+/* Dump configuration *
 vector_dump(keywords);
 dump_keywords(keywords, 0);
+*/
 
        /* Stream handling */
        process_stream(keywords);
index 8b35057..c60ed74 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        cfreader.c include file.
  *  
- * Version:     $Id: parser.h,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: parser.h,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -56,6 +56,7 @@ struct keyword {
 /* global vars exported */
 extern vector keywords;
 extern FILE *stream;
+extern int reload;
 
 /* Prototypes */
 extern void keyword_alloc(vector keywords, char *string, void (*handler) (vector));
index b184100..b249438 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.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: scheduler.c,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index ff50374..e06eeb4 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        scheduler.c include file.
  *
- * Version:     $Id: scheduler.h,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: scheduler.h,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -90,9 +90,9 @@ typedef struct _thread_master {
 #define THREAD_CHILD_TIMEOUT   9
 #define THREAD_TERMINATE       10
 
-
 /* MICRO SEC def */
 #define BOOTSTRAP_DELAY TIMER_HZ
+#define RESPAWN_TIMER  60*TIMER_HZ
 
 /* Macros. */
 #define THREAD_ARG(X) ((X)->arg)
index 4da9a6a..d29ca1c 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        Timer manipulations.
  *  
- * Version:     $Id: timer.c,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: timer.c,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
index 3853d75..0332a2c 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        timer.c include file.
  *  
- * Version:     $Id: timer.h,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: timer.h,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index b0e6588..76fa327 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        General program utils.
  *
- * Version:     $Id: utils.c,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: utils.c,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index bb6084f..410099e 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        utils.h include file.
  *
- * Version:     $Id: utils.h,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: utils.h,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 485171e..dfd1204 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        Vector structure manipulation.
  *  
- * Version:     $Id: vector.c,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: vector.c,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
index c0687f8..cccdbb6 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        vector.c include file.
  *  
- * Version:     $Id: vector.h,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
+ * Version:     $Id: vector.h,v 1.1.9 2005/02/07 03:18:31 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
diff --git a/lib/watchdog.c b/lib/watchdog.c
deleted file mode 100644 (file)
index c9f9f00..0000000
+++ /dev/null
@@ -1,301 +0,0 @@
-/* 
- * Soft:        Keepalived is a failover program for the LVS project
- *              <www.linuxvirtualserver.org>. It monitor & manipulate
- *              a loadbalanced server pool using multi-layer checks.
- * 
- * Part:        Software watchdog framework.
- *  
- * Version:     $Id: watchdog.c,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
- * 
- * Author:      Alexandre Cassen, <acassen@linux-vs.org>
- *              
- *              This program is distributed in the hope that it will be useful,
- *              but WITHOUT ANY WARRANTY; without even the implied warranty of
- *              MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *              See the GNU General Public License for more details.
- *
- *              This program is free software; you can redistribute it and/or
- *              modify it under the terms of the GNU General Public License
- *              as published by the Free Software Foundation; either version
- *              2 of the License, or (at your option) any later version.
- *
- * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
- */
-
-#include <unistd.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <syslog.h>
-#include <errno.h>
-#include <signal.h>
-#include "watchdog.h"
-#include "memory.h"
-#include "parser.h"
-
-/* global vars */
-int reload = 0;
-
-/* Watchdog connection reader */
-static int
-wdog_read(thread *thread)
-{
-       int sd;
-       int nbytes;
-       char *path;
-       unsigned char *buf;
-
-       sd = THREAD_FD(thread);
-       path = THREAD_ARG(thread);
-
-       /* Wait until read event */
-       if (thread->type == THREAD_READ_TIMEOUT) {
-               thread_add_read(master, wdog_read, path, sd,
-                               WATCHDOG_TIMER);
-               return 0;
-       }
-
-       /* Process incoming data */
-       buf = (char *) MALLOC(WDOG_READ_BUFSIZ);
-       nbytes = read(sd, buf, WDOG_READ_BUFSIZ);
-       if (nbytes <= 0) {
-               syslog(LOG_INFO, "Watchdog: Error reading to %s wdog socket",
-                      path);
-               FREE(buf);
-               return -1;
-       }
-
-       /* Register next thread */
-       thread_add_read(master, wdog_read, path, sd,
-                       WATCHDOG_TIMER);
-       FREE(buf);
-       return 0;
-}
-
-/* Watchdog connection acceptor */
-static int
-wdog_accept(thread *thread)
-{
-       struct sockaddr_un sock;
-       int sd, accept_sd;
-       int len;
-       char *path;
-
-       sd = THREAD_FD(thread);
-       path = THREAD_ARG(thread);
-
-       /* Wait until accept event */
-       if (thread->type == THREAD_READ_TIMEOUT) {
-               thread_add_read(master, wdog_accept, path, sd,
-                               WATCHDOG_TIMER);
-               return 0;
-       }
-
-       /* Set unix domain socket */
-       memset(&sock, 0, sizeof(struct sockaddr_un));
-       len = sizeof(struct sockaddr_un);
-
-       /* Accept incoming connection */
-       accept_sd = accept(sd, (struct sockaddr *) &sock, &len);
-       if (accept_sd < 0) {
-               syslog(LOG_INFO, "Watchdog: Error accepting on %s wdog socket: %s",
-                      path, strerror(errno));
-               return -1;
-       }
-
-       /* Register read thread */
-       thread_add_read(master, wdog_read, path, accept_sd,
-                       WATCHDOG_TIMER);
-       return 0;
-}
-
-/* Watchdog initialization */
-int
-wdog_init(char *path)
-{
-       struct sockaddr_un sock;
-       int sd, len, err;
-       mode_t old_mask;
-
-       /* Free stalled socket */
-       unlink(path);
-
-       /* Mask */
-       old_mask = umask(0077);
-
-       /* Simple welcome msg */
-       syslog(LOG_INFO, "Watchdog: Starting listener on %s wdog socket"
-                      , path);
-
-       /* Create unix domain socket */
-       sd = socket(AF_UNIX, SOCK_STREAM, 0);
-       if (sd < 0) {
-               syslog(LOG_INFO, "Watchdog: Error creating %s wdog socket",
-                      path);
-               return -1;
-       }
-
-       /* Create listening socket */
-       memset(&sock, 0, sizeof(struct sockaddr_un));
-       sock.sun_family = AF_UNIX;
-       strncpy(sock.sun_path, path, strlen(path));
-       len = sizeof(sock.sun_family) + strlen(path);
-       err = bind(sd, (struct sockaddr *) &sock, len);
-       if (err < 0) {
-               syslog(LOG_INFO, "Watchdog: Error binding %s wdog socket",
-                      path);
-               close(sd);
-               return -1;
-       }
-
-       /* Only parent process can connect child wdog listener */
-       err = listen(sd, 1);
-       if (err < 0) {
-               syslog(LOG_INFO, "Watchdog: Error listening %s wdog socket",
-                      path);
-               close(sd);
-               return -1;
-       }
-
-       /* Restore old mask */
-       umask(old_mask);
-
-       /* Register acceptor thread */
-       thread_add_read(master, wdog_accept, path, sd,
-                       WATCHDOG_TIMER);
-       return sd;
-}
-
-/* Close watchdog channel */
-void
-wdog_close(int sd, char *path)
-{
-       if (sd > 0) {
-               close(sd);
-               sd = -1;
-       }
-       if (path)
-               unlink(path);
-}
-
-/* Watchdog thread */
-static int
-wdog_thread(thread *thread)
-{
-       wdog_data *wdata = THREAD_ARG(thread);
-       int ret, status;
-
-       /* Refresh if reload */
-       if (reload)
-               goto reload;
-
-        /* Send watchdog string */
-       ret = (send(wdata->wdog_sd, WATCHDOG_STRING, strlen(WATCHDOG_STRING),
-                   MSG_NOSIGNAL) != -1) ? 1 : 0;
-
-       /* connection trouble */
-       if (!ret) {
-               syslog(LOG_INFO, "Watchdog: Error while sending data"
-                                " to %s. error=(%s)."
-                              , wdata->wdog_string, strerror(errno));
-
-               /* Test if pid is alive */
-               if (wdata->wdog_pid > 0) {
-                       if (kill(wdata->wdog_pid, 0)) {
-                               /* Process has gone */
-                               syslog(LOG_INFO, "Watchdog: %s no longer"
-                                                " exist, restarting..."
-                                              , wdata->wdog_string);
-                               close(wdata->wdog_sd);      /* avoid sd leak */
-                               (*wdata->wdog_start) ();
-                               return 0;
-                       } else {
-                               /* Dead loop detected */
-                               syslog(LOG_INFO, "Watchdog: %s dead loop"
-                                                " detected, restarting..."
-                                              , wdata->wdog_string);
-                               close(wdata->wdog_sd);      /* avoid sd leak */
-                               kill(wdata->wdog_pid, SIGTERM);
-                               wait(&status);
-                               (*wdata->wdog_start) ();
-                               return 0;
-                       }
-               }
-
-               /* Unexpected error */
-               syslog(LOG_INFO, "Watchdog: %s unexpected error,"
-                                " restarting..."
-                              , wdata->wdog_string);
-               (*wdata->wdog_start) ();
-               return 0;
-       }
-
-       /* Register next timer thread */
-       thread_add_timer(master, wdog_thread, wdata, WATCHDOG_DELAY);
-       return 0;
-
-reload:
-       close(wdata->wdog_sd);
-       wdata->wdog_sd = -1;
-       thread_add_timer(master, wdog_boot_thread, wdata,
-                        WATCHDOG_DELAY);
-       return 0;
-}
-
-/* Client watchdog channel */
-static int
-wdog_connect(wdog_data *wdata)
-{
-       struct sockaddr_un sock;
-       int len, err;
-
-       /* Create unix domain socket */
-       wdata->wdog_sd = socket(AF_UNIX, SOCK_STREAM, 0);
-       if (wdata->wdog_sd < 0) {
-               syslog(LOG_INFO, "Watchdog: Error creating %s wdog connect socket",
-                      wdata->wdog_path);
-               return -1;
-       }
-
-       /* create connection socket */
-       memset(&sock, 0, sizeof(struct sockaddr_un));
-       sock.sun_family = AF_UNIX;
-       strncpy(sock.sun_path, wdata->wdog_path, strlen(wdata->wdog_path));
-       len = sizeof(sock.sun_family) + strlen(wdata->wdog_path);
-       err = connect(wdata->wdog_sd, (struct sockaddr *) &sock, len);
-       if (err < 0) {
-               syslog(LOG_INFO, "Watchdog: Error connecting %s wdog socket",
-                      wdata->wdog_path);
-               close(wdata->wdog_sd);
-               return -1;
-       }
-       
-       /* Register watchdog handler */
-       syslog(LOG_INFO, "Watchdog: success connecting %s wdog socket",
-              wdata->wdog_path);
-
-       /* First connection succes unset reload flag */
-       if (reload)
-               UNSET_RELOAD;
-       thread_add_timer(master, wdog_thread, wdata, WATCHDOG_DELAY);
-       return 0;
-}
-
-/* Bootstrap thread */
-int
-wdog_boot_thread(thread *thread)
-{
-       wdog_data *wdata = THREAD_ARG(thread);
-       int err;
-
-       /* connect VRRP child domain socket */
-       err = wdog_connect(wdata);
-
-       /* Retry child connect until success */
-       if (err < 0)
-               thread_add_timer(master, wdog_boot_thread,
-                                wdata, WATCHDOG_DELAY);
-       return 0;
-}
diff --git a/lib/watchdog.h b/lib/watchdog.h
deleted file mode 100644 (file)
index 6a58510..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/* 
- * Soft:        Keepalived is a failover program for the LVS project
- *              <www.linuxvirtualserver.org>. It monitor & manipulate
- *              a loadbalanced server pool using multi-layer checks.
- * 
- * Part:        watchdog.c include file.
- *  
- * Version:     $Id: watchdog.h,v 1.1.8 2005/01/25 23:20:11 acassen Exp $
- *
- * Author:      Alexandre Cassen, <acassen@linux-vs.org>
- *
- *              This program is distributed in the hope that it will be useful,
- *              but WITHOUT ANY WARRANTY; without even the implied warranty of
- *              MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *              See the GNU General Public License for more details.
- *
- *              This program is free software; you can redistribute it and/or
- *              modify it under the terms of the GNU General Public License
- *              as published by the Free Software Foundation; either version
- *              2 of the License, or (at your option) any later version.
- *
- * Copyright (C) 2001-2005 Alexandre Cassen, <acassen@linux-vs.org>
- */
-
-#ifndef _WATCHDOG_H
-#define _WATCHDOG_H
-
-/* local includes */
-#include "scheduler.h"
-
-/* watchdog data */
-typedef struct _wdog_data {
-       char *wdog_string;              /* motd wdog string */
-       char *wdog_path;                /* unix domain socket */
-       pid_t wdog_pid;                 /* pid to monitor */
-       int wdog_sd;                    /* wdog socket descriptor */
-       int (*wdog_start) (void);       /* respawn handler */
-} wdog_data;
-
-/* watchdog definition */
-#define WATCHDOG_TIMER         (30 * TIMER_HZ)
-#define WATCHDOG_DELAY         (5 * TIMER_HZ)
-#define WATCHDOG_STRING                "hello"
-#define WDOG_READ_BUFSIZ       32
-
-/* gloabal vars exported */
-extern int reload;
-
-/* Prototypes */
-extern int wdog_init(char *path);
-extern void wdog_close(int sd, char *path);
-extern int wdog_boot_thread(thread *thread);
-
-#endif