Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 2 Dec 2000 23:11:39 +0300
From:      "Mike E. Matsnev" <mike@po.cs.msu.su>
To:        freebsd-net@FreeBSD.ORG
Subject:   TCP sockets connecting to tmeselves
Message-ID:  <20001202231139.A4050@haali.cs.msu.ru>

next in thread | raw e-mail | index | archive | help
While developing an application on linux we discovered that sometimes a tcp
socket would connect to itself on the localhost without any listen calls. I
checked this on different systems and found out that solaris, tru64 and win2k
don't connect the socket to itself, while freebsd and linux exhibit such
strange behaviour. I searched the PR database and found the pr (kern/10826),
describing this very problem. The PR was closed with the words that it's ok and
doesnt break anything. But this feature is actually annoying because sometimes
we want to connect to a server (it can also be localhost), and sometimes when
the imlicit bind() chooses a port number that we want to connect to, the
connection succeeds even when there is no server running. The socket appears to
be connected to itself. Currently we have to do getsockname()+getpeername()
after each connect and check that the addresses are different.

Can we change this behaviour to disallow connects to the same socket on localhost
when bind() is done implicitly by connect()? Currently i don't see any way to
use the feature, even if it is specified in some rfc.

Also what rfc specifies this strange behaviour? I looked through rfc793 and didnt
find any info about "symmetric opens". I also tried tcpdump -i lo0, and saw only
2 packets exchanged: one SYN and one ACK, no SYN+ACK was sent.

/Mike


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001202231139.A4050>