Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Jul 2012 17:48:19 +0000 (UTC)
From:      Christian Brueffer <brueffer@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r238007 - stable/7/usr.sbin/ndp
Message-ID:  <201207021748.q62HmJ6O084988@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: brueffer
Date: Mon Jul  2 17:48:19 2012
New Revision: 238007
URL: http://svn.freebsd.org/changeset/base/238007

Log:
  MFC: r217140
  
  Use ether_ntoa instead of home-grown version.
  
  PR:		169075
  Submitted by:	Alexandr <alter@alter.org.ua>

Modified:
  stable/7/usr.sbin/ndp/ndp.c
Directory Properties:
  stable/7/usr.sbin/ndp/   (props changed)

Modified: stable/7/usr.sbin/ndp/ndp.c
==============================================================================
--- stable/7/usr.sbin/ndp/ndp.c	Mon Jul  2 17:37:40 2012	(r238006)
+++ stable/7/usr.sbin/ndp/ndp.c	Mon Jul  2 17:48:19 2012	(r238007)
@@ -148,7 +148,6 @@ static void getdefif __P((void));
 static void setdefif __P((char *));
 #endif
 static char *sec2str __P((time_t));
-static char *ether_str __P((struct sockaddr_dl *));
 static void ts_print __P((const struct timeval *));
 
 #ifdef ICMPV6CTL_ND6_DRLIST
@@ -806,17 +805,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?201207021748.q62HmJ6O084988>