Hi,

This is a POLA violating 'let's move with the times' patch that gets rid of the special treatment of classful IPv4 network prefixes in 'netstat -rn' output. Comments please!

Rgards,
BMS
Index: route.c
===================================================================
RCS file: /home/ncvs/src/usr.bin/netstat/route.c,v
retrieving revision 1.76
diff -u -p -r1.76 route.c
--- route.c	13 May 2005 16:31:10 -0000	1.76
+++ route.c	10 Feb 2007 22:55:50 -0000
@@ -865,32 +865,7 @@ netname(u_long in, u_long mask)
 		strncpy(line, cp, sizeof(line) - 1);
 		line[sizeof(line) - 1] = '\0';
 	} else {
-		switch (dmask) {
-		case IN_CLASSA_NET:
-			if ((i & IN_CLASSA_HOST) == 0) {
-				sprintf(line, "%lu", C(i >> 24));
-				break;
-			}
-			/* FALLTHROUGH */
-		case IN_CLASSB_NET:
-			if ((i & IN_CLASSB_HOST) == 0) {
-				sprintf(line, "%lu.%lu",
-					C(i >> 24), C(i >> 16));
-				break;
-			}
-			/* FALLTHROUGH */
-		case IN_CLASSC_NET:
-			if ((i & IN_CLASSC_HOST) == 0) {
-				sprintf(line, "%lu.%lu.%lu",
-					C(i >> 24), C(i >> 16), C(i >> 8));
-				break;
-			}
-			/* FALLTHROUGH */
-		default:
-			sprintf(line, "%lu.%lu.%lu.%lu",
-				C(i >> 24), C(i >> 16), C(i >> 8), C(i));
-			break;
-		}
+		inet_ntop(AF_INET, (char *)&in, line, sizeof(line) - 1);
 	}
 	domask(line + strlen(line), i, mask);
 	return (line);
_______________________________________________
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to