Skip to content

Commit

Permalink
- ipset module #28: log that an address is added, when verbosity high.
Browse files Browse the repository at this point in the history
  • Loading branch information
wcawijngaards committed Sep 2, 2019
1 parent cd0a2b1 commit 9902a5f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions doc/Changelog
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
11 changes: 11 additions & 0 deletions ipset/ipset.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 9902a5f

Please sign in to comment.