Skip to content

Commit edb255f

Browse files
committed
pdnssec check-zone, more tolerant IPv6 format check
1 parent 0dde9d0 commit edb255f

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

pdns/pdnssec.cc

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -375,10 +375,23 @@ int checkZone(DNSSECKeeper &dk, UeberBackend &B, const std::string& zone)
375375
shared_ptr<DNSRecordContent> drc(DNSRecordContent::mastermake(rr.qtype.getCode(), 1, rr.content));
376376
string tmp=drc->serialize(rr.qname);
377377
tmp = drc->getZoneRepresentation();
378-
if (!pdns_iequals(tmp, rr.content)) {
379-
cout<<"[Warning] Parsed and original record content are not equal: "<<rr.qname<<" IN " <<rr.qtype.getName()<< " '" << rr.content<<"' (Content parsed as '"<<tmp<<"')"<<endl;
378+
if (rr.qtype.getCode() != QType::AAAA) {
379+
if (!pdns_iequals(tmp, rr.content)) {
380+
cout<<"[Warning] Parsed and original record content are not equal: "<<rr.qname<<" IN " <<rr.qtype.getName()<< " '" << rr.content<<"' (Content parsed as '"<<tmp<<"')"<<endl;
381+
rr.content=tmp;
382+
numwarnings++;
383+
}
384+
} else {
385+
struct addrinfo hint, *res;
386+
memset(&hint, 0, sizeof(hint));
387+
hint.ai_family = AF_INET6;
388+
hint.ai_flags = AI_NUMERICHOST;
389+
if(getaddrinfo(rr.content.c_str(), 0, &hint, &res)) {
390+
cout<<"[Warning] Folowing record is not a vallid IPv6 address: "<<rr.qname<<" IN " <<rr.qtype.getName()<< " '" << rr.content<<"'"<<endl;
391+
numwarnings++;
392+
} else
393+
freeaddrinfo(res);
380394
rr.content=tmp;
381-
numwarnings++;
382395
}
383396
}
384397
catch(std::exception& e)

0 commit comments

Comments
 (0)