version 1.1, 2012/02/21 22:30:18
|
version 1.1.1.1, 2012/10/09 09:06:55
|
Line 3
|
Line 3
|
Failover protocol support code... */ |
Failover protocol support code... */ |
|
|
/* |
/* |
* Copyright (c) 2011 by Internet Systems Consortium, Inc. ("ISC") | * Copyright (c) 2011-2012 by Internet Systems Consortium, Inc. ("ISC") |
* Copyright (c) 2004-2009 by Internet Systems Consortium, Inc. ("ISC") |
* Copyright (c) 2004-2009 by Internet Systems Consortium, Inc. ("ISC") |
* Copyright (c) 1999-2003 by Internet Software Consortium |
* Copyright (c) 1999-2003 by Internet Software Consortium |
* |
* |
Line 33
|
Line 33
|
* ``http://www.nominum.com''. |
* ``http://www.nominum.com''. |
*/ |
*/ |
|
|
|
#include "cdefs.h" |
#include "dhcpd.h" |
#include "dhcpd.h" |
#include <omapip/omapip_p.h> |
#include <omapip/omapip_p.h> |
|
|
Line 2384 dhcp_failover_pool_dobalance(dhcp_failover_state_t *st
|
Line 2385 dhcp_failover_pool_dobalance(dhcp_failover_state_t *st
|
struct shared_network *s; |
struct shared_network *s; |
struct pool *p; |
struct pool *p; |
binding_state_t peer_lease_state; |
binding_state_t peer_lease_state; |
binding_state_t my_lease_state; | /* binding_state_t my_lease_state; */ |
| /* XXX Why is this my_lease_state never used? */ |
struct lease **lq; |
struct lease **lq; |
int (*log_func)(const char *, ...); |
int (*log_func)(const char *, ...); |
const char *result, *reqlog; |
const char *result, *reqlog; |
Line 2408 dhcp_failover_pool_dobalance(dhcp_failover_state_t *st
|
Line 2410 dhcp_failover_pool_dobalance(dhcp_failover_state_t *st
|
if (p->failover_peer->i_am == primary) { |
if (p->failover_peer->i_am == primary) { |
lts = (p->free_leases - p->backup_leases) / 2; |
lts = (p->free_leases - p->backup_leases) / 2; |
peer_lease_state = FTS_BACKUP; |
peer_lease_state = FTS_BACKUP; |
my_lease_state = FTS_FREE; | /* my_lease_state = FTS_FREE; */ |
lq = &p->free; |
lq = &p->free; |
} else { |
} else { |
lts = (p->backup_leases - p->free_leases) / 2; |
lts = (p->backup_leases - p->free_leases) / 2; |
peer_lease_state = FTS_FREE; |
peer_lease_state = FTS_FREE; |
my_lease_state = FTS_BACKUP; | /* my_lease_state = FTS_BACKUP; */ |
lq = &p->backup; |
lq = &p->backup; |
} |
} |
|
|
Line 3218 isc_result_t dhcp_failover_state_stuff (omapi_object_t
|
Line 3220 isc_result_t dhcp_failover_state_stuff (omapi_object_t
|
omapi_object_t *h) |
omapi_object_t *h) |
{ |
{ |
dhcp_failover_state_t *s; |
dhcp_failover_state_t *s; |
omapi_connection_object_t *conn; |
|
isc_result_t status; |
isc_result_t status; |
|
|
if (c -> type != omapi_type_connection) |
if (c -> type != omapi_type_connection) |
return ISC_R_INVALIDARG; |
return ISC_R_INVALIDARG; |
conn = (omapi_connection_object_t *)c; |
|
|
|
if (h -> type != dhcp_type_failover_state) |
if (h -> type != dhcp_type_failover_state) |
return ISC_R_INVALIDARG; |
return ISC_R_INVALIDARG; |
Line 4266 void dhcp_failover_send_contact (void *vstate)
|
Line 4266 void dhcp_failover_send_contact (void *vstate)
|
if (obufix) { |
if (obufix) { |
log_debug ("%s", obuf); |
log_debug ("%s", obuf); |
} |
} |
|
#else |
|
IGNORE_UNUSED(status); |
#endif |
#endif |
return; |
return; |
} |
} |
Line 4314 isc_result_t dhcp_failover_send_state (dhcp_failover_s
|
Line 4316 isc_result_t dhcp_failover_send_state (dhcp_failover_s
|
if (obufix) { |
if (obufix) { |
log_debug ("%s", obuf); |
log_debug ("%s", obuf); |
} |
} |
|
#else |
|
IGNORE_UNUSED(status); |
#endif |
#endif |
return ISC_R_SUCCESS; |
return ISC_R_SUCCESS; |
} |
} |
Line 4450 isc_result_t dhcp_failover_send_disconnect (omapi_obje
|
Line 4454 isc_result_t dhcp_failover_send_disconnect (omapi_obje
|
const char *message) |
const char *message) |
{ |
{ |
dhcp_failover_link_t *link; |
dhcp_failover_link_t *link; |
dhcp_failover_state_t *state; |
|
isc_result_t status; |
isc_result_t status; |
#if defined (DEBUG_FAILOVER_MESSAGES) |
#if defined (DEBUG_FAILOVER_MESSAGES) |
char obuf [64]; |
char obuf [64]; |
Line 4465 isc_result_t dhcp_failover_send_disconnect (omapi_obje
|
Line 4468 isc_result_t dhcp_failover_send_disconnect (omapi_obje
|
if (!l || l -> type != dhcp_type_failover_link) |
if (!l || l -> type != dhcp_type_failover_link) |
return ISC_R_INVALIDARG; |
return ISC_R_INVALIDARG; |
link = (dhcp_failover_link_t *)l; |
link = (dhcp_failover_link_t *)l; |
state = link -> state_object; |
|
if (!l -> outer || l -> outer -> type != omapi_type_connection) |
if (!l -> outer || l -> outer -> type != omapi_type_connection) |
return ISC_R_INVALIDARG; |
return ISC_R_INVALIDARG; |
|
|