"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "server/failover.c" between
dhcp-4.3.6-P1.tar.gz and dhcp-4.4.1.tar.gz

About: ISC DHCP implements the "Dynamic Host Configuration Protocols" for connection to a local network. 4.4.x release series.

failover.c  (dhcp-4.3.6-P1):failover.c  (dhcp-4.4.1)
/* failover.c /* failover.c
Failover protocol support code... */ Failover protocol support code... */
/* /*
* Copyright (c) 2004-2017 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004-2017 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1999-2003 by Internet Software Consortium * Copyright (c) 1999-2003 by Internet Software Consortium
* *
* Permission to use, copy, modify, and distribute this software for any * This Source Code Form is subject to the terms of the Mozilla Public
* purpose with or without fee is hereby granted, provided that the above * License, v. 2.0. If a copy of the MPL was not distributed with this
* copyright notice and this permission notice appear in all copies. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
* *
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
* *
* Internet Systems Consortium, Inc. * Internet Systems Consortium, Inc.
skipping to change at line 53 skipping to change at line 53
const char *file, int line); const char *file, int line);
static void dhcp_failover_pool_balance(dhcp_failover_state_t *state); static void dhcp_failover_pool_balance(dhcp_failover_state_t *state);
static void dhcp_failover_pool_reqbalance(dhcp_failover_state_t *state); static void dhcp_failover_pool_reqbalance(dhcp_failover_state_t *state);
static int dhcp_failover_pool_dobalance(dhcp_failover_state_t *state, static int dhcp_failover_pool_dobalance(dhcp_failover_state_t *state,
isc_boolean_t *sendreq); isc_boolean_t *sendreq);
static inline int secondary_not_hoarding(dhcp_failover_state_t *state, static inline int secondary_not_hoarding(dhcp_failover_state_t *state,
struct pool *p); struct pool *p);
static void scrub_lease(struct lease* lease, const char *file, int line); static void scrub_lease(struct lease* lease, const char *file, int line);
int check_secs_byte_order = 0; /* enables byte order check of secs field if 1 */
/*! /*!
* \brief Performs a "pre-flight" sanity check of failover configuration * \brief Performs a "pre-flight" sanity check of failover configuration
* *
* Provides an opportunity to do post-parse pre-startup sanity checking * Provides an opportunity to do post-parse pre-startup sanity checking
* of failover configuration. This allows checks to be done under test * of failover configuration. This allows checks to be done under test
* mode (-T), without requiring full startup for validation. * mode (-T), without requiring full startup for validation.
* *
* Currently, it enforces all failover peers be used in at lease one * Currently, it enforces all failover peers be used in at lease one
* pool. This logic was formerly located in dhcp_failover_startup. * pool. This logic was formerly located in dhcp_failover_startup.
* *
skipping to change at line 78 skipping to change at line 80
int fail_count = 0; int fail_count = 0;
for (state = failover_states; state; state = state->next) { for (state = failover_states; state; state = state->next) {
if (state->pool_count == 0) { if (state->pool_count == 0) {
log_error ("ERROR: Failover peer, %s, has no referring" log_error ("ERROR: Failover peer, %s, has no referring"
" pools. You must refer to each peer in at" " pools. You must refer to each peer in at"
" least one pool declaration.", " least one pool declaration.",
state->name); state->name);
fail_count++; fail_count++;
} }
if (state->load_balance_max_secs == 0) {
log_info ("WARNING: load balancing will be disabled "
"for failover peer, %s, "
"because its load balance max secs is 0",
state->name);
}
} }
if (fail_count) { if (fail_count) {
log_fatal ("Failover configuration sanity check failed"); log_fatal ("Failover configuration sanity check failed");
} }
} }
void dhcp_failover_startup () void dhcp_failover_startup ()
{ {
dhcp_failover_state_t *state; dhcp_failover_state_t *state;
isc_result_t status; isc_result_t status;
struct timeval tv; struct timeval tv;
for (state = failover_states; state; state = state -> next) { for (state = failover_states; state; state = state -> next) {
dhcp_failover_state_transition (state, "startup"); dhcp_failover_state_transition (state, "startup");
skipping to change at line 5956 skipping to change at line 5966
int load_balance_mine (struct packet *packet, dhcp_failover_state_t *state) int load_balance_mine (struct packet *packet, dhcp_failover_state_t *state)
{ {
struct option_cache *oc; struct option_cache *oc;
struct data_string ds; struct data_string ds;
unsigned char hbaix; unsigned char hbaix;
int hm; int hm;
u_int16_t ec; u_int16_t ec;
ec = ntohs(packet->raw->secs); ec = ntohs(packet->raw->secs);
#if defined(SECS_BYTEORDER)
/* /*
* If desired check to see if the secs field may have been byte * If desired check to see if the secs field may have been byte
* swapped. We assume it has if the high order byte isn't cleared * swapped. We assume it has if the high order byte isn't cleared
* while the low order byte is cleared. In this case we swap the * while the low order byte is cleared. In this case we swap the
* bytes and continue processing. * bytes and continue processing.
*/ */
if ((ec > 255) && ((ec & 0xff) == 0)) { if ((check_secs_byte_order == 1) &&
((ec > 255) && ((ec & 0xff) == 0))) {
ec = (ec >> 8) | (ec << 8); ec = (ec >> 8) | (ec << 8);
} }
#endif
if (state->load_balance_max_secs < ec) { if ((state->load_balance_max_secs == 0) ||
(state->load_balance_max_secs < ec)) {
return (1); return (1);
} }
/* If we don't have a hash bucket array, we can't tell if this /* If we don't have a hash bucket array, we can't tell if this
one's ours, so we assume it's not. */ one's ours, so we assume it's not. */
if (!state->hba) if (!state->hba)
return (0); return (0);
oc = lookup_option(&dhcp_universe, packet->options, oc = lookup_option(&dhcp_universe, packet->options,
DHO_DHCP_CLIENT_IDENTIFIER); DHO_DHCP_CLIENT_IDENTIFIER);
 End of changes. 8 change blocks. 
7 lines changed or deleted 17 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)