From owner-freebsd-net Sat Dec 2 12:11:54 2000 Delivered-To: freebsd-net@freebsd.org Received: from haali.cs.msu.ru (haali.po.cs.msu.su [158.250.16.1]) by hub.freebsd.org (Postfix) with ESMTP id 30EDF37B401 for ; Sat, 2 Dec 2000 12:11:51 -0800 (PST) Received: (from mike@localhost) by haali.cs.msu.ru (8.9.3/8.9.3) id XAA04096 for freebsd-net@FreeBSD.ORG; Sat, 2 Dec 2000 23:11:39 +0300 (MSK) (envelope-from mike) Date: Sat, 2 Dec 2000 23:11:39 +0300 From: "Mike E. Matsnev" To: freebsd-net@FreeBSD.ORG Subject: TCP sockets connecting to tmeselves Message-ID: <20001202231139.A4050@haali.cs.msu.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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