Use ether_ntoa instead of home-grown version.

Noticed by:	Boris Kochergin <spawk acm poly edu>
This commit is contained in:
Xin LI 2011-01-08 01:57:23 +00:00
parent 7b2638182f
commit 97f8d65503
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=217140

View File

@ -153,7 +153,6 @@ static void getdefif(void);
static void setdefif(char *); static void setdefif(char *);
#endif #endif
static char *sec2str(time_t); static char *sec2str(time_t);
static char *ether_str(struct sockaddr_dl *);
static void ts_print(const struct timeval *); static void ts_print(const struct timeval *);
#ifdef ICMPV6CTL_ND6_DRLIST #ifdef ICMPV6CTL_ND6_DRLIST
@ -820,17 +819,14 @@ getnbrinfo(addr, ifindex, warning)
} }
static char * static char *
ether_str(sdl) ether_str(struct sockaddr_dl *sdl)
struct sockaddr_dl *sdl;
{ {
static char hbuf[NI_MAXHOST]; static char hbuf[NI_MAXHOST];
u_char *cp;
if (sdl->sdl_alen) { if (sdl->sdl_alen > 0)
cp = (u_char *)LLADDR(sdl); strlcpy(hbuf, ether_ntoa((struct ether_addr *)LLADDR(sdl)),
snprintf(hbuf, sizeof(hbuf), "%x:%x:%x:%x:%x:%x", sizeof(hbuf));
cp[0], cp[1], cp[2], cp[3], cp[4], cp[5]); else
} else
snprintf(hbuf, sizeof(hbuf), "(incomplete)"); snprintf(hbuf, sizeof(hbuf), "(incomplete)");
return(hbuf); return(hbuf);