Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 08 Apr 2011 16:08:38 +0400
From:      Sergey Vinogradov <boogie@lazybytes.org>
To:        FreeBSD Hackers <freebsd-hackers@FreeBSD.org>
Subject:   ifconfig output: ipv4 netmask format
Message-ID:  <4D9EFAC6.4020906@lazybytes.org>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------090300000608040101010202
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

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

--------------090300000608040101010202
Content-Type: text/plain;
 name="af_inet.c.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="af_inet.c.patch"

--- 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;

--------------090300000608040101010202--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4D9EFAC6.4020906>