From owner-freebsd-stable Fri Apr 5 10: 1:39 2002 Delivered-To: freebsd-stable@freebsd.org Received: from apollo.backplane.com (apollo.backplane.com [216.240.41.2]) by hub.freebsd.org (Postfix) with ESMTP id AAFE737B404; Fri, 5 Apr 2002 10:01:33 -0800 (PST) Received: (from dillon@localhost) by apollo.backplane.com (8.11.6/8.9.1) id g35I1Xl52628; Fri, 5 Apr 2002 10:01:33 -0800 (PST) (envelope-from dillon) Date: Fri, 5 Apr 2002 10:01:33 -0800 (PST) From: Matthew Dillon Message-Id: <200204051801.g35I1Xl52628@apollo.backplane.com> To: freebsd-stable@freebsd.org Cc: Ruslan Ermilov Subject: Ethernet address format changes. Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG It would appear that someone has changed ifconfig() to use ether_ntoa() when printing an interface's MAC address. In 4.x. Unfortunately, this has had the side effect of changing the format from %02x:%02x:%02x:%02x:%02x:%20x to %x:%x:%x:%x:%x:%x. The new format is non-standard. I will occassionally see it printed in a physical label attached to a machine, but I've never seen anything other then %02x displayed on a computer until now. I just got an email from a friend of mine who indicated that the change broke a bunch of his scripts. I would not be surprised if this change breaks other people's scripts as well. I would either like to fix ether_ntoa(), or back-out the change that was made to ifconfig. Since the change Ruslan made to ifconfig seems reasonable, my suggested fix to ether_ntoa() is shown below. Comments? -Matt Matthew Dillon Index: net/ether_addr.c =================================================================== RCS file: /home/ncvs/src/lib/libc/net/ether_addr.c,v retrieving revision 1.10.2.4 diff -u -r1.10.2.4 ether_addr.c --- net/ether_addr.c 7 Mar 2002 03:33:23 -0000 1.10.2.4 +++ net/ether_addr.c 5 Apr 2002 17:57:16 -0000 @@ -111,15 +111,15 @@ * Convert a binary representation of an ethernet address to * an ASCII string. */ -char -*ether_ntoa(n) +char *ether_ntoa(n) const struct ether_addr *n; { int i; static char a[18]; - i = sprintf(a,"%x:%x:%x:%x:%x:%x",n->octet[0],n->octet[1],n->octet[2], - n->octet[3],n->octet[4],n->octet[5]); + i = sprintf(a,"%02x:%02x:%02x:%02x:%02x:%02x", + n->octet[0],n->octet[1],n->octet[2], + n->octet[3],n->octet[4],n->octet[5]); if (i < 11) return (NULL); return ((char *)&a); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message