This patch against arpwatch-2.1a11 enables arpwatch to listen on an interface that has no IPv4 assigned address diff -Naur arpwatch-2.1a11/arpwatch.8 arpwatch-2.1a11.oden/arpwatch.8 --- arpwatch-2.1a11/arpwatch.8 2000-10-08 22:31:28.000000000 +0200 +++ arpwatch-2.1a11.oden/arpwatch.8 2004-06-01 02:06:34.396094208 +0200 @@ -27,7 +27,7 @@ .na .B arpwatch [ -.B -dN +.B -dNw ] [ .B -f .I datafile @@ -83,6 +83,10 @@ flag disables reporting any bogons. .LP The +.B -w +flag is used to specify an interface without a valid IPv4 address. +.LP +The .B -r flag is used to specify a savefile (perhaps created by diff -Naur arpwatch-2.1a11/arpwatch.c arpwatch-2.1a11.oden/arpwatch.c --- arpwatch-2.1a11/arpwatch.c 2000-10-14 04:07:35.000000000 +0200 +++ arpwatch-2.1a11.oden/arpwatch.c 2004-06-01 02:06:34.397094056 +0200 @@ -145,7 +145,7 @@ main(int argc, char **argv) { register char *cp; - register int op, pid, snaplen, timeout, linktype, status; + register int op, pid, snaplen, timeout, linktype, status, noip = 0; #ifdef TIOCNOTTY register int fd; #endif @@ -170,7 +170,7 @@ interface = NULL; rfilename = NULL; pd = NULL; - while ((op = getopt(argc, argv, "df:i:n:Nr:")) != EOF) + while ((op = getopt(argc, argv, "df:i:n:wNr:")) != EOF) switch (op) { case 'd': @@ -194,6 +194,10 @@ usage(); break; + case 'w': + ++noip; + break; + case 'N': ++nobogons; break; @@ -221,12 +225,19 @@ exit(1); } + if(noip){ + /* Be able to sniff on interfaces without address */ + net = 0; + netmask = 0; + } else { /* Determine network and netmask */ - if (pcap_lookupnet(interface, &net, &netmask, errbuf) < 0) { - (void)fprintf(stderr, "%s: bad interface %s: %s\n", - prog, interface, errbuf); - exit(1); + if (pcap_lookupnet(interface, &net, &netmask, errbuf) < 0) { + (void)fprintf(stderr, "%s: bad interface %s: %s\n", + prog, interface, errbuf); + exit(1); + } } + /* Drop into the background if not debugging */ if (!debug) { @@ -750,7 +761,7 @@ extern char version[]; (void)fprintf(stderr, "Version %s\n", version); - (void)fprintf(stderr, "usage: %s [-dN] [-f datafile] [-i interface]" + (void)fprintf(stderr, "usage: %s [-dNw] [-f datafile] [-i interface]" " [-n net[/width]] [-r file]\n", prog); exit(1); }