Blob Blame History Raw
RHBZ #244606: Correctly handle -n 0/32 to allow the user to disable reporting
bogons from 0.0.0.0.

diff -Naur arpwatch-3.1-original/arpwatch.c arpwatch-3.1/arpwatch.c
--- arpwatch-3.1-original/arpwatch.c	2019-11-30 13:35:23.000000000 -0500
+++ arpwatch-3.1/arpwatch.c	2020-11-07 12:10:53.357839069 -0500
@@ -814,10 +814,12 @@
 
 	/* XXX hack */
 	n = ntohl(inet_addr(tstr));
-	while ((n & 0xff000000) == 0) {
-		n <<= 8;
-		if (n == 0)
-			return (0);
+	if (n || width != 32) {
+		while ((n & 0xff000000) == 0) {
+			n <<= 8;
+			if (n == 0)
+				return (0);
+		}
 	}
 	n = htonl(n);