summaryrefslogtreecommitdiff
path: root/net/arpwatch/patches/patch-ae
blob: 2d32883451d1a5b7ee99e0d15943d4aee5c6becc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
$NetBSD: patch-ae,v 1.1 2000/06/09 09:06:56 bouyer Exp $

--- arpwatch.c.orig	Fri Jun  9 09:51:11 2000
+++ arpwatch.c	Fri Jun  9 09:54:14 2000
@@ -119,6 +119,7 @@
 extern int optind;
 extern int opterr;
 extern char *optarg;
+int aflag = 0;
 
 int
 main(int argc, char **argv)
@@ -147,9 +148,12 @@
 	interface = NULL;
 	rfilename = NULL;
 	pd = NULL;
-	while ((op = getopt(argc, argv, "df:i:r:")) != EOF)
+	while ((op = getopt(argc, argv, "adf:i:r:")) != EOF)
 		switch (op) {
 
+		case 'a':
+			aflag++;
+			break;
 		case 'd':
 			++debug;
 #ifndef DEBUG
@@ -340,7 +344,7 @@
 	BCOPY(SPA(ea), &sia, 4);
 
 	/* Watch for bogons */
-	if ((sia & netmask) != net) {
+	if (aflag == 0 && (sia & netmask) != net) {
 		dosyslog(LOG_INFO, "bogon", sia, sea, sha);
 		return;
 	}
@@ -489,7 +493,7 @@
 	BCOPY(SPA(ea), &sia, 4);
 
 	/* Watch for bogons */
-	if ((sia & netmask) != net) {
+	if (aflag == 0 && (sia & netmask) != net) {
 		dosyslog(LOG_INFO, "bogon", sia, sea, sha);
 		return;
 	}
@@ -623,6 +627,7 @@
 
 	(void)fprintf(stderr, "Version %s\n", version);
 	(void)fprintf(stderr,
-	    "usage: %s [-d] [-f datafile] [-i interface] [-r file]\n", prog);
+	    "usage: %s [-a] [-d] [-f datafile] [-i interface] [-r file]\n",
+	    prog);
 	exit(1);
 }