diff options
author | David Hankins <dhankins@isc.org> | 2006-04-27 17:26:42 +0000 |
---|---|---|
committer | David Hankins <dhankins@isc.org> | 2006-04-27 17:26:42 +0000 |
commit | a55ccdd0371568e01a6bbab7b99e427ab66e1aef (patch) | |
tree | 057d9ab6464115f011246b072b43ce1d04993e1c /server/omapi.c | |
parent | 91e17fc3aa6f6f96063b1eef7d877b779be5683c (diff) | |
download | isc-dhcp-a55ccdd0371568e01a6bbab7b99e427ab66e1aef.tar.gz |
- Support for 'reserved' (psuedo-static) and BOOTP leases via failover
was introduced. [ISC-Bugs #13672]
- The failover implementation was updated to comply with revision 12 of
the protocol draft. [ISC-Bugs #13672]
Diffstat (limited to 'server/omapi.c')
-rw-r--r-- | server/omapi.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/server/omapi.c b/server/omapi.c index b24a773b..9704a03c 100644 --- a/server/omapi.c +++ b/server/omapi.c @@ -41,7 +41,7 @@ #ifndef lint static char copyright[] = -"$Id: omapi.c,v 1.56 2006/02/27 23:43:30 dhankins Exp $ Copyright (c) 2004-2006 Internet Systems Consortium. All rights reserved.\n"; +"$Id: omapi.c,v 1.57 2006/04/27 17:26:42 dhankins Exp $ Copyright (c) 2004-2006 Internet Systems Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -266,6 +266,23 @@ isc_result_t dhcp_lease_set_value (omapi_object_t *h, return ISC_R_NOPERM; } else if (!omapi_ds_strcmp (name, "ends")) { return ISC_R_NOPERM; + } else if (!omapi_ds_strcmp(name, "flags")) { + u_int8_t oldflags; + + if (value->type != omapi_datatype_data) + return ISC_R_INVALIDARG; + + oldflags = lease->flags; + lease->flags = (value->u.buffer.value[0] & EPHEMERAL_FLAGS) | + (lease->flags & ~EPHEMERAL_FLAGS); + if(oldflags == lease->flags) + return ISC_R_SUCCESS; + if (!supersede_lease(lease, NULL, 1, 1, 1)) { + log_error("Failed to update flags for lease %s.", + piaddr(lease->ip_addr)); + return ISC_R_IOERROR; + } + return ISC_R_SUCCESS; } else if (!omapi_ds_strcmp (name, "billing-class")) { return ISC_R_UNCHANGED; /* XXX carefully allow change. */ } else if (!omapi_ds_strcmp (name, "hardware-address")) { @@ -383,6 +400,7 @@ isc_result_t dhcp_lease_destroy (omapi_object_t *h, const char *file, int line) { struct lease *lease; isc_result_t status; + u_int8_t flagbuf; if (h -> type != dhcp_type_lease) return ISC_R_INVALIDARG; @@ -485,6 +503,7 @@ isc_result_t dhcp_lease_stuff_values (omapi_object_t *c, u_int32_t bouncer; struct lease *lease; isc_result_t status; + u_int8_t flagbuf; if (h -> type != dhcp_type_lease) return ISC_R_INVALIDARG; @@ -681,6 +700,14 @@ isc_result_t dhcp_lease_stuff_values (omapi_object_t *c, if (status != ISC_R_SUCCESS) return status; + status = omapi_connection_put_name (c, "flags"); + if (status != ISC_R_SUCCESS) + return status; + flagbuf = lease->flags & EPHEMERAL_FLAGS; + status = omapi_connection_copyin(c, &flagbuf, 1); + if (status != ISC_R_SUCCESS) + return status; + if (lease -> scope) { status = binding_scope_stuff_values (c, lease -> scope); if (status != ISC_R_SUCCESS) |