mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-01 06:55:30 +00:00
Remove nodechain from dns_rbt_addnode() (#41246)
This commit is contained in:
@@ -1119,7 +1119,7 @@ dns_rbt_addnode(dns_rbt_t *rbt, dns_name_t *name, dns_rbtnode_t **nodep) {
|
|||||||
dns_offsets_t current_offsets;
|
dns_offsets_t current_offsets;
|
||||||
dns_namereln_t compared;
|
dns_namereln_t compared;
|
||||||
isc_result_t result = ISC_R_SUCCESS;
|
isc_result_t result = ISC_R_SUCCESS;
|
||||||
dns_rbtnodechain_t chain;
|
unsigned int level_count;
|
||||||
unsigned int common_labels;
|
unsigned int common_labels;
|
||||||
unsigned int nlabels, hlabels;
|
unsigned int nlabels, hlabels;
|
||||||
int order;
|
int order;
|
||||||
@@ -1182,7 +1182,7 @@ dns_rbt_addnode(dns_rbt_t *rbt, dns_name_t *name, dns_rbtnode_t **nodep) {
|
|||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
dns_rbtnodechain_init(&chain, rbt->mctx);
|
level_count = 0;
|
||||||
|
|
||||||
dns_fixedname_init(&fixedprefix);
|
dns_fixedname_init(&fixedprefix);
|
||||||
dns_fixedname_init(&fixedsuffix);
|
dns_fixedname_init(&fixedsuffix);
|
||||||
@@ -1261,8 +1261,9 @@ dns_rbt_addnode(dns_rbt_t *rbt, dns_name_t *name, dns_rbtnode_t **nodep) {
|
|||||||
|
|
||||||
parent = NULL;
|
parent = NULL;
|
||||||
child = DOWN(current);
|
child = DOWN(current);
|
||||||
ADD_LEVEL(&chain, current);
|
|
||||||
|
|
||||||
|
INSIST(level_count < DNS_RBT_LEVELBLOCK);
|
||||||
|
level_count++;
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* The number of labels in common is fewer
|
* The number of labels in common is fewer
|
||||||
@@ -1281,17 +1282,8 @@ dns_rbt_addnode(dns_rbt_t *rbt, dns_name_t *name, dns_rbtnode_t **nodep) {
|
|||||||
* levels allowed by DNSSEC.
|
* levels allowed by DNSSEC.
|
||||||
*
|
*
|
||||||
* XXXDCL need a better error result?
|
* XXXDCL need a better error result?
|
||||||
*
|
|
||||||
* XXXDCL Since chain ancestors were removed,
|
|
||||||
* no longer used by addonlevel(),
|
|
||||||
* this is the only real use of chains in the
|
|
||||||
* function. It could be done instead with
|
|
||||||
* a simple integer variable, but I am pressed
|
|
||||||
* for time.
|
|
||||||
*/
|
*/
|
||||||
if (chain.level_count ==
|
if (level_count >= DNS_RBT_LEVELBLOCK) {
|
||||||
(sizeof(chain.levels) /
|
|
||||||
sizeof(*chain.levels))) {
|
|
||||||
result = ISC_R_NOSPACE;
|
result = ISC_R_NOSPACE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1358,7 +1350,9 @@ dns_rbt_addnode(dns_rbt_t *rbt, dns_name_t *name, dns_rbtnode_t **nodep) {
|
|||||||
UPPERNODE(new_current) = UPPERNODE(current);
|
UPPERNODE(new_current) = UPPERNODE(current);
|
||||||
UPPERNODE(current) = new_current;
|
UPPERNODE(current) = new_current;
|
||||||
#endif /* DNS_RBT_USEHASH */
|
#endif /* DNS_RBT_USEHASH */
|
||||||
ADD_LEVEL(&chain, new_current);
|
|
||||||
|
INSIST(level_count < DNS_RBT_LEVELBLOCK);
|
||||||
|
level_count++;
|
||||||
|
|
||||||
LEFT(current) = NULL;
|
LEFT(current) = NULL;
|
||||||
RIGHT(current) = NULL;
|
RIGHT(current) = NULL;
|
||||||
|
Reference in New Issue
Block a user