*BSD News Article 48273


Return to BSD News archive

Path: sserve!euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!simtel!news.sprintlink.net!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!decwrl!pa.dec.com!nntpd.lkg.dec.com!usenet
From: Jon Jenkins <jenkinsj@ozy.dec.com>
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: BIND, DNS and route broken ??
Date: 6 Aug 1995 21:05:12 GMT
Organization: Digital Equipment Corp
Lines: 141
Message-ID: <403aq8$i63@nntpd.lkg.dec.com>
References: <3vmk8a$pgr@nntpd.lkg.dec.com> <401aeu$ine@enigma.uniserve.com>
NNTP-Posting-Host: ozyd13-p3.ozy.dec.com
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 1.1N (X11; I; BSD/386 uname failed)
To: tom@uniserve.com
X-URL: news:401aeu$ine@enigma.uniserve.com

tom@uniserve.com (Tom Samplonius) wrote:
>In article <3vmk8a$pgr@nntpd.lkg.dec.com>, jenkinsj@ozy.dec.com says...
>
>>To cut a long story short I enter a route to the
>>local IP address to use the localhost i.e. lo0.
>
>...
>
>>route add -host ozyd13-pX localhost
>
>  Instead:
>
>ifconfig sl0 ozyd13-pX remote-host-address
>
>route add default remote-host-address

This doen't solve the problem which involved
installing a route to the interface via
the loopback driver for X apps etc so that
local traffic will not go out on the wire
but rather be routed internally vi lo0.

The problem arises because route.c does
a getnetbyname on the hostname. Somewhere
inside the code (I havent had the time
to trace it down yet) a request is made
via a PTR? request which it shouldn't do
UNLESS I have missed something and PTR?
requests can be used for domain info
but Stevens book mentions nothing
of domain requests in PTR? requests.

A PTR? request is used to look up a name
given an ip number address. i.e. in tcpdump a
PTR? 16.153.192.203
request is directed to the namserver should result in a 
PTR ozyd13-p3.ozy.dec.com
response.

However the route code sends the ip name
address instead:
PTR? ozyd13-p3.ozy.dec.com
which of course is non sensical and should
fail which it does.

After the failures are returned from all the 
namservers (about 30 seconds delay) the code
correctly sends an address request:
A? ozyd13-p3.ozy.dec.com
which of course immediately returns
A 16.153.192.203
and the route code proceeds.

The code then proceeds to make exactly
the same error with loopback:
PTR? loopback
which also fails with about a 30 second
delay while the nameservers are polled.

Eventually the correct A? request is
sent to the nameservers and after about
a total of about 60 seconds delay the route code
succeeds in adding the route.


I have temporarily fixed this in my
situation by replacing the name addresses
by their explicit IP addresses.

Note that utilities like host and netstat
etc work fine with no delay because
they correctly format the A? and PTR?
requests.

Here is the problem point in route.c
(I have inserted debug printfs because
gdb causes a reboot in this code, Im
told there is a patch but I haven't got
it yet):

#ifdef MY_DEBUG
                        printf("inet_addr\n");
#endif
        if (((val = inet_addr(s)) != -1) &&  /* fails because name address */
            (which != RTA_DST || forcenet == 0)) {
#ifdef MY_DEBUG
                        printf("inet_addr success\n");
#endif
                su->sin.sin_addr.s_addr = val;
                if (inet_lnaof(su->sin.sin_addr) != INADDR_ANY)
                        return (1);
                else {
                        val = ntohl(val);
                        goto netdone;
                }
        }
#ifdef MY_DEBUG
        printf("return from inet_addr is %d\n",val);
#endif
        if ((val = inet_network(s)) != -1 || /* fails because it is a name */
            ((np = getnetbyname(s)) != NULL && (val = np->n_net) != 0)) {
/*
   opps this is it: getnetbyname causes an incorrect PTR? request !! 
   why? it should look in the /etc/networks file for the official
   netname unless its supposed to use bind to get the netname from
   the nameservers /etc/networks file? 

   Does it use a PTR? request for this ?
*/
netdone:
                if (which == RTA_DST)
                        inet_makenetandmask(val, &su->sin);
                return (0);
        }
#ifdef MY_DEBUG
        printf("return from inet_network is %d\n",val);
        sleep(3);
#endif
/* eventually we get here and it succeeds */
        hp = gethostbyname(s);
        if (hp) {
#ifdef MY_DEBUG
        printf("return from gethos \n",val);
#endif                  

This is as far as I have got in tracking it down.
Im preety busy with other things so it will
have to wait.


Thanks for your mail.

-- 
----------------------------------------------------------------------
Name:      Dr Jon Jenkins    Location: Digital Equipment Corporation NaC
Voice/Fax: 61-7-55-75-0151/100         Burnett Place, Research Park,  
Inet:      jenkinsj@ozy.dec.com        Bond University, Gold Coast
Close Proximity: "HEY YOU !!!"         QLD, AUSTRALIA 4229
"Daddy, what's outside the Universe?" (My 5 year old.....)
-----------------------------------------------------------------------