mirror of
https://gitlab.isc.org/isc-projects/dhcp
synced 2025-08-23 02:17:31 +00:00
Pull up RC9
This commit is contained in:
parent
274387c7b0
commit
0db87765e3
8
RELNOTES
8
RELNOTES
@ -56,6 +56,14 @@ Murrell at BC Tel Advanced Communications. I'd like to express my
|
||||
thanks to all of these good people here, both for working on the code
|
||||
and for prodding me into improving it.
|
||||
|
||||
Changes since 3.0 Release Candidate 8 Patchlevel 2
|
||||
|
||||
- Fix a bug that prevented update-static-leases from working.
|
||||
|
||||
- Document failover-state OMAPI object.
|
||||
|
||||
- Fix a compilation error on SunOS 4.
|
||||
|
||||
Changes since 3.0 Release Candidate 8 Patchlevel 1
|
||||
|
||||
- Fix a parsing bug that broke dns updates (both interim and ad-hoc).
|
||||
|
@ -3,7 +3,7 @@
|
||||
System dependencies for SunOS 4 (tested on 4.1.4)... */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996-1999 Internet Software Consortium.
|
||||
* Copyright (c) 1996-2001 Internet Software Consortium.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -56,7 +56,7 @@
|
||||
#define SOCKLEN_T int
|
||||
|
||||
#define fpos_t long
|
||||
#define fgetpos(f, p) ((*pos = ftell (f)) == -1 ? -1 : 0)
|
||||
#define fgetpos(f, p) (((*(p)) = ftell (f)) == -1 ? -1 : 0)
|
||||
#define fsetpos(f, p) (fseek (f, p, SEEK_SET))
|
||||
|
||||
/* No endian.h either. */
|
||||
|
@ -43,7 +43,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"$Id: ddns.c,v 1.16 2001/06/27 00:31:05 mellon Exp $ Copyright (c) 2000-2001 The Internet Software Consortium. All rights reserved.\n";
|
||||
"$Id: ddns.c,v 1.17 2001/06/29 18:34:54 mellon Exp $ Copyright (c) 2000-2001 The Internet Software Consortium. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "dhcpd.h"
|
||||
@ -266,7 +266,7 @@ int ddns_updates (struct packet *packet,
|
||||
specifically configured to do so. If the client asked to do its
|
||||
own update and we allowed that, we don't do this test. */
|
||||
if (lease -> flags & STATIC_LEASE) {
|
||||
if (!(oc = lookup_option (&server_universe, packet -> options,
|
||||
if (!(oc = lookup_option (&server_universe, state -> options,
|
||||
SV_UPDATE_STATIC_LEASES)) ||
|
||||
!evaluate_boolean_option_cache (&ignorep, packet, lease,
|
||||
(struct client_state *)0,
|
||||
|
148
server/dhcpd.8
148
server/dhcpd.8
@ -575,6 +575,154 @@ that the server actually exits.
|
||||
.PP
|
||||
To shut the server down, open its control object and set the state
|
||||
attribute to 2.
|
||||
.SH THE FAILOVER-STATE OBJECT
|
||||
The failover-state object is the object that tracks the state of the
|
||||
failover protocol as it is being managed for a given failover peer.
|
||||
The failover object has the following attributes (please see
|
||||
.B dhcpd.conf (5)
|
||||
for explanations about what these attributes mean):
|
||||
.PP
|
||||
.B name \fIdata\fR examine
|
||||
.RS 0.5i
|
||||
Indicates the name of the failover peer relationship, as described in
|
||||
the server's \fBdhcpd.conf\fR file.
|
||||
.RE
|
||||
.PP
|
||||
.B partner-address \fIdata\fR examine
|
||||
.RS 0.5i
|
||||
Indicates the failover partner's IP address.
|
||||
.RE
|
||||
.PP
|
||||
.B local-address \fIdata\fR examine
|
||||
.RS 0.5i
|
||||
Indicates the IP address that is being used by the DHCP server for
|
||||
this failover pair.
|
||||
.RE
|
||||
.PP
|
||||
.B partner-port \fIdata\fR examine
|
||||
.RS 0.5i
|
||||
Indicates the TCP port on which the failover partner is listening for
|
||||
failover protocol connections.
|
||||
.RE
|
||||
.PP
|
||||
.B local-port \fIdata\fR examine
|
||||
.RS 0.5i
|
||||
Indicates the TCP port on which the DHCP server is listening for
|
||||
failover protocol connections for this failover pair.
|
||||
.RE
|
||||
.PP
|
||||
.B max-outstanding-updates \fIinteger\fR examine
|
||||
.RS 0.5i
|
||||
Indicates the number of updates that can be outstanding and
|
||||
unacknowledged at any given time, in this failover relationship.
|
||||
.RE
|
||||
.PP
|
||||
.B mclt \fIinteger\fR examine
|
||||
.RS 0.5i
|
||||
Indicates the maximum client lead time in this failover relationship.
|
||||
.RE
|
||||
.PP
|
||||
.B load-balance-max-secs \fIinteger\fR examine
|
||||
.RS 0.5i
|
||||
Indicates the maximum value for the secs field in a client request
|
||||
before load balancing is bypassed.
|
||||
.RE
|
||||
.PP
|
||||
.B load-balance-hba \fIdata\fR examine
|
||||
.RS 0.5i
|
||||
Indicates the load balancing hash bucket array for this failover
|
||||
relationship.
|
||||
.RE
|
||||
.PP
|
||||
.B local-state \fIinteger\fR examine, modify
|
||||
.RS 0.5i
|
||||
Indicates the present state of the DHCP server in this failover
|
||||
relationship. Possible values for state are:
|
||||
.RE
|
||||
.RS 1i
|
||||
.PP
|
||||
.nf
|
||||
1 - partner down
|
||||
2 - normal
|
||||
3 - communications interrupted
|
||||
4 - resolution interrupted
|
||||
5 - potential conflict
|
||||
6 - recover
|
||||
7 - recover done
|
||||
8 - shutdown
|
||||
9 - paused
|
||||
10 - startup
|
||||
11 - recover wait
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
.RS 0.5i
|
||||
In general it is not a good idea to make changes to this state.
|
||||
However, in the case that the failover partner is known to be down, it
|
||||
can be useful to set the DHCP server's failover state to partner
|
||||
down. At this point the DHCP server will take over service of the
|
||||
failover partner's leases as soon as possible, and will give out
|
||||
normal leases, not leases that are restricted by MCLT. If you do put
|
||||
the DHCP server into the partner-down when the other DHCP server is
|
||||
not in the partner-down state, but is not reachable, IP address
|
||||
assignment conflicts are possible, even likely. Once a server has
|
||||
been put into partner-down mode, its failover partner must not be
|
||||
brought back online until communication is possible between the two
|
||||
servers.
|
||||
.RE
|
||||
.PP
|
||||
.B partner-state \fIinteger\fR examine
|
||||
.RS 0.5i
|
||||
Indicates the present state of the failover partner.
|
||||
.RE
|
||||
.PP
|
||||
.B local-stos \fIinteger\fR examine
|
||||
.RS 0.5i
|
||||
Indicates the time at which the DHCP server entered its present state
|
||||
in this failover relationship.
|
||||
.RE
|
||||
.PP
|
||||
.B partner-stos \fIinteger\fR examine
|
||||
.RS 0.5i
|
||||
Indicates the time at which the failover partner entered its present state.
|
||||
.RE
|
||||
.PP
|
||||
.B hierarchy \fIinteger\fR examine
|
||||
.RS 0.5i
|
||||
Indicates whether the DHCP server is primary (0) or secondary (1) in
|
||||
this failover relationship.
|
||||
.RE
|
||||
.PP
|
||||
.B last-packet-sent \fIinteger\fR examine
|
||||
.RS 0.5i
|
||||
Indicates the time at which the most recent failover packet was sent
|
||||
by this DHCP server to its failover partner.
|
||||
.RE
|
||||
.PP
|
||||
.B last-timestamp-received \fIinteger\fR examine
|
||||
.RS 0.5i
|
||||
Indicates the timestamp that was on the failover message most recently
|
||||
received from the failover partner.
|
||||
.RE
|
||||
.PP
|
||||
.B skew \fIinteger\fR examine
|
||||
.RS 0.5i
|
||||
Indicates the skew between the failover partner's clock and this DHCP
|
||||
server's clock
|
||||
.RE
|
||||
.PP
|
||||
.B max-response-delay \fIinteger\fR examine
|
||||
.RS 0.5i
|
||||
Indicates the time in seconds after which, if no message is received
|
||||
from the failover partner, the partner is assumed to be out of
|
||||
communication.
|
||||
.RE
|
||||
.PP
|
||||
.B cur-unacked-updates \fIinteger\fR examine
|
||||
.RS 0.5i
|
||||
Indicates the number of update messages that have been received from
|
||||
the failover partner but not yet processed.
|
||||
.RE
|
||||
.SH FILES
|
||||
.B ETCDIR/dhcpd.conf, DBDIR/dhcpd.leases, RUNDIR/dhcpd.pid,
|
||||
.B DBDIR/dhcpd.leases~.
|
||||
|
@ -43,7 +43,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"$Id: failover.c,v 1.55 2001/06/27 00:31:12 mellon Exp $ Copyright (c) 1999-2001 The Internet Software Consortium. All rights reserved.\n";
|
||||
"$Id: failover.c,v 1.56 2001/06/29 18:34:57 mellon Exp $ Copyright (c) 1999-2001 The Internet Software Consortium. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "dhcpd.h"
|
||||
@ -76,6 +76,9 @@ void dhcp_failover_startup ()
|
||||
to establish a connection with it. */
|
||||
status = dhcp_failover_link_initiate ((omapi_object_t *)state);
|
||||
if (status != ISC_R_SUCCESS && status != ISC_R_INCOMPLETE) {
|
||||
#if defined (DEBUG_FAILOVER_TIMING)
|
||||
log_info ("add_timeout +90 dhcp_failover_reconnect");
|
||||
#endif
|
||||
add_timeout (cur_time + 90,
|
||||
dhcp_failover_reconnect, state,
|
||||
(tvref_t)
|
||||
@ -89,6 +92,10 @@ void dhcp_failover_startup ()
|
||||
status = (dhcp_failover_listen
|
||||
((omapi_object_t *)state));
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
#if defined (DEBUG_FAILOVER_TIMING)
|
||||
log_info ("add_timeout +90 %s",
|
||||
"dhcp_failover_listener_restart");
|
||||
#endif
|
||||
add_timeout (cur_time + 90,
|
||||
dhcp_failover_listener_restart,
|
||||
state,
|
||||
@ -292,6 +299,10 @@ isc_result_t dhcp_failover_link_signal (omapi_object_t *h,
|
||||
status = ISC_R_SUCCESS;
|
||||
/* Allow the peer fifteen seconds to send us a
|
||||
startup message. */
|
||||
#if defined (DEBUG_FAILOVER_TIMING)
|
||||
log_info ("add_timeout +15 %s",
|
||||
"dhcp_failover_link_startup_timeout");
|
||||
#endif
|
||||
add_timeout (cur_time + 15,
|
||||
dhcp_failover_link_startup_timeout,
|
||||
link,
|
||||
@ -312,6 +323,10 @@ isc_result_t dhcp_failover_link_signal (omapi_object_t *h,
|
||||
name);
|
||||
|
||||
/* Start trying to reconnect. */
|
||||
#if defined (DEBUG_FAILOVER_TIMING)
|
||||
log_info ("add_timeout +5 %s",
|
||||
"dhcp_failover_reconnect");
|
||||
#endif
|
||||
add_timeout (cur_time + 5, dhcp_failover_reconnect,
|
||||
state,
|
||||
(tvref_t)dhcp_failover_state_reference,
|
||||
@ -1164,12 +1179,17 @@ isc_result_t dhcp_failover_state_signal (omapi_object_t *o,
|
||||
|
||||
dhcp_failover_link_dereference (&state -> link_to_peer, MDL);
|
||||
dhcp_failover_state_transition (state, "disconnect");
|
||||
if (state -> i_am == primary)
|
||||
if (state -> i_am == primary) {
|
||||
#if defined (DEBUG_FAILOVER_TIMING)
|
||||
log_info ("add_timeout +90 %s",
|
||||
"dhcp_failover_reconnect");
|
||||
#endif
|
||||
add_timeout (cur_time + 90, dhcp_failover_reconnect,
|
||||
state,
|
||||
(tvref_t)dhcp_failover_state_reference,
|
||||
(tvunref_t)
|
||||
dhcp_failover_state_dereference);
|
||||
}
|
||||
} else if (!strcmp (name, "message")) {
|
||||
link = va_arg (ap, dhcp_failover_link_t *);
|
||||
|
||||
@ -1302,11 +1322,21 @@ isc_result_t dhcp_failover_state_signal (omapi_object_t *o,
|
||||
if (link -> imsg -> options_present & FTB_RECEIVE_TIMER)
|
||||
state -> partner.max_response_delay =
|
||||
link -> imsg -> receive_timer;
|
||||
#if defined (DEBUG_FAILOVER_TIMING)
|
||||
log_info ("add_timeout +%d %s",
|
||||
(int)state -> partner.max_response_delay / 3,
|
||||
"dhcp_failover_send_contact");
|
||||
#endif
|
||||
add_timeout (cur_time +
|
||||
(int)state -> partner.max_response_delay / 3,
|
||||
dhcp_failover_send_contact, state,
|
||||
(tvref_t)dhcp_failover_state_reference,
|
||||
(tvunref_t)dhcp_failover_state_dereference);
|
||||
#if defined (DEBUG_FAILOVER_TIMING)
|
||||
log_info ("add_timeout +%d %s",
|
||||
(int)state -> me.max_response_delay,
|
||||
"dhcp_failover_timeout");
|
||||
#endif
|
||||
add_timeout (cur_time +
|
||||
(int)state -> me.max_response_delay,
|
||||
dhcp_failover_timeout, state,
|
||||
@ -1360,12 +1390,19 @@ isc_result_t dhcp_failover_state_signal (omapi_object_t *o,
|
||||
if (state -> link_to_peer &&
|
||||
state -> link_to_peer == link &&
|
||||
state -> link_to_peer -> state != dhcp_flink_disconnected)
|
||||
{
|
||||
#if defined (DEBUG_FAILOVER_TIMING)
|
||||
log_info ("add_timeout +%d %s",
|
||||
(int)state -> me.max_response_delay,
|
||||
"dhcp_failover_timeout");
|
||||
#endif
|
||||
add_timeout (cur_time +
|
||||
(int)state -> me.max_response_delay,
|
||||
dhcp_failover_timeout, state,
|
||||
(tvref_t)dhcp_failover_state_reference,
|
||||
(tvunref_t)dhcp_failover_state_dereference);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* Handle all the events we care about... */
|
||||
@ -1676,6 +1713,10 @@ isc_result_t dhcp_failover_set_state (dhcp_failover_state_t *state,
|
||||
break;
|
||||
|
||||
case startup:
|
||||
#if defined (DEBUG_FAILOVER_TIMING)
|
||||
log_info ("add_timeout +15 %s",
|
||||
"dhcp_failover_startup_timeout");
|
||||
#endif
|
||||
add_timeout (cur_time + 15,
|
||||
dhcp_failover_startup_timeout,
|
||||
state,
|
||||
@ -1687,14 +1728,20 @@ isc_result_t dhcp_failover_set_state (dhcp_failover_state_t *state,
|
||||
/* If we come back in recover_wait and there's still waiting
|
||||
to do, set a timeout. */
|
||||
case recover_wait:
|
||||
if (state -> me.stos + state -> mclt > cur_time)
|
||||
if (state -> me.stos + state -> mclt > cur_time) {
|
||||
#if defined (DEBUG_FAILOVER_TIMING)
|
||||
log_info ("add_timeout +%d %s",
|
||||
(int)(cur_time -
|
||||
state -> me.stos + state -> mclt),
|
||||
"dhcp_failover_startup_timeout");
|
||||
#endif
|
||||
add_timeout ((int)(state -> me.stos + state -> mclt),
|
||||
dhcp_failover_recover_done,
|
||||
state,
|
||||
(tvref_t)omapi_object_reference,
|
||||
(tvunref_t)
|
||||
omapi_object_dereference);
|
||||
else
|
||||
} else
|
||||
dhcp_failover_recover_done (state);
|
||||
break;
|
||||
|
||||
@ -1714,6 +1761,11 @@ isc_result_t dhcp_failover_set_state (dhcp_failover_state_t *state,
|
||||
state -> me.stos + state -> mclt) {
|
||||
p -> next_event_time =
|
||||
state -> me.stos + state -> mclt;
|
||||
#if defined (DEBUG_FAILOVER_TIMING)
|
||||
log_info ("add_timeout +%d %s",
|
||||
(int)(cur_time - p -> next_event_time),
|
||||
"pool_timer");
|
||||
#endif
|
||||
add_timeout (p -> next_event_time, pool_timer, p,
|
||||
(tvref_t)pool_reference,
|
||||
(tvunref_t)pool_dereference);
|
||||
@ -2344,6 +2396,11 @@ int dhcp_failover_send_acks (dhcp_failover_state_t *state)
|
||||
void dhcp_failover_toack_queue_timeout (void *vs)
|
||||
{
|
||||
dhcp_failover_state_t *state = vs;
|
||||
|
||||
#if defined (DEBUG_FAILOVER_TIMING)
|
||||
log_info ("dhcp_failover_toack_queue_timeout");
|
||||
#endif
|
||||
|
||||
dhcp_failover_send_acks (state);
|
||||
}
|
||||
|
||||
@ -2373,6 +2430,10 @@ int dhcp_failover_queue_ack (dhcp_failover_state_t *state,
|
||||
|
||||
/* Schedule a timeout to flush the ack queue. */
|
||||
if (state -> pending_acks > 0) {
|
||||
#if defined (DEBUG_FAILOVER_TIMING)
|
||||
log_info ("add_timeout +2 %s",
|
||||
"dhcp_failover_toack_queue_timeout");
|
||||
#endif
|
||||
add_timeout (cur_time + 2,
|
||||
dhcp_failover_toack_queue_timeout, state,
|
||||
(tvref_t)dhcp_failover_state_reference,
|
||||
@ -2510,6 +2571,9 @@ void dhcp_failover_reconnect (void *vs)
|
||||
dhcp_failover_state_t *state = vs;
|
||||
isc_result_t status;
|
||||
|
||||
#if defined (DEBUG_FAILOVER_TIMING)
|
||||
log_info ("dhcp_failover_reconnect");
|
||||
#endif
|
||||
/* If we already connected the other way, let the connection
|
||||
recovery code initiate any retry that may be required. */
|
||||
if (state -> link_to_peer)
|
||||
@ -2519,6 +2583,10 @@ void dhcp_failover_reconnect (void *vs)
|
||||
if (status != ISC_R_SUCCESS && status != ISC_R_INCOMPLETE) {
|
||||
log_info ("failover peer %s: %s", state -> name,
|
||||
isc_result_totext (status));
|
||||
#if defined (DEBUG_FAILOVER_TIMING)
|
||||
log_info ("add_timeout +90 %s",
|
||||
"dhcp_failover_listener_restart");
|
||||
#endif
|
||||
add_timeout (cur_time + 90,
|
||||
dhcp_failover_listener_restart, state,
|
||||
(tvref_t)dhcp_failover_state_reference,
|
||||
@ -2531,6 +2599,10 @@ void dhcp_failover_startup_timeout (void *vs)
|
||||
dhcp_failover_state_t *state = vs;
|
||||
isc_result_t status;
|
||||
|
||||
#if defined (DEBUG_FAILOVER_TIMING)
|
||||
log_info ("dhcp_failover_startup_timeout");
|
||||
#endif
|
||||
|
||||
dhcp_failover_state_transition (state, "disconnect");
|
||||
}
|
||||
|
||||
@ -2556,10 +2628,18 @@ void dhcp_failover_listener_restart (void *vs)
|
||||
dhcp_failover_state_t *state = vs;
|
||||
isc_result_t status;
|
||||
|
||||
#if defined (DEBUG_FAILOVER_TIMING)
|
||||
log_info ("dhcp_failover_listener_restart");
|
||||
#endif
|
||||
|
||||
status = dhcp_failover_listen ((omapi_object_t *)state);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
log_info ("failover peer %s: %s", state -> name,
|
||||
isc_result_totext (status));
|
||||
#if defined (DEBUG_FAILOVER_TIMING)
|
||||
log_info ("add_timeout +90 %s",
|
||||
"dhcp_failover_listener_restart");
|
||||
#endif
|
||||
add_timeout (cur_time + 90,
|
||||
dhcp_failover_listener_restart, state,
|
||||
(tvref_t)dhcp_failover_state_reference,
|
||||
@ -3605,6 +3685,12 @@ isc_result_t dhcp_failover_put_message (dhcp_failover_link_t *link,
|
||||
}
|
||||
if (link -> state_object &&
|
||||
link -> state_object -> link_to_peer == link) {
|
||||
#if defined (DEBUG_FAILOVER_TIMING)
|
||||
log_info ("add_timeout +%d %s",
|
||||
(int)(link -> state_object ->
|
||||
partner.max_response_delay) / 3,
|
||||
"dhcp_failover_send_contact");
|
||||
#endif
|
||||
add_timeout (cur_time +
|
||||
(int)(link -> state_object ->
|
||||
partner.max_response_delay) / 3,
|
||||
@ -3628,6 +3714,10 @@ void dhcp_failover_timeout (void *vstate)
|
||||
dhcp_failover_link_t *link;
|
||||
isc_result_t status;
|
||||
|
||||
#if defined (DEBUG_FAILOVER_TIMING)
|
||||
log_info ("dhcp_failover_timeout");
|
||||
#endif
|
||||
|
||||
if (!state || state -> type != dhcp_type_failover_state)
|
||||
return;
|
||||
link = state -> link_to_peer;
|
||||
@ -3659,6 +3749,10 @@ void dhcp_failover_send_contact (void *vstate)
|
||||
# define FMA (char *)0, (unsigned *)0, 0
|
||||
#endif
|
||||
|
||||
#if defined (DEBUG_FAILOVER_TIMING)
|
||||
log_info ("dhcp_failover_send_contact");
|
||||
#endif
|
||||
|
||||
if (!state || state -> type != dhcp_type_failover_state)
|
||||
return;
|
||||
link = state -> link_to_peer;
|
||||
@ -4641,6 +4735,12 @@ dhcp_failover_process_update_done (dhcp_failover_state_t *state,
|
||||
state -> partner.state != recover &&
|
||||
state -> partner.state != recover_done) {
|
||||
dhcp_failover_set_state (state, recover_wait);
|
||||
#if defined (DEBUG_FAILOVER_TIMING)
|
||||
log_info ("add_timeout +%d %s",
|
||||
(int)(cur_time -
|
||||
state -> me.stos + state -> mclt),
|
||||
"dhcp_failover_recover_done");
|
||||
#endif
|
||||
add_timeout ((int)(state -> me.stos + state -> mclt),
|
||||
dhcp_failover_recover_done,
|
||||
state,
|
||||
@ -4658,6 +4758,10 @@ void dhcp_failover_recover_done (void *sp)
|
||||
{
|
||||
dhcp_failover_state_t *state = sp;
|
||||
|
||||
#if defined (DEBUG_FAILOVER_TIMING)
|
||||
log_info ("dhcp_failover_recover_done");
|
||||
#endif
|
||||
|
||||
dhcp_failover_set_state (state, recover_done);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user