Date: Fri, 7 Jun 2013 08:06:48 +0000 (UTC) From: "Andrey V. Elsukov" <ae@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251486 - head/usr.bin/kdump Message-ID: <201306070806.r5786m5m011995@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ae Date: Fri Jun 7 08:06:48 2013 New Revision: 251486 URL: http://svnweb.freebsd.org/changeset/base/251486 Log: 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 Modified: head/usr.bin/kdump/kdump.c Modified: head/usr.bin/kdump/kdump.c ============================================================================== --- head/usr.bin/kdump/kdump.c Fri Jun 7 07:17:46 2013 (r251485) +++ head/usr.bin/kdump/kdump.c Fri Jun 7 08:06:48 2013 (r251486) @@ -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; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201306070806.r5786m5m011995>