aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-06-24 11:58:47 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-06-24 11:58:47 +0100
commit7a35efbe7f4b664cc81d7ef56271156d16c6e5ae (patch)
treef5ed25eaa75ecfba1f7921f2df6218ac3ae65d6c
parentf17df0a2fd2cdb2b879a8af7dc8af54b25fc7861 (diff)
downloadrspamd-7a35efbe7f4b664cc81d7ef56271156d16c6e5ae.tar.gz
rspamd-7a35efbe7f4b664cc81d7ef56271156d16c6e5ae.zip
[Minor] Improve monitored errors
-rw-r--r--src/libserver/monitored.c33
1 files changed, 28 insertions, 5 deletions
diff --git a/src/libserver/monitored.c b/src/libserver/monitored.c
index b94229a24..ff4e4edab 100644
--- a/src/libserver/monitored.c
+++ b/src/libserver/monitored.c
@@ -14,11 +14,13 @@
* limitations under the License.
*/
+#include <contrib/librdns/rdns.h>
#include "rdns.h"
#include "mem_pool.h"
#include "cfg_file.h"
#include "cryptobox.h"
#include "logger.h"
+#include "contrib/uthash/utlist.h"
static const gdouble default_monitoring_interval = 60.0;
static const guint default_max_errors = 3;
@@ -272,6 +274,8 @@ rspamd_monitored_dns_cb (struct rdns_reply *reply, void *arg)
{
struct rspamd_dns_monitored_conf *conf = arg;
struct rspamd_monitored *m;
+ struct rdns_reply_entry *cur;
+ gboolean is_special_reply = FALSE;
gdouble lat;
m = conf->m;
@@ -297,11 +301,30 @@ rspamd_monitored_dns_cb (struct rdns_reply *reply, void *arg)
rspamd_monitored_propagate_success (m, lat);
}
else {
- msg_info_mon ("DNS reply returned '%s' for %s while '%s' "
- "was expected",
- rdns_strerror (reply->code),
- m->url,
- rdns_strerror (conf->expected_code));
+ LL_FOREACH (reply->entries, cur) {
+ if (cur->type == RDNS_REQUEST_A) {
+ if ((guint32)cur->content.a.addr.s_addr ==
+ INADDR_LOOPBACK) {
+ is_special_reply = TRUE;
+ }
+ }
+ }
+
+ if (is_special_reply) {
+ msg_info_mon ("DNS query blocked on %s "
+ "(127.0.0.1 returned), "
+ "possibly due to high volume",
+ m->url);
+ }
+ else {
+ msg_info_mon ("DNS reply returned '%s' for %s while '%s' "
+ "was expected "
+ "(likely DNS spoofing or BL internal issues)",
+ rdns_strerror (reply->code),
+ m->url,
+ rdns_strerror (conf->expected_code));
+ }
+
rspamd_monitored_propagate_error (m, "invalid return");
}
}