aboutsummaryrefslogtreecommitdiff
path: root/networking/traceroute.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-11-10 11:22:46 +0000
committerEric Andersen <andersen@codepoet.org>2001-11-10 11:22:46 +0000
commitcd8c436d811a5a077a0b61a6616c900173e2dcfb (patch)
tree94163bfef63fec4c2638d5f56be310b7176464d7 /networking/traceroute.c
parent94f19a838518293810a0fc0c4dca926ca8caff57 (diff)
downloadbusybox-w32-cd8c436d811a5a077a0b61a6616c900173e2dcfb.tar.gz
busybox-w32-cd8c436d811a5a077a0b61a6616c900173e2dcfb.tar.bz2
busybox-w32-cd8c436d811a5a077a0b61a6616c900173e2dcfb.zip
Latest patch from vodz:
-- reverse resolve network name and cache in route and ifconfig applets, fix print nslookup server name if compile without uClibc, fix route crashe 'route add', fix warnings compile networking and pwd_grp applets
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;