xmlto
- sudo sh -c 'sed s/precise/trusty/g /etc/apt/sources.list > /etc/apt/sources.list.d/trusty.list'
- sudo apt-get update --quiet --quiet
- - sudo apt-get install --quiet --quiet liblmdb0 liblmdb-dev lmdb-utils libyaml-cpp-dev libzmq3-dev pandoc libgeoip-dev
+ - sudo apt-get install --quiet --quiet libyaml-cpp-dev libzmq3-dev pandoc libgeoip-dev
- sudo pip install pandocfilters==1.2.3 mkdocs==0.14 linkchecker==9.3 click==5.1
- sudo update-alternatives --set ruby /usr/bin/ruby1.9.1
- sudo touch /etc/authbind/byport/53
- p11-kit -l # ensure it's ok
script:
- ./bootstrap
-#DNSName --with-dynmodules='bind gmysql gpgsql gsqlite3 mydns tinydns remote random opendbx ldap lmdb lua'
#Build without --enable-botan1.10 option, Botan/SoftHSM conflict #2496
- CFLAGS='-O1' CXXFLAGS='-O1' ./configure
--with-dynmodules='bind gmysql geoip gpgsql gsqlite3 mydns tinydns pipe remote random opendbx ldap lua'
- test -f pdns/test-suite.log && cat pdns/test-suite.log || true
- test -f modules/remotebackend/test-suite.log && cat modules/remotebackend/test-suite.log || true
# DNSName: - make -k -j 2 -C pdns $(grep '(EXEEXT):' pdns/Makefile | cut -f1 -d\$ | grep -E -v 'dnsdist|calidns')
- - make -k -j 2 -C pdns $(grep '(EXEEXT):' pdns/Makefile | cut -f1 -d\$ | grep -E -v 'dnsdist|calidns|zone2lmdb|speedtest')
+ - make -k -j 2 -C pdns $(grep '(EXEEXT):' pdns/Makefile | cut -f1 -d\$ | grep -E -v 'dnsdist|calidns|speedtest')
- cd pdns
- make -k -j 2 pdns_recursor
- rm -f pdns_recursor
- ./timestamp ./start-test-stop 5300 gsqlite3-nsec3-both
# - ./timestamp ./start-test-stop 5300 gsqlite3-nsec3-optout-both
# - ./timestamp ./start-test-stop 5300 gsqlite3-nsec3-narrow
-#DNSName - ./timestamp ./start-test-stop 5300 lmdb-nodnssec
- ./timestamp ./start-test-stop 5300 mydns
- ./timestamp ./start-test-stop 5300 opendbx-sqlite3
- travis_retry ./timestamp timeout 120s ./start-test-stop 5300 remotebackend-pipe
Standards-Version: 3.9.6
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, libpolarssl-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, libcrypto++-dev, ragel, libgmp-dev, libbotan1.10-dev, libcurl4-openssl-dev, libzmq-dev, liblmdb-dev, libyaml-cpp-dev (>= 0.5), libgeoip-dev, libopendbx1-dev, libcdb-dev
+Build-Depends: debhelper (>= 9~), dh-autoreconf, dh-systemd, po-debconf, libtool, flex, bison, libmysqlclient-dev, libpq-dev, libssl-dev, libpolarssl-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, libcrypto++-dev, ragel, libgmp-dev, libbotan1.10-dev, libcurl4-openssl-dev, libzmq-dev, libyaml-cpp-dev (>= 0.5), libgeoip-dev, libopendbx1-dev, libcdb-dev
Homepage: http://www.powerdns.com/
Package: pdns-server
.
This package contains the Lua backend for PowerDNS.
-Package: pdns-backend-lmdb
-Architecture: any
-Depends: pdns-server (>= ${source:Version}), ${shlibs:Depends}, ${misc:Depends}
-Provides: pdns-backend
-Description: lmdb backend for PowerDNS
- PowerDNS is a versatile nameserver which supports a large number
- of different backends ranging from simple zonefiles to relational
- databases and load balancing/failover algorithms.
- PowerDNS tries to emphasize speed and security.
- .
- This package contains the Symas Lightning Memory-Mapped Database
- backend for PowerDNS.
-
Package: pdns-backend-remote
Architecture: any
Depends: pdns-server (>= ${source:Version}), ${shlibs:Depends}, ${misc:Depends}
./timestamp ./start-test-stop 5300 gsqlite3-nsec3-optout-both || EXITCODE=1
./timestamp ./start-test-stop 5300 gsqlite3-nsec3-narrow || EXITCODE=1
-# LMDB is broken pending DNSName
-# ./timestamp ./start-test-stop 5300 lmdb-nodnssec || EXITCODE=1
-
./timestamp ./start-test-stop 5300 mydns || EXITCODE=1
./timestamp ./start-test-stop 5300 opendbx-sqlite3 || EXITCODE=1
PDNS_WITH_ORACLE
needoracle=yes
;;
- lmdb)
- PDNS_WITH_LMDB
- needlmdb=yes
- ;;
mydns|gmysql|pdns)
PDNS_WITH_MYSQL
;;
AM_CONDITIONAL([LDAP],[test "x$needldap" = "xyes"])
-AM_CONDITIONAL([LMDB],[test "x$needlmdb" = "xyes"])
-
PDNS_CHECK_SQLITE3
AM_CONDITIONAL([SQLITE3], [test "x$needsqlite3" = "xyes"])
modules/randombackend/Makefile
modules/remotebackend/Makefile
modules/tinydnsbackend/Makefile
- modules/lmdbbackend/Makefile
])
AC_OUTPUT
+++ /dev/null
-AC_DEFUN([PDNS_WITH_LMDB],[
- AC_CHECK_HEADERS([lmdb.h], , [AC_MSG_ERROR([lmdb header (lmdb.h) not found])])
- AC_SUBST([LMDB_LIBS])
- AC_CHECK_LIB(
- [lmdb], [mdb_env_create],
- [AC_DEFINE([HAVE_LIBLMDB], 1, [Have -llmdb]) LMDB_LIBS="-llmdb"]
- )
-])
gpgsqlbackend \
gsqlite3backend \
ldapbackend \
- lmdbbackend \
luabackend \
mydnsbackend \
opendbxbackend \
+++ /dev/null
-pkglib_LTLIBRARIES = liblmdbbackend.la
-
-EXTRA_DIST = \
- lmdb-example.pl \
- OBJECTFILES \
- OBJECTLIBS
-
-liblmdbbackend_la_SOURCES = \
- lmdbbackend.cc lmdbbackend.hh
-
-liblmdbbackend_la_LDFLAGS = -module -avoid-version
-liblmdbbackend_la_LIBADD = $(LMDB_LIBS)
-
+++ /dev/null
-lmdbbackend.lo
+++ /dev/null
-$(LMDB_LIBS)
+++ /dev/null
-#!/usr/bin/perl
-use strict;
-use warnings;
-
-use LMDB_File qw( :dbflags :envflags :cursor_op :writeflags );
-
-my ($path, $dbname, $searchkey) = @ARGV;
-die unless -d $path;
-
-my $env = LMDB::Env->new( $path, {
- mapsize => 1024*1024*1024,
- maxdbs => 3,
- flags => MDB_RDONLY,
-});
-my $txn = LMDB::Txn->new( $env, MDB_RDONLY );
-my $db = $txn->OpenDB( $dbname, MDB_DUPSORT );
-my $c = $db->Cursor;
-my ($k, $v);
-if( $searchkey ) {
- $c->get( $k = $searchkey, $v, MDB_SET_RANGE );
-} else {
- $c->get( $k, $v, MDB_FIRST );
-}
-
-print "key: $k; value: $v\n";
-
-while(1) {
- eval {
- $c->get( $k, $v, MDB_NEXT );
- };
- if( $@ =~ /MDB_NOTFOUND/ ) {
- exit;
- }
- die $@ if $@;
- print "key: $k; value: $v\n";
-}
+++ /dev/null
-#!/usr/bin/perl
-# An example script to generate files for the PowerDNS LMDB high performance
-# backend
-
-use LMDB_File 0.04 qw( :dbflags :envflags :cursor_op :writeflags );
-
-use strict;
-use warnings;
-
-my $HOME = "/var/tmp/lmdb";
-
-mkdir $HOME unless -d $HOME;
-my $env = LMDB::Env->new( $HOME, {
- mapsize => 100*1024*1024*1024,
- maxdbs => 3,
-});
-my $txn = LMDB::Txn->new( $env, 0 );
-my $dns_zone = $txn->OpenDB( 'zone', MDB_CREATE );
-
-my $zone = 'example.com';
-my $zone_id = 1;
-my $zone_ttl = 300;
-my $soa_entry = "ns.$zone. hostmaster.$zone. 2012021101 86400 7200 604800 86400";
-# XXX $zone length MUST be less than 500 bytes
-$dns_zone->put( scalar reverse(lc $zone), join("\t", $zone_id, $zone_ttl, $soa_entry) );
-
-my $dns_data = $txn->OpenDB( 'data', MDB_CREATE | MDB_DUPSORT );
-my $dns_extended_data = $txn->OpenDB( 'extended_data', MDB_CREATE );
-my @entries = (
- # host type data
- [ $zone, 'NS', "ns.$zone" ],
- # MX/SRV put priority <space> data
- [ $zone, 'MX', "10 mail.example.com" ],
- # No SOA records
- [ "test.$zone", 'A', '192.0.2.66' ],
- [ "text.$zone", 'TXT', "test\n123" ],
- [ "longtext.$zone", 'TXT', "A" x 550 ],
-
-);
-
-my $extended_ref = 0;
-for my $row (@entries) {
- my ($host, $type, $data) = @$row;
-
- # Don't ever allow these characters as they break powerdns
- $data =~ tr/"\\//d;
-
- if( $type eq 'TXT' ) {
- $data =~ s/([^ -~])/sprintf '\\%03d', ord $1/eg;
- }
-
- my $key = join( "\t", scalar reverse(lc $host), $type ); # XXX must be less than 500 bytes
- my $val = join( "\t", $zone_id, $zone_ttl, $data);
- if( length $val > 500 ) {
- $dns_data->put( $key, "REF\t" . ++$extended_ref );
- $dns_extended_data->put( $extended_ref, $val );
- # Extended data record storage as DUPSORT can only store up to 500 bytes of data unfortunately
- } else {
- $dns_data->put( $key, $val );
- }
-}
-
-$txn->commit;
+++ /dev/null
-/*
- * LMDBBackend - a high performance LMDB based backend for PowerDNS written by
- * Mark Zealey, 2013
- *
- * This was originally going to be a backend using BerkeleyDB 5 for high
- * performance DNS over massive (millions of zones) databases. However,
- * BerkeleyDB had a number of issues to do with locking, contention and
- * corruption which made it unsuitable for use. Instead, we use LMDB to perform
- * very fast lookups.
- *
- * See the documentation for more details, and lmdb-example.pl for an example
- * script which generates a simple zone.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include "pdns/utility.hh"
-#include "pdns/dnsbackend.hh"
-#include "pdns/dns.hh"
-#include "pdns/dnspacket.hh"
-#include "pdns/pdnsexception.hh"
-#include "pdns/logger.hh"
-#include <signal.h>
-#include "lmdbbackend.hh"
-#include "pdns/arguments.hh"
-#include "pdns/base32.hh"
-#include "pdns/lock.hh"
-
-#if 0
-#define DEBUGLOG(msg) L<<Logger::Error<<msg
-#else
-#define DEBUGLOG(msg) do {} while(0)
-#endif
-
-int LMDBBackend::s_reloadcount=0;
-pthread_rwlock_t LMDBBackend::s_initlock = PTHREAD_RWLOCK_INITIALIZER;
-
-LMDBBackend::LMDBBackend(const string &suffix)
-{
- setArgPrefix("lmdb"+suffix);
- try {
- d_doDnssec = mustDo("experimental-dnssec");
- }
- catch (ArgException e) {
- d_doDnssec = false;
- }
- d_lastreload = s_reloadcount;
- WriteLock wl(&s_initlock);
- open_db();
-}
-
-void LMDBBackend::open_db() {
- L<<Logger::Error<<"Loading LMDB database " << getArg("datapath") << endl;
-
- string path = getArg("datapath");
- int rc;
- int major, minor, patch;
-
- string verstring( mdb_version( &major, &minor, &patch ) );
- if( MDB_VERINT( major, minor, patch ) < MDB_VERINT( 0, 9, 8 ) )
- throw PDNSException( "LMDB Library version too old (" + verstring + "). Needs to be 0.9.8 or greater" );
-
-
- if( (rc = mdb_env_create(&env)) )
- throw PDNSException("Couldn't open LMDB database " + path + ": mdb_env_create() returned " + mdb_strerror(rc));
-
- if( (rc = mdb_env_set_maxdbs( env, d_doDnssec ? 5 : 3)) )
- throw PDNSException("Couldn't open LMDB database " + path + ": mdb_env_set_maxdbs() returned " + mdb_strerror(rc));
-
- if( (rc = mdb_env_open(env, path.c_str(), MDB_RDONLY, 0)) )
- throw PDNSException("Couldn't open LMDB database " + path + ": mdb_env_open() returned " + mdb_strerror(rc));
-
- if( (rc = mdb_txn_begin(env, NULL, MDB_RDONLY, &txn) ))
- throw PDNSException("Couldn't start LMDB txn " + path + ": mdb_txn_begin() returned " + mdb_strerror(rc));
-
- if( (rc = mdb_dbi_open(txn, "zone", 0, &zone_db) ) )
- throw PDNSException("Couldn't open LMDB zone database " + path + ": mdb_dbi_open() returned " + mdb_strerror(rc));
- if( (rc = mdb_cursor_open(txn, zone_db, &zone_cursor) ))
- throw PDNSException("Couldn't open cursor on LMDB zone database " + path + ": mdb_cursor_open() returned " + mdb_strerror(rc));
-
- if( (rc = mdb_dbi_open(txn, "data", MDB_DUPSORT, &data_db) ))
- throw PDNSException("Couldn't open LMDB data database " + path + ": mdb_dbi_open() returned " + mdb_strerror(rc));
- if( (rc = mdb_cursor_open(txn, data_db, &data_cursor) ))
- throw PDNSException("Couldn't open cursor on LMDB data database " + path + ": mdb_cursor_open() returned " + mdb_strerror(rc));
-
- if( (rc = mdb_dbi_open(txn, "extended_data", 0, &data_extended_db) ))
- throw PDNSException("Couldn't open LMDB extended_data database " + path + ": mdb_dbi_open() returned " + mdb_strerror(rc));
- if( ( rc = mdb_cursor_open(txn, data_extended_db, &data_extended_cursor)) )
- throw PDNSException("Couldn't open cursor on LMDB data_extended database " + path + ": mdb_cursor_open() returned " + mdb_strerror(rc));
-
- if(d_doDnssec) {
- DEBUGLOG("Experimental dnssec support enabled"<<endl);
- if( (rc = mdb_dbi_open(txn, "rrsig", MDB_DUPSORT, &rrsig_db) ))
- throw PDNSException("Couldn't open LMDB rrsig database " + path + ": mdb_dbi_open() returned " + mdb_strerror(rc));
- if( ( rc = mdb_cursor_open(txn, rrsig_db, &rrsig_cursor)) )
- throw PDNSException("Couldn't open cursor on LMDB rrsig database " + path + ": mdb_cursor_open() returned " + mdb_strerror(rc));
-
- if( (rc = mdb_dbi_open(txn, "nsecx", 0, &nsecx_db) ))
- throw PDNSException("Couldn't open LMDB nsecx database " + path + ": mdb_dbi_open() returned " + mdb_strerror(rc));
- if( ( rc = mdb_cursor_open(txn, nsecx_db, &nsecx_cursor)) )
- throw PDNSException("Couldn't open cursor on LMDB nsecx database " + path + ": mdb_cursor_open() returned " + mdb_strerror(rc));
- }
-}
-
-void LMDBBackend::close_db() {
- L<<Logger::Error<<"Closing LMDB database"<< endl;
-
- mdb_cursor_close(data_cursor);
- mdb_cursor_close(zone_cursor);
- mdb_cursor_close(data_extended_cursor);
- mdb_dbi_close(env, data_db);
- mdb_dbi_close(env, zone_db);
- mdb_dbi_close(env, data_extended_db);
- if (d_doDnssec) {
- mdb_cursor_close(rrsig_cursor);
- mdb_cursor_close(nsecx_cursor);
- mdb_dbi_close(env, rrsig_db);
- mdb_dbi_close(env, nsecx_db);
- }
- mdb_txn_abort(txn);
- mdb_env_close(env);
-}
-
-LMDBBackend::~LMDBBackend()
-{
- WriteLock wl(&s_initlock);
- close_db();
-}
-
-void LMDBBackend::reload() {
- ++s_reloadcount;
-}
-
-void LMDBBackend::needReload() {
- if (s_reloadcount > d_lastreload) {
- WriteLock wl(&s_initlock);
- d_lastreload = s_reloadcount;
- close_db();
- open_db();
- }
-}
-
-bool LMDBBackend::getDomainMetadata(const string& name, const std::string& kind, std::vector<std::string>& meta)
-{
- if (!d_doDnssec)
- return false;
-
- needReload();
- ReadLock rl(&s_initlock);
-
- if (kind == "PRESIGNED" || kind == "NSEC3PARAM") {
- int rc;
- MDB_val key, data;
- string key_str, cur_value;
- vector<string> valparts;
-
- key_str=bitFlip(labelReverse(toLower(name)))+"\xff";
- key.mv_data = (char *)key_str.c_str();
- key.mv_size = key_str.length();
-
- if ((rc = mdb_cursor_get(zone_cursor, &key, &data, MDB_SET_KEY)) == 0) {
- cur_value.assign((const char *)data.mv_data, data.mv_size);
- stringtok(valparts,cur_value,"\t");
-
- if (valparts.size() == 4) {
- if (kind == "PRESIGNED")
- meta.push_back("1");
- else if (valparts[3] != "1")
- meta.push_back(valparts[3]);
- }
- }
-
- if (rc == MDB_NOTFOUND)
- DEBUGLOG("Metadata records for zone: '"<<name<<"'' not found. This is impossible !!!"<<endl);
- }
-
- return true;
-}
-
-bool LMDBBackend::getDirectNSECx(uint32_t id, const string &hashed, const QType &qtype, string &before, DNSResourceRecord &rr)
-{
- if (!d_doDnssec)
- return false;
-
- needReload();
- ReadLock rl(&s_initlock);
-
- MDB_val key, data;
- string key_str, cur_key, cur_value;
- vector<string> keyparts, valparts;
-
- if (qtype == QType::NSEC)
- key_str=itoa(id)+"\t"+bitFlip(hashed)+"\xff";
- else
- key_str=itoa(id)+"\t"+toBase32Hex(bitFlip(hashed));
- key.mv_data = (char *)key_str.c_str();
- key.mv_size = key_str.length();
-
- before.clear();
- if(!mdb_cursor_get(nsecx_cursor, &key, &data, MDB_SET_RANGE)) {
- cur_key.assign((const char *)key.mv_data, key.mv_size);
- cur_value.assign((const char *)data.mv_data, data.mv_size);
- stringtok(keyparts,cur_key,"\t");
- stringtok(valparts,cur_value,"\t");
-
- if( keyparts.size() != 2 || valparts.size() != 4 ) {
- throw PDNSException("Invalid record in nsecx table: key: '" + cur_key + "'; value: "+ cur_value);
- }
-
- // is the key a full match or does the id part match our zone?
- // if it does we have a valid answer.
- if (!key_str.compare(cur_key) || atoi(keyparts[0].c_str()) == (int) id) // FIXME we need atoui
- goto hasnsecx;
- }
- // no match, now we look for the last record in the NSECx chain.
- key_str=itoa(id)+"\t";
- key.mv_data = (char *)key_str.c_str();
- key.mv_size = key_str.length();
-
- if(!mdb_cursor_get(nsecx_cursor, &key, &data, MDB_NEXT_NODUP )) {
- cur_key.assign((const char *)key.mv_data, key.mv_size);
- cur_value.assign((const char *)data.mv_data, data.mv_size);
- stringtok(keyparts,cur_key,"\t");
- stringtok(valparts,cur_value,"\t");
-
- if( keyparts.size() != 2 || valparts.size() != 4 ) {
- throw PDNSException("Invalid record in nsecx table: key: '" + cur_key + "'; value: "+ cur_value);
- }
-
- if (!key_str.compare(cur_key) || atoi(keyparts[0].c_str()) == (int) id) // FIXME we need atoui
- goto hasnsecx;
- }
-
- DEBUGLOG("NSECx record for '"<<toBase32Hex(bitFlip(hashed))<<"'' in zone '"<<id<<"' not found"<<endl);
- return true;
-
-hasnsecx:
- if (qtype == QType::NSEC)
- before=bitFlip(keyparts[1]).c_str();
- else
- before=bitFlip(fromBase32Hex(keyparts[1]));
- rr.qname=valparts[0];
- rr.ttl=atoi(valparts[1].c_str());
- rr.qtype=DNSRecordContent::TypeToNumber(valparts[2]);
- rr.content=valparts[3];
- rr.d_place=DNSResourceRecord::AUTHORITY;
- rr.domain_id=id;
- rr.auth=true;
-
- return true;
-}
-
-bool LMDBBackend::getDirectRRSIGs(const string &signer, const string &qname, const QType &qtype, vector<DNSResourceRecord> &rrsigs)
-{
- if (!d_doDnssec)
- return false;
-
- needReload();
- ReadLock rl(&s_initlock);
-
- int rc;
- MDB_val key, data;
- string key_str, cur_value;
- vector<string> valparts;
-
- key_str=signer+"\t"+makeRelative(qname, signer)+"\t"+qtype.getName();
- key.mv_data = (char *)key_str.c_str();
- key.mv_size = key_str.length();
-
- if ((rc = mdb_cursor_get(rrsig_cursor, &key, &data, MDB_SET_KEY)) == 0) {
- DNSResourceRecord rr;
- rr.qname=qname;
- rr.qtype=QType::RRSIG;
- //rr.d_place = (DNSResourceRecord::Place) signPlace;
- rr.auth=false;
-
- do {
- cur_value.assign((const char *)data.mv_data, data.mv_size);
- stringtok(valparts,cur_value,"\t");
-
- if( valparts.size() != 2 ) {
- throw PDNSException("Invalid record in rrsig table: qname: '" + qname + "'; value: "+ cur_value);
- }
-
- rr.ttl=atoi(valparts[0].c_str());
- rr.content = valparts[1];
- rrsigs.push_back(rr);
-
- } while (mdb_cursor_get(rrsig_cursor, &key, &data, MDB_NEXT_DUP) == 0);
- }
-
- if (rc == MDB_NOTFOUND)
- DEBUGLOG("RRSIG records for qname: '"<<qname<<"'' with type: '"<<qtype.getName()<<"' not found"<<endl);
-
- return true;
-}
-
-// Get the zone name of the requested zone (labelReversed) OR the name of the closest parrent zone
-bool LMDBBackend::getAuthZone( string &rev_zone )
-{
- needReload();
- ReadLock rl(&s_initlock);
-
- MDB_val key, data;
- // XXX can do this just using char *
-
- string key_str=bitFlip(rev_zone+" ");
- key.mv_data = (char *)key_str.c_str();
- key.mv_size = key_str.length();
-
- // Release our transaction and cursors in order to get latest data
- mdb_txn_reset( txn );
- mdb_txn_renew( txn );
- mdb_cursor_renew( txn, zone_cursor );
- mdb_cursor_renew( txn, data_cursor );
- mdb_cursor_renew( txn, data_extended_cursor );
- if (d_doDnssec) {
- mdb_cursor_renew( txn, rrsig_cursor );
- mdb_cursor_renew( txn, nsecx_cursor );
- }
-
- // Find the best record
- if( mdb_cursor_get( zone_cursor, &key, &data, MDB_SET_RANGE ) == 0 && key.mv_size <= key_str.length() ) {
- // Found a shorter match. Now look if the zones are equal up to key-length-1. If they are check
- // if position key-length in key_str is a label separator. If all this is true we have a match.
- if( key_str.compare( 0, key.mv_size-1, (const char *) key.mv_data, key.mv_size-1 ) == 0 && key.mv_size && key_str[key.mv_size-1] == ~' ') {
- rev_zone.resize( key.mv_size-1 );
-
- DEBUGLOG("Auth key: " << rev_zone <<endl);
-
- return true;
- }
- }
-
- //reset the cursor the data in it is invallid
- mdb_cursor_renew( txn, zone_cursor );
-
- return false;
-}
-
-bool LMDBBackend::getAuthData( SOAData &soa, DNSPacket *p )
-{
- needReload();
- ReadLock rl(&s_initlock);
-
- MDB_val key, value;
- if( mdb_cursor_get(zone_cursor, &key, &value, MDB_GET_CURRENT) )
- return false;
-
- string data( (const char *)value.mv_data, value.mv_size );
- DEBUGLOG("Auth record data " << data<<endl);
-
-// XXX do this in C too
- vector<string>parts;
- stringtok(parts,data,"\t");
-
- if(parts.size() < 3)
- throw PDNSException("Invalid record in zone table: " + data );
-
- fillSOAData( parts[2], soa );
-
- soa.domain_id = atoi( parts[0].c_str() );
- soa.ttl = atoi( parts[1].c_str() );
-
- soa.scopeMask = 0;
- soa.db = this;
-
- return true;
-}
-
-// Called to start an AXFR then ->get() is called. Return true if the domain exists
-bool LMDBBackend::list(const string &target, int zoneId, bool include_disabled) {
- DEBUGLOG("list() requested for " <<target << endl);
- d_first = true;
- d_origdomain = target;
- d_domain_id = zoneId;
- d_curqtype = QType::AXFR;
-
- // getSOA will have been called first to ensure the domain exists so if
- // that's the case then there's no reason we can't AXFR it.
-
- return true;
-}
-
-void LMDBBackend::lookup(const QType &type, const string &inQdomain, DNSPacket *p, int zoneId)
-{
- DEBUGLOG("lookup: " <<inQdomain << " " << type.getName() << endl);
-
- needReload();
- ReadLock rl(&s_initlock);
-
- d_first = true;
- d_origdomain = inQdomain;
- d_curqtype = type;
-}
-
-inline bool LMDBBackend::get_finished()
-{
- d_origdomain = "";
-
- return false;
-}
-
-bool LMDBBackend::get(DNSResourceRecord &rr)
-{
- MDB_val key, value;
- bool is_axfr = (d_curqtype == QType::AXFR);
- bool is_full_key = ( ! is_axfr && d_curqtype != QType::ANY );
-
- ReadLock rl(&s_initlock);
- DEBUGLOG("get : " <<d_origdomain<< endl);
- if( !d_origdomain.length() )
- return false;
-
- DEBUGLOG("Starting Q " << d_first<< endl);
-
- if( d_first ) {
- d_first = false;
-
- // Reverse the query string
- string lowerq = toLower( d_origdomain );
- d_querykey = string( lowerq.rbegin(), lowerq.rend() );
- d_searchkey = d_querykey;
-
- // For normal queries ensure that we are only trying to get the exact
- // record and also try to specify the type too to make negatives a lot
- // quicker
- if( ! is_axfr ) {
- d_searchkey += "\t";
-
- // Search by query type too to easily exclude anything that doesn't
- // belong to us
- if( is_full_key )
- d_searchkey += d_curqtype.getName();
- }
-
- key.mv_size = d_searchkey.length();
- key.mv_data = (char *)d_searchkey.c_str();
- if( mdb_cursor_get(data_cursor, &key, &value, is_full_key ? MDB_SET_KEY : MDB_SET_RANGE ) )
- return get_finished();
- } else {
-next_record:
- key.mv_size = 0;
- if( mdb_cursor_get(data_cursor, &key, &value, is_full_key ? MDB_NEXT_DUP : MDB_NEXT ) )
- return get_finished();
- }
-
- // Some buggy versions of lmdb will do this. Should be caught in opendb above though.
- if( key.mv_size == 0 ) {
- DEBUGLOG("No key returned. Error" << endl);
- return get_finished();
- }
-
- string cur_value((const char *)value.mv_data, value.mv_size);
- string cur_key((const char *)key.mv_data, key.mv_size);
-
- DEBUGLOG("querykey: " << d_querykey << "; cur_key: " <<cur_key<< "; cur_value: '" << cur_value << "'" << endl);
-
- vector<string> keyparts, valparts;
-
- stringtok(keyparts,cur_key,"\t");
- stringtok(valparts,cur_value,"\t");
-
- if( valparts.size() == 2 && valparts[0] == "REF" ) {
- MDB_val extended_key, extended_val;
-
- // XXX parse into an int and have extended table as MDB_INTEGER to have
- // a bit better performance/smaller space?
- extended_key.mv_data = (char *)valparts[1].c_str();
- extended_key.mv_size = valparts[1].length();
-
- if( int rc = mdb_cursor_get( data_extended_cursor, &extended_key, &extended_val, MDB_SET_KEY ) )
- throw PDNSException("Record " + cur_key + " references extended record " + cur_value + " but this doesn't exist: " + mdb_strerror( rc ));
-
- cur_value.assign((const char *)extended_val.mv_data, extended_val.mv_size);
- valparts.clear();
- stringtok(valparts, cur_value, "\t");
- }
-
- if (valparts.size() != 3) // FIXME
- valparts.push_back(".");
-
- if( keyparts.size() != 2 || valparts.size() != 3 )
- throw PDNSException("Invalid record in record table: key: '" + cur_key + "'; value: '"+ cur_value+"'");
-
- string compare_string = cur_key.substr(0, d_searchkey.length());
- DEBUGLOG( "searchkey: " << d_searchkey << "; compare: " << compare_string << ";" << endl);
-
- // If we're onto records not beginning with this search prefix, then we
- // must be past the end
- if( compare_string.compare( d_searchkey ) )
- return get_finished();
-
- int domain_id = atoi( valparts[0].c_str() );
-
- // If we are doing an AXFR and the record fetched has been outside of our domain then end the transfer
- if( is_axfr ) {
- // Check it's not a subdomain ie belongs to this record
- if( domain_id != d_domain_id )
- goto next_record;
-
- // If it's under the main domain then append the . to the comparison to
- // ensure items outside our zone don't enter
- if( keyparts[0].length() > d_querykey.length() ) {
- string test = d_querykey;
- test.append(".");
-
- compare_string = cur_key.substr(0, d_querykey.length() + 1);
-
- DEBUGLOG("test: " << test << "; compare: " << compare_string << ";" << endl);
-
- if( test.compare( compare_string ) )
- goto next_record;
- }
-
- // We need to maintain query casing so strip off domain (less dot) and append originial query
- string sub = keyparts[0].substr( d_origdomain.length(), string::npos );
- rr.qname = string( sub.rbegin(), sub.rend() ) + d_origdomain;
- } else
- rr.qname = d_origdomain; // use cached and original casing
-
- DEBUGLOG("Found record: " <<cur_key << ": "<<valparts.size() << endl);
-
- DEBUGLOG("pass! " << rr.qname << ";" << endl);
- rr.qtype = keyparts[1];
-
- /* Filter records to only match query type */
- if( d_curqtype != QType::ANY && !is_axfr && rr.qtype != d_curqtype )
- goto next_record;
-
- DEBUGLOG("Correct record type" << endl);
- rr.auth = 1;
-
- rr.domain_id = domain_id;
- rr.ttl = atoi( valparts[1].c_str() );
- rr.content = valparts[2];
-
- return true;
-}
-
-class LMDBFactory : public BackendFactory
-{
-public:
- LMDBFactory() : BackendFactory("lmdb") {}
- void declareArguments(const string &suffix="")
- {
- declare(suffix,"datapath","Path to the directory containing the lmdb files","/etc/pdns/data");
- declare(suffix,"experimental-dnssec","Enable experimental DNSSEC processing","no");
- }
- DNSBackend *make(const string &suffix="")
- {
- return new LMDBBackend(suffix);
- }
-};
-
-/* THIRD PART */
-
-class LMDBLoader
-{
-public:
- LMDBLoader()
- {
- BackendMakers().report(new LMDBFactory);
- L << Logger::Info << "[lmdbbackend] This is the lmdb backend version " VERSION
-#ifndef REPRODUCIBLE
- << " (" __DATE__ " " __TIME__ ")"
-#endif
- << " reporting" << endl;
- }
-};
-
-static LMDBLoader lmdbLoader;
-
+++ /dev/null
-/*
- * LMDBBackend - a high performance LMDB based backend for PowerDNS written by
- * Mark Zealey, 2013
- */
-#ifndef PDNS_LMDBBACKEND_HH
-#define PDNS_LMDBBACKEND_HH
-
-#include <lmdb.h>
-#include <pthread.h>
-#include "pdns/dnsbackend.hh"
-
-class LMDBBackend : public DNSReversedBackend
-{
-private:
-
- MDB_env *env;
- MDB_dbi data_db, zone_db, data_extended_db, rrsig_db, nsecx_db;
- MDB_txn *txn;
- MDB_cursor *data_cursor, *zone_cursor, *data_extended_cursor, *rrsig_cursor, *nsecx_cursor;
-
- // Domain that we are querying for in list()/lookup()/get(). In original case and direction.
- string d_origdomain;
-
- // Current QType being queried for
- QType d_curqtype;
-
- // Is this the first call to ::get() ?
- bool d_first;
-
- // Is dnssec enabled ?
- bool d_doDnssec;
-
- // Current domain ID being queried for
- int d_domain_id;
-
- // The reversed and lowercase key that we are querying in the database. Set after the first ::get() call.
- string d_querykey;
-
- // d_querykey with some additional bits potentially tacked on to make searching faster
- string d_searchkey;
-
- // d_lastreload last time the db was reloaded
- int d_lastreload;
-
- void open_db();
- void close_db();
- void needReload();
- inline bool get_finished();
- static int s_reloadcount;
- static pthread_rwlock_t s_initlock;
-
-public:
- LMDBBackend(const string &suffix="");
- ~LMDBBackend();
- bool list(const string &target, int id, bool include_disabled=false);
- void lookup(const QType &type, const string &qdomain, DNSPacket *p, int zoneId);
- void reload();
- bool get(DNSResourceRecord &rr);
-
- bool getDomainMetadata(const string& name, const std::string& kind, std::vector<std::string>& meta);
- bool getDirectNSECx(uint32_t id, const string &hashed, const QType &qtype, string &before, DNSResourceRecord &rr);
- bool getDirectRRSIGs(const string &signer, const string &qname, const QType &qtype, vector<DNSResourceRecord> &rrsigs);
-
- bool getAuthZone( string &rev_zone );
- bool getAuthData( SOAData &, DNSPacket *);
-};
-
-#endif /* PDNS_LMDBBACKEND_HH */
/zone2ldap
/zone2sql
/zone2json
-/zone2lmdb
/bindlexer.c
/bindparser.cc
/bindparser.h
testrunner \
toysdig \
tsig-tests \
- zone2ldap \
- zone2lmdb
+ zone2ldap
pdns_server_SOURCES = \
arguments.cc arguments.hh \
zone2ldap_LDADD = $(MBEDTLS_LIBS)
-if LMDB
-bin_PROGRAMS += zone2lmdb
-
-zone2lmdb_SOURCES = \
- arguments.cc \
- base32.cc \
- base64.cc \
- bind-dnssec.schema.sqlite3.sql.h \
- bindlexer.l \
- bindparser.yy \
- bindparserclasses.hh \
- dns.cc \
- dns_random.cc \
- dnslabeltext.cc \
- dnsname.cc dnsname.hh \
- dnsparser.cc \
- dnsrecords.cc \
- dnswriter.cc \
- logger.cc \
- misc.cc \
- nsecrecords.cc \
- qtype.cc \
- rcpgenerator.cc \
- sillyrecords.cc \
- statbag.cc \
- unix_utility.cc \
- zone2lmdb.cc \
- zoneparser-tng.cc
-
-zone2lmdb_LDADD = \
- $(MBEDTLS_LIBS) \
- $(LMDB_LIBS)
-endif
-
sdig_SOURCES = \
base32.cc \
base64.cc base64.hh \
+++ /dev/null
-/*
- PowerDNS Versatile Database Driven Nameserver
- Copyright (C) 2002 - 2014 PowerDNS.COM BV
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License version 2
- as published by the Free Software Foundation
-
- Additionally, the license of this program contains a special
- exception which allows to distribute the program in binary form when
- it is linked against OpenSSL.
-
- 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 St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include <unistd.h>
-#include <string>
-#include <map>
-
-#include <iostream>
-#include <stdio.h>
-#include "namespaces.hh"
-
-#include "dns.hh"
-#include "arguments.hh"
-#include "bindparserclasses.hh"
-#include "statbag.hh"
-#include "misc.hh"
-#include "dnspacket.hh"
-#include "zoneparser-tng.hh"
-#include "dnsrecords.hh"
-#include <boost/algorithm/string.hpp>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <boost/foreach.hpp>
-#include <lmdb.h>
-#include "base32.hh"
-
-StatBag S;
-int g_numZones=0;
-int g_numRecords=0;
-int g_numRefs=0;
-
-MDB_env *env;
-MDB_dbi data_db, zone_db, data_extended_db, rrsig_db, nsecx_db;
-MDB_txn *txn, *txn_zone;
-
-void openDB(){
- mdb_env_create(&env);
- mdb_env_set_mapsize(env, 1*1024*1024*1024);
- mdb_env_set_maxdbs(env, 5);
- mdb_env_open(env, "./", 0, 0644);
-
- mdb_txn_begin(env, NULL, 0, &txn);
-
- mdb_dbi_open(txn, "zone", MDB_CREATE, &zone_db);
- mdb_dbi_open(txn, "data", MDB_CREATE | MDB_DUPSORT, &data_db);
- mdb_dbi_open(txn, "extended_data", MDB_CREATE, &data_extended_db);
- mdb_dbi_open(txn, "rrsig", MDB_CREATE | MDB_DUPSORT, &rrsig_db);
- mdb_dbi_open(txn, "nsecx", MDB_CREATE, &nsecx_db);
-}
-
-void closeDB(){
- mdb_txn_commit(txn);
- mdb_dbi_close(env, data_db);
- mdb_dbi_close(env, zone_db);
- mdb_dbi_close(env, data_extended_db);
- mdb_dbi_close(env, rrsig_db);
- mdb_dbi_close(env, nsecx_db);
- mdb_env_close(env);
-}
-
-string reverse(const string &name) {
- return string(name.rbegin(), name.rend());
-}
-
-void emitData(string zone, ZoneParserTNG &zpt){
-
- bool hasSOA=false, isPresigned=false;
- int numRefs=g_numRefs;
- int numRecords=g_numRecords;
- string metaData="1", qname;
- SOAData sd;
- DNSResourceRecord rr;
- MDB_val key, data, keyExt, dataExt;
-
- zone=toLower(zone);
- mdb_txn_begin(env, txn, 0, &txn_zone);
- while(zpt.get(rr)) {
- numRecords++;
- qname=toLower(stripDot(rr.qname));
- if (rr.qtype == QType::SOA) {
- hasSOA=true;
- fillSOAData(rr.content, sd);
- sd.ttl=rr.ttl;
- continue;
- }
- if (rr.qtype == QType::NSEC3PARAM) {
- metaData=rr.content;
- continue;
- }
-
- string keyStr, dataStr;
-
- if (rr.qtype == QType::RRSIG) {
- isPresigned=true;
- RRSIGRecordContent rrc(rr.content);
- keyStr=zone+"\t"+makeRelative(qname, zone)+"\t"+DNSRecordContent::NumberToType(rrc.d_type);
- dataStr=itoa(rr.ttl)+"\t"+rr.content;
-
- key.mv_data = (char*)keyStr.c_str();
- key.mv_size = keyStr.length();
- data.mv_data = (char*)dataStr.c_str();
- data.mv_size = dataStr.length();
-
- mdb_put(txn_zone, rrsig_db, &key, &data, 0);
- continue;
- }
-
- if (rr.qtype == QType::NSEC || rr.qtype == QType::NSEC3) {
- if (rr.qtype == QType::NSEC)
- keyStr=itoa(g_numZones+1)+"\t"+bitFlip(labelReverse(makeRelative(qname,zone)))+"\xff";
- else
- keyStr=itoa(g_numZones+1)+"\t"+toBase32Hex(bitFlip(fromBase32Hex(makeRelative(qname, zone))));
- dataStr=qname+"\t"+itoa(rr.ttl)+"\t"+rr.qtype.getName()+"\t"+rr.content;
-
- key.mv_data = (char*)keyStr.c_str();
- key.mv_size = keyStr.length();
- data.mv_data = (char*)dataStr.c_str();
- data.mv_size = dataStr.length();
-
- mdb_put(txn_zone, nsecx_db, &key, &data, 0);
- continue;
- }
-
- keyStr=reverse(qname)+"\t"+rr.qtype.getName();
- dataStr=itoa(g_numZones+1)+"\t"+itoa(rr.ttl)+"\t"+rr.content;
-
- key.mv_data = (char*)keyStr.c_str();
- key.mv_size = keyStr.length();
- data.mv_data = (char*)dataStr.c_str();
- data.mv_size = dataStr.length();
-
- if (dataStr.length() > 500) {
- string keyStrExt=itoa(++numRefs);
- string dataStrExt="REF\t"+itoa(numRefs);
-
- keyExt.mv_data = (char*)keyStrExt.c_str();
- keyExt.mv_size = keyStrExt.length();
- dataExt.mv_data = (char*)dataStrExt.c_str();
- dataExt.mv_size = dataStrExt.length();
-
- mdb_put(txn_zone, data_extended_db, &keyExt, &data, 0);
- mdb_put(txn_zone, data_db, &key, &dataExt, 0);
- } else
- mdb_put(txn_zone, data_db, &key, &data, 0);
- }
- if (hasSOA) {
- string keyStr=bitFlip(labelReverse(zone))+"\xff";
- string dataStr=itoa(g_numZones+1)+"\t"+itoa(sd.ttl)+"\t"+serializeSOAData(sd);
-
- if (isPresigned)
- dataStr.append("\t"+metaData);
-
- key.mv_data = (char*)keyStr.c_str();
- key.mv_size = keyStr.length();
- data.mv_data = (char*)dataStr.c_str();
- data.mv_size = dataStr.length();
-
- mdb_put(txn_zone, zone_db, &key, &data, 0);
- } else {
- mdb_txn_abort(txn_zone);
- throw PDNSException("Zone'"+zone+"' has no SOA record");
- }
- mdb_txn_commit(txn_zone);
- g_numZones++;
- g_numRecords=numRecords;
- g_numRefs=numRefs;
-}
-
-ArgvMap &arg()
-{
- static ArgvMap theArg;
- return theArg;
-}
-
-
-int main(int argc, char **argv)
-try
-{
- reportAllTypes();
-#if __GNUC__ >= 3
- std::ios_base::sync_with_stdio(false);
-#endif
-
- ::arg().setSwitch("verbose","Verbose comments on operation")="no";
- ::arg().setSwitch("on-error-resume-next","Continue after errors")="no";
- ::arg().set("zone","Zonefile to parse")="";
- ::arg().set("zone-name","Specify an $ORIGIN in case it is not present")="";
- ::arg().set("named-conf","Bind 8/9 named.conf to parse")="";
-
- ::arg().set("soa-minimum-ttl","Do not change")="0";
- ::arg().set("soa-refresh-default","Do not change")="0";
- ::arg().set("soa-retry-default","Do not change")="0";
- ::arg().set("soa-expire-default","Do not change")="0";
-
- ::arg().setCmd("help","Provide a helpful message");
-
- S.declare("logmessages");
-
- string namedfile="";
- string zonefile="";
-
- ::arg().parse(argc, argv);
-
- if(::arg().mustDo("help")) {
- cout<<"syntax:"<<endl<<endl;
- cout<<::arg().helpstring()<<endl;
- exit(0);
- }
-
- if(argc<2) {
- cerr<<"syntax:"<<endl<<endl;
- cerr<<::arg().helpstring()<<endl;
- exit(1);
- }
-
- namedfile=::arg()["named-conf"];
- zonefile=::arg()["zone"];
-
- int count=0;
-
- openDB();
-
- if(zonefile.empty()) {
- BindParser BP;
- BP.setVerbose(::arg().mustDo("verbose"));
- BP.parse(namedfile.empty() ? "./named.conf" : namedfile);
-
- vector<BindDomainInfo> domains=BP.getDomains();
- struct stat st;
- for(vector<BindDomainInfo>::iterator i=domains.begin(); i!=domains.end(); ++i) {
- if(stat(i->filename.c_str(), &st) == 0) {
- i->d_dev = st.st_dev;
- i->d_ino = st.st_ino;
- }
- }
-
- sort(domains.begin(), domains.end()); // put stuff in inode order
-
- int numdomains=domains.size();
- int tick=numdomains/100;
-
- cout <<"[";
- for(vector<BindDomainInfo>::const_iterator i=domains.begin(); i!=domains.end(); ++i) {
- if(i->type!="master" && i->type!="slave") {
- cerr<<" Warning! Skipping '"<<i->type<<"' zone '"<<i->name<<"'"<<endl;
- continue;
- }
- try {
- ZoneParserTNG zpt(i->filename, i->name, BP.getDirectory());
- emitData(i->name, zpt);
- }
- catch(std::exception &ae) {
- if(!::arg().mustDo("on-error-resume-next"))
- throw;
- else
- cerr<<endl<<ae.what()<<endl;
- }
- catch(PDNSException &ae) {
- if(!::arg().mustDo("on-error-resume-next"))
- throw;
- else
- cerr<<ae.reason<<endl;
- }
- if(!tick || !((count++)%tick))
- cerr<<"\r"<<count*100/numdomains<<"% done ("<<i->filename<<")\033\133\113";
- }
- cout << "]\n";
- cerr<<"\r100% done\033\133\113"<<endl;
- }
- else {
- ZoneParserTNG zpt(zonefile, ::arg()["zone-name"]);
- cout << "{\"name\":\"" << ::arg()["zone-name"] << "\",\"records\":";
- emitData(::arg()["zone-name"], zpt);
- cout << "}\n";
- }
- cerr<<g_numZones<<" domains were fully parsed, containing "<<g_numRecords<<" records\n";
- closeDB();
- return 0;
-
-}
-catch(PDNSException &ae) {
- cerr<<endl<<"Fatal error: "<<ae.reason<<endl;
- return 1;
-}
-catch(std::exception &e) {
- cerr<<endl<<"Died because of STL error: "<<e.what()<<endl;
- return 1;
-}
-catch(...) {
- cerr<<endl<<"Died because of unknown exception"<<endl;
- return 1;
-}
/pdns-*.conf
/*.sqlite3*
/named-slave.conf
-/named-lmdb.conf
/bulktest.results
/recursor-bulktest/
/recursor.log
/goracle2.log
/oracle.log
/oracle2.log
-/data.mdb
-/lock.mdb
/remotebackend-access.log
source ./backends/gsqlite3-master
;;
- lmdb*)
- source ./backends/lmdb-master
- ;;
-
mydns*)
source ./backends/mydns-master
;;
+++ /dev/null
-case $context in
- lmdb-nodnssec | lmdb | lmdb-nsec3 | lmdb-nsec3-optout | lmdb-zone | lmdb-nsec3-zone | lmdb-nsec3-optout-zone)
-
- if [ "${context: -5}" = "-zone" ]
- then
- orgcontext=$context
-
- case $context in
- lmdb-zone)
- context=bind-dnssec
- ;;
- lmdb-nsec3-zone)
- context=bind-dnssec-nsec3
- ;;
- lmdb-nsec3-optout-zone)
- context=bind-dnssec-nsec3-optout
- ;;
- esac
-
- source ./backends/bind-master
-
- rm -f named-lmdb.conf zones/*.signed
-
- for zone in $(grep 'zone ' named.conf | cut -f2 -d\")
- do
- $SAXFR 127.0.0.1 $port $zone showdetails showflags > zones/$zone.signed
-
- echo "" >> named-lmdb.conf
- echo "zone \"${zone}\" {" >> named-lmdb.conf
- echo " type master;" >> named-lmdb.conf
- echo " file \"zones/${zone}.signed\";" >> named-lmdb.conf
- echo "};" >> named-lmdb.conf
- done
-
- pids=$(cat pdns*.pid)
-
- if [ -n "$pids" ]
- then
- kill $pids
- set +e
- loopcount=0
- done=0
- while [ $loopcount -lt 10 ] && [ $done -eq 0 ]
- do
- done=1
- for pid in $pids
- do
- kill -0 $pid > /dev/null 2>&1
- if [ $? -eq 0 ];
- then
- done=0
- fi
- done
- let loopcount=loopcount+1
- sleep 1
- done
-
- kill -9 $pids
- set -e
- fi
- rm pdns*.pid
-
- context=${orgcontext%-zone}
- fi
-
- ${MAKE} -C ../pdns zone2lmdb > /dev/null
- rm -f data.mdb lock.mdb
-
- if [ $context = lmdb-nodnssec ]
- then
- ../pdns/zone2lmdb --named-conf=./named.conf
- else
- ../pdns/zone2lmdb --named-conf=./named-lmdb.conf
- fi
-
- $RUNWRAPPER $PDNS --daemon=no --local-port=$port --config-name=lmdb --socket-dir=./ \
- --no-shuffle --launch=lmdb \
- --send-root-referral \
- --cache-ttl=$cachettl --experimental-dname-processing --no-config \
- --lmdb-datapath=./ --lmdb-experimental-dnssec --module-dir=./modules &
-
- skipreasons="noent nodyndns nometa lmdb"
-
- if [ $context = lmdb-nsec3 ]
- then
- extracontexts="dnssec nsec3"
- skipreasons="$skipreasons nsec3"
- elif [ $context = lmdb-nsec3-optout ]
- then
- extracontexts="dnssec nsec3 nsec3-optout"
- skipreasons="$skipreasons optout"
- elif [ $context = lmdb-nsec3-narrow ]
- then
- extracontexts="dnssec narrow"
- skipreasons="$skipreasons narrow"
- elif [ $context = lmdb-nodnssec ]
- then
- skipreasons="$skipreasons nodnssec"
- else
- extracontexts="dnssec"
- skipreasons="$skipreasons"
- fi
- ;;
-
- *)
- nocontext=yes
-esac