A couple of changes of mine that I've been using for a while:
route.c: look up the netname as-is first before the shifted name. this makes a big speed difference, as the lookups are generally local DNS. The shifted names can be very wrong (there is still guessing and fudging involved) and usually go remote, taking a long time to fail. If you have the RFC reccomended netnames in your reverse lookups, this is even faster still. main.c: dont do a sethostent(1) - this is causing the resolver to use a VC (tcp) connection to the resolver, which has more overheads and is slower than the default UDP case. This once made sense when everything was based on text host tables.
This commit is contained in:
parent
05ddff6e30
commit
cc63cd5663
@ -364,12 +364,20 @@ main(argc, argv)
|
||||
printf("%s: no stats routine\n", tp->pr_name);
|
||||
exit(0);
|
||||
}
|
||||
#if 0
|
||||
/*
|
||||
* Keep file descriptors open to avoid overhead
|
||||
* of open/close on each call to get* routines.
|
||||
*/
|
||||
sethostent(1);
|
||||
setnetent(1);
|
||||
#else
|
||||
/*
|
||||
* This does not make sense any more with DNS being default over
|
||||
* the files. Doing a setXXXXent(1) causes a tcp connection to be
|
||||
* used for the queries, which is slower.
|
||||
*/
|
||||
#endif
|
||||
if (iflag) {
|
||||
intpr(interval, nl[N_IFNET].n_value);
|
||||
exit(0);
|
||||
|
@ -36,7 +36,7 @@
|
||||
static char sccsid[] = "From: @(#)route.c 8.6 (Berkeley) 4/28/95";
|
||||
#endif
|
||||
static const char rcsid[] =
|
||||
"$Id: route.c,v 1.8 1995/12/05 07:29:15 julian Exp $";
|
||||
"$Id: route.c,v 1.9 1996/01/14 23:33:13 peter Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -662,8 +662,8 @@ netname(in, mask)
|
||||
net = i & mask;
|
||||
while ((mask & 1) == 0)
|
||||
mask >>= 1, net >>= 1;
|
||||
if (!(np = getnetbyaddr(net, AF_INET)))
|
||||
np = getnetbyaddr(i, AF_INET);
|
||||
if (!(np = getnetbyaddr(i, AF_INET)))
|
||||
np = getnetbyaddr(net, AF_INET);
|
||||
if (np)
|
||||
cp = np->n_name;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user