Re: bind() allowed to non-local addresses

From: Matt Peterson (mpeterson@calderasystems.com)
Date: Thu Oct 19 2000 - 12:35:12 EST


Andi Kleen wrote:
>
> > The JRE compliance tests have a test which makes sure that for a
> > non-local addresses, bind() returns an error code, specifically
> > -EADDRNOTAVAIL.
>
> Sounds like a bug that should be reported to Sun.
>

Hello? Send a bug to Sun? I don't see any logic here. I have traced
through the Sun code all the way to the bind() call and through to the
code in the kernel where the check for local interfaces is ignored. The
JVM code path is VERY simple and ends up in a straightforward call to
bind(). The same problem is easily reproduced in C code. There is NOT
a bug in the JVM code that handles java.net.DatagramSocket. Don't you
find it a little compelling that the nearly identical JVM code passes
the Java Compatibility test suite on Linux 2.2, Solaris, HPUX, SCO, and
even Windows?

I might even go as far as to argue that there is not a problem with the
JCK test suite either. The BSD Socket interface is documented. It may
be a little shady in some areas (this being one of them) but at least
the Sun test suite is expecting the documented (look at any man page or
sockets reference) and long standing behavior of bind(). Any argument
for changing the way bind() works needs to be able to stand up to the
challenge of developers who are expecting bind() to behave the way it
has for many years on many different platforms.

Again, there is not a bug in the JVM's handling of
java.net.DatagramSocket(). I offered the JVM as an example only because
it is one application that I know of expects the standardized behavior
of bind(). The bind() behavior in Linux 2.4 is not an issue because it
affects Java only -- it is an issue because it also affects other
applications and developers that are likewise expecting the traditional
bind() behavior.

-- 
Matthew Peterson
Sr. Software Engineer
Caldera Systems, Inc
mpeterson@caldera.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