Browse files

NXDOMAIN is now logged to its on logfile

  • Loading branch information...
1 parent 67b5094 commit 5b1304f06a0a847566124d089cf155013762ae42 @gamelinux committed Mar 17, 2012
Showing with 11 additions and 4 deletions.
  1. +3 −3 src/dns.c
  2. +7 −1 src/passivedns.c
  3. +1 −0 src/passivedns.h
View
6 src/dns.c
@@ -575,15 +575,15 @@ void print_passet_nxd(pdns_record *l, ldns_rdf *lname, ldns_rr *rr){
static char ip_addr_s[INET6_ADDRSTRLEN];
static char ip_addr_c[INET6_ADDRSTRLEN];
- if (config.logfile[0] == '-' && config.logfile[1] == '\0' ) {
+ if (config.logfile_nxd[0] == '-' && config.logfile_nxd[1] == '\0' ) {
if (config.handle == NULL) return;
screen = 1;
fd = stdout;
} else {
screen = 0;
- fd = fopen(config.logfile, "a");
+ fd = fopen(config.logfile_nxd, "a");
if (fd == NULL) {
- plog("[E] ERROR: Cant open file %s\n",config.logfile);
+ plog("[E] ERROR: Cant open file %s\n",config.logfile_nxd);
l->last_print = l->last_seen;
return;
}
View
8 src/passivedns.c
@@ -973,6 +973,7 @@ void usage()
olog(" -i <iface> Network device <iface> (default: eth0).\n");
olog(" -r <file> Read pcap <file>.\n");
olog(" -l <file> Name of the logfile (default: /var/log/passivedns.log).\n");
+ olog(" -L <file> Name of NXDOMAIN logfile (default: /var/log/passivedns-nxd.log).\n");
olog(" -b 'BPF' Berkley Packet Filter (default: 'port 53').\n");
olog(" -p <file> Name of pid file (default: /var/run/passivedns.pid).\n");
olog(" -S <mem> Soft memory limit in MB (default: 256).\n");
@@ -988,6 +989,7 @@ void usage()
olog("\n");
olog(" 4:A 6:AAAA C:CNAME D:DNAME N:NAPTR O:SOA\n");
olog(" P:PTR R:RP S:SRV T:TXT M:MX n:NS\n");
+ olog(" x:NXD\n");
olog("\n");
}
@@ -1006,6 +1008,7 @@ int main(int argc, char *argv[])
#define BPFF "port 53"
config.bpff = BPFF;
config.logfile = "/var/log/passivedns.log";
+ config.logfile_nxd = "/var/log/passivedns-nxd.log";
config.pidfile = "/var/run/passivedns.pid";
config.mem_limit_max = (256 * 1024 * 1024); // 256 MB - default try to limit dns caching to this
config.dnsprinttime = DNSPRINTTIME;
@@ -1030,7 +1033,7 @@ int main(int argc, char *argv[])
signal(SIGQUIT, game_over);
signal(SIGALRM, sig_alarm_handler);
-#define ARGS "i:r:l:hb:Dp:C:P:S:X:u:g:T:"
+#define ARGS "i:r:l:L:hb:Dp:C:P:S:X:u:g:T:"
while ((ch = getopt(argc, argv, ARGS)) != -1)
switch (ch) {
@@ -1040,6 +1043,9 @@ int main(int argc, char *argv[])
case 'r':
config.pcap_file = strdup(optarg);
break;
+ case 'L':
+ config.logfile_nxd = strdup(optarg);
+ break;
case 'l':
config.logfile = strdup(optarg);
break;
View
1 src/passivedns.h
@@ -492,6 +492,7 @@ typedef struct _globalconfig {
char *user_filter; /**/
char *net_ip_string; /**/
char *logfile; /* Filename of /var/log/passivedns.log */
+ char *logfile_nxd; /* Filename for NXDOMAIN logging /var/log/passivedns-nxd.log */
char *fifo; /* Path to FIFO output */
char *pcap_file; /* Filename to pcap too read */
char *dev; /* Device name to use for sniffing */

0 comments on commit 5b1304f

Please sign in to comment.