Adjust to new bind libraries

This commit is contained in:
christos 2022-09-23 12:30:52 +00:00
parent 7b21c0e27d
commit 1856c2b98e
1 changed files with 84 additions and 110 deletions

View File

@ -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 @@ ipv6_pool_allocate(struct ipv6_pool **pool, u_int16_t type,
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 @@ cleanup_lease6(ia_hash_t *ia_table,
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,9 +1469,7 @@ add_lease6(struct ipv6_pool *pool, struct iasubopt *lease,
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) {
isc_heap_insert(pool->active_timeouts, tmp_iasubopt);
pool->num_active++;
if (pool->ipv6_pond)
pool->ipv6_pond->num_active++;
@ -1491,22 +1479,15 @@ add_lease6(struct ipv6_pool *pool, struct iasubopt *lease,
if (pool->ipv6_pond)
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)
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;
}
/*
* Note: we intentionally leave tmp_iasubopt referenced; there
* is a reference in the heap/hash, after all.
@ -1569,10 +1550,7 @@ lease6_usable(struct iasubopt *lease) {
*/
static isc_result_t
move_lease_to_active(struct ipv6_pool *pool, struct iasubopt *lease) {
isc_result_t insert_result;
insert_result = isc_heap_insert(pool->active_timeouts, lease);
if (insert_result == ISC_R_SUCCESS) {
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,
@ -1583,8 +1561,7 @@ move_lease_to_active(struct ipv6_pool *pool, struct iasubopt *lease) {
if (pool->ipv6_pond)
pool->ipv6_pond->num_active++;
}
return insert_result;
return ISC_R_SUCCESS;
}
/*!
@ -1656,10 +1633,8 @@ renew_lease6(struct ipv6_pool *pool, struct iasubopt *lease) {
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) {
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
@ -1720,8 +1695,7 @@ move_lease_to_inactive(struct ipv6_pool *pool, struct iasubopt *lease,
if (pool->ipv6_pond)
pool->ipv6_pond->num_abandoned--;
}
}
return insert_result;
return ISC_R_SUCCESS;
}
/*