Re: connect() occasionally succeeds improperly to localhost port

David S. Miller (davem@redhat.com)
Sun, 29 Aug 1999 21:14:47 -0700


Date: Mon, 30 Aug 1999 04:00:59 +0000
From: Steve Underwood <steveu@netpage.com.hk>

Eh? Sure you can listen on port X, call to port X, and succeed. Why
does it succeed when there is apparently nobody listening on port
X?

Because at the moment you begin a connect() that
"source_address/source_port/destination_address/destination_port"
unique entity exists and is in SYN_SENT state and thus can be
connected to. Check the RFC's and various BSD implementation, they
allow it too. Better yet see Steven's TCP Illustrated Volume 2, page
956 "Handle simultaneous open or self-connect".

I see about 1 or 2 people every few months who think this is illegal,
it's not.

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.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/