mirror of
https://gitlab.isc.org/isc-projects/dhcp
synced 2025-08-31 06:15:55 +00:00
sync with branch
This commit is contained in:
@@ -43,7 +43,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"$Id: confpars.c,v 1.146 2001/07/10 20:36:02 brister Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.\n";
|
||||
"$Id: confpars.c,v 1.147 2001/08/10 10:50:44 mellon Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "dhcpd.h"
|
||||
@@ -1286,6 +1286,8 @@ void parse_pool_statement (cfile, group, type)
|
||||
parse_warn (cfile,
|
||||
"failover peer %s: %s", val,
|
||||
isc_result_totext (status));
|
||||
else
|
||||
pool -> failover_peer -> pool_count++;
|
||||
parse_semi (cfile);
|
||||
break;
|
||||
#endif
|
||||
@@ -1851,7 +1853,7 @@ int parse_class_declaration (cp, cfile, group, type)
|
||||
}
|
||||
|
||||
/* Save the name, if there is one. */
|
||||
class -> name = (char *)name;
|
||||
class -> name = name;
|
||||
}
|
||||
|
||||
if (type == 0 || type == 1 || type == 3)
|
||||
@@ -2764,6 +2766,7 @@ int parse_lease_declaration (struct lease **lp, struct parse *cfile)
|
||||
break;
|
||||
|
||||
case OPTION:
|
||||
case SUPERSEDE:
|
||||
noequal = 0;
|
||||
seenbit = 0;
|
||||
oc = (struct option_cache *)0;
|
||||
|
@@ -43,7 +43,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"$Id: dhcp.c,v 1.194 2001/06/27 00:31:07 mellon Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.\n";
|
||||
"$Id: dhcp.c,v 1.195 2001/08/10 10:50:45 mellon Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "dhcpd.h"
|
||||
@@ -2919,6 +2919,7 @@ int find_lease (struct lease **lp,
|
||||
be two "free" leases for the same uid, but only one of
|
||||
them that's available for this failover peer to allocate. */
|
||||
if (uid_lease -> binding_state != FTS_ACTIVE &&
|
||||
uid_lease -> binding_state != FTS_BOOTP &&
|
||||
!lease_mine_to_reallocate (uid_lease)) {
|
||||
#if defined (DEBUG_FIND_LEASE)
|
||||
log_info ("not mine to allocate: %s",
|
||||
@@ -2982,6 +2983,7 @@ int find_lease (struct lease **lp,
|
||||
be two "free" leases for the same uid, but only one of
|
||||
them that's available for this failover peer to allocate. */
|
||||
if (hw_lease -> binding_state != FTS_ACTIVE &&
|
||||
hw_lease -> binding_state != FTS_BOOTP &&
|
||||
!lease_mine_to_reallocate (hw_lease)) {
|
||||
#if defined (DEBUG_FIND_LEASE)
|
||||
log_info ("not mine to allocate: %s",
|
||||
@@ -3114,6 +3116,7 @@ int find_lease (struct lease **lp,
|
||||
is not active, and is not ours to reallocate, forget about it. */
|
||||
if (ip_lease && (uid_lease || hw_lease) &&
|
||||
ip_lease -> binding_state != FTS_ACTIVE &&
|
||||
ip_lease -> binding_state != FTS_BOOTP &&
|
||||
!lease_mine_to_reallocate (ip_lease) &&
|
||||
packet -> packet_type == DHCPDISCOVER) {
|
||||
#if defined (DEBUG_FIND_LEASE)
|
||||
@@ -3126,14 +3129,16 @@ int find_lease (struct lease **lp,
|
||||
on the subnet that matches its uid, pick the one that
|
||||
it asked for and (if we can) free the other. */
|
||||
if (ip_lease &&
|
||||
ip_lease -> binding_state == FTS_ACTIVE &&
|
||||
(ip_lease -> binding_state == FTS_ACTIVE ||
|
||||
ip_lease -> binding_state == FTS_BOOTP) &&
|
||||
ip_lease -> uid && ip_lease != uid_lease) {
|
||||
if (have_client_identifier &&
|
||||
(ip_lease -> uid_len == client_identifier.len) &&
|
||||
!memcmp (client_identifier.data,
|
||||
ip_lease -> uid, ip_lease -> uid_len)) {
|
||||
if (uid_lease) {
|
||||
if (uid_lease -> binding_state == FTS_ACTIVE) {
|
||||
if (uid_lease -> binding_state == FTS_ACTIVE ||
|
||||
uid_lease -> binding_state == FTS_BOOTP) {
|
||||
log_error ("client %s has duplicate%s on %s",
|
||||
(print_hw_addr
|
||||
(packet -> raw -> htype,
|
||||
@@ -3147,7 +3152,10 @@ int find_lease (struct lease **lp,
|
||||
it shouldn't still be using the old
|
||||
one, so we can free it for allocation. */
|
||||
if (uid_lease &&
|
||||
uid_lease -> binding_state == FTS_ACTIVE &&
|
||||
(uid_lease -> binding_state == FTS_ACTIVE
|
||||
||
|
||||
uid_lease -> binding_state == FTS_BOOTP)
|
||||
&&
|
||||
!packet -> raw -> ciaddr.s_addr &&
|
||||
(share ==
|
||||
uid_lease -> subnet -> shared_network) &&
|
||||
@@ -3302,7 +3310,8 @@ int find_lease (struct lease **lp,
|
||||
if (lease) {
|
||||
if (!packet -> raw -> ciaddr.s_addr &&
|
||||
packet -> packet_type == DHCPREQUEST &&
|
||||
uid_lease -> binding_state == FTS_ACTIVE)
|
||||
(uid_lease -> binding_state == FTS_ACTIVE ||
|
||||
uid_lease -> binding_state == FTS_BOOTP))
|
||||
dissociate_lease (uid_lease);
|
||||
#if defined (DEBUG_FIND_LEASE)
|
||||
log_info ("not choosing uid lease.");
|
||||
|
@@ -956,7 +956,7 @@ client sends a DHCPDISCOVER message, then the server sends a
|
||||
DHCPOFFER, then the client sends a DHCPREQUEST, then the server sends
|
||||
a DHCPACK. In the current version of the server, the server will do
|
||||
a DNS update after it has received the DHCPREQUEST, and before it has
|
||||
sent the DHCPOFFER. It only sends the DNS update if it has not sent
|
||||
sent the DHCPACK. It only sends the DNS update if it has not sent
|
||||
one for the client's address before, in order to minimize the impact
|
||||
on the DHCP server.
|
||||
.PP
|
||||
|
@@ -43,7 +43,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"$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";
|
||||
"$Id: failover.c,v 1.57 2001/08/10 10:50:49 mellon Exp $ Copyright (c) 1999-2001 The Internet Software Consortium. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "dhcpd.h"
|
||||
@@ -72,6 +72,15 @@ void dhcp_failover_startup ()
|
||||
for (state = failover_states; state; state = state -> next) {
|
||||
dhcp_failover_state_transition (state, "startup");
|
||||
|
||||
if (state -> pool_count == 0) {
|
||||
log_error ("failover peer declaration with no %s",
|
||||
"referring pools.");
|
||||
log_error ("In order to use failover, you MUST %s",
|
||||
"refer to your main failover declaration");
|
||||
log_error ("in each pool declaration. You MUST %s",
|
||||
"NOT use range declarations outside");
|
||||
log_fatal ("of pool declarations.");
|
||||
}
|
||||
/* In case the peer is already running, immediately try
|
||||
to establish a connection with it. */
|
||||
status = dhcp_failover_link_initiate ((omapi_object_t *)state);
|
||||
@@ -243,7 +252,7 @@ isc_result_t dhcp_failover_link_initiate (omapi_object_t *h)
|
||||
local_addr.addrtype = AF_INET;
|
||||
local_addr.addrlen = sizeof (struct in_addr);
|
||||
if (!state -> server_identifier.len) {
|
||||
log_fatal ("failover peer %s: no identifier.",
|
||||
log_fatal ("failover peer %s: no local address.",
|
||||
state -> name);
|
||||
}
|
||||
} else {
|
||||
@@ -4981,14 +4990,9 @@ normal_binding_state_transition_check (struct lease *lease,
|
||||
switch (binding_state) {
|
||||
case FTS_FREE:
|
||||
case FTS_BACKUP:
|
||||
/* Can't set a lease to free or backup until the
|
||||
peer agrees that it's expired. */
|
||||
if (tsfp > cur_time) {
|
||||
new_state = lease -> binding_state;
|
||||
goto out;
|
||||
}
|
||||
return binding_state;
|
||||
|
||||
/* These are invalid state transitions - should we
|
||||
prevent them? */
|
||||
case FTS_RESERVED:
|
||||
case FTS_BOOTP:
|
||||
case FTS_EXPIRED:
|
||||
|
@@ -50,7 +50,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"$Id: omapi.c,v 1.50 2001/07/10 20:36:06 brister Exp $ Copyright (c) 1999-2001 The Internet Software Consortium. All rights reserved.\n";
|
||||
"$Id: omapi.c,v 1.51 2001/08/10 10:50:50 mellon Exp $ Copyright (c) 1999-2001 The Internet Software Consortium. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "dhcpd.h"
|
||||
@@ -1868,7 +1868,7 @@ isc_result_t dhcp_class_destroy (omapi_object_t *h, const char *file, int line)
|
||||
isc_result_t status;
|
||||
int i;
|
||||
|
||||
if (h -> type != dhcp_type_class || h -> type != dhcp_type_subclass)
|
||||
if (h -> type != dhcp_type_class && h -> type != dhcp_type_subclass)
|
||||
return ISC_R_INVALIDARG;
|
||||
class = (struct class *)h;
|
||||
|
||||
|
Reference in New Issue
Block a user