2004-09-09 06:23:07 +00:00
|
|
|
--- iputils/ping.c.addrcache 2002-09-20 17:08:11.000000000 +0200
|
|
|
|
+++ iputils/ping.c 2003-05-15 16:41:19.000000000 +0200
|
|
|
|
@@ -1124,6 +1124,12 @@
|
|
|
|
{
|
|
|
|
struct hostent *hp;
|
|
|
|
static char buf[4096];
|
|
|
|
+ static __u32 addr_cache = 0;
|
|
|
|
+
|
|
|
|
+ if ( addr == addr_cache )
|
|
|
|
+ return buf;
|
|
|
|
+
|
|
|
|
+ addr_cache = addr;
|
|
|
|
|
|
|
|
if ((options & F_NUMERIC) ||
|
|
|
|
!(hp = gethostbyaddr((char *)&addr, 4, AF_INET)))
|
|
|
|
--- iputils/ping6.c.addrcache 2002-09-20 17:08:11.000000000 +0200
|
|
|
|
+++ iputils/ping6.c 2003-05-15 16:41:19.000000000 +0200
|
2008-06-03 11:04:03 +00:00
|
|
|
@@ -893,7 +893,12 @@
|
2004-09-09 06:23:07 +00:00
|
|
|
*/
|
|
|
|
char * pr_addr(struct in6_addr *addr)
|
|
|
|
{
|
|
|
|
- struct hostent *hp = NULL;
|
2008-06-03 11:04:03 +00:00
|
|
|
+ static struct hostent *hp;
|
|
|
|
+ static struct in6_addr addr_cache;
|
2004-09-09 06:23:07 +00:00
|
|
|
+
|
2008-06-03 11:04:03 +00:00
|
|
|
+ if (memcmp(addr, &addr_cache, sizeof(addr_cache)) == 0)
|
2004-09-09 06:23:07 +00:00
|
|
|
+ return hp ? hp->h_name : pr_addr_n(addr);
|
2008-06-03 11:04:03 +00:00
|
|
|
+ memcpy(&addr_cache, addr, sizeof(addr_cache));
|
2004-09-09 06:23:07 +00:00
|
|
|
|
|
|
|
if (!(options&F_NUMERIC))
|
|
|
|
hp = gethostbyaddr((__u8*)addr, sizeof(struct in6_addr), AF_INET6);
|