From ba892c7f77f8f7d0e54c671499f0f48dbda29c60 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Fri, 18 May 2018 15:57:06 +0200 Subject: [PATCH] rec: Drop queries truncated because they were larger than our buffer --- pdns/pdns_recursor.cc | 8 ++++++++ pdns/rec-snmp.cc | 2 ++ pdns/rec_channel_rec.cc | 1 + pdns/recursordist/RECURSOR-MIB.txt | 9 +++++++++ pdns/recursordist/docs/metrics.rst | 6 ++++++ pdns/syncres.hh | 1 + 6 files changed, 27 insertions(+) diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index 133534652..d469a0eb6 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 f240550f0..b5884a811 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 3215c497b..9affdfd27 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 2f8bb5276..aecea2b1e 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 f10cec038..309fbbf8c 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 d912e9594..11ecb698a 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; -- 2.40.0