Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/arp Use getnameinfo() to format link-layer addresse...
details: https://anonhg.NetBSD.org/src/rev/64e0a74abc6d
branches: trunk
changeset: 515874:64e0a74abc6d
user: bjh21 <bjh21%NetBSD.org@localhost>
date: Sat Oct 06 19:09:44 2001 +0000
description:
Use getnameinfo() to format link-layer addresses, rather than doing it
ourselves.
diffstat:
usr.sbin/arp/arp.c | 20 ++++++++------------
1 files changed, 8 insertions(+), 12 deletions(-)
diffs (42 lines):
diff -r f6fec4f85d69 -r 64e0a74abc6d usr.sbin/arp/arp.c
--- a/usr.sbin/arp/arp.c Sat Oct 06 18:56:49 2001 +0000
+++ b/usr.sbin/arp/arp.c Sat Oct 06 19:09:44 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: arp.c,v 1.31 2001/07/29 21:24:57 chs Exp $ */
+/* $NetBSD: arp.c,v 1.32 2001/10/06 19:09:44 bjh21 Exp $ */
/*
* Copyright (c) 1984, 1993
@@ -46,7 +46,7 @@
#if 0
static char sccsid[] = "@(#)arp.c 8.3 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: arp.c,v 1.31 2001/07/29 21:24:57 chs Exp $");
+__RCSID("$NetBSD: arp.c,v 1.32 2001/10/06 19:09:44 bjh21 Exp $");
#endif
#endif /* not lint */
@@ -511,17 +511,13 @@
sdl_print(sdl)
const struct sockaddr_dl *sdl;
{
- int i;
- u_int8_t *p;
-
- i = sdl->sdl_alen;
- p = LLADDR(sdl);
+ char hbuf[NI_MAXHOST];
- (void)printf("%02x", *p);
- while (--i > 0) {
- putchar(':');
- (void)printf("%02x", *++p);
- }
+ if (getnameinfo((struct sockaddr *)sdl, sdl->sdl_len,
+ hbuf, sizeof(hbuf), NULL, 0, NI_NUMERICHOST) != 0)
+ printf("<invalid>");
+ else
+ printf("%s", hbuf);
}
int
Home |
Main Index |
Thread Index |
Old Index