diff --git a/src/passivedns.c b/src/passivedns.c index 6f15ba1..047f069 100644 --- a/src/passivedns.c +++ b/src/passivedns.c @@ -1093,6 +1093,7 @@ void usage() olog(" -C Seconds to cache DNS objects in memory (default: %u).\n", DNSCACHETIMEOUT); olog(" -P Seconds between printing duplicate DNS info (default %u).\n", DNSPRINTTIME); olog(" -X Manually set DNS RR Types to care about (default: -X 46CDNPRS).\n"); + olog(" -N Set interface to non promisc. mode.\n"); olog(" -u User ID to drop privileges to.\n"); olog(" -g Group ID to drop privileges to.\n"); olog(" -T Directory to chroot into.\n"); @@ -1164,6 +1165,7 @@ int main(int argc, char *argv[]) config.logfile = "/var/log/passivedns.log"; config.logfile_nxd = "/var/log/passivedns.log"; config.pidfile = "/var/run/passivedns.pid"; + config.promisc = 1; config.output_log = 0; config.output_log_nxd = 0; config.output_syslog = 0; @@ -1205,7 +1207,7 @@ int main(int argc, char *argv[]) signal(SIGUSR1, print_pdns_stats); signal(SIGUSR2, expire_all_dns_records); -#define ARGS "i:r:c:nyYjJl:L:d:hb:Dp:C:P:S:f:X:u:g:T:V" +#define ARGS "i:r:c:nyYNjJl:L:d:hb:Dp:C:P:S:f:X:u:g:T:V" while ((ch = getopt(argc, argv, ARGS)) != -1) switch (ch) { @@ -1276,6 +1278,9 @@ int main(int argc, char *argv[]) config.group_name = optarg; config.drop_privs_flag = 1; break; + case 'N': + config.promisc = 0; + break; #ifdef HAVE_PFRING case 'n': config.use_pfring = 1; @@ -1434,7 +1439,7 @@ int main(int argc, char *argv[]) config.dev = pcap_lookupdev(config.errbuf); olog("[*] Device: %s\n", config.dev); - if ((config.handle = pcap_open_live(config.dev, SNAPLENGTH, 1, 500, + if ((config.handle = pcap_open_live(config.dev, SNAPLENGTH, config.promisc, 500, config.errbuf)) == NULL) { olog("[*] Error pcap_open_live: %s \n", config.errbuf); exit(1); diff --git a/src/passivedns.h b/src/passivedns.h index a8531b1..f112f0f 100644 --- a/src/passivedns.h +++ b/src/passivedns.h @@ -497,6 +497,7 @@ typedef struct _globalconfig { uint8_t use_json_nxd; /* Use JSON as output in NXDOMAIN log */ #endif /* HAVE_JSON */ uint8_t setfilter; + uint8_t promisc; /* set interface promisc mode */ uint8_t drop_privs_flag; /* Flag marking to drop privs */ uint8_t chroot_flag; /* Flag for going chroot */ uint8_t daemon_flag; /* Flag for going daemon */