Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 27 Mar 1999 21:20:01 -0800 (PST)
From:      Per Kristian Hove <perhov@phys.ntnu.no>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: kern/10826: TCP connection looped back to itself
Message-ID:  <199903280520.VAA37458@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/10826; it has been noted by GNATS.

From: Per Kristian Hove <perhov@phys.ntnu.no>
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                                       <perhov@phys.ntnu.no>
 
 
 


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




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