[1907] in linux-net channel archive
Re: Multi-homed hosts
daemon@ATHENA.MIT.EDU (Matthias Urlichs)
Mon Feb 12 13:48:07 1996
From: Matthias Urlichs <smurf@smurf.noris.de>
To: linux-net@vger.rutgers.edu
Date: Mon, 12 Feb 1996 15:10:47 +0100
In linux.dev.net, article <dmb98p.dl7@bigred.inka.de>,
Olaf Titz <olaf@bigred.inka.de> writes:
> Matthias Urlichs <smurf@smurf.noris.de> wrote:
> > Fine, I think, there is an easy solution: hack bind() to replace IN=
ADDR_ANY
> > with the contents of the BIND_INADDR environment variable (if any).
>=20
> Neat idea. Would save me some patches in often-needed software too...
>=20
We're running our News server that way for a week now. No problems so f=
ar,
other than those I initially reported.
> > Problem: Outgoing, you don't usually call bind() at all. Easy solut=
ion:
> > bind(..,INADDR_ANY) when creating a new IP socket.
>=20
> I'd rather like to put the hack in connect() and listen() for TCP soc=
kets.
Hmm. That's a possibility too, but I'd rather modify the socket as soon=
as
it is created. That way, a program which actually checks what it's boun=
d to
might realize that it's _not_ listening to INADDR_ANY, and thus has no
business scanning the interface list and bind an extra socket to every
network address it can find.
> For UDP, this is more problematic. Off-hand, I don't see an easy
> solution.
>=20
That, too.
> > Problem: The kernel doesn't like two bind() calls in a row. Why not=
??? BSD
> > handles that fine, as far as I know, as long as there's no connecti=
on on
> > the socket. Removing the appropriate check from the kernel doesn't =
brerak
> > anything...
>=20
> Right, re-binding should be allowed without getting into any trouble.
>=20
My patches should handle the programs that depend on this behavior. I o=
nly
found the portmapper and mountd, i.e. both could be fixed by the check =
in
bindresvport().
NB, Alan told me that no, BSD doesn't allow two bind()s in a row either=
. I
don't really know why, and haven't verified it, though I do recall an o=
lder
system (Ultrix???) whose documentation explicitly allowed socket()/bind=
()/
/connect()/read-write()/shutdown()/bind()/connect().
--=20
I am a deeply superficial person.
-- Andy Warhol (1928-1987)
--=20
Matthias Urlichs \ XLink-POP N=FCrnberg | EMail: urlichs@smurf.=
noris.de
Schleiermacherstra=DFe 12 \ Unix+Linux+Mac | Phone: ...please use =
email.
90491 N=FCrnberg (Germany) \ Consulting+Networking+Programming+etc'i=
ng 42
PGP: 1B 89 E2 1C 43 EA 80 44 15 D2 29 CF C6 C7 E0 DE=20
Click <A HREF=3D"http://smurf.noris.de/~smurf/finger">here</A>.