aboutsummaryrefslogtreecommitdiffstats
path: root/testing/pdns/allocate-tcp-buffer-dynamically.patch
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2015-03-11 08:37:20 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2015-03-11 08:44:34 +0000
commitebcf082a79f5b36210d7191ce461cc3a9384472e (patch)
tree18b0e35d7d26aa7c936029fc89877320c92301c8 /testing/pdns/allocate-tcp-buffer-dynamically.patch
parente2107de80453c3de62039148f54d579dcaf97e5b (diff)
downloadaports-ebcf082a79f5b36210d7191ce461cc3a9384472e.tar.bz2
aports-ebcf082a79f5b36210d7191ce461cc3a9384472e.tar.xz
testing/pdns: upgrade to 3.4.3 and cherry-pick patch from upstream
Diffstat (limited to 'testing/pdns/allocate-tcp-buffer-dynamically.patch')
-rw-r--r--testing/pdns/allocate-tcp-buffer-dynamically.patch46
1 files changed, 46 insertions, 0 deletions
diff --git a/testing/pdns/allocate-tcp-buffer-dynamically.patch b/testing/pdns/allocate-tcp-buffer-dynamically.patch
new file mode 100644
index 0000000000..b346a2e9a1
--- /dev/null
+++ b/testing/pdns/allocate-tcp-buffer-dynamically.patch
@@ -0,0 +1,46 @@
+From c2b4ccc0d125a30a1970f555f572bf74de27a3d5 Mon Sep 17 00:00:00 2001
+From: bert hubert <bert.hubert@netherlabs.nl>
+Date: Sat, 10 Jan 2015 23:06:38 +0100
+Subject: [PATCH] allocate TCP buffer dynamically, decreasing our stack usage
+
+---
+ pdns/tcpreceiver.cc | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/pdns/tcpreceiver.cc b/pdns/tcpreceiver.cc
+index f90bf90..6356d34 100644
+--- a/pdns/tcpreceiver.cc
++++ b/pdns/tcpreceiver.cc
+@@ -253,7 +253,8 @@ void *TCPNameserver::doConnection(void *data)
+ pthread_detach(pthread_self());
+ Utility::setNonBlocking(fd);
+ try {
+- char mesg[65535];
++ int mesgsize=65535;
++ scoped_array<char> mesg(new char[mesgsize]);
+
+ DLOG(L<<"TCP Connection accepted on fd "<<fd<<endl);
+ bool logDNSQueries= ::arg().mustDo("log-dns-queries");
+@@ -278,19 +279,19 @@ void *TCPNameserver::doConnection(void *data)
+
+ // do not remove this check as it will catch if someone
+ // decreases the mesg buffer size for some reason.
+- if(pktlen>sizeof(mesg)) {
++ if(pktlen > mesgsize) {
+ L<<Logger::Error<<"Received an overly large question from "<<remote.toString()<<", dropping"<<endl;
+ break;
+ }
+
+- getQuestion(fd, mesg, pktlen, remote);
++ getQuestion(fd, mesg.get(), pktlen, remote);
+ S.inc("tcp-queries");
+
+ packet=shared_ptr<DNSPacket>(new DNSPacket);
+ packet->setRemote(&remote);
+ packet->d_tcp=true;
+ packet->setSocket(fd);
+- if(packet->parse(mesg, pktlen)<0)
++ if(packet->parse(mesg.get(), pktlen)<0)
+ break;
+
+ if(packet->qtype.getCode()==QType::AXFR) {