|
|
0c7ee9 |
--- a/arpwatch.8 2016-03-02 13:06:36.712324185 +0100
|
|
|
0c7ee9 |
+++ b/arpwatch.8 2016-03-02 13:07:03.091306605 +0100
|
|
|
0c7ee9 |
@@ -27,7 +27,7 @@ arpwatch - keep track of ethernet/ip add
|
|
|
0c7ee9 |
.na
|
|
|
0c7ee9 |
.B arpwatch
|
|
|
0c7ee9 |
[
|
|
|
0c7ee9 |
-.B -dN
|
|
|
0c7ee9 |
+.B -dNp
|
|
|
0c7ee9 |
] [
|
|
|
0c7ee9 |
.B -f
|
|
|
0c7ee9 |
.I datafile
|
|
|
0c7ee9 |
@@ -70,6 +70,10 @@ background and emailing the reports. Ins
|
|
|
0c7ee9 |
.IR stderr .
|
|
|
0c7ee9 |
.LP
|
|
|
0c7ee9 |
The
|
|
|
0c7ee9 |
+.B -p
|
|
|
0c7ee9 |
+flag disables promiscuous mode.
|
|
|
0c7ee9 |
+.LP
|
|
|
0c7ee9 |
+The
|
|
|
0c7ee9 |
.B -f
|
|
|
0c7ee9 |
flag is used to set the ethernet/ip address database filename.
|
|
|
0c7ee9 |
The default is
|
|
|
0c7ee9 |
--- a/arpwatch.c 2016-03-02 13:06:36.723324178 +0100
|
|
|
0c7ee9 |
+++ b/arpwatch.c 2016-03-02 13:11:20.650134958 +0100
|
|
|
0c7ee9 |
@@ -162,7 +162,7 @@ void dropprivileges(const char* user)
|
|
|
0c7ee9 |
}
|
|
|
0c7ee9 |
|
|
|
0c7ee9 |
char *
|
|
|
0c7ee9 |
-try_dev(char *interface, pcap_t **pd, int *linktype, char *errbuf)
|
|
|
0c7ee9 |
+try_dev(char *interface, pcap_t **pd, int *linktype, int promisc, char *errbuf)
|
|
|
0c7ee9 |
{
|
|
|
0c7ee9 |
register int snaplen, timeout;
|
|
|
0c7ee9 |
|
|
|
0c7ee9 |
@@ -170,7 +170,7 @@ try_dev(char *interface, pcap_t **pd, in
|
|
|
0c7ee9 |
sizeof(struct fddi_header)) + sizeof(struct ether_arp);
|
|
|
0c7ee9 |
timeout = 1000;
|
|
|
0c7ee9 |
|
|
|
0c7ee9 |
- *pd = pcap_open_live(interface, snaplen, 1, timeout, errbuf);
|
|
|
0c7ee9 |
+ *pd = pcap_open_live(interface, snaplen, promisc, timeout, errbuf);
|
|
|
0c7ee9 |
if (NULL == *pd) {
|
|
|
0c7ee9 |
syslog(LOG_ERR, "pcap open %s: %s", interface, errbuf);
|
|
|
0c7ee9 |
return NULL;
|
|
|
0c7ee9 |
@@ -187,14 +187,14 @@ try_dev(char *interface, pcap_t **pd, in
|
|
|
0c7ee9 |
}
|
|
|
0c7ee9 |
|
|
|
0c7ee9 |
char *
|
|
|
0c7ee9 |
-iterate_dev(char *arginterface, pcap_t **pd, int *linktype, char *errbuf)
|
|
|
0c7ee9 |
+iterate_dev(char *arginterface, pcap_t **pd, int *linktype, int promisc, char *errbuf)
|
|
|
0c7ee9 |
{
|
|
|
0c7ee9 |
static char interface[IF_NAMESIZE + 1];
|
|
|
0c7ee9 |
pcap_if_t *alldevs;
|
|
|
0c7ee9 |
pcap_if_t *dev;
|
|
|
0c7ee9 |
|
|
|
0c7ee9 |
if (NULL != arginterface) {
|
|
|
0c7ee9 |
- return try_dev(arginterface, pd, linktype, errbuf);
|
|
|
0c7ee9 |
+ return try_dev(arginterface, pd, linktype, promisc, errbuf);
|
|
|
0c7ee9 |
} else {
|
|
|
0c7ee9 |
if (pcap_findalldevs(&alldevs, errbuf) == -1) {
|
|
|
0c7ee9 |
(void)fprintf(stderr, "%s: lookup_device: %s\n",
|
|
|
0c7ee9 |
@@ -203,7 +203,7 @@ iterate_dev(char *arginterface, pcap_t *
|
|
|
0c7ee9 |
}
|
|
|
0c7ee9 |
for (dev = alldevs; dev && (arginterface == NULL); dev = dev->next) {
|
|
|
0c7ee9 |
strncpy(interface, dev->name, strlen(dev->name)+1);
|
|
|
0c7ee9 |
- arginterface = try_dev(interface, pd, linktype, errbuf);
|
|
|
0c7ee9 |
+ arginterface = try_dev(interface, pd, linktype, promisc, errbuf);
|
|
|
0c7ee9 |
}
|
|
|
0c7ee9 |
pcap_freealldevs(alldevs);
|
|
|
0c7ee9 |
return arginterface;
|
|
|
0c7ee9 |
@@ -224,6 +224,7 @@ main(int argc, char **argv)
|
|
|
0c7ee9 |
struct bpf_program code;
|
|
|
0c7ee9 |
char errbuf[PCAP_ERRBUF_SIZE];
|
|
|
0c7ee9 |
char* serveruser = NULL;
|
|
|
0c7ee9 |
+ int promisc = 1;
|
|
|
0c7ee9 |
|
|
|
0c7ee9 |
if (argv[0] == NULL)
|
|
|
0c7ee9 |
prog = "arpwatch";
|
|
|
0c7ee9 |
@@ -242,7 +243,7 @@ main(int argc, char **argv)
|
|
|
0c7ee9 |
linktype = -1;
|
|
|
0c7ee9 |
rfilename = NULL;
|
|
|
0c7ee9 |
pd = NULL;
|
|
|
0c7ee9 |
- while ((op = getopt(argc, argv, "df:i:n:Nr:u:e:s:")) != EOF)
|
|
|
0c7ee9 |
+ while ((op = getopt(argc, argv, "df:i:n:Nr:u:e:s:p")) != EOF)
|
|
|
0c7ee9 |
switch (op) {
|
|
|
0c7ee9 |
|
|
|
0c7ee9 |
case 'd':
|
|
|
0c7ee9 |
@@ -304,6 +305,10 @@ main(int argc, char **argv)
|
|
|
0c7ee9 |
}
|
|
|
0c7ee9 |
break;
|
|
|
0c7ee9 |
|
|
|
0c7ee9 |
+ case 'p':
|
|
|
0c7ee9 |
+ --promisc;
|
|
|
0c7ee9 |
+ break;
|
|
|
0c7ee9 |
+
|
|
|
0c7ee9 |
default:
|
|
|
0c7ee9 |
usage();
|
|
|
0c7ee9 |
}
|
|
|
0c7ee9 |
@@ -317,7 +322,7 @@ main(int argc, char **argv)
|
|
|
0c7ee9 |
} else {
|
|
|
0c7ee9 |
|
|
|
0c7ee9 |
/* Determine interface if not specified */
|
|
|
0c7ee9 |
- interface = iterate_dev(interface, &pd, &linktype, errbuf);
|
|
|
0c7ee9 |
+ interface = iterate_dev(interface, &pd, &linktype, promisc, errbuf);
|
|
|
0c7ee9 |
if (interface == NULL) {
|
|
|
0c7ee9 |
(void)fprintf(stderr, "%s: lookup_device: no suitable interface found\n",
|
|
|
0c7ee9 |
prog);
|