aboutsummaryrefslogtreecommitdiff
path: root/networking/traceroute.c
diff options
context:
space:
mode:
Diffstat (limited to 'networking/traceroute.c')
-rw-r--r--networking/traceroute.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/networking/traceroute.c b/networking/traceroute.c
index e7d9725af..5bd3ddb0e 100644
--- a/networking/traceroute.c
+++ b/networking/traceroute.c
@@ -72,11 +72,9 @@
72#include <string.h> 72#include <string.h>
73#include <unistd.h> 73#include <unistd.h>
74#include <sys/time.h> 74#include <sys/time.h>
75#include <sys/types.h> 75#include "inet_common.h"
76#include <sys/socket.h>
77#include <netdb.h> 76#include <netdb.h>
78#include <endian.h> 77#include <endian.h>
79#include <arpa/inet.h>
80#include <netinet/udp.h> 78#include <netinet/udp.h>
81#include <netinet/ip.h> 79#include <netinet/ip.h>
82#include <netinet/ip_icmp.h> 80#include <netinet/ip_icmp.h>
@@ -228,8 +226,8 @@ static inline void
228inetname(struct sockaddr_in *from) 226inetname(struct sockaddr_in *from)
229{ 227{
230 char *cp; 228 char *cp;
231 struct hostent *hp;
232 static char domain[MAXHOSTNAMELEN + 1]; 229 static char domain[MAXHOSTNAMELEN + 1];
230 char name[MAXHOSTNAMELEN + 1];
233 static int first = 1; 231 static int first = 1;
234 const char *ina; 232 const char *ina;
235 233
@@ -243,12 +241,11 @@ inetname(struct sockaddr_in *from)
243 } 241 }
244 cp = 0; 242 cp = 0;
245 if (!nflag && from->sin_addr.s_addr != INADDR_ANY) { 243 if (!nflag && from->sin_addr.s_addr != INADDR_ANY) {
246 hp = gethostbyaddr((char *)&(from->sin_addr), sizeof (from->sin_addr), AF_INET); 244 if(INET_rresolve(name, sizeof(name), from, 0, 0xffffffff) >= 0) {
247 if (hp) { 245 if ((cp = strchr(name, '.')) &&
248 if ((cp = strchr(hp->h_name, '.')) &&
249 !strcmp(cp + 1, domain)) 246 !strcmp(cp + 1, domain))
250 *cp = 0; 247 *cp = 0;
251 cp = (char *)hp->h_name; 248 cp = (char *)name;
252 } 249 }
253 } 250 }
254 ina = inet_ntoa(from->sin_addr); 251 ina = inet_ntoa(from->sin_addr);
@@ -645,7 +642,7 @@ traceroute_main(argc, argv)
645 } 642 }
646 putchar('\n'); 643 putchar('\n');
647 if (got_there || unreachable >= nprobes-1) 644 if (got_there || unreachable >= nprobes-1)
648 exit(0); 645 return 0;
649 } 646 }
650 647
651 return 0; 648 return 0;