Re: bind() allowed to non-local addresses

From: David S. Miller (davem@redhat.com)
Date: Thu Oct 19 2000 - 11:35:20 EST


   Date: Thu, 19 Oct 2000 18:30:22 +0200
   From: Andi Kleen <ak@suse.de>

   On Thu, Oct 19, 2000 at 09:02:12AM -0700, David S. Miller wrote:
> I'll say it again, if you have to make changes to apps/servers the
> feature does not make any sense. It must operate transparently or
> not at all.

   Why? Linux historically required always some changes to port programs
   (e.g. UDP or accept error behaviour), one socket option more for some
   very special cases is not too bad.

So you propose people should be required to port working programs
between different Linux versions :-)

> Therefore for the case you mention, for now they live without
> non-local binds, period.

   The other guy unfortunately did not describe how exactly the java
   fails, so I cannot say what is worse.

The JRE compliance tests have a test which makes sure that for a
non-local addresses, bind() returns an error code, specifically
-EADDRNOTAVAIL.

> Andi, listen to what you propose, LD_PRELOAD hacks to force programs
> to set some magic socket option, and this is a real solution?

   LD_PRELOAD for binary only programs, patches for free software.

User level binary compatability is everything, and why I have to
revert this change in the first place.

By your reasoning here, what I really should do is leave the 2.4.x
"bind() allows non-local address" behavior and require people to use
LD_PRELOAD based bind() wrappers which do the local address check
before making the system call on 2.4.x systems. This would fix the
JRE, and binary-only programs with this issue, right?

> The current situation is one chooses between %100 anally compliant
> Java or truly dynamic address friendly bind(). :-)

   Analy compliant java can use the setsockopt without LD_PRELOAD.

No, existing binaries must function properly. Because there is
precedence on our 2.2.x behavior, and we are knowledgable about the
userland dependencies that do in fact exist.

Java isn't the only case, I have in fact seen code which tries to
figure out whether XSHM pixmaps should be used by doing a bind() call
using the X server's address.

It isn't pretty, but it's pretty much been around longer than Linux.
:-)

Later,
David S. Miller
davem@redhat.com
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Oct 23 2000 - 21:00:15 EST