mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-23 02:28:55 +00:00
This implements node reference tracing that passes all the internal layers from dns_db API (and friends) to increment_reference() and decrement_reference(). It can be enabled by #defining DNS_DB_NODETRACE in <dns/trace.h> header. The output then looks like this: incr:node:check_address_records:rootns.c:409:0x7f67f5a55a40->references = 1 decr:node:check_address_records:rootns.c:449:0x7f67f5a55a40->references = 0 incr:nodelock:check_address_records:rootns.c:409:0x7f67f5a55a40:0x7f68304d7040->references = 1 decr:nodelock:check_address_records:rootns.c:449:0x7f67f5a55a40:0x7f68304d7040->references = 0 There's associated python script to find the missing detach located at: https://gitlab.isc.org/isc-projects/bind9/-/snippets/1038
72 lines
1.7 KiB
C
72 lines
1.7 KiB
C
/*
|
|
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
|
*
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
|
*
|
|
* See the COPYRIGHT file distributed with this work for additional
|
|
* information regarding copyright ownership.
|
|
*/
|
|
|
|
/*! \file */
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <isc/util.h>
|
|
|
|
#include <dns/rdataset.h>
|
|
#include <dns/rdatasetiter.h>
|
|
|
|
void
|
|
dns__rdatasetiter_destroy(dns_rdatasetiter_t **iteratorp DNS__DB_FLARG) {
|
|
/*
|
|
* Destroy '*iteratorp'.
|
|
*/
|
|
|
|
REQUIRE(iteratorp != NULL);
|
|
REQUIRE(DNS_RDATASETITER_VALID(*iteratorp));
|
|
|
|
(*iteratorp)->methods->destroy(iteratorp DNS__DB_FLARG_PASS);
|
|
|
|
ENSURE(*iteratorp == NULL);
|
|
}
|
|
|
|
isc_result_t
|
|
dns__rdatasetiter_first(dns_rdatasetiter_t *iterator DNS__DB_FLARG) {
|
|
/*
|
|
* Move the rdataset cursor to the first rdataset at the node (if any).
|
|
*/
|
|
|
|
REQUIRE(DNS_RDATASETITER_VALID(iterator));
|
|
|
|
return (iterator->methods->first(iterator DNS__DB_FLARG_PASS));
|
|
}
|
|
|
|
isc_result_t
|
|
dns__rdatasetiter_next(dns_rdatasetiter_t *iterator DNS__DB_FLARG) {
|
|
/*
|
|
* Move the rdataset cursor to the next rdataset at the node (if any).
|
|
*/
|
|
|
|
REQUIRE(DNS_RDATASETITER_VALID(iterator));
|
|
|
|
return (iterator->methods->next(iterator DNS__DB_FLARG_PASS));
|
|
}
|
|
|
|
void
|
|
dns__rdatasetiter_current(dns_rdatasetiter_t *iterator,
|
|
dns_rdataset_t *rdataset DNS__DB_FLARG) {
|
|
/*
|
|
* Return the current rdataset.
|
|
*/
|
|
|
|
REQUIRE(DNS_RDATASETITER_VALID(iterator));
|
|
REQUIRE(DNS_RDATASET_VALID(rdataset));
|
|
REQUIRE(!dns_rdataset_isassociated(rdataset));
|
|
|
|
iterator->methods->current(iterator, rdataset DNS__DB_FLARG_PASS);
|
|
}
|