From: Remi Gacogne Date: Thu, 26 Nov 2015 14:55:04 +0000 (+0100) Subject: Drop truncated UDP messages caused by a small buffer. X-Git-Tag: dnsdist-1.0.0-alpha1~188^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F2939%2Fhead;p=thirdparty%2Fpdns.git 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. --- 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());