]> granicus.if.org Git - pdns/commitdiff
hook up ixplore tool
authorbert hubert <bert.hubert@netherlabs.nl>
Thu, 22 Oct 2015 12:37:06 +0000 (14:37 +0200)
committerbert hubert <bert.hubert@netherlabs.nl>
Thu, 22 Oct 2015 12:37:06 +0000 (14:37 +0200)
pdns/Makefile.am
pdns/ixplore.cc [new file with mode: 0644]

index d31fe56ad2f65172bf6db9c2a31238fcae92df13..ead56997a278f4340d01a829cf67fb0e5370ba32 100644 (file)
@@ -89,6 +89,7 @@ bin_PROGRAMS += \
        nproxy \
        nsec3dig \
        saxfr \
+       ixplore \
        sdig
 
 if HAVE_RECVMMSG
@@ -109,6 +110,7 @@ EXTRA_PROGRAMS = \
        dnstcpbench \
        dnswasher \
        dumresp \
+       ixplore \
        notify \
        nproxy \
        nsec3dig \
@@ -567,6 +569,34 @@ if GSS_TSIG
 saxfr_LDADD += $(GSS_LIBS)
 endif
 
+
+ixplore_SOURCES = \
+       base32.cc \
+       base64.cc base64.hh \
+        dns_random.cc dns_random.hh \
+       dnslabeltext.cc \
+       dnsname.cc dnsname.hh \
+       dnsparser.cc dnsparser.hh \
+       dnsrecords.cc \
+       dnssecinfra.cc \
+       dnswriter.cc dnswriter.hh \
+       gss_context.cc gss_context.hh \
+       logger.cc \
+       mbedtlscompat.hh \
+       misc.cc misc.hh \
+       nsecrecords.cc \
+       qtype.cc \
+       rcpgenerator.cc rcpgenerator.hh \
+       ixplore.cc \
+       sillyrecords.cc \
+       sstuff.hh \
+       statbag.cc \
+       unix_utility.cc
+
+ixplore_LDADD = $(MBEDTLS_LIBS)
+
+
+
 dnstcpbench_SOURCES = \
        base32.cc \
        base64.cc base64.hh \
diff --git a/pdns/ixplore.cc b/pdns/ixplore.cc
new file mode 100644 (file)
index 0000000..f4f6caf
--- /dev/null
@@ -0,0 +1,68 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include "base64.hh"
+#include "dnsparser.hh"
+#include "sstuff.hh"
+#include "misc.hh"
+#include "dnswriter.hh"
+#include "dnsrecords.hh"
+#include "statbag.hh"
+#include "base32.hh"
+#include "dnssecinfra.hh"
+#include <boost/foreach.hpp>
+#include "dns_random.hh"
+#include "gss_context.hh"
+
+StatBag S;
+
+
+int main(int argc, char** argv)
+try
+{
+  if(argc < 4) {
+    cerr<<"Syntax: saxfr IP-address port zone directory"<<endl;
+    exit(EXIT_FAILURE);
+  }
+
+  reportAllTypes();
+  dns_random_init("0123456789abcdef");
+
+  /* goal in life:
+     in directory/zone-name we leave files with their name the serial number
+     at startup, retrieve current SOA SERIAL for domain from master server
+     
+     compare with what the best is we have in our directory, IXFR from that.
+     Store result in memory, read that best zone in memory, apply deltas, write it out.
+
+     Next up, loop this every REFRESH seconds */
+
+  DNSName zone(argv[3]);
+  vector<uint8_t> packet;
+  DNSPacketWriter pw(packet, zone, QType::SOA);
+  ComboAddress master(argv[1], atoi(argv[2]));
+
+  Socket s(master.sin4.sin_family, SOCK_DGRAM);
+  s.connect(master);
+  string msg((const char*)&packet[0], packet.size());
+  s.writen(msg);
+
+  string reply;
+  s.read(reply);
+  MOADNSParser mdp(reply);
+  for(const auto& r: mdp.d_answers) {
+    if(r.first.d_type == QType::SOA) {
+      auto sr = std::dynamic_pointer_cast<SOARecordContent>(r.first.d_content);
+      cout<<"Current serial number: "<<sr->d_st.serial<<endl;
+    }
+  }
+  
+
+}
+catch(PDNSException &e2) {
+  cerr<<"Fatal: "<<e2.reason<<endl;
+}
+catch(std::exception &e)
+{
+  cerr<<"Fatal: "<<e.what()<<endl;
+}