ifconfig output: ipv4 netmask format

Sergey Vinogradov boogie at lazybytes.org
Fri Apr 8 12:27:28 UTC 2011


Hi, hackers.
I have a question: why ipv4 netmask is displayed by ifconfig in hex 
format? Isn't dot-decimal notation more human-readable? Will the 
attached patch break something in the very bad way?

-- 
wbr,
Boo
-------------- next part --------------
--- af_inet.c.orig	2011-04-07 18:48:28.850931143 +0400
+++ af_inet.c	2011-04-08 11:45:51.556706573 +0400
@@ -79,7 +79,7 @@
 	sin = (struct sockaddr_in *)ifa->ifa_netmask;
 	if (sin == NULL)
 		sin = &null_sin;
-	printf("netmask 0x%lx ", (unsigned long)ntohl(sin->sin_addr.s_addr));
+	printf("netmask %s ", inet_ntoa(sin->sin_addr));
 
 	if (ifa->ifa_flags & IFF_BROADCAST) {
 		sin = (struct sockaddr_in *)ifa->ifa_broadaddr;


More information about the freebsd-hackers mailing list