* 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;
{
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;
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");
}
}