Skip to content

Commit

Permalink
- direct-rdata-storage, implement in qtest.c.
Browse files Browse the repository at this point in the history
- direct-rdata-storage, fix rdatas_equal in difffile.c, and
  nsec3_zone_trees_create.
  • Loading branch information
wcawijngaards committed Feb 28, 2025
1 parent 71929d7 commit 2ca452a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
10 changes: 10 additions & 0 deletions difffile.c
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,11 @@ rdatas_equal(const rr_type *rr1, const rr_type *rr2, uint16_t type,
size_t offset = 0;
const nsd_type_descriptor_type *descriptor;

if(rr1->rdlength != rr2->rdlength) {
*rdnum = 0;
*reason = "rr length different";
return 0;
}
assert(rr1->rdlength == rr2->rdlength);

/**
Expand All @@ -343,6 +348,11 @@ rdatas_equal(const rr_type *rr1, const rr_type *rr2, uint16_t type,
**/
if (type == TYPE_SOA) {
offset = 2 * sizeof(void*);
if(rr1->rdlength != offset + 20) {
*rdnum = 0;
*reason = "invalid SOA length";
return 0;
}
assert(rr1->rdlength == offset + 20);
if (memcmp(rr1->rdata + offset, rr2->rdata + offset, 4) == 0)
return 1;
Expand Down
1 change: 1 addition & 0 deletions nsec3.c
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,7 @@ prehash_zone_complete(struct namedb* db, struct zone* zone)
zone->nsec3_last = NULL;
return;
}
nsec3_zone_trees_create(db->region, zone);
nsec3_precompile_newparam(db, zone);
}

Expand Down
1 change: 1 addition & 0 deletions tpkg/cutest/cutest_namedb.c
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,7 @@ parse_rr_str(struct zone *zone, char *input, struct parse_rr_state *state)

length = strlen(input);
string = malloc(length + 1 + ZONE_BLOCK_SIZE);
memset(string, 0, length + 1 + ZONE_BLOCK_SIZE);
memcpy(string, input, length);
string[length] = 0;

Expand Down
5 changes: 2 additions & 3 deletions tpkg/cutest/qtest.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ qread(char* qfile)
static void
buffer_spool_rr(buffer_type* output, rr_type* rr, int qsection)
{
rrtype_descriptor_type *d = rrtype_descriptor_by_type(rr->type);
const nsd_type_descriptor_type *d = nsd_type_descriptor(rr->type);
int result;
const dname_type *owner = domain_dname(rr->owner);
buffer_printf(output, "%s", dname_to_string(owner, NULL));
Expand Down Expand Up @@ -336,8 +336,7 @@ buffer_spool_rr(buffer_type* output, rr_type* rr, int qsection)
result = print_rdata(output, d, rr);
if (!result) {
/* Some RDATA failed to print, so do unknown format. */
result = rdata_atoms_to_unknown_string(output, d,
rr->rdata_count, rr->rdatas);
result = print_rdata(output, d, rr);
if(!result) {
buffer_printf(output,
"rdata_atoms_to_unknown_string failed");
Expand Down

0 comments on commit 2ca452a

Please sign in to comment.