mirror of
https://gitlab.isc.org/isc-projects/dhcp
synced 2025-08-29 13:28:14 +00:00
Fix binding support.
This commit is contained in:
parent
d00855e05c
commit
583cab3c28
39
server/mdb.c
39
server/mdb.c
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char copyright[] =
|
static char copyright[] =
|
||||||
"$Id: mdb.c,v 1.24 2000/01/08 01:48:42 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
|
"$Id: mdb.c,v 1.25 2000/01/25 01:42:48 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include "dhcpd.h"
|
#include "dhcpd.h"
|
||||||
@ -132,11 +132,9 @@ isc_result_t enter_host (hd, dynamicp, commit)
|
|||||||
(esp -> data.option -> option -> code ==
|
(esp -> data.option -> option -> code ==
|
||||||
DHO_DHCP_CLIENT_IDENTIFIER)) {
|
DHO_DHCP_CLIENT_IDENTIFIER)) {
|
||||||
evaluate_option_cache
|
evaluate_option_cache
|
||||||
(&hd -> client_identifier,
|
(&hd -> client_identifier, (struct packet *)0,
|
||||||
(struct packet *)0,
|
(struct lease *)0, (struct option_state *)0,
|
||||||
(struct lease *)0,
|
(struct option_state *)0, &global_scope,
|
||||||
(struct option_state *)0,
|
|
||||||
(struct option_state *)0,
|
|
||||||
esp -> data.option);
|
esp -> data.option);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -361,7 +359,7 @@ struct subnet *find_host_for_network (host, addr, share)
|
|||||||
(struct lease *)0,
|
(struct lease *)0,
|
||||||
(struct option_state *)0,
|
(struct option_state *)0,
|
||||||
(struct option_state *)0,
|
(struct option_state *)0,
|
||||||
hp -> fixed_addr))
|
&global_scope, hp -> fixed_addr))
|
||||||
continue;
|
continue;
|
||||||
for (i = 0; i < fixed_addr.len; i += 4) {
|
for (i = 0; i < fixed_addr.len; i += 4) {
|
||||||
ip_address.len = 4;
|
ip_address.len = 4;
|
||||||
@ -886,6 +884,10 @@ int supersede_lease (comp, lease, commit)
|
|||||||
comp -> hardware_addr = lease -> hardware_addr;
|
comp -> hardware_addr = lease -> hardware_addr;
|
||||||
comp -> flags = ((lease -> flags & ~PERSISTENT_FLAGS) |
|
comp -> flags = ((lease -> flags & ~PERSISTENT_FLAGS) |
|
||||||
(comp -> flags & ~EPHEMERAL_FLAGS));
|
(comp -> flags & ~EPHEMERAL_FLAGS));
|
||||||
|
if (comp -> scope.bindings)
|
||||||
|
free_bindings (&comp -> scope, "supersede_lease");
|
||||||
|
comp -> scope.bindings = lease -> scope.bindings;
|
||||||
|
lease -> scope.bindings = (struct binding *)0;
|
||||||
|
|
||||||
if (lease -> on_expiry) {
|
if (lease -> on_expiry) {
|
||||||
if (comp -> on_expiry)
|
if (comp -> on_expiry)
|
||||||
@ -1036,6 +1038,7 @@ int supersede_lease (comp, lease, commit)
|
|||||||
execute_statements ((struct packet *)0, lease,
|
execute_statements ((struct packet *)0, lease,
|
||||||
(struct option_state *)0,
|
(struct option_state *)0,
|
||||||
(struct option_state *)0, /* XXX */
|
(struct option_state *)0, /* XXX */
|
||||||
|
&lease -> scope,
|
||||||
comp -> on_expiry);
|
comp -> on_expiry);
|
||||||
executable_statement_dereference (&comp -> on_expiry,
|
executable_statement_dereference (&comp -> on_expiry,
|
||||||
"supersede_lease");
|
"supersede_lease");
|
||||||
@ -1108,16 +1111,13 @@ void release_lease (lease, packet)
|
|||||||
{
|
{
|
||||||
struct lease lt;
|
struct lease lt;
|
||||||
|
|
||||||
#if defined (NSUPDATE) && 0
|
|
||||||
nsupdate (lease, lease -> state, packet, DELETE);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* If there are statements to execute when the lease is
|
/* If there are statements to execute when the lease is
|
||||||
released, execute them. */
|
released, execute them. */
|
||||||
if (lease -> on_release) {
|
if (lease -> on_release) {
|
||||||
execute_statements (packet, lease, packet -> options,
|
execute_statements (packet, lease, packet -> options,
|
||||||
(struct option_state *)0, /* XXX */
|
(struct option_state *)0, /* XXX */
|
||||||
lease -> on_release);
|
&lease -> scope, lease -> on_release);
|
||||||
|
if (lease -> on_release)
|
||||||
executable_statement_dereference (&lease -> on_release,
|
executable_statement_dereference (&lease -> on_release,
|
||||||
"dhcprelease");
|
"dhcprelease");
|
||||||
}
|
}
|
||||||
@ -1138,6 +1138,9 @@ void release_lease (lease, packet)
|
|||||||
lt.on_release = 0;
|
lt.on_release = 0;
|
||||||
lt.on_commit = 0;
|
lt.on_commit = 0;
|
||||||
|
|
||||||
|
/* Blow away any bindings. */
|
||||||
|
lt.scope.bindings = (struct binding *)0;
|
||||||
|
|
||||||
lt.ends = cur_time;
|
lt.ends = cur_time;
|
||||||
lt.billing_class = (struct class *)0;
|
lt.billing_class = (struct class *)0;
|
||||||
supersede_lease (lease, <, 1);
|
supersede_lease (lease, <, 1);
|
||||||
@ -1162,6 +1165,9 @@ void abandon_lease (lease, message)
|
|||||||
lt.on_release = 0;
|
lt.on_release = 0;
|
||||||
lt.on_commit = 0;
|
lt.on_commit = 0;
|
||||||
|
|
||||||
|
/* Blow away any bindings. */
|
||||||
|
lt.scope.bindings = (struct binding *)0;
|
||||||
|
|
||||||
lt.ends = cur_time; /* XXX */
|
lt.ends = cur_time; /* XXX */
|
||||||
log_error ("Abandoning IP address %s: %s",
|
log_error ("Abandoning IP address %s: %s",
|
||||||
piaddr (lease -> ip_addr), message);
|
piaddr (lease -> ip_addr), message);
|
||||||
@ -1187,6 +1193,9 @@ void dissociate_lease (lease)
|
|||||||
lt.on_release = 0;
|
lt.on_release = 0;
|
||||||
lt.on_commit = 0;
|
lt.on_commit = 0;
|
||||||
|
|
||||||
|
/* Blow away any bindings. */
|
||||||
|
lt.scope.bindings = (struct binding *)0;
|
||||||
|
|
||||||
if (lt.ends > cur_time)
|
if (lt.ends > cur_time)
|
||||||
lt.ends = cur_time;
|
lt.ends = cur_time;
|
||||||
lt.hardware_addr.hlen = 0;
|
lt.hardware_addr.hlen = 0;
|
||||||
@ -1217,9 +1226,11 @@ void pool_timer (vpool)
|
|||||||
execute_statements ((struct packet *)0, lease,
|
execute_statements ((struct packet *)0, lease,
|
||||||
(struct option_state *)0,
|
(struct option_state *)0,
|
||||||
(struct option_state *)0, /* XXX */
|
(struct option_state *)0, /* XXX */
|
||||||
|
&lease -> scope,
|
||||||
lease -> on_expiry);
|
lease -> on_expiry);
|
||||||
executable_statement_dereference (&lease -> on_expiry,
|
if (lease -> on_expiry)
|
||||||
"pool_timer");
|
executable_statement_dereference
|
||||||
|
(&lease -> on_expiry, "pool_timer");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If there's an on_release event, blow it away. */
|
/* If there's an on_release event, blow it away. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user