lib/dns/rbtdb.c
/*
 * load a non-NSEC3 node in the main tree and optionally to the auxiliary NSEC
 */
load a non-NSEC3 node in the main tree and optionally to the auxiliary NSEC
load a non - NSEC3 node in the main tree and optionally to the auxiliary NSEC
static isc_result_t
loadnode(dns_rbtdb_t *rbtdb, dns_name_t *name, dns_rbtnode_t **nodep,
	 isc_boolean_t hasnsec)
{
	isc_result_t noderesult, nsecresult;
	dns_rbtnode_t *nsecnode;
	noderesult = dns_rbt_addnode(rbtdb->tree, name, nodep);
#ifdef BIND9
	if (noderesult == ISC_R_SUCCESS)
		dns_rpz_cidr_addip(rbtdb->rpz_cidr, name);
#endif
	if (!hasnsec)
		return (noderesult);
	if (noderesult == ISC_R_EXISTS) {
		if ((*nodep)->nsec == DNS_RBT_NSEC_HAS_NSEC)
			return (noderesult);
	} else if (noderesult != ISC_R_SUCCESS) {
		return (noderesult);
	}
	nsecnode = NULL;
	nsecresult = dns_rbt_addnode(rbtdb->nsec, name, &nsecnode);
	if (nsecresult == ISC_R_SUCCESS) {
		nsecnode->nsec = DNS_RBT_NSEC_NSEC;
		(*nodep)->nsec = DNS_RBT_NSEC_HAS_NSEC;
		return (noderesult);
	}
	if (nsecresult == ISC_R_EXISTS) {
#if 1 
		isc_log_write(dns_lctx,
			      DNS_LOGCATEGORY_DATABASE,
			      DNS_LOGMODULE_CACHE,
			      ISC_LOG_WARNING,
			      "addnode: NSEC node already exists");
#endif
		(*nodep)->nsec = DNS_RBT_NSEC_HAS_NSEC;
		return (noderesult);
	}
	nsecresult = dns_rbt_deletenode(rbtdb->tree, *nodep, ISC_FALSE);
	if (nsecresult != ISC_R_SUCCESS)
		isc_log_write(dns_lctx,
			      DNS_LOGCATEGORY_DATABASE,
			      DNS_LOGMODULE_CACHE,
			      ISC_LOG_WARNING,
			      "loading_addrdataset: "
			      "dns_rbt_deletenode: %s after "
			      "dns_rbt_addnode(NSEC): %s",
			      isc_result_totext(nsecresult),
			      isc_result_totext(noderesult));
	return (noderesult);
}
static isc_result_t loadnode ( dns_rbtdb_t * rbtdb , dns_name_t * name , dns_rbtnode_t * * nodep , isc_boolean_t hasnsec ) { isc_result_t noderesult , nsecresult ; dns_rbtnode_t * nsecnode ; noderesult = dns_rbt_addnode ( rbtdb -> tree , name , nodep ) ; #ifdef BIND9 if ( noderesult == ISC_R_SUCCESS ) dns_rpz_cidr_addip ( rbtdb -> rpz_cidr , name ) ; #endif if ( ! hasnsec ) return ( noderesult ) ; if ( noderesult == ISC_R_EXISTS ) { if ( ( * nodep ) -> nsec == DNS_RBT_NSEC_HAS_NSEC ) return ( noderesult ) ; } else if ( noderesult != ISC_R_SUCCESS ) { return ( noderesult ) ; } nsecnode = NULL ; nsecresult = dns_rbt_addnode ( rbtdb -> nsec , name , & nsecnode ) ; if ( nsecresult == ISC_R_SUCCESS ) { nsecnode -> nsec = DNS_RBT_NSEC_NSEC ; ( * nodep ) -> nsec = DNS_RBT_NSEC_HAS_NSEC ; return ( noderesult ) ; } if ( nsecresult == ISC_R_EXISTS ) { #if 1 isc_log_write ( dns_lctx , DNS_LOGCATEGORY_DATABASE , DNS_LOGMODULE_CACHE , ISC_LOG_WARNING , " " ) ; #endif ( * nodep ) -> nsec = DNS_RBT_NSEC_HAS_NSEC ; return ( noderesult ) ; } nsecresult = dns_rbt_deletenode ( rbtdb -> tree , * nodep , ISC_FALSE ) ; if ( nsecresult != ISC_R_SUCCESS ) isc_log_write ( dns_lctx , DNS_LOGCATEGORY_DATABASE , DNS_LOGMODULE_CACHE , ISC_LOG_WARNING , " " " " " " , isc_result_totext ( nsecresult ) , isc_result_totext ( noderesult ) ) ; return ( noderesult ) ; }
load a non-NSEC3 node in the main tree and optionally to the auxiliary NSEC
load a non - NSEC3 node in the main tree and optionally to the auxiliary NSEC
/*
		 * Add a node to the auxiliary NSEC tree for an old node
		 * just now getting an NSEC record.
		 */ /*
	 * Build the auxiliary tree for NSECs as we go.
	 * This tree speeds searches for closest NSECs that would otherwise
	 * need to examine many irrelevant nodes in large TLDs.
	 *
	 * Add nodes to the auxiliary tree after corresponding nodes have
	 * been added to the main tree.
	 */ /* 0 */