*BSD News Article 70297


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.cs.su.oz.au!metro!metro!munnari.OZ.AU!spool.mu.edu!agate!howland.reston.ans.net!EU.net!usenet2.news.uk.psi.net!uknet!dispatch.news.demon.net!demon!awfulhak.demon.co.uk!awfulhak.demon.co.uk!awfulhak.demon.co.uk!not-for-mail
From: brian@awfulhak.demon.co.uk (Brian Somers)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Missing level 2 function in unix
Date: 4 Jun 1996 17:33:04 +0100
Organization: Coverform Ltd.
Lines: 38
Message-ID: <4p1og0$rt@anorak.coverform.lan>
X-NNTP-Posting-Host: awfulhak.demon.co.uk
X-Newsreader: TIN [version 1.2 PL2]

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.  My routing tables say that
10.0.1.1/8 is on ed0 (my private lan) and 158.152.17.1/16 is on tun0
(my connection to reality).  This 158.152.17.1/16 interface is also
my default route.  These tun entries are maintained by (ij)ppp in
daemon mode - wait for a packet and make a connection.

If I start nmbd without "-I 10.0.1.1 -B 10.0.1.255" arguments, some
local box goes "who's there" and this causes a phone call.  If I
shut down ppp (ok, I havn't got 158.152.17.1 routing to lo0), I lose
my 158.152.17.1 route, and running xterm on another local machine fails
'cos that local machine can't find my screen - it wants to send to
158.152.17.1 'cos X sets its exported DISPLAY to awfulhak.demon.co.uk.

Surely these programs should be using a function similar to the above.
What is my address when I want to talk to a given host - ie, if I
want to talk to 10.0.1.*, my IP is 10.0.1.1 (the ifa for that interface),
when I want to talk to xxxxx, my IP is whatever the IP is on the
interface that I would use to get to xxxxx.

Any comments ?  I don't know of any way that samba or X could get this
right without doing some serious examining of the routing tables, but
with the above function (passing the target IP and getting back my IP)
it could all work....

--
Brian <brian@awfulhak.demon.co.uk>
Don't _EVER_ lose your sense of humour....