*/
bool
-dns_rdataslab_equal(unsigned char *slab1, unsigned char *slab2,
- unsigned int reservelen);
+dns_rdataslab_equal(dns_slabheader_t *slab1, dns_slabheader_t *slab2);
/*%<
* Compare two rdataslabs for equality. This does _not_ do a full
* DNSSEC comparison.
*\li true if the slabs are equal, false otherwise.
*/
bool
-dns_rdataslab_equalx(unsigned char *slab1, unsigned char *slab2,
- unsigned int reservelen, dns_rdataclass_t rdclass,
- dns_rdatatype_t type);
+dns_rdataslab_equalx(dns_slabheader_t *slab1, dns_slabheader_t *slab2,
+ dns_rdataclass_t rdclass, dns_rdatatype_t type);
/*%<
* Compare two rdataslabs for DNSSEC equality.
*
if (ACTIVE(header, now) && header->type == dns_rdatatype_ns &&
EXISTS(header) && EXISTS(newheader) &&
header->trust >= newheader->trust &&
- dns_rdataslab_equalx((unsigned char *)header,
- (unsigned char *)newheader,
- (unsigned int)(sizeof(*newheader)),
+ dns_rdataslab_equalx(header, newheader,
qpdb->common.rdclass,
(dns_rdatatype_t)header->type))
{
header->type == DNS_SIGTYPE(dns_rdatatype_ds)) &&
EXISTS(header) && EXISTS(newheader) &&
header->trust >= newheader->trust &&
- dns_rdataslab_equal((unsigned char *)header,
- (unsigned char *)newheader,
- (unsigned int)(sizeof(*newheader))))
+ dns_rdataslab_equal(header, newheader))
{
/*
* Honour the new ttl if it is less than the
}
bool
-dns_rdataslab_equal(unsigned char *slab1, unsigned char *slab2,
- unsigned int reservelen) {
+dns_rdataslab_equal(dns_slabheader_t *slab1, dns_slabheader_t *slab2) {
unsigned char *current1 = NULL, *current2 = NULL;
unsigned int count1, count2;
unsigned int length1, length2;
- current1 = slab1 + reservelen;
+ current1 = (unsigned char *)slab1 + sizeof(dns_slabheader_t);
count1 = get_uint16(current1);
- current2 = slab2 + reservelen;
+ current2 = (unsigned char *)slab2 + sizeof(dns_slabheader_t);
count2 = get_uint16(current2);
if (count1 != count2) {
return false;
+ } else if (count1 == 0) {
+ return true;
}
while (count1-- > 0) {
}
bool
-dns_rdataslab_equalx(unsigned char *slab1, unsigned char *slab2,
- unsigned int reservelen, dns_rdataclass_t rdclass,
- dns_rdatatype_t type) {
+dns_rdataslab_equalx(dns_slabheader_t *slab1, dns_slabheader_t *slab2,
+ dns_rdataclass_t rdclass, dns_rdatatype_t type) {
unsigned char *current1 = NULL, *current2 = NULL;
unsigned int count1, count2;
dns_rdata_t rdata1 = DNS_RDATA_INIT;
dns_rdata_t rdata2 = DNS_RDATA_INIT;
- current1 = slab1 + reservelen;
+ current1 = (unsigned char *)slab1 + sizeof(dns_slabheader_t);
count1 = get_uint16(current1);
- current2 = slab2 + reservelen;
+ current2 = (unsigned char *)slab2 + sizeof(dns_slabheader_t);
count2 = get_uint16(current2);
if (count1 != count2) {
return false;
+ } else if (count1 == 0) {
+ return true;
}
while (count1-- > 0) {