From 9902a5f81d5d28856ebc3bf39cb229f3a126cd27 Mon Sep 17 00:00:00 2001 From: "W.C.A. Wijngaards" Date: Mon, 2 Sep 2019 13:50:42 +0200 Subject: [PATCH] - ipset module #28: log that an address is added, when verbosity high. --- doc/Changelog | 3 +++ ipset/ipset.c | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/doc/Changelog b/doc/Changelog index cadfc6136..33ab8096a 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,6 @@ +2 September 2019: Wouter + - ipset module #28: log that an address is added, when verbosity high. + 23 August 2019: Wouter - Fix contrib/fastrpz.patch asprintf return value checks. diff --git a/ipset/ipset.c b/ipset/ipset.c index 85b2edea9..ec62cc356 100755 --- a/ipset/ipset.c +++ b/ipset/ipset.c @@ -8,6 +8,7 @@ #include "config.h" #include "ipset/ipset.h" #include "util/regional.h" +#include "util/net_help.h" #include "util/config_file.h" #include "services/cache/dns.h" @@ -172,7 +173,17 @@ static int ipset_update(struct module_env *env, struct dns_msg *return_msg, stru rr_data = d->rr_data[j]; rd_len = sldns_read_uint16(rr_data); + if(af == AF_INET && rd_len != INET_SIZE) + continue; + if(af == AF_INET6 && rd_len != INET6_SIZE) + continue; if (rr_len - 2 >= rd_len) { + if(verbosity >= VERB_QUERY) { + char ip[128]; + if(inet_ntop(af, rr_data+2, ip, (socklen_t)sizeof(ip)) == 0) + snprintf(ip, sizeof(ip), "(inet_ntop_error)"); + verbose(VERB_QUERY, "ipset: add %s to %s for %s", ip, setname, dname); + } ret = add_to_ipset(mnl, setname, rr_data + 2, af); if (ret < 0) { log_err("ipset: could not add %s into %s", dname, setname);