From: Remi Gacogne Date: Fri, 18 May 2018 13:57:06 +0000 (+0200) Subject: rec: Drop queries truncated because they were larger than our buffer X-Git-Tag: dnsdist-1.3.1~37^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ba892c7f77f8f7d0e54c671499f0f48dbda29c60;p=thirdparty%2Fpdns.git rec: Drop queries truncated because they were larger than our buffer --- diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index 133534652f..d469a0eb6d 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -2035,6 +2035,14 @@ static void handleNewUDPQuestion(int fd, FDMultiplexer::funcparam_t& var) return; } + if (msgh.msg_flags & MSG_TRUNC) { + g_stats.truncatedDrops++; + if (!g_quiet) { + g_log<push_back(fromaddr); diff --git a/pdns/rec-snmp.cc b/pdns/rec-snmp.cc index f240550f0d..b5884a8110 100644 --- a/pdns/rec-snmp.cc +++ b/pdns/rec-snmp.cc @@ -108,6 +108,7 @@ static const oid policyResultNodataOID[] = { RECURSOR_STATS_OID, 89 }; static const oid policyResultTruncateOID[] = { RECURSOR_STATS_OID, 90 }; static const oid policyResultCustomOID[] = { RECURSOR_STATS_OID, 91 }; static const oid queryPipeFullDropsOID[] = { RECURSOR_STATS_OID, 92 }; +static const oid truncatedDropsOID[] = { RECURSOR_STATS_OID, 93 }; static std::unordered_map s_statsMap; @@ -220,6 +221,7 @@ RecursorSNMPAgent::RecursorSNMPAgent(const std::string& name, const std::string& registerCounter64Stat("server-parse-errors", serverParseErrorsOID, OID_LENGTH(serverParseErrorsOID)); registerCounter64Stat("too-old-drops", tooOldDropsOID, OID_LENGTH(tooOldDropsOID)); registerCounter64Stat("query-pipe-full-drops", queryPipeFullDropsOID, OID_LENGTH(queryPipeFullDropsOID)); + registerCounter64Stat("truncated-drops", truncatedDropsOID, OID_LENGTH(truncatedDropsOID)); registerCounter64Stat("answers0-1", answers01OID, OID_LENGTH(answers01OID)); registerCounter64Stat("answers1-10", answers110OID, OID_LENGTH(answers110OID)); registerCounter64Stat("answers10-100", answers10100OID, OID_LENGTH(answers10100OID)); diff --git a/pdns/rec_channel_rec.cc b/pdns/rec_channel_rec.cc index 3215c497bb..9affdfd278 100644 --- a/pdns/rec_channel_rec.cc +++ b/pdns/rec_channel_rec.cc @@ -870,6 +870,7 @@ void registerAllStats() addGetStat("client-parse-errors", &g_stats.clientParseError); addGetStat("server-parse-errors", &g_stats.serverParseError); addGetStat("too-old-drops", &g_stats.tooOldDrops); + addGetStat("truncated-drops", &g_stats.truncatedDrops); addGetStat("query-pipe-full-drops", &g_stats.queryPipeFullDrops); addGetStat("answers0-1", &g_stats.answers0_1); diff --git a/pdns/recursordist/RECURSOR-MIB.txt b/pdns/recursordist/RECURSOR-MIB.txt index 2f8bb52763..aecea2b1e0 100644 --- a/pdns/recursordist/RECURSOR-MIB.txt +++ b/pdns/recursordist/RECURSOR-MIB.txt @@ -766,6 +766,14 @@ queryPipeFullDrops OBJECT-TYPE "Number of queries dropped because the query distribution pipe was full" ::= { stats 92 } +truncatedDrops OBJECT-TYPE + SYNTAX Counter64 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Number of queries dropped because they were larger than 1500 bytes" + ::= { stats 93 } + --- --- Traps / Notifications --- @@ -900,6 +908,7 @@ recGroup OBJECT-GROUP policyResultTruncate, policyResultCustom, queryPipeFullDrops, + truncatedDrops, trapReason } STATUS current diff --git a/pdns/recursordist/docs/metrics.rst b/pdns/recursordist/docs/metrics.rst index f10cec0388..309fbbf8c9 100644 --- a/pdns/recursordist/docs/metrics.rst +++ b/pdns/recursordist/docs/metrics.rst @@ -426,6 +426,12 @@ too-old-drops ^^^^^^^^^^^^^ questions dropped that were too old +truncated-drops +^^^^^^^^^^^^^^^ +.. versionadded:: 4.2 + +questions dropped because they were larger than 1500 bytes + unauthorized-tcp ^^^^^^^^^^^^^^^^ number of TCP questions denied because of allow-from restrictions diff --git a/pdns/syncres.hh b/pdns/syncres.hh index d912e95949..11ecb698ab 100644 --- a/pdns/syncres.hh +++ b/pdns/syncres.hh @@ -905,6 +905,7 @@ struct RecursorStats std::atomic clientParseError; std::atomic serverParseError; std::atomic tooOldDrops; + std::atomic truncatedDrops; std::atomic queryPipeFullDrops; std::atomic unexpectedCount; std::atomic caseMismatchCount;