Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 8 Jan 2011 01:57:24 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r217140 - head/usr.sbin/ndp
Message-ID:  <201101080157.p081vOwd072917@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Sat Jan  8 01:57:23 2011
New Revision: 217140
URL: http://svn.freebsd.org/changeset/base/217140

Log:
  Use ether_ntoa instead of home-grown version.
  
  Noticed by:	Boris Kochergin <spawk acm poly edu>

Modified:
  head/usr.sbin/ndp/ndp.c

Modified: head/usr.sbin/ndp/ndp.c
==============================================================================
--- head/usr.sbin/ndp/ndp.c	Sat Jan  8 01:39:43 2011	(r217139)
+++ head/usr.sbin/ndp/ndp.c	Sat Jan  8 01:57:23 2011	(r217140)
@@ -153,7 +153,6 @@ static void getdefif(void);
 static void setdefif(char *);
 #endif
 static char *sec2str(time_t);
-static char *ether_str(struct sockaddr_dl *);
 static void ts_print(const struct timeval *);
 
 #ifdef ICMPV6CTL_ND6_DRLIST
@@ -820,17 +819,14 @@ getnbrinfo(addr, ifindex, warning)
 }
 
 static char *
-ether_str(sdl)
-	struct sockaddr_dl *sdl;
+ether_str(struct sockaddr_dl *sdl)
 {
 	static char hbuf[NI_MAXHOST];
-	u_char *cp;
 
-	if (sdl->sdl_alen) {
-		cp = (u_char *)LLADDR(sdl);
-		snprintf(hbuf, sizeof(hbuf), "%x:%x:%x:%x:%x:%x",
-		    cp[0], cp[1], cp[2], cp[3], cp[4], cp[5]);
-	} else
+	if (sdl->sdl_alen > 0)
+		strlcpy(hbuf, ether_ntoa((struct ether_addr *)LLADDR(sdl)),
+		    sizeof(hbuf));
+	else
 		snprintf(hbuf, sizeof(hbuf), "(incomplete)");
 
 	return(hbuf);



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