Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/mpl/dhcp/dist/server Adjust to new bind libraries
details: https://anonhg.NetBSD.org/src/rev/bb9994ac5563
branches: trunk
changeset: 370669:bb9994ac5563
user: christos <christos%NetBSD.org@localhost>
date: Fri Sep 23 12:30:52 2022 +0000
description:
Adjust to new bind libraries
diffstat:
external/mpl/dhcp/dist/server/mdb6.c | 190 +++++++++++++++-------------------
1 files changed, 82 insertions(+), 108 deletions(-)
diffs (257 lines):
diff -r ee9346a2ff27 -r bb9994ac5563 external/mpl/dhcp/dist/server/mdb6.c
--- a/external/mpl/dhcp/dist/server/mdb6.c Fri Sep 23 12:22:49 2022 +0000
+++ b/external/mpl/dhcp/dist/server/mdb6.c Fri Sep 23 12:30:52 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mdb6.c,v 1.6 2022/04/03 01:11:00 christos Exp $ */
+/* $NetBSD: mdb6.c,v 1.7 2022/09/23 12:30:52 christos Exp $ */
/*
* Copyright (C) 2007-2017 by Internet Systems Consortium, Inc. ("ISC")
@@ -17,7 +17,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: mdb6.c,v 1.6 2022/04/03 01:11:00 christos Exp $");
+__RCSID("$NetBSD: mdb6.c,v 1.7 2022/09/23 12:30:52 christos Exp $");
/*!
@@ -671,19 +671,10 @@
dfree(tmp, file, line);
return ISC_R_NOMEMORY;
}
- if (isc_heap_create(dhcp_gbl_ctx.mctx, lease_older, active_changed,
- 0, &(tmp->active_timeouts)) != ISC_R_SUCCESS) {
- iasubopt_free_hash_table(&(tmp->leases), file, line);
- dfree(tmp, file, line);
- return ISC_R_NOMEMORY;
- }
- if (isc_heap_create(dhcp_gbl_ctx.mctx, lease_older, inactive_changed,
- 0, &(tmp->inactive_timeouts)) != ISC_R_SUCCESS) {
- isc_heap_destroy(&(tmp->active_timeouts));
- iasubopt_free_hash_table(&(tmp->leases), file, line);
- dfree(tmp, file, line);
- return ISC_R_NOMEMORY;
- }
+ isc_heap_create(dhcp_gbl_ctx.mctx, lease_older, active_changed,
+ 0, &(tmp->active_timeouts));
+ isc_heap_create(dhcp_gbl_ctx.mctx, lease_older, inactive_changed,
+ 0, &(tmp->inactive_timeouts));
*pool = tmp;
return ISC_R_SUCCESS;
@@ -1411,7 +1402,6 @@
isc_result_t
add_lease6(struct ipv6_pool *pool, struct iasubopt *lease,
time_t valid_lifetime_end_time) {
- isc_result_t insert_result;
struct iasubopt *test_iasubopt;
struct iasubopt *tmp_iasubopt;
@@ -1479,34 +1469,25 @@
tmp_iasubopt->hard_lifetime_end_time = valid_lifetime_end_time;
iasubopt_hash_add(pool->leases, &tmp_iasubopt->addr,
sizeof(tmp_iasubopt->addr), lease, MDL);
- insert_result = isc_heap_insert(pool->active_timeouts,
- tmp_iasubopt);
- if (insert_result == ISC_R_SUCCESS) {
- pool->num_active++;
+ isc_heap_insert(pool->active_timeouts, tmp_iasubopt);
+ pool->num_active++;
+ if (pool->ipv6_pond)
+ pool->ipv6_pond->num_active++;
+
+ if (tmp_iasubopt->state == FTS_ABANDONED) {
+ pool->num_abandoned++;
if (pool->ipv6_pond)
- pool->ipv6_pond->num_active++;
-
- if (tmp_iasubopt->state == FTS_ABANDONED) {
- pool->num_abandoned++;
- if (pool->ipv6_pond)
- pool->ipv6_pond->num_abandoned++;
- }
+ pool->ipv6_pond->num_abandoned++;
}
} else {
tmp_iasubopt->soft_lifetime_end_time = valid_lifetime_end_time;
- insert_result = isc_heap_insert(pool->inactive_timeouts,
- tmp_iasubopt);
- if (insert_result == ISC_R_SUCCESS)
- pool->num_inactive++;
+ isc_heap_insert(pool->inactive_timeouts, tmp_iasubopt);
+ pool->num_inactive++;
}
- if (insert_result != ISC_R_SUCCESS) {
- iasubopt_hash_delete(pool->leases, &lease->addr,
- sizeof(lease->addr), MDL);
- iasubopt_dereference(&tmp_iasubopt, MDL);
- return insert_result;
- }
-
+ iasubopt_hash_delete(pool->leases, &lease->addr,
+ sizeof(lease->addr), MDL);
+ iasubopt_dereference(&tmp_iasubopt, MDL);
/*
* Note: we intentionally leave tmp_iasubopt referenced; there
* is a reference in the heap/hash, after all.
@@ -1569,22 +1550,18 @@
*/
static isc_result_t
move_lease_to_active(struct ipv6_pool *pool, struct iasubopt *lease) {
- isc_result_t insert_result;
+ isc_heap_insert(pool->active_timeouts, lease);
+ iasubopt_hash_add(pool->leases, &lease->addr,
+ sizeof(lease->addr), lease, MDL);
+ isc_heap_delete(pool->inactive_timeouts,
+ lease->inactive_index);
+ pool->num_active++;
+ pool->num_inactive--;
+ lease->state = FTS_ACTIVE;
+ if (pool->ipv6_pond)
+ pool->ipv6_pond->num_active++;
- insert_result = isc_heap_insert(pool->active_timeouts, lease);
- if (insert_result == ISC_R_SUCCESS) {
- iasubopt_hash_add(pool->leases, &lease->addr,
- sizeof(lease->addr), lease, MDL);
- isc_heap_delete(pool->inactive_timeouts,
- lease->inactive_index);
- pool->num_active++;
- pool->num_inactive--;
- lease->state = FTS_ACTIVE;
- if (pool->ipv6_pond)
- pool->ipv6_pond->num_active++;
-
- }
- return insert_result;
+ return ISC_R_SUCCESS;
}
/*!
@@ -1656,72 +1633,69 @@
static isc_result_t
move_lease_to_inactive(struct ipv6_pool *pool, struct iasubopt *lease,
binding_state_t state) {
- isc_result_t insert_result;
- insert_result = isc_heap_insert(pool->inactive_timeouts, lease);
- if (insert_result == ISC_R_SUCCESS) {
- /*
- * Handle expire and release statements
- * To get here we must be active and have done a commit so
- * we should run the proper statements if they exist, though
- * that will change when we remove the inactive heap.
- * In addition we get rid of the references for both as we
- * can only do one (expire or release) on a lease
- */
- if (lease->on_star.on_expiry != NULL) {
- if (state == FTS_EXPIRED) {
- execute_statements(NULL, NULL, NULL,
- NULL, NULL, NULL,
- &lease->scope,
- lease->on_star.on_expiry,
- &lease->on_star);
- }
- executable_statement_dereference
- (&lease->on_star.on_expiry, MDL);
+ isc_heap_insert(pool->inactive_timeouts, lease);
+ /*
+ * Handle expire and release statements
+ * To get here we must be active and have done a commit so
+ * we should run the proper statements if they exist, though
+ * that will change when we remove the inactive heap.
+ * In addition we get rid of the references for both as we
+ * can only do one (expire or release) on a lease
+ */
+ if (lease->on_star.on_expiry != NULL) {
+ if (state == FTS_EXPIRED) {
+ execute_statements(NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ &lease->scope,
+ lease->on_star.on_expiry,
+ &lease->on_star);
}
+ executable_statement_dereference
+ (&lease->on_star.on_expiry, MDL);
+ }
- if (lease->on_star.on_release != NULL) {
- if (state == FTS_RELEASED) {
- execute_statements(NULL, NULL, NULL,
- NULL, NULL, NULL,
- &lease->scope,
- lease->on_star.on_release,
- &lease->on_star);
- }
- executable_statement_dereference
- (&lease->on_star.on_release, MDL);
+ if (lease->on_star.on_release != NULL) {
+ if (state == FTS_RELEASED) {
+ execute_statements(NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ &lease->scope,
+ lease->on_star.on_release,
+ &lease->on_star);
}
+ executable_statement_dereference
+ (&lease->on_star.on_release, MDL);
+ }
#if defined (NSUPDATE)
- /* Process events upon expiration. */
- if (pool->pool_type != D6O_IA_PD) {
- (void) ddns_removals(NULL, lease, NULL, ISC_FALSE);
- }
+ /* Process events upon expiration. */
+ if (pool->pool_type != D6O_IA_PD) {
+ (void) ddns_removals(NULL, lease, NULL, ISC_FALSE);
+ }
#endif
- /* Binding scopes are no longer valid after expiry or
- * release.
- */
- if (lease->scope != NULL) {
- binding_scope_dereference(&lease->scope, MDL);
- }
+ /* Binding scopes are no longer valid after expiry or
+ * release.
+ */
+ if (lease->scope != NULL) {
+ binding_scope_dereference(&lease->scope, MDL);
+ }
- iasubopt_hash_delete(pool->leases,
- &lease->addr, sizeof(lease->addr), MDL);
- isc_heap_delete(pool->active_timeouts, lease->active_index);
- lease->state = state;
- pool->num_active--;
- pool->num_inactive++;
+ iasubopt_hash_delete(pool->leases,
+ &lease->addr, sizeof(lease->addr), MDL);
+ isc_heap_delete(pool->active_timeouts, lease->active_index);
+ lease->state = state;
+ pool->num_active--;
+ pool->num_inactive++;
+ if (pool->ipv6_pond)
+ pool->ipv6_pond->num_active--;
+
+ if (lease->state == FTS_ABANDONED) {
+ pool->num_abandoned--;
if (pool->ipv6_pond)
- pool->ipv6_pond->num_active--;
-
- if (lease->state == FTS_ABANDONED) {
- pool->num_abandoned--;
- if (pool->ipv6_pond)
- pool->ipv6_pond->num_abandoned--;
- }
+ pool->ipv6_pond->num_abandoned--;
}
- return insert_result;
+ return ISC_R_SUCCESS;
}
/*
Home |
Main Index |
Thread Index |
Old Index