Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F142712247
D45926.id140708.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
752 B
Referenced Files
None
Subscribers
None
D45926.id140708.diff
View Options
diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c
--- a/usr.bin/netstat/inet.c
+++ b/usr.bin/netstat/inet.c
@@ -1507,15 +1507,19 @@
char *
inetname(struct in_addr *inp)
{
- char *cp;
+ struct sockaddr_in sin = {
+ .sin_len = sizeof(struct sockaddr_in),
+ .sin_family = AF_INET,
+ .sin_addr = *inp,
+ };
+ char *cp, host[NI_MAXHOST];
static char line[MAXHOSTNAMELEN];
- struct hostent *hp;
cp = 0;
if (!numeric_addr && inp->s_addr != INADDR_ANY) {
- hp = gethostbyaddr((char *)inp, sizeof (*inp), AF_INET);
- if (hp) {
- cp = hp->h_name;
+ if (getnameinfo((struct sockaddr *)&sin, sin.sin_len,
+ host, sizeof(host), NULL, 0, NI_NAMEREQD) == 0) {
+ cp = host;
trimdomain(cp, strlen(cp));
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jan 23, 1:55 PM (11 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27884807
Default Alt Text
D45926.id140708.diff (752 B)
Attached To
Mode
D45926: netstat: remove gethostby*() calls
Attached
Detach File
Event Timeline
Log In to Comment