mirror of
https://gitlab.isc.org/isc-projects/dhcp
synced 2025-08-31 06:15:55 +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:
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)
|
||||
|
Reference in New Issue
Block a user