mirror of
https://gitlab.isc.org/isc-projects/dhcp
synced 2025-08-30 05:47:45 +00:00
Changed supersede_lease() to return 1, even if the commit option is
not specified. (Before, it would always return 0 if commit was not given.) Fixed up the one call to supersede_lease() which expected the old behavior. Added a check to supersede_lease() to return an error if the pimmediate flag is given, and commit is not. (You should never be sending information on an uncommitted lease to a peer.) Separated the failover queue update (the propogate flag) test from the commit test in supersede_lease(), so that you can now enqueue an update on an uncommitted lease.
This commit is contained in:
parent
f7dca4c7b3
commit
15c24b882b
@ -43,7 +43,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"$Id: dhcp.c,v 1.181 2001/02/12 21:00:02 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n";
|
||||
"$Id: dhcp.c,v 1.182 2001/02/15 21:34:08 neild Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "dhcpd.h"
|
||||
@ -2058,9 +2058,8 @@ void ack_lease (packet, lease, offer, when, msg, ms_nulltp)
|
||||
and we can't write the lease, don't ACK it (or BOOTREPLY
|
||||
it) either. */
|
||||
|
||||
if (!(supersede_lease (lease, lt, !offer || offer == DHCPACK,
|
||||
offer == DHCPACK, offer == DHCPACK)
|
||||
|| (offer && offer != DHCPACK))) {
|
||||
if (!supersede_lease (lease, lt, !offer || offer == DHCPACK,
|
||||
offer == DHCPACK, offer == DHCPACK)) {
|
||||
log_info ("%s: database update failed", msg);
|
||||
free_lease_state (state, MDL);
|
||||
static_lease_dereference (lease, MDL);
|
||||
|
29
server/mdb.c
29
server/mdb.c
@ -43,7 +43,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"$Id: mdb.c,v 1.52 2001/02/12 21:09:21 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium. All rights reserved.\n";
|
||||
"$Id: mdb.c,v 1.53 2001/02/15 21:34:07 neild Exp $ Copyright (c) 1996-2000 The Internet Software Consortium. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "dhcpd.h"
|
||||
@ -775,6 +775,14 @@ int supersede_lease (comp, lease, commit, propogate, pimmediate)
|
||||
struct lease *lp, **lq, *prev;
|
||||
TIME lp_next_state;
|
||||
|
||||
#if defined (FAILOVER_PROTOCOL)
|
||||
/* We must commit leases before sending updates regarding them
|
||||
to failover peers. It is, therefore, an error to set pimmediate
|
||||
and not commit. */
|
||||
if (pimmediate && !commit)
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
/* If there is no sample lease, just do the move. */
|
||||
if (!lease)
|
||||
goto just_move_it;
|
||||
@ -1047,14 +1055,21 @@ int supersede_lease (comp, lease, commit, propogate, pimmediate)
|
||||
(tvunref_t)pool_dereference);
|
||||
}
|
||||
|
||||
/* Return zero if we didn't commit the lease to permanent storage;
|
||||
nonzero if we did. */
|
||||
return commit && write_lease (comp) && commit_leases ()
|
||||
if (commit) {
|
||||
if (!write_lease (comp))
|
||||
return 0;
|
||||
if (!commit_leases ())
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined (FAILOVER_PROTOCOL)
|
||||
&& (!propogate ||
|
||||
dhcp_failover_queue_update (comp, pimmediate))
|
||||
if (propogate) {
|
||||
if (!dhcp_failover_queue_update (comp, pimmediate))
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void process_state_transition (struct lease *lease)
|
||||
|
Loading…
x
Reference in New Issue
Block a user