Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!rutgers!brl-adm!adm!bzs@bu-cs.bu.EDU From: bzs@bu-cs.bu.EDU Newsgroups: comp.unix.wizards Subject: problems and suggested fix for route (4.xBSD, x>=2) Message-ID: <4592@brl-adm.ARPA> Date: Sat, 21-Feb-87 19:43:01 EST Article-I.D.: brl-adm.4592 Posted: Sat Feb 21 19:43:01 1987 Date-Received: Sun, 22-Feb-87 03:24:34 EST Sender: news@brl-adm.ARPA Lines: 34 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