]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- ipset module #28: log that an address is added, when verbosity high.
authorW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Mon, 2 Sep 2019 11:50:42 +0000 (13:50 +0200)
committerW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Mon, 2 Sep 2019 11:50:42 +0000 (13:50 +0200)
doc/Changelog
ipset/ipset.c

index cadfc61366afb8e11f5a995edca77bb49a1663e1..33ab8096ac4e80184d7cea7a1829fc26ee7a706c 100644 (file)
@@ -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.
 
index 85b2edea9ed4c1d55a91604b237f8dd04ad2e72b..ec62cc356830d418c72fdabdfd874af8839be1be 100755 (executable)
@@ -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);