]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Add dnspcap2protobuf to pdns-tools
authorPieter Lexis <pieter.lexis@powerdns.com>
Tue, 21 Jun 2016 17:03:57 +0000 (19:03 +0200)
committerPieter Lexis <pieter.lexis@powerdns.com>
Thu, 23 Jun 2016 13:37:28 +0000 (15:37 +0200)
build-scripts/build-auth-rpm
build-scripts/debian-authoritative/control.in
build-scripts/debian-authoritative/pdns-tools.install
build-scripts/debian-authoritative/pdns-tools.manpages
build-scripts/debian-authoritative/rules
docs/Makefile.am
docs/manpages/dnspcap2protobuf.1.md [new file with mode: 0644]
pdns/Makefile.am
pdns/dnspcap2protobuf.cc

index 18d8200eb2834f70f31566c302e4cc083d431c03..e3da467f49aa8a8646ef8396a8ff29bf8dcbaf9c 100755 (executable)
@@ -531,6 +531,8 @@ BuildRequires: boost-devel
 BuildRequires: lua-devel
 BuildRequires: bison
 BuildRequires: openssl-devel
+BuildRequires: protobuf-devel
+BuildRequires: protobuf-compiler
 Provides: powerdns = %{version}-%{release}
 %global backends %{backends} bind
 
@@ -652,7 +654,6 @@ export CPPFLAGS="-DLDAP_DEPRECATED"
        --with-lua \
        --with-dynmodules='%{backends} random' \
        --enable-tools \
-       --without-protobuf \
        --enable-unit-tests \
        --enable-systemd
 
@@ -724,6 +725,7 @@ exit 0
 %{_bindir}/calidns
 %{_bindir}/dnsbulktest
 %{_bindir}/dnsgram
+%{_bindir}/dnspcap2protobuf
 %{_bindir}/dnsreplay
 %{_bindir}/dnsscan
 %{_bindir}/dnsscope
@@ -739,6 +741,7 @@ exit 0
 %{_mandir}/man1/calidns.1.gz
 %{_mandir}/man1/dnsbulktest.1.gz
 %{_mandir}/man1/dnsgram.1.gz
+%{_mandir}/man1/dnspcap2protobuf.1.gz
 %{_mandir}/man1/dnsreplay.1.gz
 %{_mandir}/man1/dnsscan.1.gz
 %{_mandir}/man1/dnsscope.1.gz
index 47aa6de84faff9bdf73089834753dbc1c09ab337..bd5bcd41ab49de151ea558763e78082d28611161 100644 (file)
@@ -4,7 +4,7 @@ Priority: extra
 Standards-Version: 3.9.8
 Maintainer: PowerDNS Autobuilder <powerdns.support@powerdns.com>
 Origin: PowerDNS
-Build-Depends: debhelper (>= 9~), dh-autoreconf, dh-systemd, po-debconf, libtool, flex, bison, libmysqlclient-dev, libpq-dev, libssl-dev, libgdbm-dev, libldap2-dev, libsqlite3-dev, dpkg-dev (>= 1.17.0~), libboost-dev, libboost-serialization-dev, libboost-program-options-dev, libboost-test-dev, autotools-dev, automake, autoconf, liblua5.2-dev, pkg-config, ragel, libgmp-dev, libbotan1.10-dev, libcurl4-openssl-dev, libzmq-dev, libyaml-cpp-dev (>= 0.5), libgeoip-dev, libopendbx1-dev, libcdb-dev, unixodbc-dev (>= 2.3.1) @LIBSYSTEMDDEV@
+Build-Depends: debhelper (>= 9~), dh-autoreconf, dh-systemd, po-debconf, libtool, flex, bison, libmysqlclient-dev, libpq-dev, libssl-dev, libgdbm-dev, libldap2-dev, libsqlite3-dev, dpkg-dev (>= 1.17.0~), libboost-dev, libboost-serialization-dev, libboost-program-options-dev, libboost-test-dev, autotools-dev, automake, autoconf, liblua5.2-dev, pkg-config, ragel, libgmp-dev, libbotan1.10-dev, libcurl4-openssl-dev, libzmq-dev, libyaml-cpp-dev (>= 0.5), libgeoip-dev, libopendbx1-dev, libcdb-dev, unixodbc-dev (>= 2.3.1), libprotobuf-dev, protobuf-compiler @LIBSYSTEMDDEV@
 Homepage: http://www.powerdns.com/
 
 Package: pdns-server
index dd9d70c4f1634fd519dc657094359e3eb9220194..6ca38a9e4397ade10bce8dc81e39252223330901 100644 (file)
@@ -1,6 +1,7 @@
 usr/bin/calidns
 usr/bin/dnsbulktest
 usr/bin/dnsgram
+usr/bin/dnspcap2protobuf
 usr/bin/dnsreplay
 usr/bin/dnsscan
 usr/bin/dnsscope
index afbafe82f88e85c1deb2fd0f9622bc3221bff479..b8b70a83da965e2134a2ea3cddf87f76e2b43b55 100644 (file)
@@ -1,6 +1,7 @@
 debian/tmp/usr/share/man/man1/calidns.1
 debian/tmp/usr/share/man/man1/dnsbulktest.1
 debian/tmp/usr/share/man/man1/dnsgram.1
+debian/tmp/usr/share/man/man1/dnspcap2protobuf.1
 debian/tmp/usr/share/man/man1/dnsreplay.1
 debian/tmp/usr/share/man/man1/dnsscan.1
 debian/tmp/usr/share/man/man1/dnsscope.1
index b1e78bbabdb45c3bb39bf68d8ce2a04e44c84e70..4b37fbb7a4503d8b6e65f9b20f1af5a3917e8ea1 100755 (executable)
@@ -45,7 +45,6 @@ override_dh_auto_configure:
                --with-pgsql-includes=`pg_config --includedir` \
                --enable-botan1.10 \
                --enable-tools \
-               --without-protobuf \
                --enable-unit-tests \
                $(ENABLE_SYSTEMD)
 
index eeeac6984c16ada52995ed38b0952c45fb515502..4fa8256a751de9fbc1e2be14333a34cdb2b5b928 100644 (file)
@@ -13,9 +13,9 @@ MANPAGES_TARGET_TOOLS = calidns.1 \
        dnswasher.1 \
        dumresp.1 \
        ixplore.1 \
-       pdns_notify.1 \
        nproxy.1 \
        nsec3dig.1 \
+       pdns_notify.1 \
        saxfr.1 \
        sdig.1
 
@@ -24,6 +24,13 @@ MANPAGES_TARGET_TOOLS += dnsbulktest.1 \
        dnstcpbench.1
 endif
 
+
+if HAVE_PROTOBUF
+if HAVE_PROTOC
+MANPAGES_TARGET_TOOLS += dnspcap2protobuf.1
+endif
+endif
+
 MANPAGES_TARGET_DNSDIST = dnsdist.1
 
 MANPAGES_TARGET_RECURSOR = pdns_recursor.1 \
diff --git a/docs/manpages/dnspcap2protobuf.1.md b/docs/manpages/dnspcap2protobuf.1.md
new file mode 100644 (file)
index 0000000..1709106
--- /dev/null
@@ -0,0 +1,20 @@
+% DNSPCAP2PROTOBUF(1)
+% PowerDNS.com BV
+% June 2016
+
+# NAME
+**dnspcap2protobuf** - A tool to convert PCAPs of DNS traffic to PowerDNS Protobuf
+
+# SYNOPSIS
+**dnspcap2protobuf** *PCAPFILE* *OUTFILE*
+
+# DESCRIPTION
+**dnspcap2protobuf** reads the PCAP file *PCAPFILE* for DNS queries and responses
+and writes these in the PowerDNS protobuf format to *OUTFILE*.
+
+# OPTIONS
+--help
+:    Show a summary of options.
+
+--version
+:    Display the version of dnspcap2protobuf
index e2c6a536d7ab698920cf414d5ba540faa0e5b01b..12ce89669dcfa0c936647584ec69d5fbdf4e82d6 100644 (file)
@@ -1046,7 +1046,7 @@ dnsdemog_LDADD = \
 
 if HAVE_PROTOBUF
 if HAVE_PROTOC
-EXTRA_PROGRAMS += dnspcap2protobuf
+bin_PROGRAMS += dnspcap2protobuf
 
 dnsmessage.pb.cc: dnsmessage.proto
        $(AM_V_GEN)$(PROTOC) --cpp_out=./ $<
@@ -1163,12 +1163,14 @@ testrunner_LDADD = \
        $(LIBDL)
 
 if HAVE_PROTOBUF
+if HAVE_PROTOC
 nodist_testrunner_SOURCES = \
        dnsmessage.pb.cc dnsmessage.pb.h
 
 testrunner_LDADD += \
        $(PROTOBUF_LIBS)
 endif
+endif
 
 if PKCS11
 testrunner_SOURCES += pkcs11signers.cc pkcs11signers.hh
index b66ef44bbd4b9675c31bfad92d7ef78d48d89456..1f33ff17840f4716abe560ab33a0907439e85c9a 100644 (file)
@@ -1,3 +1,6 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 #include <boost/uuid/uuid.hpp>
 #include <boost/uuid/uuid_generators.hpp>
 
@@ -75,14 +78,33 @@ catch(std::exception& e)
 {
   cerr<<"Error parsing response records: "<<e.what()<<endl;
 }
+
+void usage()
+{
+  cerr<<"This program reads DNS queries and responses from a PCAP file and stores them into our protobuf format."<<endl;
+  cerr<<"Usage: dnspcap2protobuf PCAPFILE OUTFILE"<<endl;
+}
+
 int main(int argc, char **argv)
 {
+  for(int n=1 ; n < argc; ++n) {
+    if ((string) argv[n] == "--help") {
+      usage();
+      return EXIT_SUCCESS;
+    }
+
+    if ((string) argv[n] == "--version") {
+      cerr<<"dnspcap2protobuf "<<VERSION<<endl;
+      return EXIT_SUCCESS;
+    }
+  }
+
   if(argc < 3) {
-    cerr<<"This program reads DNS queries and responses from a PCAP file and stores them into our protobuf format."<<endl;
-    cerr<<"Usage: "<<argv[0]<<" <PCAP file> <out file>"<<endl;
+    usage();
     exit(EXIT_FAILURE);
   }
 
+
   PcapPacketReader pr(argv[1]);
 
   FILE* fp = fopen(argv[2], "w");