2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-08-30 05:47:45 +00:00

Fix RT #1100. This was due to incorrect refcounting of failover messages

in two places, and also the fact that failover_message_dereference() was
not zeroing out the pointer.
This commit is contained in:
Ben Cottrell 2001-03-28 23:07:10 +00:00
parent 140158d3ff
commit fa0b47093f

View File

@ -43,7 +43,7 @@
#ifndef lint #ifndef lint
static char copyright[] = static char copyright[] =
"$Id: failover.c,v 1.40 2001/03/16 01:56:32 mellon Exp $ Copyright (c) 1999-2001 The Internet Software Consortium. All rights reserved.\n"; "$Id: failover.c,v 1.41 2001/03/28 23:07:10 tamino Exp $ Copyright (c) 1999-2001 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */ #endif /* not lint */
#include "dhcpd.h" #include "dhcpd.h"
@ -360,6 +360,7 @@ isc_result_t dhcp_failover_link_signal (omapi_object_t *h,
return ISC_R_UNEXPECTED; return ISC_R_UNEXPECTED;
} }
memset (link -> imsg, 0, sizeof (failover_message_t)); memset (link -> imsg, 0, sizeof (failover_message_t));
link -> imsg -> refcnt = 1;
/* Get the length: */ /* Get the length: */
omapi_connection_get_uint16 (c, &link -> imsg_len); omapi_connection_get_uint16 (c, &link -> imsg_len);
link -> imsg_count = 0; /* Bytes read. */ link -> imsg_count = 0; /* Bytes read. */
@ -2144,6 +2145,7 @@ int dhcp_failover_send_acks (dhcp_failover_state_t *state)
failover_message_dereference (&msg, MDL); failover_message_dereference (&msg, MDL);
} }
if (state -> toack_queue_tail)
failover_message_dereference (&state -> toack_queue_tail, MDL); failover_message_dereference (&state -> toack_queue_tail, MDL);
state -> pending_acks = 0; state -> pending_acks = 0;
@ -4721,6 +4723,7 @@ static isc_result_t failover_message_dereference (failover_message_t **mp,
if ((*mp) -> refcnt == 0) { if ((*mp) -> refcnt == 0) {
dfree (*mp, MDL); dfree (*mp, MDL);
} }
*mp = 0;
return ISC_R_SUCCESS; return ISC_R_SUCCESS;
} }