*BSD News Article 70481


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.mira.net.au!news.mel.connect.com.au!munnari.OZ.AU!spool.mu.edu!howland.reston.ans.net!Germany.EU.net!zib-berlin.de!irz401!uriah.heep!news
From: j@uriah.heep.sax.de (J Wunsch)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: Missing level 2 function in unix
Date: 31 May 1996 17:49:00 GMT
Organization: Private BSD site, Dresden
Lines: 40
Message-ID: <4onbec$df@uriah.heep.sax.de>
References: <4p1og0$rt@anorak.coverform.lan>
Reply-To: joerg_wunsch@uriah.heep.sax.de (Joerg Wunsch)
NNTP-Posting-Host: localhost.heep.sax.de
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Newsreader: knews 0.9.6
X-Phone: +49-351-2012 669
X-PGP-Fingerprint: DC 47 E6 E4 FF A6 E9 8F  93 21 E0 7D F9 12 D6 4E

brian@awfulhak.demon.co.uk (Brian Somers) wrote:

> I've had various problems with IP numbers in the past, and have been
> forced to re-visit them recently with samba.  I have deduced that there
> is one missing OS function call...
> 
> 	struct hostent *gethostforotherhost( struct hostent * )
> 
> The problem is with things such as X and samba looking up my hostname
> with gethostent().
> 
> My setup is that my "official" hostname (returned by hostname(1)) is
> awfulhak.demon.co.uk, IP 158.152.17.1.  My local network has an ifa
> of awfulhak.coverform.lan, IP 10.0.1.1.

Ah, samba is also suffering from the multihomed host syndrome...

Talk used to be the most prominent offender in this field, along with
NFS in some respects.

Basically, what all these programs are doing wrong is to pick the
first address entry as obtained by a gethostbyfoo() lookup, instead of
picking the _correct_ entry out of the address list.  They actually
don't even need to ask DNS for this, instead, it's possible to request
this information from an actual IP connection.

Garrett Wollman contributed an non-obvious but excellent method to
find out about the IP address a remote peer can be reached across.
It's in /usr/share/examples/find_interface, but alas, only in
2.2-current.  I've integrated his method into talk(1) later, and i'm
able to talk directly to the Internet since without logging into a
proxy host first.  (I'm in about the same situation as you regarding
the local ethernet.)

-- 
cheers, J"org

joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)