Date: Thu, 29 Nov 2001 00:37:39 -0600 (CST) From: Jonathan Lemon <jlemon@flugsvamp.com> To: cfliu@csie.nctu.edu.tw, net@freebsd.org Subject: Re: Does 4.4 FreeBSD kernel supports TCP simultaneous open? Message-ID: <200111290637.fAT6bd213755@prism.flugsvamp.com> In-Reply-To: <local.mail.freebsd-net/20011129043524$01c0@prism.flugsvamp.com>
next in thread | previous in thread | raw e-mail | index | archive | help
In article <local.mail.freebsd-net/20011129043524$01c0@prism.flugsvamp.com> you write:
>-=-=-=-=-=-
>
>Hi, I am tracing the FreeBSD 4.4 kernel and I found that its TCP seems
>NOT be able to do simultaneous open according to the source code. In
>tcp_input.c, even though code near line #1750,
>
>case TCPS_SYN_RECEIVED:
> .....
> if (tp->t_flags & TF_NEEDFIN) {
> tp->t_state = TCPS_FIN_WAIT_1;
> tp->t_flags &= ~TF_NEEDFIN;
> } else {
> tp->t_state = TCPS_ESTABLISHED;
> callout_reset(tp->tt_keep, tcp_keepidle,
> tcp_timer_keep, tp);
> }
>
>do change state from SYN_RCVD state to ESTABLISHED, however, near line
>1700 , the code fragment
>
>if (thflags & TH_SYN) {
> tp = tcp_drop(tp, ECONNRESET);
> rstreason = BANDLIM_UNLIMITED;
> goto dropwithreset;
> }
>
>
> drops a packet with SYN bit set in SYN_RCVD state. I think this would
>break TCP's simultaneous open.
>
>Since upon receiving a SYN segment in SYN_SENT state, TCP switches to
>SYN_RCVD state and sends a (ACK,SYN) segment to the peer, if the peer
>drops segments with SYN bit set during SYN_RCVD state, the simultaneous
>open mechanism of TCP would break.
>
>Am I correct?
No. In this case, there are 3 distinct state transitions:
A. send SYN. CLOSED -> SYN_SENT
B. recv SYN. SYN_SENT -> SYN_RECEIVED
C. recv ACK. SYN_RECIEVED -> ESTABLISHED
So dropping a connection when receiving a SYN packet in the SYN_RECEIVED
state is the correct thing to do; this is would be a duplicate SYN. For
a simultaneous open, the peer's SYN is received when the local state is
SYN_SENT.
The error in your logic above is that in step B, only an ACK is sent to
the peer, the SYN is not retransmitted as well.
--
Jonathan
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?200111290637.fAT6bd213755>
