1 --- iputils/ping.c.addrcache 2002-09-20 17:08:11.000000000 +0200
2 +++ iputils/ping.c 2003-05-15 16:41:19.000000000 +0200
7 + static __u32 addr_cache = 0;
9 + if ( addr == addr_cache )
14 if ((options & F_NUMERIC) ||
15 !(hp = gethostbyaddr((char *)&addr, 4, AF_INET)))
16 --- iputils/ping6.c.addrcache 2002-09-20 17:08:11.000000000 +0200
17 +++ iputils/ping6.c 2003-05-15 16:41:19.000000000 +0200
20 char * pr_addr(struct in6_addr *addr)
22 - struct hostent *hp = NULL;
23 + static struct hostent *hp;
24 + static struct in6_addr addr_cache;
26 + if (memcmp(addr, &addr_cache, sizeof(addr_cache)) == 0)
27 + return hp ? hp->h_name : pr_addr_n(addr);
28 + memcpy(&addr_cache, addr, sizeof(addr_cache));
30 if (!(options&F_NUMERIC))
31 hp = gethostbyaddr((__u8*)addr, sizeof(struct in6_addr), AF_INET6);