This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix ether_ntoa() output format


On Sat, Oct 12, 2013 at 02:34:51PM -0700, mokhtar wrote:
> Hi everybody
> 
> I checked in  about mac address format  and I found these articles
> 
> MAC address <http://en.wikipedia.org/wiki/MAC_address>  
> /
> The standard (IEEE 802) format for printing MAC-48 addresses in
> human-friendly form is six groups of two hexadecimal digits, separated by
> hyphens (-) or colons (:), in transmission order (e.g. 01-23-45-67-89-ab  
> or   01:23:45:67:89:ab ). This form is also commonly used for EUI-64/. 

A relevant patch is following. Any objections to this?

2010-07-26  Nikita Izyumtsev  <nikita.izyumtsev@gmail.com>
 
	* inet/ether_ntoa_r.c (ether_ntoa_r): fix ether_ntoa() output format.
 
---
 inet/ether_ntoa_r.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
 
diff --git a/inet/ether_ntoa_r.c b/inet/ether_ntoa_r.c
index c5f347c..5730e60 100644
--- a/inet/ether_ntoa_r.c
+++ b/inet/ether_ntoa_r.c
@@ -25,7 +25,7 @@
 char *
 ether_ntoa_r (const struct ether_addr *addr, char *buf)
 {
-  sprintf (buf, "%x:%x:%x:%x:%x:%x",
+  sprintf (buf, "%02x:%02x:%02x:%02x:%02x:%02x",
        addr->ether_addr_octet[0], addr->ether_addr_octet[1],
        addr->ether_addr_octet[2], addr->ether_addr_octet[3],
        addr->ether_addr_octet[4], addr->ether_addr_octet[5]);
-- 
1.7.0.2


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]