::arg().set("recursor","If recursion is desired, IP address of a recursing nameserver")="no";
::arg().set("allow-recursion","List of subnets that are allowed to recurse")="0.0.0.0/0";
::arg().set("pipebackend-abi-version","Version of the pipe backend ABI")="1";
-
+ ::arg().set("udp-truncation-threshold", "Maximum UDP response size before we truncate")="1680";
::arg().set("disable-tcp","Do not listen to TCP queries")="no";
::arg().set("disable-axfr","Do not allow zone transfers")="no";
g_anyToTcp = ::arg().mustDo("any-to-tcp");
g_addSuperfluousNSEC3 = ::arg().mustDo("add-superfluous-nsec3-for-old-bind");
+ DNSPacket::s_udpTruncationThreshold = ::arg().asNum("udp-truncation-threshold");
DNSPacket::s_doEDNSSubnetProcessing = ::arg().mustDo("edns-subnet-processing");
{
std::vector<std::string> codes;
#include "utility.hh"
#include <cstdio>
-
#include <cstdlib>
#include <sys/types.h>
-
#include <iostream>
-
#include <string>
#include <errno.h>
#include <boost/tokenizer.hpp>
bool DNSPacket::s_doEDNSSubnetProcessing;
std::vector<int> DNSPacket::s_ednssubnetcodes;
+uint16_t DNSPacket::s_udpTruncationThreshold;
DNSPacket::DNSPacket()
{
if(getEDNSOpts(mdp, &edo)) {
d_haveednssection=true;
- d_maxreplylen=std::min(edo.d_packetsize, (uint16_t)1680);
+ d_maxreplylen=std::min(edo.d_packetsize, s_udpTruncationThreshold);
// cerr<<edo.d_Z<<endl;
if(edo.d_Z & EDNSOpts::DNSSECOK)
d_dnssecOk=true;
vector<DNSResourceRecord>& getRRS() { return d_rrs; }
TSIGRecordContent d_trc;
static bool s_doEDNSSubnetProcessing;
+ static uint16_t s_udpTruncationThreshold;
static std::vector<int> s_ednssubnetcodes;
private:
void pasteQ(const char *question, int length); //!< set the question of this packet, useful for crafting replies
<listitem><para>
IP address of incoming notification proxy
</para></listitem></varlistentry>
+ <varlistentry><term>udp-truncation-threshold=...</term>
+ <listitem><para>
+ EDNS0 allows for large UDP response datagrams, which can potentially raise performance. Large responses however
+ also have downsides in terms of reflection attacks. Up till PowerDNS Authoritative Server 3.3, the truncation limit
+ was set at 1680 bytes, regardless of EDNS0 buffer size indications from the client. Beyond 3.3, this setting makes
+ our truncation limit configurable. Maximum value is 65535, but values above 4096 should probably not be attempted.
+ </para></listitem></varlistentry>
<varlistentry><term>urlredirector=...</term>
<listitem><para>
Where we send hosts to that need to be url redirected. See <xref linkend="fancy-records"/>.