]> granicus.if.org Git - pdns/commitdiff
pdnssec check-zone, more tolerant IPv6 format check
authorKees Monshouwer <mind04@monshouwer.org>
Mon, 30 Sep 2013 22:04:57 +0000 (00:04 +0200)
committermind04 <mind04@monshouwer.org>
Mon, 30 Sep 2013 22:28:09 +0000 (00:28 +0200)
pdns/pdnssec.cc

index 365a30ee0e0757de55908a42a6d0a9d7003cdcf3..45554d875f96e4bd962e7047d492476be965ac72 100644 (file)
@@ -378,10 +378,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)