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