pdns  4.2.0-rc1
About: PowerDNS daemon - a high performance authoritative nameserver. Release candidate.
  Fossies Dox: pdns-4.2.0-rc1.tar.bz2  ("inofficial" and yet experimental doxygen-generated source code documentation)  

PacketHandler Class Reference

#include <packethandler.hh>

Collaboration diagram for PacketHandler:

Public Member Functions

DNSPacketdoQuestion (DNSPacket *)
 hand us a DNS packet with a question, we give you an answer More...
 
DNSPacketquestion (DNSPacket *)
 hand us a DNS packet with a question, we give you an answer More...
 
 PacketHandler ()
 
 ~PacketHandler ()
 
UeberBackendgetBackend ()
 Returns the number of running PacketHandlers. Called by Distributor. More...
 
int trySuperMasterSynchronous (const DNSPacket *p, const DNSName &tsigkeyname)
 

Static Public Member Functions

static int numRunning ()
 

Static Public Attributes

static NetmaskGroup s_allowNotifyFrom
 
static set< string > s_forwardNotify
 

Private Member Functions

int trySuperMaster (DNSPacket *p, const DNSName &tsigkeyname)
 
int processNotify (DNSPacket *)
 
void addRootReferral (DNSPacket *r)
 
int doChaosRequest (DNSPacket *p, DNSPacket *r, DNSName &target)
 
bool addDNSKEY (DNSPacket *p, DNSPacket *r, const SOAData &sd)
 
bool addCDNSKEY (DNSPacket *p, DNSPacket *r, const SOAData &sd)
 
bool addCDS (DNSPacket *p, DNSPacket *r, const SOAData &sd)
 
bool addNSEC3PARAM (DNSPacket *p, DNSPacket *r, const SOAData &sd)
 
int doAdditionalProcessingAndDropAA (DNSPacket *p, DNSPacket *r, const SOAData &sd, bool retargeted)
 
void addNSECX (DNSPacket *p, DNSPacket *r, const DNSName &target, const DNSName &wildcard, const DNSName &auth, int mode)
 
void addNSEC (DNSPacket *p, DNSPacket *r, const DNSName &target, const DNSName &wildcard, const DNSName &auth, int mode)
 
void addNSEC3 (DNSPacket *p, DNSPacket *r, const DNSName &target, const DNSName &wildcard, const DNSName &auth, const NSEC3PARAMRecordContent &nsec3param, bool narrow, int mode)
 
void emitNSEC (DNSPacket *r, const SOAData &sd, const DNSName &name, const DNSName &next, int mode)
 
void emitNSEC3 (DNSPacket *r, const SOAData &sd, const NSEC3PARAMRecordContent &ns3rc, const DNSName &unhashed, const string &begin, const string &end, int mode)
 
int processUpdate (DNSPacket *p)
 
int forwardPacket (const string &msgPrefix, DNSPacket *p, DomainInfo *di)
 
uint performUpdate (const string &msgPrefix, const DNSRecord *rr, DomainInfo *di, bool isPresigned, bool *narrow, bool *haveNSEC3, NSEC3PARAMRecordContent *ns3pr, bool *updatedSerial)
 
int checkUpdatePrescan (const DNSRecord *rr)
 
int checkUpdatePrerequisites (const DNSRecord *rr, DomainInfo *di)
 
void increaseSerial (const string &msgPrefix, const DomainInfo *di, bool haveNSEC3, bool narrow, const NSEC3PARAMRecordContent *ns3pr)
 
void makeNXDomain (DNSPacket *p, DNSPacket *r, const DNSName &target, const DNSName &wildcard, SOAData &sd)
 
void makeNOError (DNSPacket *p, DNSPacket *r, const DNSName &target, const DNSName &wildcard, SOAData &sd, int mode)
 
vector< DNSZoneRecordgetBestReferralNS (DNSPacket *p, SOAData &sd, const DNSName &target)
 
vector< DNSZoneRecordgetBestDNAMESynth (DNSPacket *p, SOAData &sd, DNSName &target)
 
bool tryDNAME (DNSPacket *p, DNSPacket *r, SOAData &sd, DNSName &target)
 
bool tryReferral (DNSPacket *p, DNSPacket *r, SOAData &sd, const DNSName &target, bool retargeted)
 
bool getBestWildcard (DNSPacket *p, SOAData &sd, const DNSName &target, DNSName &wildcard, vector< DNSZoneRecord > *ret)
 
bool tryWildcard (DNSPacket *p, DNSPacket *r, SOAData &sd, DNSName &target, DNSName &wildcard, bool &retargeted, bool &nodata)
 
bool addDSforNS (DNSPacket *p, DNSPacket *r, SOAData &sd, const DNSName &dsname)
 
void completeANYRecords (DNSPacket *p, DNSPacket *r, SOAData &sd, const DNSName &target)
 
void tkeyHandler (DNSPacket *p, DNSPacket *r)
 

Private Attributes

bool d_logDNSDetails
 
bool d_doIPv6AdditionalProcessing
 
bool d_doDNAME
 
bool d_doExpandALIAS
 
std::unique_ptr< AuthLua4d_pdl
 
std::unique_ptr< AuthLua4d_update_policy_lua
 
UeberBackend B
 
DNSSECKeeper d_dk
 

Static Private Attributes

static AtomicCounter s_count
 
static pthread_mutex_t s_rfc2136lock =PTHREAD_MUTEX_INITIALIZER
 

Detailed Description

Definition at line 55 of file packethandler.hh.

Constructor & Destructor Documentation

◆ PacketHandler()

PacketHandler::PacketHandler ( )

◆ ~PacketHandler()

PacketHandler::~PacketHandler ( )

Definition at line 94 of file packethandler.cc.

References DLOG, Logger::Error, g_log, and s_count.

Member Function Documentation

◆ addCDNSKEY()

bool PacketHandler::addCDNSKEY ( DNSPacket p,
DNSPacket r,
const SOAData sd 
)
private

This adds CDNSKEY records to the answer packet. Returns true if one was added.

Parameters
pPointer to the DNSPacket containing the original question
rPointer to the DNSPacket where the records should be inserted into
sdSOAData of the zone for which CDNSKEY records sets should be added
Returns
bool that shows if any records were added

Definition at line 108 of file packethandler.cc.

References DNSPacket::addRecord(), arg(), DNSZoneRecord::auth, B, QType::CDNSKEY, DNSRecord::d_content, d_dk, DNSRecord::d_name, DNSRecord::d_ttl, DNSRecord::d_type, SOAData::default_ttl, SOAData::domain_id, DNSZoneRecord::dr, UeberBackend::get(), DNSSECKeeper::getEntryPoints(), DNSSECKeeper::getFromMeta(), UeberBackend::lookup(), and DNSPacket::qdomain.

Referenced by completeANYRecords(), and doQuestion().

◆ addCDS()

bool PacketHandler::addCDS ( DNSPacket p,
DNSPacket r,
const SOAData sd 
)
private

This adds CDS records to the answer packet r.

Parameters
pPointer to the DNSPacket containing the original question.
rPointer to the DNSPacket where the records should be inserted into.
sdSOAData of the zone for which CDS records sets should be added, used to determine record TTL.
Returns
bool that shows if any records were added.

Definition at line 187 of file packethandler.cc.

References DNSPacket::addRecord(), arg(), DNSZoneRecord::auth, B, QType::CDS, DNSRecord::d_content, d_dk, DNSRecord::d_name, DNSRecord::d_ttl, DNSRecord::d_type, SOAData::default_ttl, SOAData::domain_id, DNSZoneRecord::dr, UeberBackend::get(), DNSSECKeeper::getEntryPoints(), DNSSECKeeper::getFromMeta(), UeberBackend::lookup(), makeDSFromDNSKey(), pdns_stou(), DNSPacket::qdomain, and stringtok().

Referenced by completeANYRecords(), and doQuestion().

◆ addDNSKEY()

bool PacketHandler::addDNSKEY ( DNSPacket p,
DNSPacket r,
const SOAData sd 
)
private

This adds DNSKEY records to the answer packet. Returns true if one was added.

Parameters
pPointer to the DNSPacket containing the original question
rPointer to the DNSPacket where the records should be inserted into
sdSOAData of the zone for which DNSKEY records sets should be added
Returns
bool that shows if any records were added

Definition at line 149 of file packethandler.cc.

References DNSPacket::addRecord(), arg(), DNSZoneRecord::auth, B, DNSRecord::d_content, d_dk, DNSRecord::d_name, DNSRecord::d_ttl, DNSRecord::d_type, SOAData::default_ttl, QType::DNSKEY, SOAData::domain_id, DNSZoneRecord::dr, UeberBackend::get(), DNSSECKeeper::getKeys(), UeberBackend::lookup(), and DNSPacket::qdomain.

Referenced by completeANYRecords(), and doQuestion().

◆ addDSforNS()

bool PacketHandler::addDSforNS ( DNSPacket p,
DNSPacket r,
SOAData sd,
const DNSName dsname 
)
private

◆ addNSEC()

void PacketHandler::addNSEC ( DNSPacket p,
DNSPacket r,
const DNSName target,
const DNSName wildcard,
const DNSName auth,
int  mode 
)
private

◆ addNSEC3()

void PacketHandler::addNSEC3 ( DNSPacket p,
DNSPacket r,
const DNSName target,
const DNSName wildcard,
const DNSName auth,
const NSEC3PARAMRecordContent nsec3param,
bool  narrow,
int  mode 
)
private

◆ addNSEC3PARAM()

bool PacketHandler::addNSEC3PARAM ( DNSPacket p,
DNSPacket r,
const SOAData sd 
)
private

◆ addNSECX()

void PacketHandler::addNSECX ( DNSPacket p,
DNSPacket r,
const DNSName target,
const DNSName wildcard,
const DNSName auth,
int  mode 
)
private

◆ addRootReferral()

void PacketHandler::addRootReferral ( DNSPacket r)
private

◆ checkUpdatePrerequisites()

◆ checkUpdatePrescan()

◆ completeANYRecords()

void PacketHandler::completeANYRecords ( DNSPacket p,
DNSPacket r,
SOAData sd,
const DNSName target 
)
private

◆ doAdditionalProcessingAndDropAA()

◆ doChaosRequest()

◆ doQuestion()

DNSPacket * PacketHandler::doQuestion ( DNSPacket p)

hand us a DNS packet with a question, we give you an answer

Called by the Distributor to ask a question. Returns 0 in case of an error.

Definition at line 1109 of file packethandler.cc.

References QType::A, QType::AAAA, addCDNSKEY(), addCDS(), addDNSKEY(), addNSEC(), addNSEC3PARAM(), DNSPacket::addRecord(), addRRSigs(), QType::ALIAS, DNSResourceRecord::ANSWER, QType::ANY, QClass::ANY, DNSZoneRecord::auth, B, ERCode::BADVERS, calculateEditSOA(), QType::CDNSKEY, QType::CDS, QClass::CHAOS, DNSPacket::checkForCorrectTSIG(), QType::CNAME, DNSPacket::commitD(), completeANYRecords(), DNSProxy::completePacket(), DNSPacket::couldBeCached(), DNSPacket::d, TSIGRecordContent::d_algoName, DNSRecord::d_content, d_dk, DNSPacket::d_dnssecOk, d_doExpandALIAS, DNSPacket::d_havetsig, d_logDNSDetails, TSIGRecordContent::d_mac, DNSRecord::d_name, DNSPacket::d_peer_principal, DNSRecord::d_place, DNSPacket::d_remote, DNSPacket::d_tcp, DNSPacket::d_tsig_algo, DNSRecord::d_ttl, DNSRecord::d_type, DLOG, QType::DNSKEY, doAdditionalProcessingAndDropAA(), doChaosRequest(), SOAData::domain_id, DNSZoneRecord::domain_id, DP, DNSZoneRecord::dr, QType::DS, DNSName::empty(), Logger::Error, g_anyToTcp, g_log, UeberBackend::get(), UeberBackend::getAuth(), Netmask::getBits(), QType::getCode(), DNSPacket::getEDNSVersion(), DNSSECKeeper::getFromMeta(), DNSPacket::getMinTTL(), QType::getName(), DNSSECKeeper::getNSEC3PARAM(), GssContext::getPeerPrincipal(), DNSPacket::getRealRemote(), DNSPacket::getRemote(), DNSPacket::getRRS(), getTSIGHashEnum(), DNSPacket::hasEDNS(), QClass::IN, StatBag::inc(), Logger::Info, AuthPacketCache::insert(), DNSPacket::isEmpty(), DNSSECKeeper::isSecuredZone(), QType::IXFR, UeberBackend::lookup(), QType::LUA, luaSynth(), makeNOError(), makeNXDomain(), makeSOAContent(), RCode::NotAuth, Opcode::Notify, RCode::NotImp, QType::NS, QType::NSEC, QType::NSEC3PARAM, PC, processNotify(), processUpdate(), DNSPacket::qclass, DNSPacket::qdomain, DNSPacket::qdomainwild, DNSPacket::qdomainzone, SOAData::qname, DNSPacket::qtype, PDNSException::reason, RCode::Refused, DNSPacket::replyPacket(), StatBag::ringAccount(), QType::RRSIG, S, DNSZoneRecord::scopeMask, SOAData::serial, RCode::ServFail, DNSPacket::setA(), DNSPacket::setEDNSRcode(), DNSPacket::setOpcode(), DNSPacket::setRcode(), DNSPacket::setTSIGDetails(), QType::SOA, QType::TKEY, tkeyHandler(), DNSName::toLogString(), DNSName::trimToLabels(), tryDNAME(), tryReferral(), tryWildcard(), TSIG_GSS, SOAData::ttl, Opcode::Update, validDNSName(), Logger::Warning, and DNSPacket::wrapup().

Referenced by TCPNameserver::doConnection(), and question().

◆ emitNSEC()

◆ emitNSEC3()

◆ forwardPacket()

◆ getBackend()

UeberBackend * PacketHandler::getBackend ( )

Returns the number of running PacketHandlers. Called by Distributor.

Definition at line 89 of file packethandler.cc.

References B.

Referenced by TCPNameserver::canDoAXFR(), TCPNameserver::doAXFR(), TCPNameserver::doIXFR(), CommunicatorClass::masterUpdateCheck(), and CommunicatorClass::slaveRefresh().

◆ getBestDNAMESynth()

◆ getBestReferralNS()

vector< DNSZoneRecord > PacketHandler::getBestReferralNS ( DNSPacket p,
SOAData sd,
const DNSName target 
)
private

◆ getBestWildcard()

◆ increaseSerial()

◆ makeNOError()

◆ makeNXDomain()

◆ numRunning()

static int PacketHandler::numRunning ( )
inlinestatic

Definition at line 62 of file packethandler.hh.

References s_count.

◆ performUpdate()

uint PacketHandler::performUpdate ( const string &  msgPrefix,
const DNSRecord rr,
DomainInfo di,
bool  isPresigned,
bool *  narrow,
bool *  haveNSEC3,
NSEC3PARAMRecordContent ns3pr,
bool *  updatedSerial 
)
private

◆ processNotify()

◆ processUpdate()

int PacketHandler::processUpdate ( DNSPacket p)
private

Definition at line 704 of file rfc2136handler.cc.

References DNSBackend::abortTransaction(), NetmaskGroup::addMask(), DNSResourceRecord::ANSWER, QType::ANY, QClass::ANY, arg(), DNSResourceRecord::AUTHORITY, B, DomainInfo::backend, checkUpdatePrerequisites(), checkUpdatePrescan(), QType::CNAME, DNSBackend::commitTransaction(), Communicator, DNSPacket::d, DNSRecord::d_class, d_dk, DNSPacket::d_havetsig, DNSRecord::d_name, DNSPacket::d_peer_principal, DNSRecord::d_place, DNSPacket::d_remote, DNSPacket::d_tsig_algo, DNSRecord::d_ttl, DNSRecord::d_type, d_update_policy_lua, Logger::Debug, StatBag::deposit(), Logger::Error, RCode::FormErr, forwardPacket(), DNSResourceRecord::fromWire(), g_log, DNSBackend::get(), QType::getCode(), UeberBackend::getDomainInfo(), UeberBackend::getDomainMetadata(), QType::getName(), DNSSECKeeper::getNSEC3PARAM(), DNSPacket::getRemote(), DNSPacket::getString(), DNSPacket::getTSIGDetails(), DomainInfo::id, dnsheader::id, QClass::IN, increaseSerial(), Logger::Info, DNSName::isPartOf(), DNSSECKeeper::isPresigned(), itoa(), DomainInfo::kind, DNSBackend::lookup(), DomainInfo::Master, GssName::match(), NetmaskGroup::match(), message, RCode::NoError, QClass::NONE, RCode::NotAuth, CommunicatorClass::notifyDomain(), RCode::NotImp, RCode::NotZone, QType::NS, RCode::NXRRSet, performUpdate(), purgeAuthCaches(), DNSPacket::qclass, DNSPacket::qdomain, DNSResourceRecord::qtype, DNSPacket::qtype, PDNSException::reason, RCode::Refused, QType::RRSIG, S, s_rfc2136lock, RCode::ServFail, DomainInfo::Slave, QType::SOA, DNSBackend::startTransaction(), stringtok(), RCode::to_s(), DNSName::toLogString(), DNSName::toString(), ComboAddress::toString(), TSIG_GSS, DNSResourceRecord::ttl, SSqlException::txtReason(), Logger::Warning, and DomainInfo::zone.

Referenced by doQuestion().

◆ question()

DNSPacket * PacketHandler::question ( DNSPacket p)

hand us a DNS packet with a question, we give you an answer

Definition at line 949 of file packethandler.cc.

References DNSPacket::d, d_pdl, doQuestion(), StatBag::getPointer(), and S.

◆ tkeyHandler()

◆ tryDNAME()

bool PacketHandler::tryDNAME ( DNSPacket p,
DNSPacket r,
SOAData sd,
DNSName target 
)
private

◆ tryReferral()

bool PacketHandler::tryReferral ( DNSPacket p,
DNSPacket r,
SOAData sd,
const DNSName target,
bool  retargeted 
)
private

◆ trySuperMaster()

int PacketHandler::trySuperMaster ( DNSPacket p,
const DNSName tsigkeyname 
)
private

◆ trySuperMasterSynchronous()

◆ tryWildcard()

bool PacketHandler::tryWildcard ( DNSPacket p,
DNSPacket r,
SOAData sd,
DNSName target,
DNSName wildcard,
bool &  retargeted,
bool &  nodata 
)
private

Member Data Documentation

◆ B

◆ d_dk

◆ d_doDNAME

bool PacketHandler::d_doDNAME
private

Definition at line 110 of file packethandler.hh.

Referenced by PacketHandler(), and tryDNAME().

◆ d_doExpandALIAS

bool PacketHandler::d_doExpandALIAS
private

Definition at line 111 of file packethandler.hh.

Referenced by doQuestion(), and PacketHandler().

◆ d_doIPv6AdditionalProcessing

bool PacketHandler::d_doIPv6AdditionalProcessing
private

Definition at line 109 of file packethandler.hh.

Referenced by doAdditionalProcessingAndDropAA(), and PacketHandler().

◆ d_logDNSDetails

bool PacketHandler::d_logDNSDetails
private

Definition at line 108 of file packethandler.hh.

Referenced by doQuestion(), and PacketHandler().

◆ d_pdl

std::unique_ptr<AuthLua4> PacketHandler::d_pdl
private

Definition at line 112 of file packethandler.hh.

Referenced by PacketHandler(), and question().

◆ d_update_policy_lua

std::unique_ptr<AuthLua4> PacketHandler::d_update_policy_lua
private

Definition at line 113 of file packethandler.hh.

Referenced by PacketHandler(), and processUpdate().

◆ s_allowNotifyFrom

NetmaskGroup PacketHandler::s_allowNotifyFrom
static

Definition at line 67 of file packethandler.hh.

Referenced by CommunicatorClass::go(), and processNotify().

◆ s_count

AtomicCounter PacketHandler::s_count
staticprivate

Definition at line 106 of file packethandler.hh.

Referenced by numRunning(), PacketHandler(), and ~PacketHandler().

◆ s_forwardNotify

set< string > PacketHandler::s_forwardNotify
static

Definition at line 68 of file packethandler.hh.

Referenced by CommunicatorClass::go(), and processNotify().

◆ s_rfc2136lock

pthread_mutex_t PacketHandler::s_rfc2136lock =PTHREAD_MUTEX_INITIALIZER
staticprivate

Definition at line 107 of file packethandler.hh.

Referenced by processUpdate().


The documentation for this class was generated from the following files: