From: Ted Lemon Date: Thu, 31 Aug 2000 04:40:05 +0000 (+0000) Subject: Move state information common to both peers into a common structure. X-Git-Tag: V3-BETA-2-PATCH-1~23 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fcbeefb3ba5a15cf0584d984b7a03b37a2f07253;p=thirdparty%2Fdhcp.git Move state information common to both peers into a common structure. --- diff --git a/includes/failover.h b/includes/failover.h index b2c0957e1..36b7ffbd5 100644 --- a/includes/failover.h +++ b/includes/failover.h @@ -217,9 +217,10 @@ typedef struct { u_int32_t xid; } dhcp_failover_link_t; -typedef struct { +typedef struct _dhcp_failover_listener { OMAPI_OBJECT_PREAMBLE; - unsigned local_port; + struct _dhcp_failover_listener *next; + omapi_addr_t address; } dhcp_failover_listener_t; #endif /* FAILOVER_PROTOCOL */ @@ -234,7 +235,8 @@ enum failover_state { recover, recover_done, shut_down, - paused + paused, + startup }; /* Service states are simplifications of failover states, particularly @@ -251,25 +253,28 @@ enum service_state { }; #if defined (FAILOVER_PROTOCOL) +typedef struct _dhcp_failover_config { + struct option_cache *address; + int port; + u_int32_t max_flying_updates; + enum failover_state state; + TIME stos; + u_int32_t max_response_delay; +} dhcp_failover_config_t; + typedef struct _dhcp_failover_state { OMAPI_OBJECT_PREAMBLE; struct _dhcp_failover_state *next; char *name; /* Name of this failover instance. */ - struct option_cache *address; /* Partner's IP address or hostname. */ - int port; /* Partner's TCP port. */ - struct option_cache *server_addr; /* IP address on which to listen. */ + dhcp_failover_config_t me; /* My configuration. */ + dhcp_failover_config_t partner; /* Partner's configuration. */ + enum failover_state saved_state; /* Saved state during startup. */ struct data_string server_identifier; /* Server identifier (IP addr) */ - int listen_port; /* Port on which to listen. */ - u_int32_t max_flying_updates; u_int32_t mclt; u_int8_t *hba; /* Hash bucket array for load balancing. */ int load_balance_max_secs; - enum failover_state partner_state; - TIME partner_stos; - enum failover_state my_state; - TIME my_stos; enum service_state service_state; const char *nrr; /* Printable reason why we're in the not_responding service state (empty @@ -286,13 +291,6 @@ typedef struct _dhcp_failover_state { TIME last_timestamp_received; /* The last timestamp we sent that has been returned by our partner. */ TIME skew; /* The skew between our clock and our partner's. */ - u_int32_t max_transmit_idle; /* Always send a poll if we haven't sent - some other packet more recently than - this. */ - u_int32_t max_response_delay; /* If the returned timestamp on the - last packet we received is older - than this, communications have been - interrupted. */ struct lease *update_queue_head; /* List of leases we haven't sent to peer. */ struct lease *update_queue_tail; diff --git a/server/db.c b/server/db.c index f10109f3d..8a96054f6 100644 --- a/server/db.c +++ b/server/db.c @@ -43,7 +43,7 @@ #ifndef lint static char copyright[] = -"$Id: db.c,v 1.56 2000/08/11 01:26:08 neild Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n"; +"$Id: db.c,v 1.57 2000/08/31 04:40:05 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -516,21 +516,21 @@ int write_failover_state (dhcp_failover_state_t *state) if (errno) ++errors; - t = gmtime (&state -> my_stos); + t = gmtime (&state -> me.stos); errno = 0; fprintf (db_file, "\n my state %s at %d %d/%02d/%02d %02d:%02d:%02d;", - dhcp_failover_state_name_print (state -> my_state), + dhcp_failover_state_name_print (state -> me.state), t -> tm_wday, t -> tm_year + 1900, t -> tm_mon + 1, t -> tm_mday, t -> tm_hour, t -> tm_min, t -> tm_sec); if (errno) ++errors; - t = gmtime (&state -> partner_stos); + t = gmtime (&state -> partner.stos); errno = 0; fprintf (db_file, "\n partner state %s at %d %d/%02d/%02d %02d:%02d:%02d;", - dhcp_failover_state_name_print (state -> my_state), + dhcp_failover_state_name_print (state -> partner.state), t -> tm_wday, t -> tm_year + 1900, t -> tm_mon + 1, t -> tm_mday, t -> tm_hour, t -> tm_min, t -> tm_sec);