From 43eeadc142d01b88f08aed7f6a7aba69f9dd9666 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Thu, 26 Nov 2015 15:55:04 +0100 Subject: [PATCH] Drop truncated UDP messages caused by a small buffer. When we receive a message too large for our buffer, recvmsg() will truncate the content to fit the buffer and set the MSG_TRUNC flag. There is no point in trying to parse this message because we will choke during the parsing anyway. --- pdns/dnsdist.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pdns/dnsdist.cc b/pdns/dnsdist.cc index fc72f8316d..d189d3f0ef 100644 --- a/pdns/dnsdist.cc +++ b/pdns/dnsdist.cc @@ -439,6 +439,13 @@ try continue; } + if (msgh.msg_flags & MSG_TRUNC) { + /* message was too large for our buffer */ + vinfolog("Dropping message too large for our buffer"); + g_stats.nonCompliantQueries++; + continue; + } + g_stats.queries++; if(!acl->match(remote)) { vinfolog("Query from %s dropped because of ACL", remote.toStringWithPort()); -- 2.47.2