keepalived-1.1.3 v1.1.3
authorAlexandre Cassen <acassen@freebox.fr>
Mon, 29 Sep 2003 14:04:48 +0000 (16:04 +0200)
committerAlexandre Cassen <acassen@freebox.fr>
Mon, 28 Sep 2009 08:58:58 +0000 (10:58 +0200)
* keepalived-1.1.3 released.
* Stephan von Krawczynski, <skraw@ithnet.com> extended ip
  address framework to support broadcast address selection.
* Extended the scheduling framework to support plain 'long'
  timer. Visited the layer4 framework to support this new
  scheduling scheme. Reviewed the checkers and VRRP framework
  to support long timer.
* VRRP : Removed the timer micro adjust call. Its use is
  obsolete with the new scheduling 'long' timer support.
* Jacob Rief, <Jacob.Rief@tiscover.com> and I added support
  log level selection for main daemon. A new command line
  argument has been created :
  --log-facility  -S  0-7 Set syslog facility to
                      LOG_LOCAL[0-7]. (default=LOG_DAEMON)
* Extended the HTTP checker to support non blocking read
  while processing stream. NONBLOCK flags is set before
  read operation to catch EAGAIN error.
* VRRP : Diego Rivera, <lrivera@racsa.co.cr> and I fixed a
  notify issue while building notify exec string.
* VRRP : Diego Rivera, <lrivera@racsa.co.cr> and I extended
  FSM to support BACKUP state notifiers and smtp_alert call
  during VRRP initialization.
* Jan Vanhercke, <jan.vanhercke@c-cure.be> and I extended
  scheduling timer computation to support micro-sec second
  overlap. Extended the whole scheduling framework to support
  this scheduling scheme while computing thread timers.
* Fixed scheduling framework to support child thread timers
  while computing global scheduling timer.

102 files changed:
ChangeLog
README
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
keepalived.spec
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 d7c74b2..e4aba85 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,33 @@
+2003-09-29  Alexandre Cassen  <acassen@linux-vs.org>
+       * keepalived-1.1.3 released.
+       * Stephan von Krawczynski, <skraw@ithnet.com> extended ip
+         address framework to support broadcast address selection.
+       * Extended the scheduling framework to support plain 'long' 
+         timer. Visited the layer4 framework to support this new
+         scheduling scheme. Reviewed the checkers and VRRP framework
+         to support long timer.
+       * VRRP : Removed the timer micro adjust call. Its use is
+         obsolete with the new scheduling 'long' timer support.
+       * Jacob Rief, <Jacob.Rief@tiscover.com> and I added support
+         log level selection for main daemon. A new command line
+         argument has been created :
+         --log-facility  -S  0-7 Set syslog facility to
+                             LOG_LOCAL[0-7]. (default=LOG_DAEMON)
+       * Extended the HTTP checker to support non blocking read
+         while processing stream. NONBLOCK flags is set before
+         read operation to catch EAGAIN error.
+       * VRRP : Diego Rivera, <lrivera@racsa.co.cr> and I fixed a
+         notify issue while building notify exec string.
+       * VRRP : Diego Rivera, <lrivera@racsa.co.cr> and I extended
+         FSM to support BACKUP state notifiers and smtp_alert call
+         during VRRP initialization.
+       * Jan Vanhercke, <jan.vanhercke@c-cure.be> and I extended
+         scheduling timer computation to support micro-sec second
+         overlap. Extended the whole scheduling framework to support
+         this scheduling scheme while computing thread timers.
+       * Fixed scheduling framework to support child thread timers
+         while computing global scheduling timer.
+
 2003-09-07  Alexandre Cassen  <acassen@linux-vs.org>
        * keepalived-1.1.2 released.
        * Dominik Vogt, <dominik.vogt@gmx.de> and I extended checker
diff --git a/README b/README
index 78a092b..153816e 100644 (file)
--- a/README
+++ b/README
@@ -9,7 +9,8 @@ Keepalived implementation is based on an I/O multiplexer to handle a
 strong multi-threading framework. All the events process use this I/O
 multiplexer.
 
-Keepalived is free software. See the file COPYING for copying conditions.
+Keepalived is free software, Copyright (C) Alexandre Cassen.
+See the file COPYING for copying conditions.
 
 
 OPENSSL TOOLKIT LICENCE EXCEPTION
diff --git a/VERSION b/VERSION
index 45a1b3f..781dcb0 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.1.2
+1.1.3
index cf52526..0c57230 100644 (file)
@@ -39,8 +39,8 @@ global_defs {                         # Block identification
        The configuration block looks like :
 
 static_ipaddress {                     # block identification
-    <IP ADDRESS>/<MASK> dev <STRING> scope <SCOPE>
-    <IP ADDRESS>/<MASK> dev <STRING> scope <SCOPE>
+    <IP ADDRESS>/<MASK> brd <IP ADDRESS> dev <STRING> scope <SCOPE>
+    <IP ADDRESS>/<MASK> brd <IP ADDRESS> dev <STRING> scope <SCOPE>
     ...
 }
 
@@ -127,13 +127,13 @@ vrrp_instance <STRING> {          # VRRP instance declaration
         auth_pass <STRING>             # Password string
     }
     virtual_ipaddress {                        # VRRP IP addres block
-        <IP ADDRESS>/<MASK> dev <STRING> scope <SCOPE>
-        <IP ADDRESS>/<MASK> dev <STRING> scope <SCOPE>
+        <IP ADDRESS>/<MASK> brd <IP ADDRESS> dev <STRING> scope <SCOPE>
+        <IP ADDRESS>/<MASK> brd <IP ADDRESS> dev <STRING> scope <SCOPE>
         ...
     }
     virtual_ipaddress_excluded {                       # VRRP IP excluded from VRRP
-        <IP ADDRESS>/<MASK> dev <STRING> scope <SCOPE> # packets
-        <IP ADDRESS>/<MASK> dev <STRING> scope <SCOPE>
+        <IP ADDRESS>/<MASK> brd <IP ADDRESS> dev <STRING> scope <SCOPE>        # packets
+        <IP ADDRESS>/<MASK> brd <IP ADDRESS> dev <STRING> scope <SCOPE>
         ...
     }
     virtual_routes {                    # VRRP virtual routes
index ea23978..9eae2a2 100644 (file)
@@ -58,7 +58,8 @@ extern REQ *req;
  */
 
 /* free allocated pieces */
-static void free_all(thread * thread)
+static void
+free_all(thread * thread)
 {
        SOCK *sock = THREAD_ARG(thread);
 
@@ -87,7 +88,7 @@ epilog(thread * thread)
 
 /* Simple finalization function */
 int
-finalize(thread *thread)
+finalize(thread * thread)
 {
        SOCK *sock = THREAD_ARG(thread);
        unsigned char digest[16];
@@ -99,7 +100,7 @@ finalize(thread *thread)
                printf("\n");
                printf(HTML_MD5);
                print_buffer(16, digest);
-       
+
                printf(HTML_MD5_FINAL);
        }
        printf("MD5SUM = ");
@@ -113,7 +114,8 @@ finalize(thread *thread)
 }
 
 /* Process incoming stream */
-int http_process_stream(SOCK *sock, int r)
+int
+http_process_stream(SOCK * sock, int r)
 {
        sock->size += r;
        sock->total_size += r;
@@ -121,12 +123,13 @@ int http_process_stream(SOCK *sock, int r)
        if (!sock->extracted) {
                if (req->verbose)
                        printf(HTTP_HEADER_HEXA);
-               if ((sock->extracted =
-                   extract_html(sock->buffer, sock->size))) {
+               if ((sock->extracted = extract_html(sock->buffer, sock->size))) {
                        if (req->verbose) {
-                               print_buffer(sock->extracted - sock->buffer, sock->buffer);
+                               print_buffer(sock->extracted - sock->buffer,
+                                            sock->buffer);
                                printf(HTTP_HEADER_ASCII);
-                               for (r = 0; r < sock->extracted - sock->buffer; r++)
+                               for (r = 0; r < sock->extracted - sock->buffer;
+                                    r++)
                                        printf("%c", sock->buffer[r]);
                                printf("\n");
                                printf(HTML_HEADER_HEXA);
@@ -136,8 +139,7 @@ int http_process_stream(SOCK *sock, int r)
                                if (req->verbose)
                                        print_buffer(r, sock->extracted);
                                memcpy(sock->buffer, sock->extracted, r);
-                               MD5_Update(&sock->context, sock->buffer,
-                                          r);
+                               MD5_Update(&sock->context, sock->buffer, r);
                                r = 0;
                        }
                        sock->size = r;
@@ -152,8 +154,7 @@ int http_process_stream(SOCK *sock, int r)
        } else if (sock->size) {
                if (req->verbose)
                        print_buffer(r, sock->buffer);
-               MD5_Update(&sock->context, sock->buffer,
-                          sock->size);
+               MD5_Update(&sock->context, sock->buffer, sock->size);
                sock->size = 0;
        }
 
@@ -249,13 +250,11 @@ http_request_thread(thread * thread)
        memset(str_request, 0, GET_BUFFER_LENGTH);
 
        snprintf(str_request, GET_BUFFER_LENGTH, REQUEST_TEMPLATE,
-                req->url,
-                (req->vhost) ? req->vhost : inet_ntop2(req->addr_ip)
+                req->url, (req->vhost) ? req->vhost : inet_ntop2(req->addr_ip)
                 , ntohs(req->addr_port));
 
        /* Send the GET request to remote Web server */
-       DBG("Sending GET request [%s] on fd:%d\n",
-           req->url, sock->fd);
+       DBG("Sending GET request [%s] on fd:%d\n", req->url, sock->fd);
        if (req->ssl)
                ret =
                    ssl_send_request(sock->ssl, str_request,
@@ -269,8 +268,8 @@ http_request_thread(thread * thread)
 
        if (!ret) {
                fprintf(stderr, "Cannot send get request to [%s:%d].\n",
-                   inet_ntop2(req->addr_ip)
-                   , ntohs(req->addr_port));
+                       inet_ntop2(req->addr_ip)
+                       , ntohs(req->addr_port));
                return epilog(thread);
        }
 
index 504faf4..6a67671 100644 (file)
@@ -36,7 +36,7 @@
 /* global defs */
 #define GET_BUFFER_LENGTH 2048
 #define MAX_BUFFER_LENGTH 4096
-#define HTTP_CNX_TIMEOUT 5
+#define HTTP_CNX_TIMEOUT (5 * TIMER_HZ)
 #define PROTO_HTTP     0x01
 #define PROTO_SSL      0x02
 
@@ -55,9 +55,9 @@
 #define HTML_MD5_FINAL    DELIM_BEGIN" HTML MD5 final resulting "DELIM_END
 
 /* Define prototypes */
-extern int epilog(thread *thread);
-extern int finalize(thread *thread);
-extern int http_process_stream(SOCK *sock, int r);
+extern int epilog(thread * thread);
+extern int finalize(thread * thread);
+extern int http_process_stream(SOCK * sock, int r);
 extern int http_request_thread(thread * thread);
 
 #endif
index c2f53e5..6392752 100644 (file)
@@ -115,15 +115,8 @@ tcp_socket_state(int fd, thread * thread, uint32_t addr_ip, uint16_t addr_port,
                    inet_ntop2(addr_ip), ntohs(addr_port));
 
                timer_min = timer_sub_now(thread->sands);
-
-               if (TIMER_SEC(timer_min) <= 0)
-                       thread_add_write(thread->master, func,
-                                        THREAD_ARG(thread)
-                                        , thread->u.fd, 0);
-               else
-                       thread_add_write(thread->master, func,
-                                        THREAD_ARG(thread)
-                                        , thread->u.fd, TIMER_SEC(timer_min));
+               thread_add_write(thread->master, func, THREAD_ARG(thread)
+                                , thread->u.fd, TIMER_LONG(timer_min));
                return connect_in_progress;
        }
 
@@ -133,7 +126,7 @@ tcp_socket_state(int fd, thread * thread, uint32_t addr_ip, uint16_t addr_port,
 void
 tcp_connection_state(int fd, enum connect_result status, thread * thread,
                     int (*func) (struct _thread *)
-                    , int timeout)
+                    , long timeout)
 {
        switch (status) {
        case connect_error:
@@ -145,7 +138,7 @@ tcp_connection_state(int fd, enum connect_result status, thread * thread,
                                 fd, timeout);
                break;
 
-       /* Checking non-blocking connect, we wait until socket is writable */
+               /* Checking non-blocking connect, we wait until socket is writable */
        case connect_in_progress:
                thread_add_write(thread->master, func, THREAD_ARG(thread),
                                 fd, timeout);
@@ -162,8 +155,9 @@ tcp_check_thread(thread * thread)
        SOCK *sock = THREAD_ARG(thread);
        int ret = 1;
 
-       sock->status = tcp_socket_state(thread->u.fd, thread, req->addr_ip
-                                 , req->addr_port, tcp_check_thread);
+       sock->status =
+           tcp_socket_state(thread->u.fd, thread, req->addr_ip, req->addr_port,
+                            tcp_check_thread);
        switch (sock->status) {
        case connect_error:
                DBG("Error connecting server [%s:%d].\n",
@@ -189,8 +183,7 @@ tcp_check_thread(thread * thread)
                                 */
                                sock->lock = 0;
                                thread_add_event(thread->master,
-                                                http_request_thread,
-                                                sock, 0);
+                                                http_request_thread, sock, 0);
                        } else {
                                DBG("Connection trouble to: [%s:%d].\n",
                                    inet_ntop2(req->addr_ip),
index 5ab5519..5a513c9 100644 (file)
@@ -46,18 +46,18 @@ enum connect_result {
 
 /* Prototypes defs */
 extern enum connect_result
-tcp_connect(int fd, uint32_t, uint16_t);
+ tcp_connect(int fd, uint32_t, uint16_t);
 
 extern enum connect_result
-tcp_socket_state(int, thread *, uint32_t, uint16_t,
-                int (*func) (struct _thread *));
+ tcp_socket_state(int, thread *, uint32_t, uint16_t,
+                 int (*func) (struct _thread *));
 
 extern void
-tcp_connection_state(int, enum connect_result
-                    , thread *, int (*func) (struct _thread *)
-                    , int);
+ tcp_connection_state(int, enum connect_result
+                     , thread *, int (*func) (struct _thread *)
+                     , long);
 
 extern int
-tcp_connect_thread(thread *);
+ tcp_connect_thread(thread *);
 
 #endif
index 793543b..2e4b664 100644 (file)
@@ -54,13 +54,13 @@ signal_set(int signo, void (*func) (int))
        sig.sa_flags = 0;
 #ifdef SA_RESTART
        sig.sa_flags |= SA_RESTART;
-#endif /* SA_RESTART */
+#endif                         /* SA_RESTART */
 
        ret = sigaction(signo, &sig, &osig);
 
        if (ret < 0)
                return (SIG_ERR);
-        else
+       else
                return (osig.sa_handler);
 }
 
@@ -74,7 +74,6 @@ signal_init(void)
        signal_set(SIGKILL, sigend);
 }
 
-
 /* Usage function */
 static void
 usage(const char *prog)
@@ -220,7 +219,7 @@ main(int argc, char **argv)
 
        /* Signal handling initialization  */
        signal_init();
-       
+
        /* Create the master thread */
        master = thread_make_master();
 
@@ -238,7 +237,7 @@ main(int argc, char **argv)
        /* Finalize output informations */
        if (req->verbose)
                printf("Global response time for [%s] =%lu\n",
-                      req->url, req->response_time-req->ref_time);
+                      req->url, req->response_time - req->ref_time);
 
        /* exit cleanly */
        SSL_CTX_free(req->ctx);
index 6bf0626..9dd3427 100644 (file)
@@ -71,7 +71,7 @@ typedef struct {
 } REQ;
 
 /* Global variables */
-REQ *req;                              /* Cmd line arguments */
+REQ *req;                      /* Cmd line arguments */
 unsigned int debug;
 
 /* Data buffer length description */
index f67f5b2..7f6420d 100644 (file)
@@ -36,7 +36,8 @@ extern thread_master *master;
 extern SOCK *sock;
 
 /* Close the descriptor */
-static void close_sock(SOCK *sock)
+static void
+close_sock(SOCK * sock)
 {
        if (sock->ssl) {
                SSL_shutdown(sock->ssl);
@@ -46,7 +47,8 @@ static void close_sock(SOCK *sock)
 }
 
 /* Destroy the socket handler */
-void free_sock(SOCK *sock)
+void
+free_sock(SOCK * sock)
 {
        DBG("Freeing fd:%d\n", sock->fd);
 
@@ -55,10 +57,10 @@ void free_sock(SOCK *sock)
 }
 
 /* Init socket handler */
-void init_sock(void)
+void
+init_sock(void)
 {
-       sock = (SOCK *)MALLOC(sizeof(SOCK));
-       memset(sock, 0, sizeof(SOCK));
-       thread_add_event(master, tcp_connect_thread,
-                        sock, 0);
+       sock = (SOCK *) MALLOC(sizeof (SOCK));
+       memset(sock, 0, sizeof (SOCK));
+       thread_add_event(master, tcp_connect_thread, sock, 0);
 }
index 1943353..939a155 100644 (file)
@@ -44,7 +44,7 @@ typedef struct {
 } SOCK;
 
 /* Prototypes */
-extern void free_sock(SOCK *sock);
+extern void free_sock(SOCK * sock);
 extern void init_sock(void);
 
 #endif
index 0fdaa93..fa42d9b 100644 (file)
@@ -106,8 +106,7 @@ ssl_connect(thread * thread)
        SSL_set_bio(sock->ssl, sock->bio, sock->bio);
        ret = SSL_connect(sock->ssl);
 
-       DBG("  SSL_connect return code = %d on fd:%d\n",
-           ret, thread->u.fd);
+       DBG("  SSL_connect return code = %d on fd:%d\n", ret, thread->u.fd);
        ssl_printerr(SSL_get_error(sock->ssl, ret));
 
        return (ret > 0) ? 1 : 0;
@@ -161,7 +160,7 @@ ssl_read_thread(thread * thread)
         * and sometime not...
         */
 
-read_stream:
+      read_stream:
 
        /* read the SSL stream */
        memset(sock->buffer, 0, MAX_BUFFER_LENGTH);
index 1d2c281..bbd313d 100644 (file)
@@ -1,7 +1,7 @@
 Name: keepalived
 Summary: HA monitor built upon LVS, VRRP and services poller
 Packager: Christophe Varoqui, <christophe.varoqui@free.fr>
-Version: 1.1.1
+Version: 1.1.3
 Release: 1
 Source: http://www.keepalived.org/software/%{name}-%{version}.tar.gz
 Copyright: GPL
index 7600bc8..1f7ff45 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Checkers registration.
  *
- * Version:     $Id: check_api.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: check_api.c,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index f12834a..6d23813 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        CI-LINUX checker. Integration to Compaq Cluster Infrastructure.
  *
- * Version:     $Id: check_ci.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: check_ci.c,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Aneesh Kumar K.V, <aneesh.kumar@digital.com>
index 2abf68a..318cbb6 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Healthcheckrs child process handling.
  *
- * Version:     $Id: check_daemon.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: check_daemon.c,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -229,7 +229,7 @@ start_check_child(void)
                               , strerror(errno));
                return -1;
        } else if (pid) {
-               int poll_delay = (wdog_delay_check) ? wdog_delay_check : WATCHDOG_DELAY;
+               long poll_delay = (wdog_delay_check) ? wdog_delay_check : WATCHDOG_DELAY;
                checkers_child = pid;
                syslog(LOG_INFO, "Starting Healthcheck child process, pid=%d"
                               , pid);
index 35d60a4..3b38d4c 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Healthcheckers dynamic data structure definition.
  *
- * Version:     $Id: check_data.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: check_data.c,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index e13dc68..44d10d5 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        WEB CHECK. Common HTTP/SSL checker primitives.
  *
- * Version:     $Id: check_http.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: check_http.c,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
@@ -83,11 +83,11 @@ dump_http_get_check(void *data)
        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, "   Connection timeout = %lu",
+              http_get_chk->connection_to/TIMER_HZ);
        syslog(LOG_INFO, "   Nb get retry = %d", http_get_chk->nb_get_retry);
-       syslog(LOG_INFO, "   Delay before retry = %d",
-              http_get_chk->delay_before_retry);
+       syslog(LOG_INFO, "   Delay before retry = %lu",
+              http_get_chk->delay_before_retry/TIMER_HZ);
        dump_list(http_get_chk->url);
 }
 static http_get_checker *
@@ -135,7 +135,7 @@ void
 connect_to_handler(vector strvec)
 {
        http_get_checker *http_get_chk = CHECKER_GET();
-       http_get_chk->connection_to = CHECKER_VALUE_INT(strvec);
+       http_get_chk->connection_to = CHECKER_VALUE_INT(strvec) * TIMER_HZ;
 }
 
 void
@@ -149,7 +149,7 @@ void
 delay_before_retry_handler(vector strvec)
 {
        http_get_checker *http_get_chk = CHECKER_GET();
-       http_get_chk->delay_before_retry = CHECKER_VALUE_INT(strvec);
+       http_get_chk->delay_before_retry = CHECKER_VALUE_INT(strvec) * TIMER_HZ;
 }
 
 void
@@ -544,16 +544,35 @@ http_read_thread(thread * thread)
        uint16_t addr_port = get_service_port(checker);
        unsigned char digest[16];
        int r = 0;
+       int val;
 
        /* Handle read timeout */
        if (thread->type == THREAD_READ_TIMEOUT)
                return timeout_epilog(thread, "=> HTTP CHECK failed on service"
                                      " : recevice data <=\n\n", "HTTP read");
 
+       /* Set descriptor non blocking */
+       val = fcntl(thread->u.fd, F_GETFL, 0);
+       fcntl(thread->u.fd, F_SETFL, val | O_NONBLOCK);
+
        /* read the HTTP stream */
        r = read(thread->u.fd, req->buffer + req->len,
                 MAX_BUFFER_LENGTH - req->len);
 
+       /* restore descriptor flags */
+       fcntl(thread->u.fd, F_SETFL, val);
+
+       /* Test if data are ready */
+       if (r == -1 && errno == EAGAIN) {
+               syslog(LOG_INFO, "Read error with server [%s:%d]: %s",
+                      inet_ntop2(CHECKER_RIP(checker))
+                      , ntohs(addr_port)
+                      , strerror(errno));
+               thread_add_read(thread->master, http_read_thread, checker,
+                               thread->u.fd, http_get_check->connection_to);
+               return 0;
+       }
+
        if (r == -1 || r == 0) {        /* -1:error , 0:EOF */
 
                /* All the HTTP stream has been parsed */
index a34d3e1..0c6e04d 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.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: check_misc.c,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Eric Jarman, <ehj38230@cmsu2.cmsu.edu>
@@ -57,7 +57,7 @@ dump_misc_check(void *data)
 
        syslog(LOG_INFO, "   Keepalive method = MISC_CHECK");
        syslog(LOG_INFO, "   script = %s", misc_chk->path);
-       syslog(LOG_INFO, "   timeout = %d", misc_chk->timeout);
+       syslog(LOG_INFO, "   timeout = %lu", misc_chk->timeout/TIMER_HZ);
 }
 
 void
@@ -81,7 +81,7 @@ void
 misc_timeout_handler(vector strvec)
 {
        misc_checker *misc_chk = CHECKER_GET();
-       misc_chk->timeout = CHECKER_VALUE_INT(strvec);
+       misc_chk->timeout = CHECKER_VALUE_INT(strvec) * TIMER_HZ;
 }
 
 void
index 7c0b923..c138db7 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.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: check_parser.c,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
index 0fbb5ee..4705911 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.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: check_ssl.c,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
index 00df1a3..27704c7 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        TCP checker.
  *
- * Version:     $Id: check_tcp.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: check_tcp.c,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -54,7 +54,7 @@ dump_tcp_check(void *data)
                       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);
+       syslog(LOG_INFO, "   Connection timeout = %d", tcp_chk->connection_to/TIMER_HZ);
 }
 
 void
@@ -85,7 +85,7 @@ void
 connect_timeout_handler(vector strvec)
 {
        tcp_checker *tcp_chk = CHECKER_GET();
-       tcp_chk->connection_to = CHECKER_VALUE_INT(strvec);
+       tcp_chk->connection_to = CHECKER_VALUE_INT(strvec) * TIMER_HZ;
 }
 
 void
index 8c44438..48d8901 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.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: ipfwwrapper.c,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index b8e27ed..2a21de7 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.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: ipvswrapper.c,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
index c285975..488e70e 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Manipulation functions for IPVS & IPFW wrappers.
  *
- * Version:     $id: ipwrapper.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $id: ipwrapper.c,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index f478f80..0ff552a 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Main program structure.
  *
- * Version:     $Id: main.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: main.c,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -122,7 +122,7 @@ signal_set(int signo, void (*func) (int))
        sig.sa_flags = 0;
 #ifdef SA_RESTART
        sig.sa_flags |= SA_RESTART;
-#endif /* SA_RESTART */
+#endif                         /* SA_RESTART */
 
        ret = sigaction(signo, &sig, &osig);
 
index c6d9549..67d4fd1 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Dynamic data structure definition.
  *
- * Version:     $Id: global_data.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: global_data.c,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -35,58 +35,64 @@ extern conf_data *data;
 
 /* Default settings */
 static void
-set_default_lvs_id(conf_data* conf_data)
+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;
+       if (!new_id || !new_id[0])
+               return;
 
        len = strlen(new_id);
        conf_data->lvs_id = MALLOC(len + 1);
-       if (!conf_data->lvs_id) return;
+       if (!conf_data->lvs_id)
+               return;
 
        memcpy(conf_data->lvs_id, new_id, len);
 }
 
 static void
-set_default_email_from(conf_data* conf_data)
+set_default_email_from(conf_data * conf_data)
 {
        struct passwd *pwd = NULL;
-       char* hostname = NULL;
+       char *hostname = NULL;
        int len = 0;
 
        hostname = get_local_name();
-       if (!hostname || !hostname[0]) return;
+       if (!hostname || !hostname[0])
+               return;
 
        pwd = getpwuid(getuid());
-       if (!pwd) return;
+       if (!pwd)
+               return;
 
        len = strlen(hostname) + strlen(pwd->pw_name) + 2;
        conf_data->email_from = MALLOC(len);
-       if (!conf_data->email_from) return;
-       
+       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)
+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)
+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)
+set_default_values(conf_data * conf_data)
 {
        /* No global data so don't default */
-       if (!conf_data) return;
+       if (!conf_data)
+               return;
        set_default_lvs_id(conf_data);
        set_default_smtp_server(conf_data);
        set_default_smtp_connection_timeout(conf_data);
@@ -132,7 +138,7 @@ alloc_global_data(void)
 }
 
 void
-free_global_data(conf_data *data)
+free_global_data(conf_data * data)
 {
        free_list(data->email);
        FREE_PTR(data->lvs_id);
@@ -141,14 +147,13 @@ free_global_data(conf_data *data)
 }
 
 void
-dump_global_data(conf_data *data)
+dump_global_data(conf_data * data)
 {
        if (!data)
                return;
 
        if (data->lvs_id ||
-           data->smtp_server ||
-           data->smtp_connection_to || data->email_from) {
+           data->smtp_server || data->smtp_connection_to || data->email_from) {
                syslog(LOG_INFO, "------< Global definitions >------");
        }
        if (data->lvs_id)
@@ -157,8 +162,8 @@ dump_global_data(conf_data *data)
                syslog(LOG_INFO, " Smtp server = %s",
                       inet_ntop2(data->smtp_server));
        if (data->smtp_connection_to)
-               syslog(LOG_INFO, " Smtp server connection timeout = %d",
-                      data->smtp_connection_to);
+               syslog(LOG_INFO, " Smtp server connection timeout = %lu",
+                      data->smtp_connection_to / TIMER_HZ);
        if (data->email_from) {
                syslog(LOG_INFO, " Email notification from = %s",
                       data->email_from);
index 233cb55..974d8b4 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.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: global_parser.c,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -50,7 +50,7 @@ emailfrom_handler(vector strvec)
 static void
 smtpto_handler(vector strvec)
 {
-       data->smtp_connection_to = atoi(VECTOR_SLOT(strvec, 1));
+       data->smtp_connection_to = atoi(VECTOR_SLOT(strvec, 1)) * TIMER_HZ;
 }
 static void
 smtpip_handler(vector strvec)
index d8916ea..2ef201f 100644 (file)
@@ -6,7 +6,7 @@
  * Part:        Layer4 checkers handling. Register worker threads &
  *              upper layer checkers.
  *
- * Version:     $Id: layer4.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: layer4.c,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -53,7 +53,7 @@ tcp_bind_connect(int fd, uint32_t addr_ip, uint16_t addr_port, uint32_t bind_ip)
        if (bind_ip) {
                sin.sin_family = AF_INET;
                sin.sin_addr.s_addr = bind_ip;
-               if (bind(fd, (struct sockaddr *) &sin, sizeof(sin)) != 0)
+               if (bind(fd, (struct sockaddr *) &sin, sizeof (sin)) != 0)
                        return connect_error;
        }
 
@@ -129,15 +129,8 @@ tcp_socket_state(int fd, thread * thread, uint32_t addr_ip, uint16_t addr_port,
                    inet_ntop2(addr_ip), ntohs(addr_port));
 
                timer_min = timer_sub_now(thread->sands);
-
-               if (TIMER_SEC(timer_min) <= 0)
-                       thread_add_write(thread->master, func,
-                                        THREAD_ARG(thread)
-                                        , thread->u.fd, 0);
-               else
-                       thread_add_write(thread->master, func,
-                                        THREAD_ARG(thread)
-                                        , thread->u.fd, TIMER_SEC(timer_min));
+               thread_add_write(thread->master, func, THREAD_ARG(thread)
+                                , thread->u.fd, TIMER_LONG(timer_min));
                return connect_in_progress;
        } else if (status != 0) {
                close(thread->u.fd);
@@ -150,7 +143,7 @@ tcp_socket_state(int fd, thread * thread, uint32_t addr_ip, uint16_t addr_port,
 void
 tcp_connection_state(int fd, enum connect_result status, thread * thread,
                     int (*func) (struct _thread *)
-                    , int timeout)
+                    , long timeout)
 {
        checker *checker;
 
index 76730ce..5a1c072 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Main program structure.
  *
- * Version:     $Id: main.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: main.c,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
 #include "main.h"
 #include "watchdog.h"
 
+/* Log faility table */
+struct {
+       int facility;
+} LOG_FACILITY[LOG_FACILITY_MAX + 1] = {
+       {LOG_LOCAL0}, {LOG_LOCAL1}, {LOG_LOCAL2}, {LOG_LOCAL3},
+       {LOG_LOCAL4}, {LOG_LOCAL5}, {LOG_LOCAL6}, {LOG_LOCAL7}
+};
+
 /* Daemon stop sequence */
 static void
 stop_keepalived(void)
@@ -142,9 +150,11 @@ usage(const char *prog)
                "  %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, prog);
 }
 
 /* Command line parser */
@@ -160,6 +170,7 @@ parse_cmdline(int argc, char **argv)
                {"help", 'h', POPT_ARG_NONE, NULL, 'h'},
                {"log-console", 'l', POPT_ARG_NONE, NULL, 'l'},
                {"log-detail", 'D', POPT_ARG_NONE, NULL, 'D'},
+               {"log-facility", 'S', POPT_ARG_STRING, &optarg, 'S'},
                {"dont-release-vrrp", 'V', POPT_ARG_NONE, NULL, 'V'},
                {"dont-release-ipvs", 'I', POPT_ARG_NONE, NULL, 'I'},
                {"dont-fork", 'n', POPT_ARG_NONE, NULL, 'n'},
@@ -204,14 +215,17 @@ parse_cmdline(int argc, char **argv)
        case 'D':
                debug |= 32;
                break;
+       case 'S':
+               log_facility = LOG_FACILITY[atoi(optarg)].facility;
+               break;
        case 'f':
                conf_file = optarg;
                break;
        case 'R':
-               wdog_delay_vrrp = atoi(optarg);
+               wdog_delay_vrrp = atoi(optarg) * TIMER_HZ;
                break;
        case 'H':
-               wdog_delay_check = atoi(optarg);
+               wdog_delay_check = atoi(optarg) * TIMER_HZ;
                break;
        }
 
@@ -236,14 +250,17 @@ parse_cmdline(int argc, char **argv)
                case 'D':
                        debug |= 32;
                        break;
+               case 'S':
+                       log_facility = LOG_FACILITY[atoi(optarg)].facility;
+                       break;
                case 'f':
                        conf_file = optarg;
                        break;
                case 'R':
-                       wdog_delay_vrrp = atoi(optarg);
+                       wdog_delay_vrrp = atoi(optarg) * TIMER_HZ;
                        break;
                case 'H':
-                       wdog_delay_check = atoi(optarg);
+                       wdog_delay_check = atoi(optarg) * TIMER_HZ;
                        break;
                }
        }
@@ -272,7 +289,7 @@ main(int argc, char **argv)
         */
        parse_cmdline(argc, argv);
 
-       openlog(PROG, LOG_PID | (debug & 1) ? LOG_CONS : 0, LOG_DAEMON);
+       openlog(PROG, LOG_PID | (debug & 1) ? LOG_CONS : 0, log_facility);
        syslog(LOG_INFO, "Starting " VERSION_STRING);
 
        /* Check if keepalived is already running */
index bdafb5e..9c5c8f3 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        pidfile utility.
  *
- * Version:     $Id: pidfile.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: pidfile.c,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -31,8 +31,8 @@ pidfile_write(char *pid_file, int pid)
        FILE *pidfile = fopen(pid_file, "w");
 
        if (!pidfile) {
-               syslog(LOG_INFO, "pidfile_write : Can not open %s pidfile"
-                      , pid_file);
+               syslog(LOG_INFO, "pidfile_write : Can not open %s pidfile",
+                      pid_file);
                return 0;
        }
        fprintf(pidfile, "%d\n", pid);
index fcad7cb..8cf3ac5 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.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: smtp.c,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -159,7 +159,8 @@ smtp_read_thread(thread * thread)
        smtp_arg = THREAD_ARG(thread);
 
        if (thread->type == THREAD_READ_TIMEOUT) {
-               syslog(LOG_INFO, "Timeout reading data to remote SMTP server [%s:%d].",
+               syslog(LOG_INFO,
+                      "Timeout reading data to remote SMTP server [%s:%d].",
                       inet_ntop2(data->smtp_server), SMTP_PORT);
                SMTP_FSM_READ(QUIT, thread, 0);
                return -1;
@@ -173,7 +174,8 @@ smtp_read_thread(thread * thread)
        if (rcv_buffer_size == -1) {
                if (errno == EAGAIN)
                        goto end;
-               syslog(LOG_INFO, "Error reading data from remote SMTP server [%s:%d].",
+               syslog(LOG_INFO,
+                      "Error reading data from remote SMTP server [%s:%d].",
                       inet_ntop2(data->smtp_server), SMTP_PORT);
                SMTP_FSM_READ(QUIT, thread, 0);
                return 0;
@@ -181,9 +183,10 @@ smtp_read_thread(thread * thread)
 
        /* received data overflow buffer size ? */
        if (smtp_arg->buflen >= SMTP_BUFFER_MAX) {
-               syslog(LOG_INFO, "Received buffer from remote SMTP server [%s:%d]"
-                      " overflow our get read buffer length."
-                      , inet_ntop2(data->smtp_server), SMTP_PORT);
+               syslog(LOG_INFO,
+                      "Received buffer from remote SMTP server [%s:%d]"
+                      " overflow our get read buffer length.",
+                      inet_ntop2(data->smtp_server), SMTP_PORT);
                SMTP_FSM_READ(QUIT, thread, 0);
                return 0;
        } else {
@@ -191,7 +194,7 @@ smtp_read_thread(thread * thread)
                buffer[smtp_arg->buflen] = 0;   /* NULL terminate */
        }
 
-end:
+      end:
 
        /* parse the buffer, finding the last line of the response for the code */
        reply = buffer;
@@ -205,8 +208,9 @@ end:
                        smtp_arg->buflen -= (reply - buffer);
                        buffer[smtp_arg->buflen] = 0;
 
-                       thread_add_read(thread->master, smtp_read_thread, smtp_arg,
-                                       thread->u.fd, data->smtp_connection_to);
+                       thread_add_read(thread->master, smtp_read_thread,
+                                       smtp_arg, thread->u.fd,
+                                       data->smtp_connection_to);
                        return 0;
                }
 
@@ -241,8 +245,9 @@ end:
                thread_add_write(thread->master, smtp_send_thread, smtp_arg,
                                 smtp_arg->fd, data->smtp_connection_to);
        } else {
-               syslog(LOG_INFO, "Can not read data from remote SMTP server [%s:%d].",
-                      inet_ntop2(data->smtp_server), SMTP_PORT);
+               syslog(LOG_INFO,
+                      "Can not read data from remote SMTP server [%s:%d].",
+                      inet_ntop2(data->smtp_server), SMTP_PORT);
                SMTP_FSM_READ(QUIT, thread, 0);
        }
 
@@ -253,9 +258,10 @@ static int
 smtp_send_thread(thread * thread)
 {
        smtp_thread_arg *smtp_arg = THREAD_ARG(thread);
-       
+
        if (thread->type == THREAD_WRITE_TIMEOUT) {
-               syslog(LOG_INFO, "Timeout sending data to remote SMTP server [%s:%d].",
+               syslog(LOG_INFO,
+                      "Timeout sending data to remote SMTP server [%s:%d].",
                       inet_ntop2(data->smtp_server), SMTP_PORT);
                SMTP_FSM_READ(QUIT, thread, 0);
                return 0;
@@ -274,15 +280,15 @@ smtp_send_thread(thread * thread)
                thread_add_read(thread->master, smtp_read_thread, smtp_arg,
                                thread->u.fd, data->smtp_connection_to);
        } else {
-               syslog(LOG_INFO, "Can not send data to remote SMTP server [%s:%d].",
-                      inet_ntop2(data->smtp_server), SMTP_PORT);
+               syslog(LOG_INFO,
+                      "Can not send data to remote SMTP server [%s:%d].",
+                      inet_ntop2(data->smtp_server), SMTP_PORT);
                SMTP_FSM_READ(QUIT, thread, 0);
        }
 
        return 0;
 }
 
-
 static int
 connection_code(thread * thread, int status)
 {
@@ -292,8 +298,8 @@ connection_code(thread * thread, int status)
                smtp_arg->stage++;
        } else {
                syslog(LOG_INFO, "Error connecting SMTP server[%s:%d]."
-                      " SMTP status code = %d"
-                      , inet_ntop2(data->smtp_server), SMTP_PORT, status);
+                      " SMTP status code = %d", inet_ntop2(data->smtp_server),
+                      SMTP_PORT, status);
                smtp_arg->stage = ERROR;
        }
 
@@ -307,9 +313,8 @@ helo_cmd(thread * thread)
        smtp_thread_arg *smtp_arg = THREAD_ARG(thread);
        char *buffer;
 
-       buffer = (char *)MALLOC(SMTP_BUFFER_MAX);
-       snprintf(buffer, SMTP_BUFFER_MAX, SMTP_HELO_CMD,
-                get_local_name());
+       buffer = (char *) MALLOC(SMTP_BUFFER_MAX);
+       snprintf(buffer, SMTP_BUFFER_MAX, SMTP_HELO_CMD, get_local_name());
        if (send(thread->u.fd, buffer, strlen(buffer), 0) == -1)
                smtp_arg->stage = ERROR;
        FREE(buffer);
@@ -324,9 +329,10 @@ helo_code(thread * thread, int status)
        if (status == 250) {
                smtp_arg->stage++;
        } else {
-               syslog(LOG_INFO, "Error processing HELO cmd on SMTP server [%s:%d]."
-                      " SMTP status code = %d"
-                      , inet_ntop2(data->smtp_server), SMTP_PORT, status);
+               syslog(LOG_INFO,
+                      "Error processing HELO cmd on SMTP server [%s:%d]."
+                      " SMTP status code = %d", inet_ntop2(data->smtp_server),
+                      SMTP_PORT, status);
                smtp_arg->stage = ERROR;
        }
 
@@ -340,9 +346,8 @@ mail_cmd(thread * thread)
        smtp_thread_arg *smtp_arg = THREAD_ARG(thread);
        char *buffer;
 
-       buffer = (char *)MALLOC(SMTP_BUFFER_MAX);
-       snprintf(buffer, SMTP_BUFFER_MAX, SMTP_MAIL_CMD,
-                data->email_from);
+       buffer = (char *) MALLOC(SMTP_BUFFER_MAX);
+       snprintf(buffer, SMTP_BUFFER_MAX, SMTP_MAIL_CMD, data->email_from);
        if (send(thread->u.fd, buffer, strlen(buffer), 0) == -1)
                smtp_arg->stage = ERROR;
        FREE(buffer);
@@ -357,9 +362,10 @@ mail_code(thread * thread, int status)
        if (status == 250) {
                smtp_arg->stage++;
        } else {
-               syslog(LOG_INFO, "Error processing MAIL cmd on SMTP server [%s:%d]."
-                      " SMTP status code = %d"
-                      , inet_ntop2(data->smtp_server), SMTP_PORT, status);
+               syslog(LOG_INFO,
+                      "Error processing MAIL cmd on SMTP server [%s:%d]."
+                      " SMTP status code = %d", inet_ntop2(data->smtp_server),
+                      SMTP_PORT, status);
                smtp_arg->stage = ERROR;
        }
 
@@ -374,7 +380,7 @@ rcpt_cmd(thread * thread)
        char *buffer;
        char *fetched_email;
 
-       buffer = (char *)MALLOC(SMTP_BUFFER_MAX);
+       buffer = (char *) MALLOC(SMTP_BUFFER_MAX);
        /* We send RCPT TO command multiple time to add all our email receivers.
         * --rfc821.3.1
         */
@@ -401,9 +407,10 @@ rcpt_code(thread * thread, int status)
                if (!fetched_email)
                        smtp_arg->stage++;
        } else {
-               syslog(LOG_INFO, "Error processing RCPT cmd on SMTP server [%s:%d]."
-                      " SMTP status code = %d"
-                      , inet_ntop2(data->smtp_server), SMTP_PORT, status);
+               syslog(LOG_INFO,
+                      "Error processing RCPT cmd on SMTP server [%s:%d]."
+                      " SMTP status code = %d", inet_ntop2(data->smtp_server),
+                      SMTP_PORT, status);
                smtp_arg->stage = ERROR;
        }
 
@@ -429,9 +436,10 @@ data_code(thread * thread, int status)
        if (status == 354) {
                smtp_arg->stage++;
        } else {
-               syslog(LOG_INFO, "Error processing DATA cmd on SMTP server [%s:%d]."
-                      " SMTP status code = %d"
-                      , inet_ntop2(data->smtp_server), SMTP_PORT, status);
+               syslog(LOG_INFO,
+                      "Error processing DATA cmd on SMTP server [%s:%d]."
+                      " SMTP status code = %d", inet_ntop2(data->smtp_server),
+                      SMTP_PORT, status);
                smtp_arg->stage = ERROR;
        }
 
@@ -448,7 +456,7 @@ body_cmd(thread * thread)
        smtp_thread_arg *smtp_arg = THREAD_ARG(thread);
        char *buffer;
 
-       buffer = (char *)MALLOC(SMTP_BUFFER_MAX);
+       buffer = (char *) MALLOC(SMTP_BUFFER_MAX);
 
        snprintf(buffer, SMTP_BUFFER_MAX, SMTP_HEADERS_CMD,
                 data->email_from, smtp_arg->subject);
@@ -458,8 +466,7 @@ body_cmd(thread * thread)
                smtp_arg->stage = ERROR;
 
        memset(buffer, 0, SMTP_BUFFER_MAX);
-       snprintf(buffer, SMTP_BUFFER_MAX, SMTP_BODY_CMD,
-                smtp_arg->body);
+       snprintf(buffer, SMTP_BUFFER_MAX, SMTP_BODY_CMD, smtp_arg->body);
 
        /* send the the body field */
        if (send(thread->u.fd, buffer, strlen(buffer), 0) == -1)
@@ -482,9 +489,10 @@ body_code(thread * thread, int status)
                syslog(LOG_INFO, "SMTP alert successfully sent.");
                smtp_arg->stage++;
        } else {
-               syslog(LOG_INFO, "Error processing DOT cmd on SMTP server [%s:%d]."
-                      " SMTP status code = %d"
-                      , inet_ntop2(data->smtp_server), SMTP_PORT, status);
+               syslog(LOG_INFO,
+                      "Error processing DOT cmd on SMTP server [%s:%d]."
+                      " SMTP status code = %d", inet_ntop2(data->smtp_server),
+                      SMTP_PORT, status);
                smtp_arg->stage = ERROR;
        }
 
@@ -517,35 +525,32 @@ quit_code(thread * thread, int status)
 
 /* connect remote SMTP server */
 static void
-smtp_connect(smtp_thread_arg *smtp_arg)
+smtp_connect(smtp_thread_arg * smtp_arg)
 {
        enum connect_result status;
 
        if ((smtp_arg->fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP))
-            == -1) {
+           == -1) {
                DBG("SMTP connect fail to create socket.");
                free_smtp_all(smtp_arg);
                return;
        }
 
-       status = tcp_connect(smtp_arg->fd, data->smtp_server,
-                            htons(SMTP_PORT));
+       status = tcp_connect(smtp_arg->fd, data->smtp_server, htons(SMTP_PORT));
 
        /* Handle connection status code */
-       thread_add_event(master, SMTP_FSM[status].send, smtp_arg,
-                        smtp_arg->fd);
+       thread_add_event(master, SMTP_FSM[status].send, smtp_arg, smtp_arg->fd);
 }
 
 /* Main entry point */
 void
 smtp_alert(thread_master * master, real_server * rs, vrrp_rt * vrrp,
-          vrrp_sgroup *vgroup, const char *subject, const char *body)
+          vrrp_sgroup * vgroup, const char *subject, const char *body)
 {
        smtp_thread_arg *smtp_arg;
 
        /* Only send mail if email specified */
-       if (!LIST_ISEMPTY(data->email) &&
-           data->smtp_server != 0) {
+       if (!LIST_ISEMPTY(data->email) && data->smtp_server != 0) {
                /* allocate & initialize smtp argument data structure */
                smtp_arg = (smtp_thread_arg *) MALLOC(sizeof (smtp_thread_arg));
                smtp_arg->subject = (char *) MALLOC(MAX_HEADERS_LENGTH);
index b00c135..25359a7 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Checkers arguments structures definitions.
  *
- * Version:     $Id: check_api.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: check_api.h,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index ec566eb..afd438a 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_ci.c include file.
  *
- * Version:     $Id: check_ci.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: check_ci.h,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Aneesh Kumar K.V, <aneesh.kumar@digital.com>
index ee1b6ba..32b3c30 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_daemon.c include file.
  * 
- * Version:     $Id: check_daemon.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: check_daemon.h,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
index d32ec86..0538d0d 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Healthcheckers dynamic data structure definition.
  *
- * Version:     $Id: check_data.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: check_data.h,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 27947ce..e09be50 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_http.c include file.
  *
- * Version:     $Id: check_http.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: check_http.h,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
@@ -67,9 +67,9 @@ typedef struct _http_get_checker {
        int proto;
        uint16_t connection_port;
        uint32_t bindto;
-       int connection_to;
+       long connection_to;
        int nb_get_retry;
-       int delay_before_retry;
+       long delay_before_retry;
        list url;
        http_arg *arg;
 } http_get_checker;
@@ -94,7 +94,7 @@ extern void install_http_check_keyword(void);
 extern int epilog(thread * thread, int metod, int t, int c);
 extern int timeout_epilog(thread * thread, char *smtp_msg, char *debug_msg);
 extern url *fetch_next_url(http_get_checker * http_get_check);
-extern int http_process_response(REQ *req, int r);
+extern int http_process_response(REQ * req, int r);
 extern int http_handle_response(thread * thread, unsigned char digest[16]
                                , int empty_buffer);
 #endif
index db96709..5418959 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_misc.c include file.
  *
- * Version:     $Id: check_misc.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: check_misc.h,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              Eric Jarman, <ehj38230@cmsu2.cmsu.edu>
@@ -35,7 +35,7 @@
 /* Checker argument structure  */
 typedef struct _misc_checker {
        char *path;
-       int timeout;
+       long timeout;
 } misc_checker;
 
 /* Prototypes defs */
index f44dffd..c7be342 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        check_parser.c include file.
  *  
- * Version:     $Id: check_parser.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: check_parser.h,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 53f3b40..d617cfb 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_http.c include file.
  *
- * Version:     $Id: check_http.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: check_http.h,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
index 420172b..6c31d90 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_tcp.c include file.
  *
- * Version:     $Id: check_tcp.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: check_tcp.h,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 65d5aec..8a09a8c 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Daemon process handling.
  *
- * Version:     $Id: daemon.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: daemon.h,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 856f0e5..d1cfb93 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Dynamic data structure definition.
  *
- * Version:     $Id: global_data.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: global_data.h,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
 
 /* local includes */
 #include "list.h"
+#include "timer.h"
 
 /* constants */
 #define DEFAULT_SMTP_SERVER 0x7f000001
-#define DEFAULT_SMTP_CONNECTION_TIMEOUT 30
+#define DEFAULT_SMTP_CONNECTION_TIMEOUT (30 * TIMER_HZ)
 
 /* email link list */
 typedef struct _email {
@@ -47,7 +48,7 @@ typedef struct _conf_data {
        char *lvs_id;
        char *email_from;
        uint32_t smtp_server;
-       int smtp_connection_to;
+       long smtp_connection_to;
        list email;
 } conf_data;
 
index 6e10f0f..1c2570e 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        vrrp_parser.c include file.
  *  
- * Version:     $Id: global_parser.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: global_parser.h,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index f54ff32..ddfd33e 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        ipfwwrapper.c include file.
  *
- * Version:     $Id: ipfwwrapper.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: ipfwwrapper.h,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 0f79fc9..f962328 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        ipvswrapper.c include file.
  *
- * Version:     $Id: ipvswrapper.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: ipvswrapper.h,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -93,9 +93,10 @@ do {                                         \
 
 /* prototypes */
 extern virtual_server_group *ipvs_get_group_by_name(char *gname, list l);
-extern int ipvs_group_remove_entry(virtual_server *vs,
-                                  virtual_server_group_entry *vsge);
-extern int ipvs_cmd(int cmd, list vs_group, virtual_server * vserver, real_server * rserver);
+extern int ipvs_group_remove_entry(virtual_server * vs,
+                                  virtual_server_group_entry * vsge);
+extern int ipvs_cmd(int cmd, list vs_group, virtual_server * vserver,
+                   real_server * rserver);
 extern int ipvs_syncd_cmd(int cmd, char *ifname, int state);
 extern void ipvs_syncd_master(char *ifname);
 extern void ipvs_syncd_backup(char *ifname);
index 7205697..7ac07b4 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        ipwrapper.c include file.
  *
- * Version:     $Id: ipwrapper.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: ipwrapper.h,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
 
 /* 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 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 a3467a8..81e3ba1 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        layer4.c include file.
  *
- * Version:     $Id: layer4.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: layer4.h,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -46,17 +46,17 @@ enum connect_result {
 
 /* Prototypes defs */
 extern enum connect_result
-tcp_bind_connect(int, uint32_t, uint16_t, uint32_t);
+ tcp_bind_connect(int, uint32_t, uint16_t, uint32_t);
 
 extern enum connect_result
-tcp_connect(int, uint32_t, uint16_t);
+ tcp_connect(int, uint32_t, uint16_t);
 
 extern enum connect_result
-tcp_socket_state(int, thread *, uint32_t, uint16_t,
-                int (*func) (struct _thread *));
+ tcp_socket_state(int, thread *, uint32_t, uint16_t,
+                 int (*func) (struct _thread *));
 
 extern void
-tcp_connection_state(int, enum connect_result
-                    , thread *, int (*func) (struct _thread *)
-                    , int);
+ tcp_connection_state(int, enum connect_result
+                     , thread *, int (*func) (struct _thread *)
+                     , long);
 #endif
index fbe1cd3..79e6efc 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Main program include file.
  *
- * Version:     $Id: main.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: main.h,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
 #include "global_data.h"
 
 /* global var */
-thread_master *master = NULL;          /* Scheduling master thread */
-char *conf_file = NULL;                        /* Configuration file */
-int reload = 0;                                /* Global reloading flag */
-unsigned int debug;                    /* Debugging flags */
-pid_t vrrp_child = -1;                 /* VRRP child process ID */
-pid_t checkers_child = -1;             /* Healthcheckers child process ID */
-int wdog_delay_vrrp = 0;               /* VRRP child polling delay */
-int wdog_delay_check = 0;              /* Healthchecker child polling delay */
-conf_data *data;                       /* Global configuration data */
+thread_master *master = NULL;  /* Scheduling master thread */
+char *conf_file = NULL;                /* Configuration file */
+int log_facility = LOG_DAEMON; /* Optional logging facilities */
+int reload = 0;                        /* Global reloading flag */
+unsigned int debug;            /* Debugging flags */
+pid_t vrrp_child = -1;         /* VRRP child process ID */
+pid_t checkers_child = -1;     /* Healthcheckers child process ID */
+long wdog_delay_vrrp = 0;      /* VRRP child polling delay */
+long wdog_delay_check = 0;     /* Healthchecker child polling delay */
+conf_data *data;               /* Global configuration data */
 
 /* Build version */
+#define LOG_FACILITY_MAX       7
 #define PROG    "Keepalived"
 
-#define VERSION_CODE 0x010102
-#define DATE_CODE    0x080903
+#define VERSION_CODE 0x010103
+#define DATE_CODE    0x1D0903
 
 #define KEEPALIVED_VERSION(version)    \
        (version >> 16) & 0xFF,         \
index 242565f..c6b1767 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        pidfile.c include file.
  *
- * Version:     $Id: pidfile.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: pidfile.h,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index b8f860d..e4e04c4 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        smtp.c include file.
  *
- * Version:     $Id: smtp.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: smtp.h,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -92,6 +92,6 @@ typedef struct _smtp_thread_arg {
 
 /* Prototypes defs */
 extern void smtp_alert(thread_master *,
-                      real_server *, vrrp_rt *,  vrrp_sgroup *,
+                      real_server *, vrrp_rt *, vrrp_sgroup *,
                       const char *, const char *);
 #endif
index bafc78a..16731ea 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Part:        vrrp.c program include file.
  *
- * Version:     $Id: vrrp.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: vrrp.h,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -54,19 +54,19 @@ typedef struct {            /* rfc2338.5.1 */
 
 /* protocol constants */
 #define INADDR_VRRP_GROUP 0xe0000012   /* multicast addr - rfc2338.5.2.2 */
-#define VRRP_IP_TTL    255             /* in and out pkt ttl -- rfc2338.5.2.3 */
-#define IPPROTO_VRRP   112             /* IP protocol number -- rfc2338.5.2.4 */
-#define VRRP_VERSION   2               /* current version -- rfc2338.5.3.1 */
-#define VRRP_PKT_ADVERT        1               /* packet type -- rfc2338.5.3.2 */
-#define VRRP_PRIO_OWNER        255             /* priority of the ip owner -- rfc2338.5.3.4 */
-#define VRRP_PRIO_DFL  100             /* default priority -- rfc2338.5.3.4 */
-#define VRRP_PRIO_STOP 0               /* priority to stop -- rfc2338.5.3.4 */
-#define VRRP_AUTH_NONE 0               /* no authentification -- rfc2338.5.3.6 */
-#define VRRP_AUTH_PASS 1               /* password authentification -- rfc2338.5.3.6 */
-#define VRRP_AUTH_AH   2               /* AH(IPSec) authentification - rfc2338.5.3.6 */
-#define VRRP_ADVER_DFL 1               /* advert. interval (in sec) -- rfc2338.5.3.7 */
-#define VRRP_PREEMPT_DFL 1             /* rfc2338.6.1.2.Preempt_Mode */
-#define VRRP_GARP_DELAY 5              /* Default delay to launch gratuitous arp */
+#define VRRP_IP_TTL    255     /* in and out pkt ttl -- rfc2338.5.2.3 */
+#define IPPROTO_VRRP   112     /* IP protocol number -- rfc2338.5.2.4 */
+#define VRRP_VERSION   2       /* current version -- rfc2338.5.3.1 */
+#define VRRP_PKT_ADVERT        1       /* packet type -- rfc2338.5.3.2 */
+#define VRRP_PRIO_OWNER        255     /* priority of the ip owner -- rfc2338.5.3.4 */
+#define VRRP_PRIO_DFL  100     /* default priority -- rfc2338.5.3.4 */
+#define VRRP_PRIO_STOP 0       /* priority to stop -- rfc2338.5.3.4 */
+#define VRRP_AUTH_NONE 0       /* no authentification -- rfc2338.5.3.6 */
+#define VRRP_AUTH_PASS 1       /* password authentification -- rfc2338.5.3.6 */
+#define VRRP_AUTH_AH   2       /* AH(IPSec) authentification - rfc2338.5.3.6 */
+#define VRRP_ADVER_DFL 1       /* advert. interval (in sec) -- rfc2338.5.3.7 */
+#define VRRP_PREEMPT_DFL 1     /* rfc2338.6.1.2.Preempt_Mode */
+#define VRRP_GARP_DELAY (5 * TIMER_HZ) /* Default delay to launch gratuitous arp */
 
 /*
  * parameters per vrrp sync group. A vrrp_sync_group is a set
index 05e2f60..6aabf7b 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_arp.c include file.
  *
- * Version:     $Id: vrrp_arp.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: vrrp_arp.h,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
 
 /* types definition */
 typedef struct _m_arphdr {
-       unsigned short int ar_hrd;              /* Format of hardware address.  */
-       unsigned short int ar_pro;              /* Format of protocol address.  */
-       unsigned char ar_hln;                   /* Length of hardware address.  */
-       unsigned char ar_pln;                   /* Length of protocol address.  */
-       unsigned short int ar_op;               /* ARP opcode (command).  */
+       unsigned short int ar_hrd;      /* Format of hardware address.  */
+       unsigned short int ar_pro;      /* Format of protocol address.  */
+       unsigned char ar_hln;   /* Length of hardware address.  */
+       unsigned char ar_pln;   /* Length of protocol address.  */
+       unsigned short int ar_op;       /* ARP opcode (command).  */
 
        /* Ethernet looks like this : This bit is variable sized however...  */
        unsigned char __ar_sha[ETH_ALEN];       /* Sender hardware address.  */
-       unsigned char __ar_sip[4];              /* Sender IP address.  */
+       unsigned char __ar_sip[4];      /* Sender IP address.  */
        unsigned char __ar_tha[ETH_ALEN];       /* Target hardware address.  */
-       unsigned char __ar_tip[4];              /* Target IP address.  */
+       unsigned char __ar_tip[4];      /* Target IP address.  */
 } m_arphdr;
 
 /* Global var */
@@ -59,6 +59,6 @@ int garp_fd;
 /* prototypes */
 extern void gratuitous_arp_init(void);
 extern void gratuitous_arp_close(void);
-extern int send_gratuitous_arp(ip_address *ipaddress);
+extern int send_gratuitous_arp(ip_address * ipaddress);
 
 #endif
index ad27fcc..8f4eb1b 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_daemon.c include file.
  * 
- * Version:     $Id: vrrp_daemon.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: vrrp_daemon.h,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
index eb07473..6a5a725 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Dynamic data structure definition.
  *
- * Version:     $Id: vrrp_data.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: vrrp_data.h,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 37d57e7..b42fc92 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_if.c include file.
  *
- * Version:     $Id: vrrp_if.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: vrrp_if.h,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -49,7 +49,7 @@
 #define IF_HWADDR_MAX 20       /* Max MAC address length size */
 #define ARPHRD_ETHER 1
 #define ARPHRD_LOOPBACK 772
-#define POLLING_DELAY 1
+#define POLLING_DELAY TIMER_HZ
 
 /* Interface Linkbeat code selection */
 #define LB_IOCTL   0x1
 /* Interface structure definition */
 typedef struct _interface {
        char ifname[IF_NAMESIZ + 1];    /* Interface name */
-       unsigned int ifindex;           /* Interface index */
-       uint32_t address;               /* Interface main primary IP address */
-       unsigned long flags;            /* flags */
-       unsigned int mtu;               /* MTU for this interface */
-       unsigned short hw_type;         /* Type of hardware address */
+       unsigned int ifindex;   /* Interface index */
+       uint32_t address;       /* Interface main primary IP address */
+       unsigned long flags;    /* flags */
+       unsigned int mtu;       /* MTU for this interface */
+       unsigned short hw_type; /* Type of hardware address */
        u_char hw_addr[IF_HWADDR_MAX];  /* MAC address */
-       int hw_addr_len;                /* MAC addresss length */
-       int lb_type;                    /* Interface regs selection */
-       int linkbeat;                   /* LinkBeat from MII BMSR req */
+       int hw_addr_len;        /* MAC addresss length */
+       int lb_type;            /* Interface regs selection */
+       int linkbeat;           /* LinkBeat from MII BMSR req */
 } interface;
 
 /* Global interface queue */
@@ -98,9 +98,9 @@ extern int if_monitor_thread(thread * thread);
 extern void init_interface_queue(void);
 extern void free_interface_queue(void);
 extern void dump_if(void *data);
-extern int if_join_vrrp_group(int sd, interface *ifp, int proto);
-extern void if_leave_vrrp_group(int sd, interface *ifp);
-extern int if_setsockopt_bindtodevice(int sd, interface *ifp);
+extern int if_join_vrrp_group(int sd, interface * ifp, int proto);
+extern void if_leave_vrrp_group(int sd, interface * ifp);
+extern int if_setsockopt_bindtodevice(int sd, interface * ifp);
 extern int if_setsockopt_hdrincl(int sd);
 extern int if_setsockopt_mcast_loop(int sd);
 
index 5314f87..dbf3315 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_index.c include file.
  *
- * Version:     $Id: vrrp_index.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: vrrp_index.h,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 34c3c3e..0eb4f92 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_ipaddress.c include file.
  *
- * Version:     $Id: vrrp_ipaddress.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: vrrp_ipaddress.h,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -40,6 +40,7 @@
 /* types definition */
 typedef struct {
        uint32_t addr;          /* the ip address */
+       uint32_t broadcast;     /* the broadcast address */
        uint8_t mask;           /* the ip address CIDR netmask */
        int ifindex;            /* Interface index owning IP address */
        interface *ifp;         /* Interface owning IP address */
@@ -58,11 +59,11 @@ typedef struct {
                        (X)->scope   == (Y)->scope)
 
 /* prototypes */
-extern int netlink_address_ipv4(ip_address *ipaddr, int cmd);
+extern int netlink_address_ipv4(ip_address * ipaddr, int cmd);
 extern void netlink_iplist_ipv4(list ip_list, int cmd);
 extern void free_ipaddress(void *data);
 extern void dump_ipaddress(void *data);
-extern void alloc_ipaddress(list ip_list, vector strvec, interface *ifp);
+extern void alloc_ipaddress(list ip_list, vector strvec, interface * ifp);
 extern void clear_diff_address(list l, list n);
 extern void clear_diff_saddresses(void);
 
index a2c11c3..7f46463 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_iproute.c include file.
  *
- * Version:     $Id: vrrp_iproute.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: vrrp_iproute.h,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index cb72042..f534e99 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_ipsecah.c include file.
  * 
- * Version:     $Id: vrrp_ipsecah.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: vrrp_ipsecah.h,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
index cef19b2..a5232c4 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_netlink.c include file.
  *
- * Version:     $Id: vrrp_netlink.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: vrrp_netlink.h,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -35,6 +35,9 @@
 #include <linux/netlink.h>
 #include <linux/rtnetlink.h>
 
+/* local includes */
+#include "timer.h"
+
 /* types definitions */
 struct nl_handle {
        int fd;
@@ -43,7 +46,7 @@ struct nl_handle {
 };
 
 /* Define types */
-#define NETLINK_TIMER 30
+#define NETLINK_TIMER (30 * TIMER_HZ)
 
 /* Our global netlink handler */
 struct nl_handle nl_kernel;    /* Kernel reflection channel */
index b6844e4..2d45530 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Part:        vrrp_notify.c include file.
  *
- * Version:     $Id: vrrp_notify.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: vrrp_notify.h,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index e6e4d83..2c13f17 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        vrrp_parser.c include file.
  *  
- * Version:     $Id: vrrp_parser.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: vrrp_parser.h,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index c0fdca2..178842a 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_scheduler.c include file.
  * 
- * Version:     $Id: vrrp_scheduler.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: vrrp_scheduler.h,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
index c921681..dd265db 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_sync.c include file.
  * 
- * Version:     $Id: vrrp_sync.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: vrrp_sync.h,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -44,6 +44,7 @@
 
 /* extern prototypes */
 extern void vrrp_init_instance_sands(vrrp_rt *);
+extern void vrrp_sync_smtp_notifier(vrrp_sgroup *);
 extern void vrrp_sync_set_group(vrrp_sgroup *);
 extern int vrrp_sync_group_up(vrrp_sgroup *);
 extern int vrrp_sync_leave_fault(vrrp_rt *);
index 4e59e73..8067f2a 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_track.c include file.
  *
- * Version:     $Id: vrrp_track.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: vrrp_track.h,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index a0da6f0..6036498 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.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: vrrp.c,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 899115c..2505e06 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        ARP primitives.
  *
- * Version:     $Id: vrrp_arp.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: vrrp_arp.c,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index e39b2da..e07c013 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        VRRP child process handling.
  *
- * Version:     $Id: vrrp_daemon.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: vrrp_daemon.c,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -235,7 +235,7 @@ start_vrrp_child(void)
                               , strerror(errno));
                return -1;
        } else if (pid) {
-               int poll_delay = (wdog_delay_vrrp) ? wdog_delay_vrrp : WATCHDOG_DELAY;
+               long poll_delay = (wdog_delay_vrrp) ? wdog_delay_vrrp : WATCHDOG_DELAY;
                vrrp_child = pid;
                syslog(LOG_INFO, "Starting VRRP child process, pid=%d"
                               , pid);
index aac721d..d462e31 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Dynamic data structure definition.
  *
- * Version:     $Id: vrrp_data.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: vrrp_data.c,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -131,7 +131,8 @@ dump_vrrp(void *data)
                syslog(LOG_INFO, "   Runing LVS sync daemon on interface = %s",
                       vrrp->lvs_syncd_if);
        if (vrrp->garp_delay)
-               syslog(LOG_INFO, "   Gratuitous ARP delay = %d", vrrp->garp_delay);
+               syslog(LOG_INFO, "   Gratuitous ARP delay = %d",
+                      vrrp->garp_delay/TIMER_HZ);
        syslog(LOG_INFO, "   Virtual Router ID = %d", vrrp->vrid);
        syslog(LOG_INFO, "   Priority = %d", vrrp->priority);
        syslog(LOG_INFO, "   Advert interval = %dsec",
@@ -185,7 +186,7 @@ alloc_vrrp_sync_group(char *gname)
        /* Allocate new VRRP group structure */
        new = (vrrp_sgroup *) MALLOC(sizeof (vrrp_sgroup));
        new->gname = (char *) MALLOC(size + 1);
-       new->state = VRRP_STATE_BACK;
+       new->state = VRRP_STATE_INIT;
        memcpy(new->gname, gname, size);
 
        list_add(vrrp_data->vrrp_sync_group, new);
index dd45bf9..39d6218 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Interfaces manipulation.
  *
- * Version:     $Id: vrrp_if.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: vrrp_if.c,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 7219e86..0eb93bf 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        VRRP instance index table.
  *
- * Version:     $Id: vrrp_index.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: vrrp_index.c,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index d632600..95869f8 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        NETLINK IPv4 address manipulation.
  *
- * Version:     $Id: vrrp_ipaddress.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: vrrp_ipaddress.c,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -54,6 +54,9 @@ netlink_address_ipv4(ip_address *ipaddr, int cmd)
        req.ifa.ifa_scope = ipaddr->scope;
        req.ifa.ifa_prefixlen = ipaddr->mask;
        addattr_l(&req.n, sizeof (req), IFA_LOCAL, &ipaddr->addr, sizeof (ipaddr->addr));
+       if (ipaddr->broadcast)
+               addattr_l(&req.n, sizeof (req), IFA_BROADCAST,
+                         &ipaddr->broadcast, sizeof (ipaddr->broadcast));
 
        if (netlink_talk(&nl_cmd, &req.n) < 0)
                status = -1;
@@ -93,9 +96,10 @@ void
 dump_ipaddress(void *data)
 {
        ip_address *ip_addr = data;
-       syslog(LOG_INFO, "     %s/%d dev %s scope %s"
+       syslog(LOG_INFO, "     %s/%d brd %s dev %s scope %s"
               , inet_ntop2(ip_addr->addr)
               , ip_addr->mask
+              , inet_ntop2(ip_addr->broadcast)
               , IF_NAME(if_get_by_ifindex(ip_addr->ifindex))
               , netlink_scope_n2a(ip_addr->scope));
 }
@@ -126,6 +130,8 @@ alloc_ipaddress(list ip_list, vector strvec, interface *ifp)
                        new->ifindex = IF_INDEX(new->ifp);
                } else if (!strcmp(str, "scope")) {
                        new->scope = netlink_scope_a2n(VECTOR_SLOT(strvec, ++i));
+               } else if (!strcmp(str, "broadcast") || !strcmp(str, "brd")) {
+                       inet_ston(VECTOR_SLOT(strvec, ++i), &new->broadcast);
                } else {
                        if (inet_ston(VECTOR_SLOT(strvec, i), &ipaddr)) {
                                inet_ston(VECTOR_SLOT(strvec, i), &new->addr);
index 7038044..98859e9 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        NETLINK IPv4 routes manipulation.
  *
- * Version:     $Id: vrrp_iproute.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: vrrp_iproute.c,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index ebbb2ab..3c4579e 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.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: vrrp_ipsecah.c,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 23e255f..2dab1d6 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        NETLINK kernel command channel.
  *
- * Version:     $Id: vrrp_netlink.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: vrrp_netlink.c,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index c6d9776..2701c80 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        VRRP state transition notification scripts handling.
  *
- * Version:     $Id: vrrp_notify.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: vrrp_notify.c,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -111,6 +111,10 @@ script_open(char *script)
 static int
 notify_script_exec(char* script, char *type, int state_num, char* name)
 {
+       char *state = "{UNKNOWN}";
+       char *command_line = NULL;
+       int size = 0;
+
        /*
         * Determine the length of the buffer that we'll need to generate the command
         * to run:
@@ -133,20 +137,19 @@ notify_script_exec(char* script, char *type, int state_num, char* name)
         *
         *     strlen(script) + strlen(type) + strlen(state) + strlen(name) + 8
         */
-
-       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);
+       size = strlen(script) + strlen(type) + strlen(state) + strlen(name) + 8;
+       command_line = MALLOC(size);
        if (!command_line)
                return 0;
 
        /* Launch the script */
+       snprintf(command_line, size, "\"%s\" %s \"%s\" %s",script, type, name, state);
        notify_exec(command_line);
        FREE(command_line);
        return 1;
index 1b7b1ba..9ea1c67 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.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: vrrp_parser.c,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -242,7 +242,7 @@ static void
 vrrp_garp_delay_handler(vector strvec)
 {
        vrrp_rt *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
-       vrrp->garp_delay = atoi(VECTOR_SLOT(strvec, 1));
+       vrrp->garp_delay = atoi(VECTOR_SLOT(strvec, 1)) * TIMER_HZ;
 }
 static void
 vrrp_auth_type_handler(vector strvec)
index 224bfc2..35b86bb 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Sheduling framework for vrrp code.
  *
- * Version:     $Id: vrrp_scheduler.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: vrrp_scheduler.c,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -178,6 +178,7 @@ static void
 vrrp_init_state(list l)
 {
        vrrp_rt *vrrp;
+       vrrp_sgroup *vgroup;
        element e;
 
        for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) {
@@ -203,7 +204,20 @@ vrrp_init_state(list l)
 #endif
                        syslog(LOG_INFO, "VRRP_Instance(%s) Entering BACKUP STATE",
                               vrrp->iname);
+
+                       /* Set BACKUP state */
                        vrrp->state = VRRP_STATE_BACK;
+                       vrrp_smtp_notifier(vrrp);
+                       notify_instance_exec(vrrp, VRRP_STATE_BACK);
+
+                       /* Init group if needed  */
+                       if ((vgroup = vrrp->sync)) {
+                               if (GROUP_STATE(vgroup) != VRRP_STATE_BACK) {
+                                       vgroup->state = VRRP_STATE_BACK;
+                                       vrrp_sync_smtp_notifier(vgroup);
+                                       notify_group_exec(vgroup, VRRP_STATE_BACK);
+                               }
+                       }
                }
        }
 }
@@ -788,7 +802,6 @@ vrrp_read_dispatcher_thread(thread * thread)
 
        /* register next dispatcher thread */
        vrrp_timer = vrrp_timer_fd(fd);
-       TIMER_MICRO_ADJUST(vrrp_timer);
        if (fd == -1)
                thread_add_timer(thread->master, vrrp_read_dispatcher_thread,
                                 (int *)THREAD_TIMER, vrrp_timer);
index 6ed798b..981e0e8 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        VRRP synchronization framework.
  *
- * Version:     $Id: vrrp_sync.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: vrrp_sync.c,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -38,35 +38,16 @@ vrrp_init_instance_sands(vrrp_rt * vrrp)
 {
        TIMEVAL timer = timer_now();
 
-       /*
-        * We only make timer auto-recalibration while being in
-        * master state. Other state are transtions so recalibration
-        * is not needed. Here we estimate the VRRP advert time
-        * handling and substract it to new computed timer.
-        * We just take care to the usec sub timer and not sec one
-        * to not conflict scheduling decision.
-        */
-       if (vrrp->state == VRRP_STATE_MAST) {
-               long usec;
-               usec = timer.tv_usec - vrrp->sands.tv_usec;
-               vrrp->sands.tv_sec = timer.tv_sec + vrrp->adver_int / TIMER_HZ;
-               vrrp->sands.tv_usec = timer.tv_usec;
-               if (usec > 0)
-                       vrrp->sands.tv_usec -= usec;
-               return;
-       }
-
-       if (vrrp->state == VRRP_STATE_GOTO_MASTER ||
+       if (vrrp->state == VRRP_STATE_MAST        ||
+           vrrp->state == VRRP_STATE_GOTO_MASTER ||
            vrrp->state == VRRP_STATE_GOTO_FAULT) {
                vrrp->sands.tv_sec = timer.tv_sec + vrrp->adver_int / TIMER_HZ;
                vrrp->sands.tv_usec = timer.tv_usec;
                return;
        }
 
-       if (vrrp->state == VRRP_STATE_BACK || vrrp->state == VRRP_STATE_FAULT) {
-               vrrp->sands.tv_sec = timer.tv_sec + vrrp->ms_down_timer / TIMER_HZ;
-               vrrp->sands.tv_usec = timer.tv_usec + vrrp->ms_down_timer % TIMER_HZ;
-       }
+       if (vrrp->state == VRRP_STATE_BACK || vrrp->state == VRRP_STATE_FAULT)
+               vrrp->sands = timer_add_long(timer, vrrp->ms_down_timer);
 }
 
 /* Instance name lookup */
@@ -129,7 +110,7 @@ vrrp_sync_group_up(vrrp_sgroup * vgroup)
 }
 
 /* SMTP alert group notifier */
-static void
+void
 vrrp_sync_smtp_notifier(vrrp_sgroup *vgroup)
 {
        if (vgroup->smtp_alert) {
@@ -172,7 +153,7 @@ vrrp_sync_master_election(vrrp_rt * vrrp)
                return;
 
        syslog(LOG_INFO, "VRRP_Group(%s) Transition to MASTER state",
-              GROUP_NAME(vrrp->sync));
+              GROUP_NAME(vgroup));
 
        /* Perform sync index */
        for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) {
@@ -196,13 +177,16 @@ vrrp_sync_backup(vrrp_rt * vrrp)
        list l = vgroup->index;
        element e;
 
+       if (GROUP_STATE(vgroup) == VRRP_STATE_BACK)
+               return;
+
        syslog(LOG_INFO, "VRRP_Group(%s) Syncing instances to BACKUP state",
               GROUP_NAME(vgroup));
 
        /* Perform sync index */
        for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) {
                isync = ELEMENT_DATA(e);
-               if (isync != vrrp) {
+               if (isync != vrrp && isync->state != VRRP_STATE_BACK) {
                        isync->wantstate = VRRP_STATE_BACK;
                        vrrp_state_leave_master(isync);
                        vrrp_init_instance_sands(isync);
@@ -221,18 +205,18 @@ vrrp_sync_master(vrrp_rt * vrrp)
        list l = vgroup->index;
        element e;
 
-       if (GROUP_STATE(vrrp->sync) == VRRP_STATE_MAST)
+       if (GROUP_STATE(vgroup) == VRRP_STATE_MAST)
                return;
 
        syslog(LOG_INFO, "VRRP_Group(%s) Syncing instances to MASTER state",
-              GROUP_NAME(vrrp->sync));
+              GROUP_NAME(vgroup));
 
        /* Perform sync index */
        for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) {
                isync = ELEMENT_DATA(e);
 
                /* Send the higher priority advert on all synced instances */
-               if (isync != vrrp) {
+               if (isync != vrrp && isync->state != VRRP_STATE_MAST) {
                        isync->wantstate = VRRP_STATE_MAST;
                        vrrp_state_goto_master(isync);
                        vrrp_init_instance_sands(isync);
@@ -251,11 +235,11 @@ vrrp_sync_fault(vrrp_rt * vrrp)
        list l = vgroup->index;
        element e;
 
-       if (GROUP_STATE(vrrp->sync) == VRRP_STATE_FAULT)
+       if (GROUP_STATE(vgroup) == VRRP_STATE_FAULT)
                return;
 
        syslog(LOG_INFO, "VRRP_Group(%s) Syncing instances to FAULT state",
-              GROUP_NAME(vrrp->sync));
+              GROUP_NAME(vgroup));
 
        /* Perform sync index */
        for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) {
@@ -267,7 +251,7 @@ vrrp_sync_fault(vrrp_rt * vrrp)
                 * => by default ms_down_timer is set to 3secs.
                 * => Takeover will be less than 3secs !
                 */
-               if (isync != vrrp) {
+               if (isync != vrrp && isync->state != VRRP_STATE_FAULT) {
                        if (isync->state == VRRP_STATE_MAST)
                                isync->wantstate = VRRP_STATE_GOTO_FAULT;
                        if (isync->state == VRRP_STATE_BACK)
index 9925944..fc531ef 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Interface tracking framework.
  *
- * Version:     $Id: vrrp_track.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: vrrp_track.c,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index b157def..1d44568 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        HTML stream parser utility functions.
  *
- * Version:     $Id: html.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: html.c,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *
index f28827d..2b24dbb 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        parser.c include file.
  *
- * Version:     $Id: html.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: html.h,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *
index 662ad98..ef299ed 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        List structure manipulation.
  *  
- * Version:     $Id: list.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: list.c,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
index a3a579e..a82d648 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        list.c include file.
  *  
- * Version:     $Id: list.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: list.h,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 18ed880..cdc17c0 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.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: memory.c,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
index 606a183..a3a31d4 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        memory.c include file.
  *
- * Version:     $Id: memory.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: memory.h,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
index 7393cd7..ee6a0e3 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Forked system call to launch an extra script.
  *
- * Version:     $Id: notify.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: notify.c,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 36c1945..44ac835 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        notify.c include file.
  *
- * Version:     $Id: notify.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: notify.h,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 25af2ed..7a8986c 100644 (file)
@@ -7,7 +7,7 @@
  *              data structure representation the conf file representing
  *              the loadbalanced server pool.
  *  
- * Version:     $Id: parser.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: parser.c,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
index 9cd04ed..ef2be2d 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        cfreader.c include file.
  *  
- * Version:     $Id: parser.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: parser.h,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index d7c71e5..edb4a5a 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.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: scheduler.c,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -216,7 +216,6 @@ thread_add_read(thread_master * m, int (*func) (thread *)
                , void *arg, int fd, long timer)
 {
        thread *thread;
-       TIMEVAL time_now;
 
        assert(m != NULL);
 
@@ -235,14 +234,7 @@ thread_add_read(thread_master * m, int (*func) (thread *)
        thread->u.fd = fd;
 
        /* Compute read timeout value */
-       time_now = timer_now();
-       if (timer >= TIMER_MAX_SEC) {
-               time_now.tv_sec += timer / TIMER_HZ;
-               time_now.tv_usec += timer % TIMER_HZ;
-       } else
-               time_now.tv_sec += timer;
-
-       thread->sands = time_now;
+       thread->sands = timer_add_long(timer_now(), timer);
 
        /* Sort the thread. */
        thread_list_add_timeval(&m->read, thread);
@@ -256,7 +248,6 @@ thread_add_write(thread_master * m, int (*func) (thread *)
                 , void *arg, int fd, long timer)
 {
        thread *thread;
-       TIMEVAL time_now;
 
        assert(m != NULL);
 
@@ -275,14 +266,7 @@ thread_add_write(thread_master * m, int (*func) (thread *)
        thread->u.fd = fd;
 
        /* Compute write timeout value */
-       time_now = timer_now();
-       if (timer >= TIMER_MAX_SEC) {
-               time_now.tv_sec += timer / TIMER_HZ;
-               time_now.tv_usec += timer % TIMER_HZ;
-       } else
-               time_now.tv_sec += timer;
-
-       thread->sands = time_now;
+       thread->sands = timer_add_long(timer_now(), timer);
 
        /* Sort the thread. */
        thread_list_add_timeval(&m->write, thread);
@@ -296,7 +280,6 @@ thread_add_timer(thread_master * m, int (*func) (thread *)
                 , void *arg, long timer)
 {
        thread *thread;
-       TIMEVAL time_now;
 
        assert(m != NULL);
 
@@ -308,14 +291,7 @@ thread_add_timer(thread_master * m, int (*func) (thread *)
        thread->arg = arg;
 
        /* Do we need jitter here? */
-       time_now = timer_now();
-       if (timer >= TIMER_MAX_SEC) {
-               time_now.tv_sec += timer / TIMER_HZ;
-               time_now.tv_usec += timer % TIMER_HZ;
-       } else
-               time_now.tv_sec += timer;
-
-       thread->sands = time_now;
+       thread->sands = timer_add_long(timer_now(), timer);
 
        /* Sort by timeval. */
        thread_list_add_timeval(&m->timer, thread);
@@ -329,7 +305,6 @@ thread_add_child(thread_master * m, int (*func) (thread *)
                 , void * arg, pid_t pid, long timer)
 {
        thread *thread;
-       TIMEVAL time_now;
 
        assert(m != NULL);
 
@@ -343,14 +318,7 @@ thread_add_child(thread_master * m, int (*func) (thread *)
        thread->u.c.status = 0;
 
        /* Compute write timeout value */
-       time_now = timer_now();
-       if (timer >= TIMER_MAX_SEC) {
-               time_now.tv_sec += timer / TIMER_HZ;
-               time_now.tv_usec += timer % TIMER_HZ;
-       } else
-               time_now.tv_sec += timer;
-
-       thread->sands = time_now;
+       thread->sands = timer_add_long(timer_now(), timer);
 
        /* Sort by timeval. */
        thread_list_add_timeval(&m->child, thread);
@@ -488,6 +456,14 @@ thread_compute_timer(thread_master * m, TIMEVAL * timer_wait)
                        timer_min = m->read.head->sands;
        }
 
+       if (m->child.head) {
+               if (!TIMER_ISNULL(timer_min)) {
+                       if (timer_cmp(m->child.head->sands, timer_min) <= 0)
+                               timer_min = m->child.head->sands;
+               } else
+                       timer_min = m->child.head->sands;
+       }
+
        if (!TIMER_ISNULL(timer_min)) {
                timer_min = timer_sub(timer_min, time_now);
                if (timer_min.tv_sec < 0) {
index 7902046..ebd6ec9 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        scheduler.c include file.
  *
- * Version:     $Id: scheduler.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: scheduler.h,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -92,7 +92,7 @@ typedef struct _thread_master {
 
 
 /* MICRO SEC def */
-#define BOOTSTRAP_DELAY 1
+#define BOOTSTRAP_DELAY TIMER_HZ
 
 /* Macros. */
 #define THREAD_ARG(X) ((X)->arg)
index ab0e609..da6f5ea 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        Timer manipulations.
  *  
- * Version:     $Id: timer.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: timer.c,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -71,6 +71,24 @@ timer_sub(TIMEVAL a, TIMEVAL b)
        return ret;
 }
 
+/* timer add */
+TIMEVAL
+timer_add_long(TIMEVAL a, long b)
+{
+       TIMEVAL ret;
+
+       TIMER_RESET(ret);
+       ret.tv_usec = a.tv_usec + b % TIMER_HZ;
+       ret.tv_sec = a.tv_sec + b / TIMER_HZ;
+
+       if (ret.tv_usec >= TIMER_HZ) {
+               ret.tv_sec++;
+               ret.tv_usec -= TIMER_HZ;
+       }
+
+       return ret;
+}
+
 /* current time */
 TIMEVAL
 timer_now(void)
index 8397c27..eea0bde 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        timer.c include file.
  *  
- * Version:     $Id: timer.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: timer.h,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -33,15 +33,16 @@ typedef struct timeval TIMEVAL;
 #define TIMER_HZ      1000000
 #define TIMER_MAX_SEC 1000
 #define TIMER_SEC(T) ((T).tv_sec)
+#define TIMER_LONG(T) ((T).tv_sec * TIMER_HZ + (T).tv_usec)
 #define TIMER_ISNULL(T) ((T).tv_sec == 0 && (T).tv_usec == 0)
 #define TIMER_RESET(T) (memset(&(T), 0, sizeof(struct timeval)))
-#define TIMER_MICRO_ADJUST(T) ((T) = ((T) < TIMER_MAX_SEC)?TIMER_MAX_SEC:(T))
 
 /* prototypes */
 extern TIMEVAL timer_now(void);
 extern TIMEVAL timer_dup(TIMEVAL b);
 extern int timer_cmp(TIMEVAL a, TIMEVAL b);
 extern TIMEVAL timer_sub(TIMEVAL a, TIMEVAL b);
+extern TIMEVAL timer_add_long(TIMEVAL a, long b);
 extern TIMEVAL timer_sub_now(TIMEVAL a);
 extern void timer_dump(TIMEVAL a);
 extern unsigned long timer_tol(TIMEVAL a);
index 2161465..7237468 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        General program utils.
  *
- * Version:     $Id: utils.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: utils.c,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 92e0a34..3a5c962 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        utils.h include file.
  *
- * Version:     $Id: utils.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: utils.h,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 669b78f..ab28aa4 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        Vector structure manipulation.
  *  
- * Version:     $Id: vector.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: vector.c,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
index d540da9..5f5f34f 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        vector.c include file.
  *  
- * Version:     $Id: vector.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: vector.h,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 2f57ee4..8b67d0d 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        Software watchdog framework.
  *  
- * Version:     $Id: watchdog.c,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: watchdog.c,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
index 7e14f98..bb4f132 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        watchdog.c include file.
  *  
- * Version:     $Id: watchdog.h,v 1.1.2 2003/09/08 01:18:41 acassen Exp $
+ * Version:     $Id: watchdog.h,v 1.1.3 2003/09/29 02:37:13 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -39,7 +39,7 @@ typedef struct _wdog_data {
 
 /* watchdog definition */
 #define WATCHDOG_TIMER         30
-#define WATCHDOG_DELAY         5
+#define WATCHDOG_DELAY         (5 * TIMER_HZ)
 #define WATCHDOG_STRING                "hello"
 #define WDOG_READ_BUFSIZ       32