[382] in linux-net channel archive
Re: Feature/hack for multi-homed hosts (esp. ifconfig alias)
daemon@ATHENA.MIT.EDU (Eric Packman)
Sat May 27 18:38:49 1995
Date: Sat, 27 May 1995 16:54:51 -0400
From: Eric Packman <eric@micro.org>
To: Ian Jackson <iwj10@cus.cam.ac.uk>
cc: linux-net@vger.rutgers.edu
In-Reply-To: <m0sFKFQ-0000XQZ@chiark.al.cl.cam.ac.uk>
So what is so bad about accepting an incomming TCP connection on all
ports? Obviously, I have missed something. Feel free to fill me in. :)
On Sat, 27 May 1995, Ian Jackson wrote:
> There is currently a small problem when trying to use ifconfig alias
> or dummy devices or just plain multiple interfaces to give their
> machine several IP#'s which respond differently to incoming
> connections.
>
> Most TCP/IP-based programs aren't aware that there is a decision to be
> made about which local address to bind to, and just pass `bind'
> all-zeroes in the IP# field. This causes the resulting socket to
> listen on all the machine's interfaces.
>
> Ultimately, of course, each program should be modified to have a
> configuration option for the local interface to use. However doing
> this to many programs would be tedious at the very least, and in some
> cases impossible (a nice example of this is net-Doom).
>
> How about having an environment variable (IP_BIND_DEFAULT_ADDR or some
> such) which contains the IP address to use ? The C library's `bind'
> call would, if the address type was AF_INET and the IP# was
> all-zeroes, copy the struct and fill in the IP# from
> IP_BIND_DEFAULT_ADDR.
>
> This is the kind of solution that strikes some people as `elegant' and
> others as a `horrible hack'. Perhaps it's both. There is some
> precedent for having environment variables modify the behaviour of
> standard library calls, especially in the TCP/IP context - for
> example, the variable HOSTALIASES used by gethostbyname() and RESOLV_*
> used by the resolver.
>
> (I thought about posting this to the linux-gcc list too, but decided
> to field it here first.)
>
> Ian.
>