diff options
author | delphij <delphij@FreeBSD.org> | 2011-01-08 01:57:23 +0000 |
---|---|---|
committer | delphij <delphij@FreeBSD.org> | 2011-01-08 01:57:23 +0000 |
commit | 3cb53d70b9e8f98c526f015964d2037890c229e1 (patch) | |
tree | e16de32caf19622d724fb8da5beaaa06eb0bed6d /usr.sbin/ndp | |
parent | 07a217f1bdc1c1912097eb111e3aa2a892538b24 (diff) | |
download | FreeBSD-src-3cb53d70b9e8f98c526f015964d2037890c229e1.zip FreeBSD-src-3cb53d70b9e8f98c526f015964d2037890c229e1.tar.gz |
Use ether_ntoa instead of home-grown version.
Noticed by: Boris Kochergin <spawk acm poly edu>
Diffstat (limited to 'usr.sbin/ndp')
-rw-r--r-- | usr.sbin/ndp/ndp.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/usr.sbin/ndp/ndp.c b/usr.sbin/ndp/ndp.c index 6926a27..1f62230 100644 --- a/usr.sbin/ndp/ndp.c +++ b/usr.sbin/ndp/ndp.c @@ -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); |