summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorae <ae@FreeBSD.org>2013-06-07 08:06:48 +0000
committerae <ae@FreeBSD.org>2013-06-07 08:06:48 +0000
commite69fa77a289c83a41a81a7a0bdcd4c102ce4f3aa (patch)
treeaf6159fea50217d94e73c85f7cb9bd19910e762e /usr.bin
parentbbed7eb4ffad6ce27570f6efc1384efdb9ca5a4b (diff)
downloadFreeBSD-src-e69fa77a289c83a41a81a7a0bdcd4c102ce4f3aa.zip
FreeBSD-src-e69fa77a289c83a41a81a7a0bdcd4c102ce4f3aa.tar.gz
Use getnameinfo(3) instead of inet_ntop(3) to make printable versions of
sockaddr_in6 structures. getnameinfo(3) does the same thing, but it is also able to represent a scope zone id as described in the RFC 4007. MFC after: 2 weeks
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/kdump/kdump.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/kdump/kdump.c b/usr.bin/kdump/kdump.c
index 7694cfe..550c4cb 100644
--- a/usr.bin/kdump/kdump.c
+++ b/usr.bin/kdump/kdump.c
@@ -74,6 +74,7 @@ extern int errno;
#include <grp.h>
#include <inttypes.h>
#include <locale.h>
+#include <netdb.h>
#include <nl_types.h>
#include <pwd.h>
#include <stdio.h>
@@ -1531,7 +1532,8 @@ ktrsockaddr(struct sockaddr *sa)
memset(&sa_in6, 0, sizeof(sa_in6));
memcpy(&sa_in6, sa, sa->sa_len);
check_sockaddr_len(in6);
- inet_ntop(AF_INET6, &sa_in6.sin6_addr, addr, sizeof addr);
+ getnameinfo((struct sockaddr *)&sa_in6, sizeof(sa_in6),
+ addr, sizeof(addr), NULL, 0, NI_NUMERICHOST);
printf("[%s]:%u", addr, htons(sa_in6.sin6_port));
break;
}
OpenPOWER on IntegriCloud