This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Fix ether_ntoa() output format
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: mokhtar <mbmessaoud at gmail dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Sun, 13 Oct 2013 11:13:54 +0200
- Subject: Re: [PATCH] Fix ether_ntoa() output format
- Authentication-results: sourceware.org; auth=none
- References: <op dot vggmcoovgweiyn at localhost dot localdomain> <4C5190C2 dot 7020801 at redhat dot com> <1381613691126-247250 dot post at n7 dot nabble dot com>
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