Pointer: connect to 127.x.y.z succeeds

Matthias Andree (matthias.andree@gmx.de)
Thu, 19 Sep 2002 03:44:17 +0200


There's a slight difference between Linux and FreeBSD. Assume each is
configured so that the loopback device is 127.0.0.1/8. Linux will then
accept a connect to 127.126.125.124, FreeBSD will instead say
EADDRNOTAVAIL:

"49 EADDRNOTAVAIL Cannot assign requested address. Normally results
from an attempt to create a socket with an address not on this
machine." (FreeBSD 4.7-PRERELEASE errno(2) man page)

While the routing decision seems right with automatic routes, it's
strange that Linux accepts a connection on an IP that is not configured.
Would it be feasible that Linux looks at the destination IP before
accepting a connection on the lo interface?

This may also be related to the issue raised some time ago that Linux
lets you connect to any local IP from any interface by default, so that
eth0 clients can connect to the eth2 IP even when the route is removed.
I believe Felix von Leitner complained about this behaviour.

I'd appreciate documentation pointers on this discussion as I believe
this has been mentioned before, yet I don't recall enough to feed Google
with a decent search.

-- 
Matthias Andree
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/