From: Remi Gacogne Date: Wed, 9 Dec 2020 10:48:30 +0000 (+0100) Subject: Remove left-over protobuf from build files, CI, documentation X-Git-Tag: rec-4.5.0-alpha1~38^2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7fd852454801cdb6ba9869952052ce68fe8659c2;p=thirdparty%2Fpdns.git Remove left-over protobuf from build files, CI, documentation --- diff --git a/.circleci/config.yml b/.circleci/config.yml index 6437a12270..e31b470fc2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -181,8 +181,7 @@ commands: libssl1.1 \ libsystemd0 \ libsodium23 \ - libfstrm0 \ - libprotobuf17 + libfstrm0 install-auth-deps: description: Install all libraries needed to run the auth @@ -223,13 +222,11 @@ commands: libfstrm0 \ libh2o-evloop0.13 \ liblmdb0 \ - libprotobuf17 \ libre2-5 \ libssl-dev \ libsystemd0 \ libsodium23 \ patch \ - protobuf-compiler \ python3-venv install-ixfrdist-deps: @@ -441,8 +438,7 @@ commands: name: configure command: | ./configure \ - --disable-unit-tests \ - --disable-protobuf + --disable-unit-tests working_directory: ~/project/pdns/recursordist - run: name: build docs @@ -477,8 +473,7 @@ commands: name: configure command: | ./configure \ - --disable-unit-tests \ - --disable-protobuf + --disable-unit-tests working_directory: ~/project/pdns/dnsdistdist - run: name: build docs @@ -1051,14 +1046,12 @@ jobs: libcap-dev \ libluajit-5.1-dev \ libfstrm-dev \ - libprotobuf-dev \ libsodium-dev \ libssl-dev \ libsystemd-dev \ libtool \ make \ pkg-config \ - protobuf-compiler \ ragel \ systemd \ python3-venv @@ -1080,7 +1073,6 @@ jobs: --with-libsodium \ --with-lua=luajit \ --with-libcap \ - --with-protobuf=yes \ --without-net-snmp working_directory: ~/project/pdns/recursordist - run: @@ -1112,7 +1104,7 @@ jobs: password: $DOCKERHUB_PASSWORD steps: - add-auth-repo - - run: apt-get --no-install-recommends install -qq -y pdns-server pdns-backend-bind pdns-tools daemontools authbind jq libfaketime lua-posix lua-socket moreutils bc python3-venv protobuf-compiler + - run: apt-get --no-install-recommends install -qq -y pdns-server pdns-backend-bind pdns-tools daemontools authbind jq libfaketime lua-posix lua-socket moreutils bc python3-venv - install-recursor-deps - run: name: Set up authbind @@ -1516,7 +1508,6 @@ jobs: libfstrm-dev \ liblmdb-dev \ libluajit-5.1-dev \ - libprotobuf-dev \ libre2-dev \ libsnmp-dev \ libsodium-dev \ @@ -1525,7 +1516,6 @@ jobs: libtool \ make \ pkg-config \ - protobuf-compiler \ ragel \ python3-venv - install-coverity-tools @@ -1549,7 +1539,6 @@ jobs: --with-libsodium \ --with-lua=luajit \ --with-libcap \ - --with-protobuf=yes \ --with-re2 working_directory: /opt/project/pdns/dnsdistdist - run: @@ -1595,14 +1584,12 @@ jobs: libcap-dev \ libluajit-5.1-dev \ libfstrm-dev \ - libprotobuf-dev \ libsodium-dev \ libssl-dev \ libsystemd-dev \ libtool \ make \ pkg-config \ - protobuf-compiler \ ragel \ python3-venv - install-coverity-tools @@ -1623,7 +1610,6 @@ jobs: --with-libsodium \ --with-lua=luajit \ --with-libcap \ - --with-protobuf=yes \ --without-net-snmp working_directory: /opt/project/pdns/recursordist - run: @@ -1672,7 +1658,6 @@ jobs: libh2o-evloop-dev \ liblmdb-dev \ libluajit-5.1-dev \ - libprotobuf-dev \ libre2-dev \ libsnmp-dev \ libsodium-dev \ @@ -1681,7 +1666,6 @@ jobs: libtool \ make \ pkg-config \ - protobuf-compiler \ ragel \ systemd \ python3-venv @@ -1706,7 +1690,6 @@ jobs: --with-libsodium \ --with-lua=luajit \ --with-libcap \ - --with-protobuf=yes \ --with-re2 \ --enable-asan \ --enable-ubsan diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index a4ed3ee577..041737071d 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -88,7 +88,6 @@ jobs: libmaxminddb-dev \ libp11-kit-dev \ libpq-dev \ - libprotobuf-dev \ libre2-dev \ libsnmp-dev \ libsodium-dev \ @@ -97,14 +96,13 @@ jobs: libsystemd-dev \ libwslay-dev \ libyaml-cpp-dev \ - protobuf-compiler \ ragel \ unixodbc-dev - name: Build auth run: | autoreconf -vfi - ./configure --with-modules='bind geoip gmysql godbc gpgsql gsqlite3 ldap lmdb lua2 pipe random remote tinydns' --enable-tools --enable-ixfrdist --enable-dns-over-tls --enable-experimental-pkcs11 --with-libsodium --with-protobuf --enable-lua-records CFLAGS='-O0' CXXFLAGS='-O0' + ./configure --with-modules='bind geoip gmysql godbc gpgsql gsqlite3 ldap lmdb lua2 pipe random remote tinydns' --enable-tools --enable-ixfrdist --enable-dns-over-tls --enable-experimental-pkcs11 --with-libsodium --enable-lua-records CFLAGS='-O0' CXXFLAGS='-O0' make -j8 -C ext make -j8 -C modules make -j8 -C pdns @@ -116,7 +114,6 @@ jobs: ./configure --enable-unit-tests --enable-dnstap --enable-dnscrypt --enable-dns-over-tls --enable-dns-over-https LIBS=-lwslay CFLAGS='-O0' CXXFLAGS='-O0' make -j8 -C ext/ipcrypt make -j8 -C ext/yahttp - make dnsmessage.pb.cc dnstap.pb.cc make -j4 dnsdist - name: Build recursor @@ -125,7 +122,7 @@ jobs: autoreconf -vfi ./configure --enable-unit-tests --enable-nod --enable-dnstap CFLAGS='-O0' CXXFLAGS='-O0' make -j8 -C ext - make dnsmessage.pb.cc dnstap.pb.cc htmlfiles.h + make htmlfiles.h make -j8 pdns_recursor rec_control - name: Perform CodeQL Analysis diff --git a/Dockerfile-recursor b/Dockerfile-recursor index ccebb237a8..6e291c2cd2 100644 --- a/Dockerfile-recursor +++ b/Dockerfile-recursor @@ -18,7 +18,6 @@ COPY builder-support /source/builder-support # TODO: control file is not in tarballs at all right now RUN mk-build-deps -i -t 'apt-get -y -o Debug::pkgProblemResolver=yes --no-install-recommends' /source/builder-support/debian/recursor/debian-buster/control && \ apt-get clean -# RUN apt-get -y install protobuf-compiler && apt-get clean COPY pdns /source/pdns COPY build-aux /source/build-aux diff --git a/build-scripts/travis.sh b/build-scripts/travis.sh index d42fe9c7af..512ed94580 100755 --- a/build-scripts/travis.sh +++ b/build-scripts/travis.sh @@ -643,9 +643,7 @@ test_repo(){ run "sudo apt-get -qq --no-install-recommends install \ libboost-all-dev \ libluajit-5.1-dev \ - libedit-dev \ - libprotobuf-dev \ - protobuf-compiler" + libedit-dev" run "cd .." run "wget http://ppa.launchpad.net/kalon33/gamesgiroll/ubuntu/pool/main/libs/libsodium/libsodium-dev_1.0.3-1~ppa14.04+1_amd64.deb" diff --git a/builder-support/debian/authoritative/debian-buster/control b/builder-support/debian/authoritative/debian-buster/control index 4e64ed676d..803b97b2b0 100644 --- a/builder-support/debian/authoritative/debian-buster/control +++ b/builder-support/debian/authoritative/debian-buster/control @@ -29,7 +29,6 @@ Build-Depends: autoconf, libmaxminddb-dev, libp11-kit-dev, libpq-dev, - libprotobuf-dev, libsodium-dev, libsqlite3-dev, libssl-dev, @@ -38,7 +37,6 @@ Build-Depends: autoconf, libyaml-cpp-dev (>= 0.5), pkg-config, po-debconf, - protobuf-compiler, ragel, systemd [linux-any], unixodbc-dev (>= 2.3.1) diff --git a/builder-support/debian/authoritative/debian-buster/rules b/builder-support/debian/authoritative/debian-buster/rules index 600e7412b7..f49a64bf6d 100755 --- a/builder-support/debian/authoritative/debian-buster/rules +++ b/builder-support/debian/authoritative/debian-buster/rules @@ -41,7 +41,6 @@ override_dh_auto_configure: --enable-tools \ --with-libsodium \ --with-lua=luajit \ - --with-protobuf \ --enable-unit-tests \ --enable-experimental-pkcs11 \ --enable-lua-records \ diff --git a/builder-support/debian/authoritative/debian-jessie/control b/builder-support/debian/authoritative/debian-jessie/control index dad4154985..a5dbd201c5 100644 --- a/builder-support/debian/authoritative/debian-jessie/control +++ b/builder-support/debian/authoritative/debian-jessie/control @@ -27,7 +27,6 @@ Build-Depends: autoconf, libmysqlclient-dev, libp11-kit-dev, libpq-dev, - libprotobuf-dev, libsodium-dev, libsqlite3-dev, libssl-dev, @@ -36,7 +35,6 @@ Build-Depends: autoconf, libyaml-cpp-dev (>= 0.5), pkg-config, po-debconf, - protobuf-compiler, ragel, systemd [linux-any], unixodbc-dev (>= 2.3.1) diff --git a/builder-support/debian/authoritative/debian-jessie/rules b/builder-support/debian/authoritative/debian-jessie/rules index 5cc5cbb7c9..ee04b0e9ec 100755 --- a/builder-support/debian/authoritative/debian-jessie/rules +++ b/builder-support/debian/authoritative/debian-jessie/rules @@ -30,7 +30,6 @@ override_dh_auto_configure: --enable-tools \ --with-libsodium \ --with-lua=luajit \ - --with-protobuf \ --enable-unit-tests \ --enable-experimental-pkcs11 \ --enable-lua-records \ diff --git a/builder-support/debian/authoritative/debian-stretch/control b/builder-support/debian/authoritative/debian-stretch/control index 4e64ed676d..803b97b2b0 100644 --- a/builder-support/debian/authoritative/debian-stretch/control +++ b/builder-support/debian/authoritative/debian-stretch/control @@ -29,7 +29,6 @@ Build-Depends: autoconf, libmaxminddb-dev, libp11-kit-dev, libpq-dev, - libprotobuf-dev, libsodium-dev, libsqlite3-dev, libssl-dev, @@ -38,7 +37,6 @@ Build-Depends: autoconf, libyaml-cpp-dev (>= 0.5), pkg-config, po-debconf, - protobuf-compiler, ragel, systemd [linux-any], unixodbc-dev (>= 2.3.1) diff --git a/builder-support/debian/authoritative/debian-stretch/rules b/builder-support/debian/authoritative/debian-stretch/rules index 221f7a9877..41c7f83b7f 100755 --- a/builder-support/debian/authoritative/debian-stretch/rules +++ b/builder-support/debian/authoritative/debian-stretch/rules @@ -40,7 +40,6 @@ override_dh_auto_configure: --with-modules="" \ --enable-tools \ --with-libsodium \ - --with-protobuf \ --enable-unit-tests \ --enable-experimental-pkcs11 \ --enable-lua-records \ diff --git a/builder-support/debian/dnsdist/debian-buster/control b/builder-support/debian/dnsdist/debian-buster/control index 3467f11e89..deb19af486 100644 --- a/builder-support/debian/dnsdist/debian-buster/control +++ b/builder-support/debian/dnsdist/debian-buster/control @@ -14,7 +14,6 @@ Build-Depends: debhelper (>= 10), liblmdb-dev, libluajit-5.1-dev [!arm64], liblua5.3-dev [arm64], - libprotobuf-dev, libre2-dev, libsnmp-dev, libsodium-dev, @@ -22,7 +21,6 @@ Build-Depends: debhelper (>= 10), libsystemd-dev [linux-any], libwslay-dev, pkg-config, - protobuf-compiler, ragel, systemd [linux-any] Standards-Version: 4.1.5 diff --git a/builder-support/debian/dnsdist/debian-buster/rules b/builder-support/debian/dnsdist/debian-buster/rules index 2f2d0e303e..3207e619bd 100755 --- a/builder-support/debian/dnsdist/debian-buster/rules +++ b/builder-support/debian/dnsdist/debian-buster/rules @@ -57,7 +57,6 @@ override_dh_auto_configure: --with-libsodium \ --with-re2 \ --with-ebpf \ - --with-protobuf \ --with-service-user='_dnsdist' \ --with-service-group='_dnsdist' \ $(CONFIGURE_ARGS) diff --git a/builder-support/debian/dnsdist/debian-jessie/control b/builder-support/debian/dnsdist/debian-jessie/control index 9200f31df8..5845006dd0 100644 --- a/builder-support/debian/dnsdist/debian-jessie/control +++ b/builder-support/debian/dnsdist/debian-jessie/control @@ -10,13 +10,11 @@ Build-Depends: debhelper (>= 9~), libcdb-dev, libedit-dev, libluajit-5.1-dev, - libprotobuf-dev, libre2-dev, libsodium-dev, libssl-dev, libsystemd-dev [linux-any], pkg-config, - protobuf-compiler, ragel, systemd [linux-any] Standards-Version: 4.1.0 diff --git a/builder-support/debian/dnsdist/debian-jessie/rules b/builder-support/debian/dnsdist/debian-jessie/rules index 053c23e5cc..9677fb2d02 100755 --- a/builder-support/debian/dnsdist/debian-jessie/rules +++ b/builder-support/debian/dnsdist/debian-jessie/rules @@ -46,7 +46,6 @@ override_dh_auto_configure: --with-re2 \ --with-ebpf \ --with-lua=luajit \ - --with-protobuf \ --with-service-user='_dnsdist' \ --with-service-group='_dnsdist' \ $(CONFIGURE_ARGS) diff --git a/builder-support/debian/dnsdist/debian-stretch/control b/builder-support/debian/dnsdist/debian-stretch/control index 63d7b00f41..cba9cc1439 100644 --- a/builder-support/debian/dnsdist/debian-stretch/control +++ b/builder-support/debian/dnsdist/debian-stretch/control @@ -13,13 +13,11 @@ Build-Depends: debhelper (>= 10), liblmdb-dev, libluajit-5.1-dev [!arm64], liblua5.3-dev [arm64], - libprotobuf-dev, libre2-dev, libsodium-dev, libssl-dev, libsystemd-dev [linux-any], pkg-config, - protobuf-compiler, ragel, systemd [linux-any] Standards-Version: 4.1.0 diff --git a/builder-support/debian/dnsdist/debian-stretch/rules b/builder-support/debian/dnsdist/debian-stretch/rules index 55eebc3dcf..004cb4042a 100755 --- a/builder-support/debian/dnsdist/debian-stretch/rules +++ b/builder-support/debian/dnsdist/debian-stretch/rules @@ -56,7 +56,6 @@ override_dh_auto_configure: --with-libsodium \ --with-re2 \ --with-ebpf \ - --with-protobuf \ --with-service-user='_dnsdist' \ --with-service-group='_dnsdist' \ $(CONFIGURE_ARGS) diff --git a/builder-support/debian/recursor/debian-buster/control b/builder-support/debian/recursor/debian-buster/control index df21562b1f..8634bf4a70 100644 --- a/builder-support/debian/recursor/debian-buster/control +++ b/builder-support/debian/recursor/debian-buster/control @@ -10,13 +10,11 @@ Build-Depends: debhelper (>= 10), libcap-dev, libluajit-5.1-dev [!arm64], liblua5.3-dev [arm64], - libprotobuf-dev, libfstrm-dev, libsodium-dev, libssl-dev, libsystemd-dev [linux-any], pkg-config, - protobuf-compiler, ragel, systemd [linux-any] Vcs-Git: https://anonscm.debian.org/git/pkg-dns/pdns-recursor.git diff --git a/builder-support/debian/recursor/debian-buster/rules b/builder-support/debian/recursor/debian-buster/rules index 8e48f3eb44..7a92e43e53 100755 --- a/builder-support/debian/recursor/debian-buster/rules +++ b/builder-support/debian/recursor/debian-buster/rules @@ -36,7 +36,6 @@ override_dh_auto_configure: --enable-unit-tests \ --with-libcap \ --with-libsodium \ - --with-protobuf=yes \ --enable-dnstap \ --without-net-snmp \ --disable-silent-rules \ diff --git a/builder-support/debian/recursor/debian-jessie/control b/builder-support/debian/recursor/debian-jessie/control index f2fa238e38..31ffc2c90c 100644 --- a/builder-support/debian/recursor/debian-jessie/control +++ b/builder-support/debian/recursor/debian-jessie/control @@ -9,13 +9,11 @@ Build-Depends: debhelper (>= 9~), libboost-all-dev, libcap-dev, libluajit-5.1-dev, - libprotobuf-dev, libsnmp-dev, libsodium-dev, libssl-dev, libsystemd-dev [linux-any], pkg-config, - protobuf-compiler, ragel, systemd [linux-any] Homepage: https://www.powerdns.com/ diff --git a/builder-support/debian/recursor/debian-jessie/rules b/builder-support/debian/recursor/debian-jessie/rules index 9f8872b027..1e36211f41 100755 --- a/builder-support/debian/recursor/debian-jessie/rules +++ b/builder-support/debian/recursor/debian-jessie/rules @@ -30,7 +30,6 @@ override_dh_auto_configure: --with-lua=luajit \ --with-libcap \ --with-libsodium \ - --with-protobuf=yes \ --with-net-snmp \ --disable-silent-rules \ --with-service-user=pdns \ diff --git a/builder-support/debian/recursor/debian-stretch/control b/builder-support/debian/recursor/debian-stretch/control index df21562b1f..8634bf4a70 100644 --- a/builder-support/debian/recursor/debian-stretch/control +++ b/builder-support/debian/recursor/debian-stretch/control @@ -10,13 +10,11 @@ Build-Depends: debhelper (>= 10), libcap-dev, libluajit-5.1-dev [!arm64], liblua5.3-dev [arm64], - libprotobuf-dev, libfstrm-dev, libsodium-dev, libssl-dev, libsystemd-dev [linux-any], pkg-config, - protobuf-compiler, ragel, systemd [linux-any] Vcs-Git: https://anonscm.debian.org/git/pkg-dns/pdns-recursor.git diff --git a/builder-support/debian/recursor/debian-stretch/rules b/builder-support/debian/recursor/debian-stretch/rules index 8e48f3eb44..7a92e43e53 100755 --- a/builder-support/debian/recursor/debian-stretch/rules +++ b/builder-support/debian/recursor/debian-stretch/rules @@ -36,7 +36,6 @@ override_dh_auto_configure: --enable-unit-tests \ --with-libcap \ --with-libsodium \ - --with-protobuf=yes \ --enable-dnstap \ --without-net-snmp \ --disable-silent-rules \ diff --git a/builder-support/specs/dnsdist.spec b/builder-support/specs/dnsdist.spec index 9ca9884d35..1a4f0a7ed7 100644 --- a/builder-support/specs/dnsdist.spec +++ b/builder-support/specs/dnsdist.spec @@ -13,8 +13,6 @@ BuildRequires: openssl-devel %if 0%{?el6} BuildRequires: boost148-devel BuildRequires: lua-devel -BuildRequires: protobuf-compiler -BuildRequires: protobuf-devel BuildRequires: re2-devel %endif %if 0%{?suse_version} @@ -38,8 +36,6 @@ BuildRequires: luajit-devel %define lua_implementation luajit %endif BuildRequires: net-snmp-devel -BuildRequires: protobuf-compiler -BuildRequires: protobuf-devel BuildRequires: re2-devel BuildRequires: systemd BuildRequires: systemd-devel @@ -87,7 +83,6 @@ sed -i '/^ExecStart/ s/dnsdist/dnsdist -u dnsdist -g dnsdist/' dnsdist.service.i --without-libsodium \ --with-re2 \ --with-net-snmp \ - --with-protobuf \ --with-boost=/usr/include/boost148 LIBRARY_PATH=/usr/lib64/boost148 %endif %if 0%{?suse_version} @@ -95,12 +90,10 @@ sed -i '/^ExecStart/ s/dnsdist/dnsdist -u dnsdist -g dnsdist/' dnsdist.service.i --without-libsodium \ --without-re2 \ --enable-systemd --with-systemd=/lib/systemd/system \ - --without-protobuf \ --without-net-snmp %endif %if 0%{?rhel} >= 7 --with-gnutls \ - --with-protobuf \ --enable-dnstap \ --with-lua=%{lua_implementation} \ --with-libcap \ diff --git a/builder-support/specs/pdns-recursor.spec b/builder-support/specs/pdns-recursor.spec index 4b033b2134..069ce9d245 100644 --- a/builder-support/specs/pdns-recursor.spec +++ b/builder-support/specs/pdns-recursor.spec @@ -33,8 +33,6 @@ BuildRequires: libatomic %endif %if 0%{?rhel} >= 7 -BuildRequires: protobuf-compiler -BuildRequires: protobuf-devel BuildRequires: fstrm-devel %endif @@ -73,13 +71,11 @@ package if you need a dns cache for your network. --disable-static \ --enable-unit-tests \ %if 0%{?rhel} == 6 - --without-protobuf \ --with-boost=/usr/include/boost148 LIBRARY_PATH=/usr/lib64/boost148 \ CPPFLAGS=-D__STDC_FORMAT_MACROS make %{?_smp_mflags} LIBRARY_PATH=/usr/lib64/boost148 %else - --with-protobuf \ --enable-dnstap \ --with-libcap \ --with-lua=%{lua_implementation} \ diff --git a/builder-support/specs/pdns.spec b/builder-support/specs/pdns.spec index d043b5ffda..1475f41e0f 100644 --- a/builder-support/specs/pdns.spec +++ b/builder-support/specs/pdns.spec @@ -27,8 +27,6 @@ BuildRequires: systemd BuildRequires: systemd-units BuildRequires: systemd-devel -BuildRequires: protobuf-devel -BuildRequires: protobuf-compiler BuildRequires: p11-kit-devel BuildRequires: libcurl-devel BuildRequires: boost-devel @@ -221,7 +219,6 @@ export CPPFLAGS="-DLDAP_DEPRECATED" --enable-ixfrdist %else --disable-lua-records \ - --without-protobuf \ --with-boost=/usr/include/boost148/ LDFLAGS=-L/usr/lib64/boost148 \ CXXFLAGS=-std=gnu++11 \ CPPFLAGS="${CPPFLAGS} -D__STDC_FORMAT_MACROS" @@ -363,14 +360,12 @@ fi %{_mandir}/man1/sdig.1.gz %{_bindir}/dnsbulktest %{_bindir}/dnspcap2calidns +%{_bindir}/dnspcap2protobuf %{_bindir}/dnstcpbench %{_mandir}/man1/dnsbulktest.1.gz %{_mandir}/man1/dnspcap2calidns.1.gz -%{_mandir}/man1/dnstcpbench.1.gz -%if 0%{?rhel} >= 7 -%{_bindir}/dnspcap2protobuf %{_mandir}/man1/dnspcap2protobuf.1.gz -%endif +%{_mandir}/man1/dnstcpbench.1.gz %files backend-mysql %doc modules/gmysqlbackend/schema.mysql.sql diff --git a/configure.ac b/configure.ac index 02b76692c4..b8e060920a 100644 --- a/configure.ac +++ b/configure.ac @@ -234,8 +234,6 @@ PDNS_ENABLE_REMOTEBACKEND_ZEROMQ PDNS_ENABLE_TOOLS PDNS_ENABLE_IXFRDIST -PDNS_WITH_PROTOBUF - PDNS_WITH_LUA_RECORDS AM_CONDITIONAL([LDAP], [test "x$needldap" = "xyes"]) diff --git a/docs/Makefile.am b/docs/Makefile.am index 3a2954be5f..fd55913bfc 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -14,6 +14,7 @@ endif MANPAGES_TARGET_TOOLS = calidns.1 \ dnspcap2calidns.1 \ + dnspcap2protobuf.1 \ dnsgram.1 \ dnsreplay.1 \ dnsscan.1 \ @@ -33,20 +34,13 @@ MANPAGES_TARGET_IXFRDIST = ixfrdist.1 \ MANPAGES_DIST += $(MANPAGES_TARGET_TOOLS) \ $(MANPAGES_TARGET_IXFRDIST) \ dnsbulktest.1 \ - dnstcpbench.1 \ - dnspcap2protobuf.1 + dnstcpbench.1 if HAVE_BOOST_GE_148 MANPAGES_INSTALL += dnsbulktest.1 \ dnstcpbench.1 endif -if HAVE_PROTOBUF -if HAVE_PROTOC -MANPAGES_INSTALL += dnspcap2protobuf.1 -endif -endif - if TOOLS MANPAGES_INSTALL += $(MANPAGES_TARGET_TOOLS) endif diff --git a/m4/pdns_with_protobuf.m4 b/m4/pdns_with_protobuf.m4 deleted file mode 100644 index f106c5889f..0000000000 --- a/m4/pdns_with_protobuf.m4 +++ /dev/null @@ -1,27 +0,0 @@ -AC_DEFUN([PDNS_WITH_PROTOBUF], [ - AC_MSG_CHECKING([if we need to link in protobuf]) - AC_ARG_WITH([protobuf], - AS_HELP_STRING([--with-protobuf],[enable protobuf support @<:@default=auto@:>@]), - [with_protobuf=$withval], - [with_protobuf=auto], - ) - AC_MSG_RESULT([$with_protobuf]) - - AS_IF([test "x$with_protobuf" != "xno"], [ - AS_IF([test "x$with_protobuf" = "xyes" -o "x$with_protobuf" = "xauto"], [ - PKG_CHECK_MODULES([PROTOBUF], [protobuf], [ : ], [ : ]) - AC_CHECK_PROG([PROTOC], [protoc], [protoc]) - ]) - ]) - AS_IF([test "x$with_protobuf" = "xyes"], [ - AS_IF([test x"$PROTOBUF_LIBS" = "x"], [ - AC_MSG_ERROR([Protobuf requested but libraries were not found]) - ]) - AS_IF([test x"$PROTOC" = "x"], [ - AC_MSG_ERROR([Protobuf requested but the protobuf compiler was not found]) - ]) - ]) - AM_CONDITIONAL([HAVE_PROTOBUF], [test x"$PROTOBUF_LIBS" != "x"]) - AM_CONDITIONAL([HAVE_PROTOC], [test x"$PROTOC" != "x"]) - AS_IF([test x"$PROTOBUF_LIBS" != "x"], [AC_DEFINE([HAVE_PROTOBUF], [1], [Define if using protobuf.])]) -]) diff --git a/pdns/Makefile.am b/pdns/Makefile.am index 6a0c436a1d..f2cc0a5dc9 100644 --- a/pdns/Makefile.am +++ b/pdns/Makefile.am @@ -70,7 +70,6 @@ CLEANFILES = \ backends/gsql/gsqlbackend.gcda \ backends/gsql/gsqlbackend.gcno \ backends/gsql/gsqlbackend.gcov \ - dnsmessage.pb.cc dnsmessage.pb.h \ pdns.conf-dist \ apidocfiles.h \ api-swagger.yaml \ diff --git a/pdns/dnsdistdist/docs/install.rst b/pdns/dnsdistdist/docs/install.rst index 85344c6df6..fe299b4b13 100644 --- a/pdns/dnsdistdist/docs/install.rst +++ b/pdns/dnsdistdist/docs/install.rst @@ -49,7 +49,7 @@ dnsdist depends on the following libraries: * `Lua `_ 5.1+ or `LuaJit `_ * `Editline (libedit) `_ * `libsodium `_ (optional) -* `protobuf `_ (optional) +* `protobuf `_ (optional, not needed as of 1.6.0) * `re2 `_ (optional) Should :program:`dnsdist` be run on a system with systemd, it is highly recommended to have diff --git a/pdns/protobuf.cc b/pdns/protobuf.cc deleted file mode 100644 index 31fe67edf8..0000000000 --- a/pdns/protobuf.cc +++ /dev/null @@ -1,383 +0,0 @@ - -#include "gettime.hh" -#include "dnsparser.hh" -#include "protobuf.hh" -#include "dnsparser.hh" -#include "gettime.hh" - -void DNSProtoBufMessage::setType(DNSProtoBufMessageType type) -{ -#ifdef HAVE_PROTOBUF - switch(type) { - case DNSProtoBufMessage::DNSProtoBufMessageType::Query: - d_message.set_type(PBDNSMessage_Type_DNSQueryType); - break; - case DNSProtoBufMessage::DNSProtoBufMessageType::Response: - d_message.set_type(PBDNSMessage_Type_DNSResponseType); - break; - case DNSProtoBufMessage::DNSProtoBufMessageType::OutgoingQuery: - d_message.set_type(PBDNSMessage_Type_DNSOutgoingQueryType); - break; - case DNSProtoBufMessage::DNSProtoBufMessageType::IncomingResponse: - d_message.set_type(PBDNSMessage_Type_DNSIncomingResponseType); - break; - default: - throw std::runtime_error("Unsupported protobuf type: "+std::to_string(type)); - } -#endif /* HAVE_PROTOBUF */ -} - -DNSProtoBufMessage::DNSProtoBufMessage(DNSProtoBufMessageType type) -{ - setType(type); -} - -void DNSProtoBufMessage::setQuestion(const DNSName& qname, uint16_t qtype, uint16_t qclass) -{ -#ifdef HAVE_PROTOBUF - PBDNSMessage_DNSQuestion* question = d_message.mutable_question(); - if (question) { - if(!qname.empty()) - question->set_qname(qname.toString()); - question->set_qtype(qtype); - question->set_qclass(qclass); - } -#endif /* HAVE_PROTOBUF */ -} - -void DNSProtoBufMessage::setBytes(size_t bytes) -{ -#ifdef HAVE_PROTOBUF - d_message.set_inbytes(bytes); -#endif /* HAVE_PROTOBUF */ -} - -void DNSProtoBufMessage::setResponseCode(uint8_t rcode) -{ -#ifdef HAVE_PROTOBUF - PBDNSMessage_DNSResponse* response = d_message.mutable_response(); - if (response) { - response->set_rcode(rcode); - } -#endif /* HAVE_PROTOBUF */ -} - -void DNSProtoBufMessage::setNetworkErrorResponseCode() -{ -#ifdef HAVE_PROTOBUF - PBDNSMessage_DNSResponse* response = d_message.mutable_response(); - if (response) { - /* special code meaning 'network error', like a timeout */ - response->set_rcode(65536); - } -#endif /* HAVE_PROTOBUF */ -} - -void DNSProtoBufMessage::setTime(time_t sec, uint32_t usec) -{ -#ifdef HAVE_PROTOBUF - d_message.set_timesec(sec); - d_message.set_timeusec(usec); -#endif /* HAVE_PROTOBUF */ -} - -void DNSProtoBufMessage::setQueryTime(time_t sec, uint32_t usec) -{ -#ifdef HAVE_PROTOBUF - PBDNSMessage_DNSResponse* response = d_message.mutable_response(); - if (response) { - response->set_querytimesec(sec); - response->set_querytimeusec(usec); - } -#endif /* HAVE_PROTOBUF */ -} - -void DNSProtoBufMessage::setEDNSSubnet(const Netmask& subnet, uint8_t mask) -{ -#ifdef HAVE_PROTOBUF - if (!subnet.empty()) { - ComboAddress ca(subnet.getNetwork()); - ca.truncate(mask); - if (ca.sin4.sin_family == AF_INET) { - d_message.set_originalrequestorsubnet(&ca.sin4.sin_addr.s_addr, sizeof(ca.sin4.sin_addr.s_addr)); - } - else if (ca.sin4.sin_family == AF_INET6) { - d_message.set_originalrequestorsubnet(&ca.sin6.sin6_addr.s6_addr, sizeof(ca.sin6.sin6_addr.s6_addr)); - } - } -#endif /* HAVE_PROTOBUF */ -} - -void DNSProtoBufMessage::addTag(const std::string& strValue) -{ -#ifdef HAVE_PROTOBUF - - PBDNSMessage_DNSResponse* response = d_message.mutable_response(); - if (!response) - return; - - response->add_tags(strValue); - -#endif /* HAVE_PROTOBUF */ -} - -void DNSProtoBufMessage::addRR(const DNSName& qname, uint16_t uType, uint16_t uClass, uint32_t uTTL, const std::string& strBlob) -{ -#ifdef HAVE_PROTOBUF - - PBDNSMessage_DNSResponse* response = d_message.mutable_response(); - if (!response) - return; - PBDNSMessage_DNSResponse_DNSRR* rr = response->add_rrs(); - if (rr) { - rr->set_name(qname.toString()); - rr->set_type(uType); - rr->set_class_(uClass); - rr->set_ttl(uTTL); - rr->set_rdata(strBlob.c_str(), strBlob.size()); - } - -#endif /* HAVE_PROTOBUF */ -} - -void DNSProtoBufMessage::addRRsFromPacket(const char* packet, const size_t len, bool includeCNAME) -{ -#ifdef HAVE_PROTOBUF - if (len < sizeof(struct dnsheader)) - return; - - const struct dnsheader* dh = (const struct dnsheader*) packet; - - if (ntohs(dh->ancount) == 0) - return; - - if (ntohs(dh->qdcount) == 0) - return; - - PBDNSMessage_DNSResponse* response = d_message.mutable_response(); - if (!response) - return; - - std::string packetStr(packet, len); - PacketReader pr(packetStr); - - size_t idx = 0; - DNSName rrname; - uint16_t qdcount = ntohs(dh->qdcount); - uint16_t ancount = ntohs(dh->ancount); - uint16_t rrtype; - uint16_t rrclass; - string blob; - struct dnsrecordheader ah; - - rrname = pr.getName(); - rrtype = pr.get16BitInt(); - rrclass = pr.get16BitInt(); - - /* consume remaining qd if any */ - if (qdcount > 1) { - for(idx = 1; idx < qdcount; idx++) { - rrname = pr.getName(); - rrtype = pr.get16BitInt(); - rrclass = pr.get16BitInt(); - (void) rrtype; - (void) rrclass; - } - } - - /* parse AN */ - for (idx = 0; idx < ancount; idx++) { - rrname = pr.getName(); - pr.getDnsrecordheader(ah); - - if (ah.d_type == QType::A || ah.d_type == QType::AAAA) { - pr.xfrBlob(blob); - - PBDNSMessage_DNSResponse_DNSRR* rr = response->add_rrs(); - if (rr) { - rr->set_name(rrname.toString()); - rr->set_type(ah.d_type); - rr->set_class_(ah.d_class); - rr->set_ttl(ah.d_ttl); - rr->set_rdata(blob.c_str(), blob.length()); - } - } else if (ah.d_type == QType::CNAME && includeCNAME) { - PBDNSMessage_DNSResponse_DNSRR* rr = response->add_rrs(); - if (rr) { - rr->set_name(rrname.toString()); - rr->set_type(ah.d_type); - rr->set_class_(ah.d_class); - rr->set_ttl(ah.d_ttl); - DNSName target; - pr.xfrName(target, true); - rr->set_rdata(target.toString()); - } - } - else { - pr.xfrBlob(blob); - } - } -#endif /* HAVE_PROTOBUF */ -} - -void DNSProtoBufMessage::setRequestor(const std::string& requestor) -{ -#ifdef HAVE_PROTOBUF - d_message.set_from(requestor); -#endif /* HAVE_PROTOBUF */ -} - -void DNSProtoBufMessage::setRequestor(const ComboAddress& requestor) -{ -#ifdef HAVE_PROTOBUF - if (requestor.sin4.sin_family == AF_INET) { - d_message.set_from(&requestor.sin4.sin_addr.s_addr, sizeof(requestor.sin4.sin_addr.s_addr)); - } - else if (requestor.sin4.sin_family == AF_INET6) { - d_message.set_from(&requestor.sin6.sin6_addr.s6_addr, sizeof(requestor.sin6.sin6_addr.s6_addr)); - } -#endif /* HAVE_PROTOBUF */ -} - -void DNSProtoBufMessage::setRequestorPort(uint16_t port) -{ -#ifdef HAVE_PROTOBUF - d_message.set_fromport(port); -#endif /* HAVE_PROTOBUF */ -} - -void DNSProtoBufMessage::setRequestorId(const std::string& requestorId) -{ -#ifdef HAVE_PROTOBUF - d_message.set_requestorid(requestorId); -#endif /* HAVE_PROTOBUF */ -} - -void DNSProtoBufMessage::setDeviceId(const std::string& deviceId) -{ -#ifdef HAVE_PROTOBUF - d_message.set_deviceid(deviceId); -#endif /* HAVE_PROTOBUF */ -} - -void DNSProtoBufMessage::setDeviceName(const std::string& deviceName) -{ -#ifdef HAVE_PROTOBUF - d_message.set_devicename(deviceName); -#endif /* HAVE_PROTOBUF */ -} - -void DNSProtoBufMessage::setServerIdentity(const std::string& serverId) -{ -#ifdef HAVE_PROTOBUF - d_message.set_serveridentity(serverId); -#endif /* HAVE_PROTOBUF */ -} - -void DNSProtoBufMessage::setResponder(const std::string& responder) -{ -#ifdef HAVE_PROTOBUF - d_message.set_to(responder); -#endif /* HAVE_PROTOBUF */ -} - -void DNSProtoBufMessage::setResponder(const ComboAddress& responder) -{ -#ifdef HAVE_PROTOBUF - if (responder.sin4.sin_family == AF_INET) { - d_message.set_to(&responder.sin4.sin_addr.s_addr, sizeof(responder.sin4.sin_addr.s_addr)); - } - else if (responder.sin4.sin_family == AF_INET6) { - d_message.set_to(&responder.sin6.sin6_addr.s6_addr, sizeof(responder.sin6.sin6_addr.s6_addr)); - } -#endif /* HAVE_PROTOBUF */ -} - -void DNSProtoBufMessage::setResponderPort(uint16_t port) -{ -#ifdef HAVE_PROTOBUF - d_message.set_toport(port); -#endif /* HAVE_PROTOBUF */ -} - -void DNSProtoBufMessage::serialize(std::string& data) const -{ -#ifdef HAVE_PROTOBUF - d_message.SerializeToString(&data); -#endif /* HAVE_PROTOBUF */ -} - -std::string DNSProtoBufMessage::toDebugString() const -{ -#ifdef HAVE_PROTOBUF - return d_message.DebugString(); -#else - return std::string(); -#endif /* HAVE_PROTOBUF */ -} - -#ifdef HAVE_PROTOBUF - -void DNSProtoBufMessage::setUUID(const boost::uuids::uuid& uuid) -{ - std::string* messageId = d_message.mutable_messageid(); - messageId->resize(uuid.size()); - std::copy(uuid.begin(), uuid.end(), messageId->begin()); -} - -void DNSProtoBufMessage::setInitialRequestID(const boost::uuids::uuid& uuid) -{ - std::string* messageId = d_message.mutable_initialrequestid(); - messageId->resize(uuid.size()); - std::copy(uuid.begin(), uuid.end(), messageId->begin()); -} - -void DNSProtoBufMessage::updateTime() -{ - struct timespec ts; - gettime(&ts, true); - setTime(ts.tv_sec, ts.tv_nsec / 1000); -} - -void DNSProtoBufMessage::update(const boost::uuids::uuid& uuid, const ComboAddress* requestor, const ComboAddress* responder, bool isTCP, uint16_t id) -{ - updateTime(); - setUUID(uuid); - d_message.set_id(ntohs(id)); - - if (requestor) { - d_message.set_socketfamily(requestor->sin4.sin_family == AF_INET ? PBDNSMessage_SocketFamily_INET : PBDNSMessage_SocketFamily_INET6); - } - else if (responder) { - d_message.set_socketfamily(responder->sin4.sin_family == AF_INET ? PBDNSMessage_SocketFamily_INET : PBDNSMessage_SocketFamily_INET6); - } - - d_message.set_socketprotocol(isTCP ? PBDNSMessage_SocketProtocol_TCP : PBDNSMessage_SocketProtocol_UDP); - - if (responder) { - setResponder(*responder); - setResponderPort(responder->getPort()); - } - if (requestor) { - setRequestor(*requestor); - setRequestorPort(requestor->getPort()); - } -} - - -DNSProtoBufMessage::DNSProtoBufMessage(DNSProtoBufMessageType type, const boost::uuids::uuid& uuid, const ComboAddress* requestor, const ComboAddress* responder, const DNSName& domain, int qtype, uint16_t qclass, uint16_t qid, bool isTCP, size_t bytes) -{ - update(uuid, requestor, responder, isTCP, qid); - - setType(type); - - setBytes(bytes); - setQuestion(domain, qtype, qclass); -} - -void DNSProtoBufMessage::copyFrom(const DNSProtoBufMessage& msg) -{ - d_message.CopyFrom(msg.d_message); -} - -#endif /* HAVE_PROTOBUF */ diff --git a/pdns/protobuf.hh b/pdns/protobuf.hh deleted file mode 100644 index 0df3ee62be..0000000000 --- a/pdns/protobuf.hh +++ /dev/null @@ -1,92 +0,0 @@ -/* - * This file is part of PowerDNS or dnsdist. - * Copyright -- PowerDNS.COM B.V. and its contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * In addition, for the avoidance of any doubt, permission is granted to - * link this program with OpenSSL and to (re)distribute the binaries - * produced as the result of such linking. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#pragma once - -#include -#include - -#include "config.h" - -#include "dnsname.hh" -#include "iputils.hh" - -#ifdef HAVE_PROTOBUF -#include -#include "dnsmessage.pb.h" -#endif /* HAVE_PROTOBUF */ - -class DNSProtoBufMessage -{ -public: - enum DNSProtoBufMessageType { - Query, - Response, - OutgoingQuery, - IncomingResponse - }; - - DNSProtoBufMessage() - { - } - - DNSProtoBufMessage(DNSProtoBufMessage::DNSProtoBufMessageType type); - - ~DNSProtoBufMessage() - { - } - - void setType(DNSProtoBufMessage::DNSProtoBufMessageType type); - void setQuestion(const DNSName& qname, uint16_t qtype, uint16_t qclass); - void setEDNSSubnet(const Netmask& subnet, uint8_t mask=128); - void setBytes(size_t bytes); - void setTime(time_t sec, uint32_t usec); - void updateTime(); - void setQueryTime(time_t sec, uint32_t usec); - void setResponseCode(uint8_t rcode); - void setNetworkErrorResponseCode(); - void addRRsFromPacket(const char* packet, const size_t len, bool includeCNAME=false); - void serialize(std::string& data) const; - void setRequestor(const std::string& requestor); - void setRequestor(const ComboAddress& requestor); - void setRequestorPort(uint16_t port); - void setResponder(const std::string& responder); - void setResponder(const ComboAddress& responder); - void setResponderPort(uint16_t port); - void setRequestorId(const std::string& requestorId); - void setDeviceId(const std::string& deviceId); - void setDeviceName(const std::string& deviceName); - void setServerIdentity(const std::string& serverId); - std::string toDebugString() const; - void addTag(const std::string& strValue); - void addRR(const DNSName& qame, uint16_t utype, uint16_t uClass, uint32_t uTTl, const std::string& strBlob); - -#ifdef HAVE_PROTOBUF - DNSProtoBufMessage(DNSProtoBufMessage::DNSProtoBufMessageType type, const boost::uuids::uuid& uuid, const ComboAddress* requestor, const ComboAddress* responder, const DNSName& domain, int qtype, uint16_t qclass, uint16_t qid, bool isTCP, size_t bytes); - void update(const boost::uuids::uuid& uuid, const ComboAddress* requestor, const ComboAddress* responder, bool isTCP, uint16_t id); - void setUUID(const boost::uuids::uuid& uuid); - void setInitialRequestID(const boost::uuids::uuid& uuid); - void copyFrom(const DNSProtoBufMessage& msg); - -protected: - PBDNSMessage d_message; -#endif /* HAVE_PROTOBUF */ -}; diff --git a/pdns/rec-protobuf.cc b/pdns/rec-protobuf.cc deleted file mode 100644 index e5a7f4e8b4..0000000000 --- a/pdns/rec-protobuf.cc +++ /dev/null @@ -1,259 +0,0 @@ - -#include "config.h" -#include "rec-protobuf.hh" - -#ifdef NOD_ENABLED -void RecProtoBufMessage::setNOD(bool nod) -{ -#ifdef HAVE_PROTOBUF - d_message.set_newlyobserveddomain(nod); -#endif /* HAVE_PROTOBUF */ -} - -void RecProtoBufMessage::clearUDR() -{ -#ifdef HAVE_PROTOBUF - auto response = d_message.mutable_response(); - if (!response) { - return; - } - const int count = response->rrs_size(); - for (int idx = 0; idx < count; idx++) { - auto rr = response->mutable_rrs(idx); - rr->set_udr(false); - } -#endif /* HAVE_PROTOBUF */ -} -#endif /* NOD_ENABLED */ - -#ifdef NOD_ENABLED -void RecProtoBufMessage::addRR(const DNSRecord& record, const std::set& exportTypes, bool udr) -#else -void RecProtoBufMessage::addRR(const DNSRecord& record, const std::set& exportTypes) -#endif /* NOD_ENABLED */ -{ -#ifdef HAVE_PROTOBUF - PBDNSMessage_DNSResponse* response = d_message.mutable_response(); - if (!response) { - return; - } - - if (record.d_place != DNSResourceRecord::ANSWER || record.d_class != QClass::IN) { - return; - } - - if (exportTypes.count(record.d_type) == 0) { - return; - } - - PBDNSMessage_DNSResponse_DNSRR* pbRR = response->add_rrs(); - if (!pbRR) { - return; - } - - pbRR->set_name(record.d_name.toString()); - pbRR->set_type(record.d_type); - pbRR->set_class_(record.d_class); - pbRR->set_ttl(record.d_ttl); -#ifdef NOD_ENABLED - pbRR->set_udr(udr); -#endif - - switch(record.d_type) { - case QType::A: - { - const auto& content = dynamic_cast(*(record.d_content)); - ComboAddress data = content.getCA(); - pbRR->set_rdata(&data.sin4.sin_addr.s_addr, sizeof(data.sin4.sin_addr.s_addr)); - break; - } - case QType::AAAA: - { - const auto& content = dynamic_cast(*(record.d_content)); - ComboAddress data = content.getCA(); - pbRR->set_rdata(&data.sin6.sin6_addr.s6_addr, sizeof(data.sin6.sin6_addr.s6_addr)); - break; - } - case QType::CNAME: - { - const auto& content = dynamic_cast(*(record.d_content)); - pbRR->set_rdata(content.getTarget().toString()); - break; - } - case QType::TXT: - { - const auto& content = dynamic_cast(*(record.d_content)); - pbRR->set_rdata(content.d_text); - break; - } - case QType::NS: - { - const auto& content = dynamic_cast(*(record.d_content)); - pbRR->set_rdata(content.getNS().toString()); - break; - } - case QType::PTR: - { - const auto& content = dynamic_cast(*(record.d_content)); - pbRR->set_rdata(content.getContent().toString()); - break; - } - case QType::MX: - { - const auto& content = dynamic_cast(*(record.d_content)); - pbRR->set_rdata(content.d_mxname.toString()); - break; - } - case QType::SPF: - { - const auto& content = dynamic_cast(*(record.d_content)); - pbRR->set_rdata(content.getText()); - break; - } - case QType::SRV: - { - const auto& content = dynamic_cast(*(record.d_content)); - pbRR->set_rdata(content.d_target.toString()); - break; - } - default: - break; - } -#endif /* HAVE_PROTOBUF */ -} - -void RecProtoBufMessage::addRRs(const std::vector& records, const std::set& exportTypes) -{ - for (const auto& record : records) { - addRR(record, exportTypes); - } -} - -void RecProtoBufMessage::setAppliedPolicy(const std::string& policy) -{ -#ifdef HAVE_PROTOBUF - PBDNSMessage_DNSResponse* response = d_message.mutable_response(); - if (response && !policy.empty()) { - response->set_appliedpolicy(policy); - } -#endif /* HAVE_PROTOBUF */ -} - -void RecProtoBufMessage::setAppliedPolicyType(const DNSFilterEngine::PolicyType& type) -{ -#ifdef HAVE_PROTOBUF - PBDNSMessage_DNSResponse* response = d_message.mutable_response(); - if (response) { - switch(type) { - case DNSFilterEngine::PolicyType::None: - response->set_appliedpolicytype(PBDNSMessage_PolicyType_UNKNOWN); - break; - case DNSFilterEngine::PolicyType::QName: - response->set_appliedpolicytype(PBDNSMessage_PolicyType_QNAME); - break; - case DNSFilterEngine::PolicyType::ClientIP: - response->set_appliedpolicytype(PBDNSMessage_PolicyType_CLIENTIP); - break; - case DNSFilterEngine::PolicyType::ResponseIP: - response->set_appliedpolicytype(PBDNSMessage_PolicyType_RESPONSEIP); - break; - case DNSFilterEngine::PolicyType::NSDName: - response->set_appliedpolicytype(PBDNSMessage_PolicyType_NSDNAME); - break; - case DNSFilterEngine::PolicyType::NSIP: - response->set_appliedpolicytype(PBDNSMessage_PolicyType_NSIP); - break; - default: - throw std::runtime_error("Unsupported protobuf policy type"); - } - } -#endif /* HAVE_PROTOBUF */ -} - -void RecProtoBufMessage::setAppliedPolicyTrigger(const DNSName& trigger) -{ -#ifdef HAVE_PROTOBUF - PBDNSMessage_DNSResponse* response = d_message.mutable_response(); - if (response && !trigger.empty()) { - response->set_appliedpolicytrigger(trigger.toString()); - } -#endif /* HAVE_PROTOBUF */ -} - -void RecProtoBufMessage::setAppliedPolicyHit(const string& hit) -{ -#ifdef HAVE_PROTOBUF - PBDNSMessage_DNSResponse* response = d_message.mutable_response(); - if (response && !hit.empty()) { - response->set_appliedpolicyhit(hit); - } -#endif /* HAVE_PROTOBUF */ -} - -void RecProtoBufMessage::setPolicyTags(const std::unordered_set& policyTags) -{ -#ifdef HAVE_PROTOBUF - PBDNSMessage_DNSResponse* response = d_message.mutable_response(); - if (response) { - for (const auto& tag : policyTags) { - response->add_tags(tag); - } - } -#endif /* HAVE_PROTOBUF */ -} - -void RecProtoBufMessage::addPolicyTag(const std::string& policyTag) -{ -#ifdef HAVE_PROTOBUF - PBDNSMessage_DNSResponse* response = d_message.mutable_response(); - if (response) { - response->add_tags(policyTag); - } -#endif -} - -void RecProtoBufMessage::removePolicyTag(const std::string& policyTag) -{ -#ifdef HAVE_PROTOBUF - PBDNSMessage_DNSResponse* response = d_message.mutable_response(); - if (response) { - const int count = response->tags_size(); - int keep = 0; - for (int idx = 0; idx < count; ++idx) { - auto tagp = response->mutable_tags(idx); - if (tagp->compare(policyTag) == 0) { - } - else { - if (keep < idx) { - response->mutable_tags()->SwapElements(idx, keep); - } - ++keep; - } - } - response->mutable_tags()->DeleteSubrange(keep, count - keep); - } -#endif -} - -std::string RecProtoBufMessage::getAppliedPolicy() const -{ - std::string result; -#ifdef HAVE_PROTOBUF - const PBDNSMessage_DNSResponse& response = d_message.response(); - result = response.appliedpolicy(); -#endif /* HAVE_PROTOBUF */ - return result; -} - -std::vector RecProtoBufMessage::getPolicyTags() const -{ - std::vector result; -#ifdef HAVE_PROTOBUF - const PBDNSMessage_DNSResponse& response = d_message.response(); - const int count = response.tags_size(); - for (int idx = 0; idx < count; idx++) { - result.push_back(response.tags(idx)); - } -#endif /* HAVE_PROTOBUF */ - return result; -} diff --git a/pdns/rec-protobuf.hh b/pdns/rec-protobuf.hh deleted file mode 100644 index c5ec2f06bd..0000000000 --- a/pdns/rec-protobuf.hh +++ /dev/null @@ -1,62 +0,0 @@ -/* - * This file is part of PowerDNS or dnsdist. - * Copyright -- PowerDNS.COM B.V. and its contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * In addition, for the avoidance of any doubt, permission is granted to - * link this program with OpenSSL and to (re)distribute the binaries - * produced as the result of such linking. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#pragma once - -#include "protobuf.hh" -#include "filterpo.hh" -#include "dnsrecords.hh" - -class RecProtoBufMessage: public DNSProtoBufMessage -{ -public: - RecProtoBufMessage(): DNSProtoBufMessage() - { - } - - RecProtoBufMessage(DNSProtoBufMessage::DNSProtoBufMessageType type): DNSProtoBufMessage(type) - { - } - -#ifdef HAVE_PROTOBUF - RecProtoBufMessage(DNSProtoBufMessage::DNSProtoBufMessageType type, const boost::uuids::uuid& uuid, const ComboAddress* requestor, const ComboAddress* responder, const DNSName& domain, int qtype, uint16_t qclass, uint16_t qid, bool isTCP, size_t bytes): DNSProtoBufMessage(type, uuid, requestor, responder, domain, qtype, qclass, qid, isTCP, bytes) - { - } -#endif /* HAVE_PROTOBUF */ - - void addRRs(const std::vector& records, const std::set& exportTypes); -#ifdef NOD_ENABLED - void setNOD(bool nod); - void addRR(const DNSRecord& record, const std::set& exportTypes, bool udr=false); - void clearUDR(); -#else - void addRR(const DNSRecord& record, const std::set& exportTypes); -#endif /* NOD_ENABLED */ - void setAppliedPolicy(const std::string& policy); - void setAppliedPolicyType(const DNSFilterEngine::PolicyType& policyType); - void setAppliedPolicyTrigger(const DNSName& trigger); - void setAppliedPolicyHit(const string& hit); - void setPolicyTags(const std::unordered_set& policyTags); - void addPolicyTag(const std::string& policyTag); - void removePolicyTag(const std::string& policyTag); - std::string getAppliedPolicy() const; - std::vector getPolicyTags() const; -}; diff --git a/pdns/recursordist/Makefile.am b/pdns/recursordist/Makefile.am index 8f7f0ac05a..725cf5c3cb 100644 --- a/pdns/recursordist/Makefile.am +++ b/pdns/recursordist/Makefile.am @@ -33,8 +33,6 @@ BUILT_SOURCES=htmlfiles.h \ dnslabeltext.cc CLEANFILES = htmlfiles.h \ - dnsmessage.pb.cc \ - dnsmessage.pb.h \ recursor.conf-dist htmlfiles.h: html/* diff --git a/pdns/recursordist/docs/appendices/compiling.rst b/pdns/recursordist/docs/appendices/compiling.rst index 8c1eade07c..6158be4d8f 100644 --- a/pdns/recursordist/docs/appendices/compiling.rst +++ b/pdns/recursordist/docs/appendices/compiling.rst @@ -64,10 +64,8 @@ Protobuf to emit DNS logs ^^^^^^^^^^^^^^^^^^^^^^^^^ The PowerDNS Recursor can log DNS query information over :doc:`Protocol Buffers <../lua-config/protobuf>`. -To enable this functionality, install the `protobuf `_ library and compiler. -The configure script will automatically detect this and bump the Boost version dependency to 1.42. -To disable building this functionality, use ``--without-protobuf``. +This functionality from 4.5.0 and upwards, without needing any external library. Before 4.5.0, installing the `protobuf `_ library and compiler is required to enable this functionality. The configure script will automatically detect this and bump the Boost version dependency to 1.42. To disable building this functionality before 4.5.0, use ``--without-protobuf``. systemd notify support ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/pdns/recursordist/protobuf.cc b/pdns/recursordist/protobuf.cc deleted file mode 120000 index 088ecc89e8..0000000000 --- a/pdns/recursordist/protobuf.cc +++ /dev/null @@ -1 +0,0 @@ -../protobuf.cc \ No newline at end of file diff --git a/pdns/recursordist/protobuf.hh b/pdns/recursordist/protobuf.hh deleted file mode 120000 index c7def8e442..0000000000 --- a/pdns/recursordist/protobuf.hh +++ /dev/null @@ -1 +0,0 @@ -../protobuf.hh \ No newline at end of file diff --git a/pdns/recursordist/rec-protobuf.cc b/pdns/recursordist/rec-protobuf.cc deleted file mode 120000 index 1bab3e4e2e..0000000000 --- a/pdns/recursordist/rec-protobuf.cc +++ /dev/null @@ -1 +0,0 @@ -../rec-protobuf.cc \ No newline at end of file diff --git a/pdns/recursordist/rec-protobuf.hh b/pdns/recursordist/rec-protobuf.hh deleted file mode 120000 index 93a7607b37..0000000000 --- a/pdns/recursordist/rec-protobuf.hh +++ /dev/null @@ -1 +0,0 @@ -../rec-protobuf.hh \ No newline at end of file