problems and suggested fix for route (4.xBSD, x>=2)
bzs at bu-cs.bu.EDU
bzs at bu-cs.bu.EDU
Sun Feb 22 10:43:01 AEST 1987
The route program will always call gethostbyname(), even if you
provide numeric internet addresses. This can be a problem if you use
some form of name server and/or yellow pages distributed service. How
do you fix a route to the name server?
Anyhow, it can even be a nuisance if things are very slow for some
reason and it's particularly insidious when used in rc boot files
as the name server may be on the same machine and initializing which
can really slow down a simple request to poke a default route or
some such, or worse.
You get the picture.
I threw together a version of route I call nroute which is very
simple, assumes only d.d.d.d format addresses and AF_INET thus never
needing to speak to anyone to just poke a route (use the inet(3)
routines to xlate the numbers.)
Unfortunately it's hugely ripped out of the 4.2 route.c source so I am
loathe to just send it out, but perhaps the thought was worthwhile and
it would be simple to write the same thing with or without sources
(hint: see net/route.h, fill in the rt_gateway, rt_dst stuff and the
rt_flags field [with at least RTF_UP and either |RTF_GATEWAY (metric > 0)
or |RTF_HOST] of an rtentry struct and then call ioctl on an
AF_INET,SOCK_RAW socket with either SIOCADDRT or SIOCDELRT [add/delete
respectively] and the address of the rt_entry.])
By the way, anyone else notice that, (both 4.2, 4.3 if I read right),
the metric is only checked for zero/gtr-zero to set the RTF_GATEWAY
flag? Interesting. The documentation alludes to this but the term
'metric' might be misleading (hop count?)
-Barry Shein, Boston University
More information about the Comp.unix.wizards
mailing list