From owner-freebsd-bugs Sat Mar 27 21:20:20 1999 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 2C57D14E00 for ; Sat, 27 Mar 1999 21:20:19 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.2/8.9.2) id VAA37458; Sat, 27 Mar 1999 21:20:01 -0800 (PST) (envelope-from gnats@FreeBSD.org) Date: Sat, 27 Mar 1999 21:20:01 -0800 (PST) Message-Id: <199903280520.VAA37458@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Per Kristian Hove Subject: Re: kern/10826: TCP connection looped back to itself Reply-To: Per Kristian Hove Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The following reply was made to PR kern/10826; it has been noted by GNATS. From: Per Kristian Hove To: chris@calldei.com Cc: FreeBSD-gnats-submit@FreeBSD.ORG Subject: Re: kern/10826: TCP connection looped back to itself Date: Sun, 28 Mar 1999 07:14:36 +0200 (MET DST) On Sat, 27 Mar 1999, Chris Costello wrote: > How is this a bug? It behaves how it should, doesn't it? If it does, I'm sorry I've taken up your time on something that isn't a bug. I'm not at all a networking guru, it just seemed strange to me to get a connection when nothing should be listening to that port. But when setting net.inet.tcp.log_in_vin = 1 and try to connect to port 3434, I see in my logs Connection attempt to TCP 127.0.0.1:3434 from 127.0.0.1:3460 and when I then try to connect to port 3461 (the "outgoing" port number increases by 1 for every connection attempt), that succeeds. So what seemed random, it's not random at all. I thought you had to explicitly listen() [and then accept()] in order to accept connections. But connect()ing on a socket makes it accept incoming connections? (And yes, I'm no programmer either). This is how I thought it worked: When I connect to the port, a port is allocated locally in the local end of the connection. Then a SYN is sent to the remote end, and if I get a (SYN | ACK) in return, I will get connected to the destination end. If I should get just a (SYN | ~ACK), I shouldn't get connected to the remote end. I only send a SYN (to myself, by accident, cause the port number is the same in both ends of the connection), and since I'm sending it to myself, I also think that I'm receiving it. But since it's just a SYN, and not a (SYN | ACK), I shouldn't accept that it's a valid response to my original SYN. It seems like FreeBSD reads the SYN as 'okay, let him have a connection'. -- per kristian To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message