Permalink
Browse files

pdnssec check-zone, more tolerant IPv6 format check

  • Loading branch information...
1 parent 0dde9d0 commit edb255f9bf25ba56e245d561afe4b2a7b1d646ef @mind04 mind04 committed with mind04 Sep 30, 2013
Showing with 16 additions and 3 deletions.
  1. +16 −3 pdns/pdnssec.cc
View
@@ -375,10 +375,23 @@ int checkZone(DNSSECKeeper &dk, UeberBackend &B, const std::string& zone)
shared_ptr<DNSRecordContent> drc(DNSRecordContent::mastermake(rr.qtype.getCode(), 1, rr.content));
string tmp=drc->serialize(rr.qname);
tmp = drc->getZoneRepresentation();
- if (!pdns_iequals(tmp, rr.content)) {
- cout<<"[Warning] Parsed and original record content are not equal: "<<rr.qname<<" IN " <<rr.qtype.getName()<< " '" << rr.content<<"' (Content parsed as '"<<tmp<<"')"<<endl;
+ if (rr.qtype.getCode() != QType::AAAA) {
+ if (!pdns_iequals(tmp, rr.content)) {
+ cout<<"[Warning] Parsed and original record content are not equal: "<<rr.qname<<" IN " <<rr.qtype.getName()<< " '" << rr.content<<"' (Content parsed as '"<<tmp<<"')"<<endl;
+ rr.content=tmp;
+ numwarnings++;
+ }
+ } else {
+ struct addrinfo hint, *res;
+ memset(&hint, 0, sizeof(hint));
+ hint.ai_family = AF_INET6;
+ hint.ai_flags = AI_NUMERICHOST;
+ if(getaddrinfo(rr.content.c_str(), 0, &hint, &res)) {
+ cout<<"[Warning] Folowing record is not a vallid IPv6 address: "<<rr.qname<<" IN " <<rr.qtype.getName()<< " '" << rr.content<<"'"<<endl;
+ numwarnings++;
+ } else
+ freeaddrinfo(res);
rr.content=tmp;
- numwarnings++;
}
}
catch(std::exception& e)

0 comments on commit edb255f

Please sign in to comment.