|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
Subject: Re: how to bind smtp client to specific address?
From: Grendel (grendel
vip.net.pl)Date: Sat Apr 01 2000 - 12:36:30 CST
- Next message: Michael Schwager: "Re: Header logging, revisited"
- Previous message: Michael Schwager: "Re: Header logging, revisited"
- In reply to: Greg Stark: "Re: how to bind smtp client to specific address?"
- Reply: Grendel: "Re: how to bind smtp client to specific address?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
** On Apr 01, Greg Stark scribbled:
[snip]
> It doesn't really matter what linux considers its interfaces for purposes of
> this discussion. The important fact is that linux is not implementing the
> bind(2) system call correctly. The program has called bind(2) with a
> particular "interface" and by that I mean a particular address on the network,
> and the OS has happily sent it out with a different source address.
Oh? Take a look at the output of a simple program that binds a socket to
several "interfaces" on eth0 on my machine. .130 is the primary interface,
the rest are aliases. This is a modified sample program from the glibc2
sources (inetsrv.c + mkisock.c):
$ ./tst
Trying to bind to 0.0.0.0
Bound socket address: 0.0.0.0:5555
Trying to bind to 195.216.103.130
Bound socket address: 195.216.103.130:5556
Trying to bind to 195.216.103.132
Bound socket address: 195.216.103.132:5557
Trying to bind to 195.216.103.133
Bound socket address: 195.216.103.133:5558
eth0 is 195.216.103.130
eth0:1 is 195.216.103.132
eth0:2 is 195.216.103.133
eth0 IS the interface, the rest are only labels+ADDRESSES. One interface
with THREE addresses, and not THREE interfaces. If you bind to a specified
address, then that's what you get in return. If you bind to 0.0.0.0 you bind
to all the addresses assigned to that interface - whichever receives the
incoming request, that's where you will answer it. If you bind to 0.0.0.0
and send something somewhere, then the routing determines what your source
address will be. If you have several addresses on one interface and, for
example, you do 'telnet yourhost 25' then you'll appear to be coming from
the yourhost IP number. If you do 'telnet yourvirtualhost 25' then you'll
have the yourvirtualhost's IP _if it is one of addresses assigned to one of
your _interfaces_'. The kernel is free to chose the IP for you in that case,
since you told it so.
[snip]
> I find it really hard to believe these posters that linux's network stack is
good, because it isn't
> this broken in this regard. Each alias really has to be considered a distinct
> interfae for purposes of the userland tcp/ip interface, otherwise all sorts of
no. It should be considered just a separate _address_. There is no such
thing as an _alias_ creates an _interface_. There's just another IP assigned
to an interface and labelled with some nome of your choice.
> things will break. Not doing so would violate dozens of specifications all
> over the place.
How? Applications connect to some address not to some interface. They don't
care whether the address is assigned to ethernet device, a slip device, a
tunnel, a ppp device, an isdn device or whatever other devices we have.
> Incidentally this seems like a really painful interface, what if you want a
> different MTU or even a different MAC address for that matter for each alias.
MAC? How come?
> Is there also a provision for setting up real virtual interfaces as well?
Can you define the term _real virtual interface_, please?
marek
- application/pgp-signature attachment: stored
- Next message: Michael Schwager: "Re: Header logging, revisited"
- Previous message: Michael Schwager: "Re: Header logging, revisited"
- In reply to: Greg Stark: "Re: how to bind smtp client to specific address?"
- Reply: Grendel: "Re: how to bind smtp client to specific address?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]