/* void nsec_find_interval_and_wild(zdb_zone *zone, const dnsname_vector *name_vector, zdb_rr_label **label, u8 *dname_out, zdb_rr_label **wild_label, u8 *wild_dname_out) { u8 dname_inverted[MAX_DOMAIN_LENGTH + 2]; s32 len = dnslabel_stack_to_dnsname(name_vector->labels, name_vector->size, dname_inverted); nsec_node *node = nsec_avl_find_interval_start(&zone->nsec.nsec, dname_inverted); nsec_inverse_name(dname_out, node->inverse_relative_name); dname_inverted[len-1] = (u8)1; dname_inverted[len+0] = (u8)'*'; dname_inverted[len+1] = (u8)0; nsec_node *wild_node = nsec_avl_find_interval_start(&zone->nsec.nsec, dname_inverted); if(wild_node != node) { nsec_inverse_name(wild_dname_out, wild_node->inverse_relative_name); } *label = node->label; *wild_label = wild_node->label; } */ void nsec_name_error(const zdb_zone* zone, const dnsname_vector *name, s32 closest_index, u8* out_encloser_nsec_name, zdb_rr_label** out_encloser_nsec_label, u8* out_wild_encloser_nsec_name, zdb_rr_label** out_wildencloser_nsec_label ) { u8 dname_inverted[MAX_DOMAIN_LENGTH + 2]; dnslabel_stack_to_dnsname(name->labels, name->size, dname_inverted); nsec_node *node = nsec_avl_find_interval_start(&zone->nsec.nsec, dname_inverted); nsec_inverse_name(out_encloser_nsec_name, node->inverse_relative_name); dnslabel_stack_to_dnsname(&name->labels[closest_index], name->size - closest_index, dname_inverted); nsec_node *wild_node = nsec_avl_find_interval_start(&zone->nsec.nsec, dname_inverted); if(wild_node != node) { nsec_inverse_name(out_wild_encloser_nsec_name, wild_node->inverse_relative_name); } *out_encloser_nsec_label = node->label; *out_wildencloser_nsec_label = wild_node->label; }
bool nsec_delete_label_node(zdb_zone* zone, zdb_rr_label* label, dnslabel_vector_reference labels, s32 labels_top) { u8 inverse_name[MAX_DOMAIN_LENGTH]; dnslabel_stack_to_dnsname(labels, labels_top, inverse_name); nsec_node *node = nsec_avl_find(&zone->nsec.nsec, inverse_name); if(node != NULL) { node->label->nsec.nsec.node = NULL; node->label = NULL; nsec_avl_delete(&zone->nsec.nsec, inverse_name); log_debug("nsec_delete_label_node: %{dnsname}", inverse_name); return TRUE; } else { log_debug("nsec_delete_label_node: %{dnsname} has not been found", inverse_name); return FALSE; } }
u32 nsec_inverse_name(u8 *inverse_name, const u8 *name) { dnslabel_vector labels; s32 vtop = dnsname_to_dnslabel_vector(name, labels); return dnslabel_stack_to_dnsname(labels, vtop, inverse_name); }
zdb_rr_label * nsec_find_interval(const zdb_zone *zone, const dnsname_vector *name_vector, u8 *dname_out) { u8 dname_inverted[MAX_DOMAIN_LENGTH]; dnslabel_stack_to_dnsname(name_vector->labels, name_vector->size, dname_inverted); nsec_node *node = nsec_avl_find_interval_start(&zone->nsec.nsec, dname_inverted); nsec_inverse_name(dname_out, node->inverse_relative_name); return node->label; }
nsec_node * nsec_update_label_node(zdb_zone* zone, zdb_rr_label* label, dnslabel_vector_reference labels, s32 labels_top) { u8 inverse_name[MAX_DOMAIN_LENGTH]; dnslabel_stack_to_dnsname(labels, labels_top, inverse_name); nsec_node *node = nsec_avl_insert(&zone->nsec.nsec, inverse_name); node->label = label; label->nsec.nsec.node = node; log_debug("nsec_update_label_node: %{dnsname}", node->inverse_relative_name); return node; }
nsec_node * nsec_update_label_node(zdb_zone* zone, zdb_rr_label* label, dnslabel_vector_reference labels, s32 labels_top) { u8 inverse_name[MAX_DOMAIN_LENGTH]; dnslabel_stack_to_dnsname(labels, labels_top, inverse_name); nsec_node *node = nsec_avl_insert(&zone->nsec.nsec, inverse_name); node->label = label; label->nsec.nsec.node = node; label->flags |= ZDB_RR_LABEL_NSEC; #ifdef DEBUG memset(inverse_name, 0xff, sizeof(inverse_name)); log_debug("nsec_update_label_node: %{dnsname}", node->inverse_relative_name); #endif return node; }