From a4a748204a800d1894c1b1812ff353db0da3607d Mon Sep 17 00:00:00 2001 From: Pieter Lexis Date: Tue, 21 Jun 2016 19:03:57 +0200 Subject: [PATCH] Add dnspcap2protobuf to pdns-tools --- build-scripts/build-auth-rpm | 5 +++- build-scripts/debian-authoritative/control.in | 2 +- .../debian-authoritative/pdns-tools.install | 1 + .../debian-authoritative/pdns-tools.manpages | 1 + build-scripts/debian-authoritative/rules | 1 - docs/Makefile.am | 9 ++++++- docs/manpages/dnspcap2protobuf.1.md | 20 ++++++++++++++ pdns/Makefile.am | 4 ++- pdns/dnspcap2protobuf.cc | 26 +++++++++++++++++-- 9 files changed, 62 insertions(+), 7 deletions(-) create mode 100644 docs/manpages/dnspcap2protobuf.1.md diff --git a/build-scripts/build-auth-rpm b/build-scripts/build-auth-rpm index 18d8200eb2..e3da467f49 100755 --- a/build-scripts/build-auth-rpm +++ b/build-scripts/build-auth-rpm @@ -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 diff --git a/build-scripts/debian-authoritative/control.in b/build-scripts/debian-authoritative/control.in index 47aa6de84f..bd5bcd41ab 100644 --- a/build-scripts/debian-authoritative/control.in +++ b/build-scripts/debian-authoritative/control.in @@ -4,7 +4,7 @@ Priority: extra Standards-Version: 3.9.8 Maintainer: PowerDNS Autobuilder 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 diff --git a/build-scripts/debian-authoritative/pdns-tools.install b/build-scripts/debian-authoritative/pdns-tools.install index dd9d70c4f1..6ca38a9e43 100644 --- a/build-scripts/debian-authoritative/pdns-tools.install +++ b/build-scripts/debian-authoritative/pdns-tools.install @@ -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 diff --git a/build-scripts/debian-authoritative/pdns-tools.manpages b/build-scripts/debian-authoritative/pdns-tools.manpages index afbafe82f8..b8b70a83da 100644 --- a/build-scripts/debian-authoritative/pdns-tools.manpages +++ b/build-scripts/debian-authoritative/pdns-tools.manpages @@ -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 diff --git a/build-scripts/debian-authoritative/rules b/build-scripts/debian-authoritative/rules index b1e78bbabd..4b37fbb7a4 100755 --- a/build-scripts/debian-authoritative/rules +++ b/build-scripts/debian-authoritative/rules @@ -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) diff --git a/docs/Makefile.am b/docs/Makefile.am index eeeac6984c..4fa8256a75 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -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 index 0000000000..170910676e --- /dev/null +++ b/docs/manpages/dnspcap2protobuf.1.md @@ -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 diff --git a/pdns/Makefile.am b/pdns/Makefile.am index e2c6a536d7..12ce89669d 100644 --- a/pdns/Makefile.am +++ b/pdns/Makefile.am @@ -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 diff --git a/pdns/dnspcap2protobuf.cc b/pdns/dnspcap2protobuf.cc index b66ef44bbd..1f33ff1784 100644 --- a/pdns/dnspcap2protobuf.cc +++ b/pdns/dnspcap2protobuf.cc @@ -1,3 +1,6 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include #include @@ -75,14 +78,33 @@ catch(std::exception& e) { cerr<<"Error parsing response records: "< "<