keepalived-1.1.17 v1.1.17
authorAlexandre Cassen <acassen@freebox.fr>
Thu, 5 Mar 2009 08:22:25 +0000 (09:22 +0100)
committerAlexandre Cassen <acassen@freebox.fr>
Mon, 28 Sep 2009 08:59:02 +0000 (10:59 +0200)
* keepalived-1.1.17 released.
* Fixed low-level scheduler timer computation to take care to
  monothonic computation. Select returns if timer is null!
* VRRP : Fixed vrrp script initialization to use event thread
  instead of timer thread so that script no longer need to
  wait until first polling timer fired.
* VRRP : Willy and I fixed MII media link failure detection
  to test SIOCGMIIREG call before fetching BMSR.
* VRRP : Resurected VRRP_STATE_GOTO_FAULT. This state is
  really needed to speed-up convergence and prevent against
  any issue while using vrrp_sync_group.

94 files changed:
ChangeLog
VERSION
keepalived.spec.in
keepalived/check/check_api.c
keepalived/check/check_daemon.c
keepalived/check/check_data.c
keepalived/check/check_http.c
keepalived/check/check_misc.c
keepalived/check/check_parser.c
keepalived/check/check_smtp.c
keepalived/check/check_ssl.c
keepalived/check/check_tcp.c
keepalived/check/ipfwwrapper.c
keepalived/check/ipvswrapper.c
keepalived/check/ipwrapper.c
keepalived/core/daemon.c
keepalived/core/global_data.c
keepalived/core/global_parser.c
keepalived/core/layer4.c
keepalived/core/main.c
keepalived/core/pidfile.c
keepalived/core/smtp.c
keepalived/include/check_api.h
keepalived/include/check_daemon.h
keepalived/include/check_data.h
keepalived/include/check_http.h
keepalived/include/check_misc.h
keepalived/include/check_parser.h
keepalived/include/check_smtp.h
keepalived/include/check_ssl.h
keepalived/include/check_tcp.h
keepalived/include/config.h.in
keepalived/include/daemon.h
keepalived/include/global_data.h
keepalived/include/global_parser.h
keepalived/include/ipfwwrapper.h
keepalived/include/ipvswrapper.h
keepalived/include/ipwrapper.h
keepalived/include/layer4.h
keepalived/include/main.h
keepalived/include/pidfile.h
keepalived/include/smtp.h
keepalived/include/vrrp.h
keepalived/include/vrrp_arp.h
keepalived/include/vrrp_daemon.h
keepalived/include/vrrp_data.h
keepalived/include/vrrp_if.h
keepalived/include/vrrp_index.h
keepalived/include/vrrp_ipaddress.h
keepalived/include/vrrp_iproute.h
keepalived/include/vrrp_ipsecah.h
keepalived/include/vrrp_netlink.h
keepalived/include/vrrp_notify.h
keepalived/include/vrrp_parser.h
keepalived/include/vrrp_scheduler.h
keepalived/include/vrrp_sync.h
keepalived/include/vrrp_track.h
keepalived/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/logger.c
lib/logger.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/signals.c
lib/signals.h
lib/timer.c
lib/timer.h
lib/utils.c
lib/utils.h
lib/vector.c
lib/vector.h

index ab30547..33794e6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2009-03-05  Alexandre Cassen  <acassen@linux-vs.org>
+       * keepalived-1.1.17 released.
+       * Fixed low-level scheduler timer computation to take care to
+         monothonic computation. Select returns if timer is null!
+       * VRRP : Fixed vrrp script initialization to use event thread
+         instead of timer thread so that script no longer need to
+         wait until first polling timer fired.
+       * VRRP : Willy and I fixed MII media link failure detection
+         to test SIOCGMIIREG call before fetching BMSR.
+       * VRRP : Resurected VRRP_STATE_GOTO_FAULT. This state is
+         really needed to speed-up convergence and prevent against
+         any issue while using vrrp_sync_group.
+
 2009-02-15  Alexandre Cassen  <acassen@linux-vs.org>
        * keepalived-1.1.16 released.
        * Code clean-up.
diff --git a/VERSION b/VERSION
index 63b283b..cbb8cba 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.1.16
+1.1.17
index 6b4f287..a60cc74 100644 (file)
@@ -6,7 +6,7 @@
 
 Summary: HA monitor built upon LVS, VRRP and services poller
 Name: keepalived
-Version: 1.1.15
+Version: 1.1.17
 Release: 5
 License: GPL
 Group: Applications/System
index 7a526ca..caa0b58 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Checkers registration.
  *
- * Version:     $Id: check_api.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: check_api.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index aed209b..d3522eb 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Healthcheckrs child process handling.
  *
- * Version:     $Id: check_daemon.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: check_daemon.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index ce34ff5..2e1a8e0 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Healthcheckers dynamic data structure definition.
  *
- * Version:     $Id: check_data.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: check_data.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 5c7c922..5ed2dc1 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        WEB CHECK. Common HTTP/SSL checker primitives.
  *
- * Version:     $Id: check_http.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: check_http.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
index 2f49347..f3fec65 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.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: check_misc.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Eric Jarman, <ehj38230@cmsu2.cmsu.edu>
index 2156049..c6d7c97 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.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: check_parser.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
index c828d20..97ea445 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        SMTP CHECK. Check an SMTP-server.
  *
- * Version:     $Id: check_smtp.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: check_smtp.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Authors:     Jeremy Rumpf, <jrumpf@heavyload.net>
  *              Alexandre Cassen, <acassen@linux-vs.org>
index 6877cd0..6617a47 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.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: check_ssl.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
index fd2eeea..7b5a59a 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        TCP checker.
  *
- * Version:     $Id: check_tcp.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: check_tcp.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index b4f4a41..e1d2a62 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.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: ipfwwrapper.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 77fd2d0..6411e18 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.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: ipvswrapper.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
index b500624..d7ed3dd 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Manipulation functions for IPVS & IPFW wrappers.
  *
- * Version:     $Id: ipwrapper.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: ipwrapper.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 9f2d06b..32294e5 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Main program structure.
  *
- * Version:     $Id: main.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: main.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index a197789..6d3b568 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Dynamic data structure definition.
  *
- * Version:     $Id: global_data.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: global_data.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 2522aa5..4245f16 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.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: global_parser.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
index e5e43f6..0377e9c 100644 (file)
@@ -6,7 +6,7 @@
  * Part:        Layer4 checkers handling. Register worker threads &
  *              upper layer checkers.
  *
- * Version:     $Id: layer4.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: layer4.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 21c8fd2..bb94a87 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Main program structure.
  *
- * Version:     $Id: main.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: main.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 54f2e16..39434e9 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        pidfile utility.
  *
- * Version:     $Id: pidfile.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: pidfile.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 3f0515f..b8e6d2b 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.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: smtp.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 5856f08..3128766 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Checkers arguments structures definitions.
  *
- * Version:     $Id: check_api.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: check_api.h,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 5326fb0..ee162a9 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_daemon.c include file.
  * 
- * Version:     $Id: check_daemon.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: check_daemon.h,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
index 9a63f3d..79ac0d9 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Healthcheckers dynamic data structure definition.
  *
- * Version:     $Id: check_data.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: check_data.h,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 2244c1c..fcfc5d2 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_http.c include file.
  *
- * Version:     $Id: check_http.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: check_http.h,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
index dbad4de..5429632 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_misc.c include file.
  *
- * Version:     $Id: check_misc.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: check_misc.h,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              Eric Jarman, <ehj38230@cmsu2.cmsu.edu>
index dfc06f3..858d3c3 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        check_parser.c include file.
  *  
- * Version:     $Id: check_parser.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: check_parser.h,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 5bde6da..00a93f6 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_smtp.c include file.
  *
- * Version:     $Id: check_smtp.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: check_smtp.h,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              Jeremy Rumpf, <jrumpf@heavyload.net>
index 91e8abc..6d730e5 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_http.c include file.
  *
- * Version:     $Id: check_http.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: check_http.h,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
index 2e0125c..7ee245c 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        check_tcp.c include file.
  *
- * Version:     $Id: check_tcp.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: check_tcp.h,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 02ad719..04edbf2 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Configuration include file.
  *
- * Version:     $Id: config.h.in,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: config.h.in,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Jacob Rief, <jacob.rief@tiscover.com>
  *
index 924cc79..13d322a 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Daemon process handling.
  *
- * Version:     $Id: daemon.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: daemon.h,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 8c106e2..492ff87 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Dynamic data structure definition.
  *
- * Version:     $Id: global_data.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: global_data.h,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index ade4d47..3ea971b 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        vrrp_parser.c include file.
  *  
- * Version:     $Id: global_parser.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: global_parser.h,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 2333f24..b83efe6 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        ipfwwrapper.c include file.
  *
- * Version:     $Id: ipfwwrapper.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: ipfwwrapper.h,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 8e2438f..9c11685 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        ipvswrapper.c include file.
  *
- * Version:     $Id: ipvswrapper.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: ipvswrapper.h,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 850ce57..4120db1 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        ipwrapper.c include file.
  *
- * Version:     $Id: ipwrapper.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: ipwrapper.h,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index d0d2a55..8559800 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        layer4.c include file.
  *
- * Version:     $Id: layer4.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: layer4.h,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 8d2fd26..f7dba66 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Main program include file.
  *
- * Version:     $Id: main.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: main.h,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index dea2c3d..55ebfe1 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        pidfile.c include file.
  *
- * Version:     $Id: pidfile.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: pidfile.h,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index ead7937..5c26472 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        smtp.c include file.
  *
- * Version:     $Id: smtp.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: smtp.h,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index c2a59f3..f9762b6 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Part:        vrrp.c program include file.
  *
- * Version:     $Id: vrrp.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: vrrp.h,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -166,6 +166,7 @@ typedef struct _vrrp_rt {
 #define VRRP_STATE_FAULT               3       /* internal */
 #define VRRP_STATE_GOTO_MASTER         4       /* internal */
 #define VRRP_STATE_LEAVE_MASTER                5       /* internal */
+#define VRRP_STATE_GOTO_FAULT          98      /* internal */
 #define VRRP_DISPATCHER                99      /* internal */
 #define VRRP_MCAST_RETRY               10      /* internal */
 #define VRRP_MAX_FSM_STATE             4       /* internal */
index c9d58de..0cf3c69 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_arp.c include file.
  *
- * Version:     $Id: vrrp_arp.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: vrrp_arp.h,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 308f20b..7595f7d 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_daemon.c include file.
  * 
- * Version:     $Id: vrrp_daemon.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: vrrp_daemon.h,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
index 6b0572e..698df09 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Dynamic data structure definition.
  *
- * Version:     $Id: vrrp_data.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: vrrp_data.h,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 5192794..5a7971f 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_if.c include file.
  *
- * Version:     $Id: vrrp_if.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: vrrp_if.h,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 60c360a..14b8a9d 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_index.c include file.
  *
- * Version:     $Id: vrrp_index.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: vrrp_index.h,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index bb76ffc..0b4b594 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_ipaddress.c include file.
  *
- * Version:     $Id: vrrp_ipaddress.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: vrrp_ipaddress.h,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 91dabf8..875ee59 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_iproute.c include file.
  *
- * Version:     $Id: vrrp_iproute.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: vrrp_iproute.h,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index e09f42d..73be32e 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_ipsecah.c include file.
  * 
- * Version:     $Id: vrrp_ipsecah.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: vrrp_ipsecah.h,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
index 59031ce..41cd489 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_netlink.c include file.
  *
- * Version:     $Id: vrrp_netlink.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: vrrp_netlink.h,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index fab2e73..155e766 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Part:        vrrp_notify.c include file.
  *
- * Version:     $Id: vrrp_notify.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: vrrp_notify.h,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index c6078e9..cd92ab9 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        vrrp_parser.c include file.
  *  
- * Version:     $Id: vrrp_parser.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: vrrp_parser.h,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 404f968..d4ee59d 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_scheduler.c include file.
  * 
- * Version:     $Id: vrrp_scheduler.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: vrrp_scheduler.h,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
index 3ff0d75..255a3a8 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_sync.c include file.
  * 
- * Version:     $Id: vrrp_sync.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: vrrp_sync.h,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
index 5e85901..01d7da7 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        vrrp_track.c include file.
  *
- * Version:     $Id: vrrp_track.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: vrrp_track.h,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 07d4fd8..718da1b 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.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: vrrp.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -695,11 +695,20 @@ vrrp_state_leave_master(vrrp_rt * vrrp)
        }
 
        /* set the new vrrp state */
-       log_message(LOG_INFO, "VRRP_Instance(%s) Entering BACKUP STATE",
-                   vrrp->iname);
-       vrrp_restore_interface(vrrp, 0);
-       vrrp->state = vrrp->wantstate;
-       notify_instance_exec(vrrp, VRRP_STATE_BACK);
+       switch (vrrp->wantstate) {
+       case VRRP_STATE_BACK:
+               log_message(LOG_INFO, "VRRP_Instance(%s) Entering BACKUP STATE", vrrp->iname);
+               vrrp_restore_interface(vrrp, 0);
+               vrrp->state = vrrp->wantstate;
+               notify_instance_exec(vrrp, VRRP_STATE_BACK);
+               break;
+       case VRRP_STATE_GOTO_FAULT:
+               log_message(LOG_INFO, "VRRP_Instance(%s) Entering FAULT STATE", vrrp->iname);
+               vrrp_restore_interface(vrrp, 0);
+               vrrp->state = VRRP_STATE_FAULT;
+               notify_instance_exec(vrrp, VRRP_STATE_FAULT);
+               break;
+       }
 
        /* Set the down timer */
        vrrp->ms_down_timer = 3 * vrrp->adver_int + VRRP_TIMER_SKEW(vrrp);
@@ -776,9 +785,8 @@ vrrp_state_master_rx(vrrp_rt * vrrp, char *buf, int buflen)
        ipsec_ah *ah;
 
        /* return on link failure */
-       if (vrrp->wantstate == VRRP_STATE_FAULT) {
-               vrrp->ms_down_timer =
-                   3 * vrrp->adver_int + VRRP_TIMER_SKEW(vrrp);
+       if (vrrp->wantstate == VRRP_STATE_GOTO_FAULT) {
+               vrrp->ms_down_timer = 3 * vrrp->adver_int + VRRP_TIMER_SKEW(vrrp);
                vrrp->state = VRRP_STATE_FAULT;
                return 1;
        }
index 8c99084..1cc2700 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        ARP primitives.
  *
- * Version:     $Id: vrrp_arp.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: vrrp_arp.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index ac7c548..ea772fb 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        VRRP child process handling.
  *
- * Version:     $Id: vrrp_daemon.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: vrrp_daemon.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 3e27dbb..852515d 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Dynamic data structure definition.
  *
- * Version:     $Id: vrrp_data.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: vrrp_data.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 257efbd..bddbcc0 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Interfaces manipulation.
  *
- * Version:     $Id: vrrp_if.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: vrrp_if.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -173,6 +173,8 @@ if_mii_status(const int fd)
 int
 if_mii_probe(const char *ifname)
 {
+       uint16_t *data = (uint16_t *) (&ifr.ifr_data);
+       int phy_id;
        int fd = socket(AF_INET, SOCK_DGRAM, 0);
        int status = 0;
 
@@ -185,6 +187,17 @@ if_mii_probe(const char *ifname)
                return -1;
        }
 
+       /* check if the driver reports BMSR using the MII interface, as we
+        * will need this and we already know that some don't support it.
+        */
+       phy_id = data[0]; /* save it in case it is overwritten */
+       data[1] = 1;
+       if (ioctl(fd, SIOCGMIIREG, &ifr) < 0) {
+               close(fd);
+               return -1;
+       }
+       data[0] = phy_id;
+
        /* Dump the MII transceiver */
        status = if_mii_status(fd);
        close(fd);
@@ -355,8 +368,7 @@ init_if_linkbeat(void)
                }
 
                /* Register new monitor thread */
-               thread_add_timer(master, if_linkbeat_refresh_thread, ifp
-                                , POLLING_DELAY);
+               thread_add_timer(master, if_linkbeat_refresh_thread, ifp, POLLING_DELAY);
        }
 }
 
index 243f446..8dc33b3 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        VRRP instance index table.
  *
- * Version:     $Id: vrrp_index.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: vrrp_index.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index b0974ac..69b6d2c 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        NETLINK IPv4 address manipulation.
  *
- * Version:     $Id: vrrp_ipaddress.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: vrrp_ipaddress.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 22c2072..5ff7489 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        NETLINK IPv4 routes manipulation.
  *
- * Version:     $Id: vrrp_iproute.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: vrrp_iproute.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 81e028c..4cbab67 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.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: vrrp_ipsecah.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index a603840..bae8b37 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        NETLINK kernel command channel.
  *
- * Version:     $Id: vrrp_netlink.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: vrrp_netlink.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 7320982..3fb5a2f 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        VRRP state transition notification scripts handling.
  *
- * Version:     $Id: vrrp_notify.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: vrrp_notify.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index c27449b..413920f 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.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: vrrp_parser.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
index 1e51787..52398c1 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Sheduling framework for vrrp code.
  *
- * Version:     $Id: vrrp_scheduler.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: vrrp_scheduler.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -299,12 +299,10 @@ vrrp_init_script(list l)
 
                if (vscript->result == VRRP_SCRIPT_STATUS_INIT) {
                        vscript->result = VRRP_SCRIPT_STATUS_NONE;
-                       thread_add_timer(master, vrrp_script_thread,
-                                        vscript, vscript->interval);
+                       thread_add_event(master, vrrp_script_thread, vscript, vscript->interval);
                } else if (vscript->result == VRRP_SCRIPT_STATUS_INIT_GOOD) {
                        vscript->result = VRRP_SCRIPT_STATUS_GOOD;
-                       thread_add_timer(master, vrrp_script_thread,
-                                        vscript, vscript->interval);
+                       thread_add_event(master, vrrp_script_thread, vscript, vscript->interval);
                }
        }
 }
@@ -585,7 +583,7 @@ vrrp_leave_master(vrrp_rt * vrrp, char *buffer, int len)
 {
        if (!VRRP_ISUP(vrrp)) {
                vrrp_log_int_down(vrrp);
-               vrrp->wantstate = VRRP_STATE_FAULT;
+               vrrp->wantstate = VRRP_STATE_GOTO_FAULT;
                vrrp_state_leave_master(vrrp);
        } else if (vrrp_state_master_rx(vrrp, buffer, len)) {
                vrrp_state_leave_master(vrrp);
@@ -723,30 +721,28 @@ static void
 vrrp_master(vrrp_rt * vrrp)
 {
        /* Check if interface we are running on is UP */
-       if (vrrp->wantstate != VRRP_STATE_FAULT) {
+       if (vrrp->wantstate != VRRP_STATE_GOTO_FAULT) {
                if (!VRRP_ISUP(vrrp)) {
                        vrrp_log_int_down(vrrp);
-                       vrrp->wantstate = VRRP_STATE_FAULT;
+                       vrrp->wantstate = VRRP_STATE_GOTO_FAULT;
                }
        }
 
        /* Then perform the state transition */
-       if (vrrp->wantstate == VRRP_STATE_FAULT ||
+       if (vrrp->wantstate == VRRP_STATE_GOTO_FAULT ||
            vrrp->wantstate == VRRP_STATE_BACK ||
            vrrp->ipsecah_counter->cycle) {
-               vrrp->ms_down_timer =
-                   3 * vrrp->adver_int + VRRP_TIMER_SKEW(vrrp);
+               vrrp->ms_down_timer = 3 * vrrp->adver_int + VRRP_TIMER_SKEW(vrrp);
 
                /* handle backup state transition */
                vrrp_state_leave_master(vrrp);
 
                if (vrrp->state == VRRP_STATE_BACK)
-                       log_message(LOG_INFO,
-                              "VRRP_Instance(%s) Now in BACKUP state",
-                              vrrp->iname);
+                       log_message(LOG_INFO, "VRRP_Instance(%s) Now in BACKUP state",
+                                   vrrp->iname);
                if (vrrp->state == VRRP_STATE_FAULT)
                        log_message(LOG_INFO, "VRRP_Instance(%s) Now in FAULT state",
-                              vrrp->iname);
+                                   vrrp->iname);
        } else if (vrrp->state == VRRP_STATE_MAST) {
                /*
                 * Send the VRRP advert.
index b511b32..15d8f2b 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        VRRP synchronization framework.
  *
- * Version:     $Id: vrrp_sync.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: vrrp_sync.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -37,7 +37,7 @@ vrrp_init_instance_sands(vrrp_rt * vrrp)
 
        if (vrrp->state == VRRP_STATE_MAST        ||
            vrrp->state == VRRP_STATE_GOTO_MASTER ||
-           vrrp->state == VRRP_STATE_FAULT       ||
+           vrrp->state == VRRP_STATE_GOTO_FAULT  ||
            vrrp->wantstate == VRRP_STATE_GOTO_MASTER) {
                vrrp->sands.tv_sec = time_now.tv_sec + vrrp->adver_int / TIMER_HZ;
                vrrp->sands.tv_usec = time_now.tv_usec;
@@ -251,7 +251,7 @@ vrrp_sync_fault(vrrp_rt * vrrp)
                 */
                if (isync != vrrp && isync->state != VRRP_STATE_FAULT) {
                        if (isync->state == VRRP_STATE_MAST)
-                               isync->wantstate = VRRP_STATE_FAULT;
+                               isync->wantstate = VRRP_STATE_GOTO_FAULT;
                        if (isync->state == VRRP_STATE_BACK)
                                isync->state = VRRP_STATE_FAULT;
                }
index 16a731c..ef1af5f 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Interface tracking framework.
  *
- * Version:     $Id: vrrp_track.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: vrrp_track.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 9b4e673..28a50c4 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        HTML stream parser utility functions.
  *
- * Version:     $Id: html.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: html.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *
index 4c904b8..5c3b58f 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        parser.c include file.
  *
- * Version:     $Id: html.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: html.h,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *
index 1af3c13..50d2c41 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        List structure manipulation.
  *  
- * Version:     $Id: list.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: list.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
index bc21dd2..1458968 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        list.c include file.
  *  
- * Version:     $Id: list.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: list.h,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 2a16a14..d2dd09d 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        logging facility.
  *  
- * Version:     $Id: vector.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: vector.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
index 77330b2..d71f588 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        logging facility.
  *  
- * Version:     $Id: vector.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: vector.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
index 8646929..47e8ff9 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.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: memory.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
index 10137a7..8b9e23a 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        memory.c include file.
  *
- * Version:     $Id: memory.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: memory.h,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Authors:     Alexandre Cassen, <acassen@linux-vs.org>
  *              Jan Holmberg, <jan@artech.net>
index 5d560a7..0438150 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        Forked system call to launch an extra script.
  *
- * Version:     $Id: notify.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: notify.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 7761ffd..e396a28 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        notify.c include file.
  *
- * Version:     $Id: notify.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: notify.h,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 3a6d062..c8fd02a 100644 (file)
@@ -7,7 +7,7 @@
  *              data structure representation the conf file representing
  *              the loadbalanced server pool.
  *  
- * Version:     $Id: parser.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: parser.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
index 4c4e8cf..cfcb28a 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        cfreader.c include file.
  *  
- * Version:     $Id: parser.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: parser.h,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 54b499f..6566e5c 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.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: scheduler.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
@@ -445,54 +445,50 @@ thread_cancel_event(thread_master * m, void *arg)
        }
 }
 
+/* Update timer value */
+static void
+thread_update_timer(thread_list *list, TIMEVAL *timer_min)
+{
+       if (list->head) {
+               if (!TIMER_ISNULL(*timer_min)) {
+                       if (timer_cmp(list->head->sands, *timer_min) <= 0) {
+                               *timer_min = list->head->sands;
+                       }
+               } else {
+                       *timer_min = list->head->sands;
+               }
+       }
+}
+
 /* Compute the wait timer. Take care of timeouted fd */
 static void
 thread_compute_timer(thread_master * m, TIMEVAL * timer_wait)
 {
        TIMEVAL timer_min;
 
+       /* Prepare timer */
        TIMER_RESET(timer_min);
+       thread_update_timer(&m->timer, &timer_min);
+       thread_update_timer(&m->write, &timer_min);
+       thread_update_timer(&m->read, &timer_min);
+       thread_update_timer(&m->child, &timer_min);
 
-       if (m->timer.head)
-               timer_min = m->timer.head->sands;
-
-       if (m->write.head) {
-               if (!TIMER_ISNULL(timer_min)) {
-                       if (timer_cmp(m->write.head->sands, timer_min) <= 0)
-                               timer_min = m->write.head->sands;
-               } else
-                       timer_min = m->write.head->sands;
-       }
-
-       if (m->read.head) {
-               if (!TIMER_ISNULL(timer_min)) {
-                       if (timer_cmp(m->read.head->sands, timer_min) <= 0)
-                               timer_min = m->read.head->sands;
-               } else
-                       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;
-       }
-
+       /* Take care about monothonic clock */
        if (!TIMER_ISNULL(timer_min)) {
                timer_min = timer_sub(timer_min, time_now);
                if (timer_min.tv_sec < 0) {
-                       timer_wait->tv_sec = timer_wait->tv_usec = 0;
-               } else {
-                       timer_wait->tv_sec = timer_min.tv_sec;
-                       timer_wait->tv_usec = timer_min.tv_usec;
+                       timer_min.tv_sec = timer_min.tv_usec = 0;
+               } else if (timer_min.tv_sec >= 1) {
+                       timer_min.tv_sec = 1;
+                       timer_min.tv_usec = 0;
                }
-               return;
-       }
 
-       if (TIMER_ISNULL(*timer_wait))
+               timer_wait->tv_sec = timer_min.tv_sec;
+               timer_wait->tv_usec = timer_min.tv_usec;
+       } else {
                timer_wait->tv_sec = 1;
+               timer_wait->tv_usec = 0;
+       }
 }
 
 /* Fetch next ready thread. */
@@ -552,8 +548,7 @@ retry:      /* When thread can't fetch try to find next thread again. */
        signal_fd = signal_rfd();
        FD_SET(signal_fd, &readfd);
 
-       ret = select(FD_SETSIZE, &readfd, &writefd, &exceptfd,
-                   (TIMER_ISNULL(timer_wait)) ? NULL : &timer_wait);
+       ret = select(FD_SETSIZE, &readfd, &writefd, &exceptfd, &timer_wait);
 
        /* we have to save errno here because the next syscalls will set it */
        old_errno = errno;
index 6e7e280..d83395a 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        scheduler.c include file.
  *
- * Version:     $Id: scheduler.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: scheduler.h,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index f22bd8c..362d313 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        Signals framework.
  *  
- * Version:     $Id: signals.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: signals.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  * 
  * Author:      Kevin Lindsay, <kevinl@netnation.com>
  *              Alexandre Cassen, <acassen@linux-vs.org>
index 06aa70a..fcece86 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        signals.c include file.
  *  
- * Version:     $Id: signals.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: signals.h,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Kevin Lindsay, <kevinl@netnation.com>
  *              Alexandre Cassen, <acassen@linux-vs.org>
index 7883e2d..282a00b 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        Timer manipulations.
  *  
- * Version:     $Id: timer.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: timer.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
@@ -102,11 +102,11 @@ timer_add_long(TIMEVAL a, long b)
  * normally return 0, unless <now> is NULL, in which case it will return -1 and
  * set errno to EFAULT.
  */
-int monotonic_gettimeofday(struct timeval *now)
+int monotonic_gettimeofday(TIMEVAL *now)
 {
-       static struct timeval mono_date;
-       static struct timeval drift; /* warning: signed seconds! */
-       struct timeval sys_date, adjusted, deadline;
+       static TIMEVAL mono_date;
+       static TIMEVAL drift; /* warning: signed seconds! */
+       TIMEVAL sys_date, adjusted, deadline;
 
        if (!now) {
                errno = EFAULT;
@@ -126,8 +126,8 @@ int monotonic_gettimeofday(struct timeval *now)
        /* compute new adjusted time by adding the drift offset */
        adjusted.tv_sec  = sys_date.tv_sec  + drift.tv_sec;
        adjusted.tv_usec = sys_date.tv_usec + drift.tv_usec;
-       if (adjusted.tv_usec >= 1000000) {
-               adjusted.tv_usec -= 1000000;
+       if (adjusted.tv_usec >= TIMER_HZ) {
+               adjusted.tv_usec -= TIMER_HZ;
                adjusted.tv_sec++;
        }
 
@@ -140,10 +140,10 @@ int monotonic_gettimeofday(struct timeval *now)
        /* check for jumps too far in the future, and bound them to
         * TIME_MAX_FORWARD_US microseconds.
         */
-       deadline.tv_sec  = mono_date.tv_sec  + TIME_MAX_FORWARD_US / 1000000;
-       deadline.tv_usec = mono_date.tv_usec + TIME_MAX_FORWARD_US % 1000000;
-       if (deadline.tv_usec >= 1000000) {
-               deadline.tv_usec -= 1000000;
+       deadline.tv_sec  = mono_date.tv_sec  + TIME_MAX_FORWARD_US / TIMER_HZ;
+       deadline.tv_usec = mono_date.tv_usec + TIME_MAX_FORWARD_US % TIMER_HZ;
+       if (deadline.tv_usec >= TIMER_HZ) {
+               deadline.tv_usec -= TIMER_HZ;
                deadline.tv_sec++;
        }
 
@@ -168,7 +168,7 @@ int monotonic_gettimeofday(struct timeval *now)
        drift.tv_sec  = mono_date.tv_sec  - sys_date.tv_sec;
        drift.tv_usec = mono_date.tv_usec - sys_date.tv_usec;
        if (drift.tv_usec < 0) {
-               drift.tv_usec += 1000000;
+               drift.tv_usec += TIMER_HZ;
                drift.tv_sec--;
        }
        *now = mono_date;
index e98c99f..8f6d76a 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        timer.c include file.
  *  
- * Version:     $Id: timer.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: timer.h,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index b552eaf..412a8d3 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        General program utils.
  *
- * Version:     $Id: utils.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: utils.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 264854d..c633b4b 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Part:        utils.h include file.
  *
- * Version:     $Id: utils.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: utils.h,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *
index 7cc6038..7f33f33 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        Vector structure manipulation.
  *  
- * Version:     $Id: vector.c,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: vector.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  * 
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *              
index ab1f7c2..371963a 100644 (file)
@@ -5,7 +5,7 @@
  * 
  * Part:        vector.c include file.
  *  
- * Version:     $Id: vector.h,v 1.1.16 2009/02/14 03:25:07 acassen Exp $
+ * Version:     $Id: vector.h,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
  *
  * Author:      Alexandre Cassen, <acassen@linux-vs.org>
  *