From 7ff19458de3abc2e8a0a648548b1b7b0a1a5192e Mon Sep 17 00:00:00 2001 From: Paul Traina Date: Fri, 13 Sep 1996 18:47:03 +0000 Subject: [PATCH] Receipt of two SYN's are sufficient to set the t_timer[TCPT_KEEP] to "keepidle". this should not occur unless the connection has been established via the 3-way handshake which requires an ACK Submitted by: jmb Obtained from: problem discussed in Stevens vol. 3 --- sys/netinet/tcp_input.c | 18 ++++++++++++------ sys/netinet/tcp_reass.c | 18 ++++++++++++------ 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 67f57168719e..329cf2504931 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)tcp_input.c 8.12 (Berkeley) 5/24/95 - * $Id: tcp_input.c,v 1.45 1996/05/02 05:31:12 fenner Exp $ + * $Id: tcp_input.c,v 1.46 1996/05/02 05:54:12 fenner Exp $ */ #ifndef TUBA_INCLUDE @@ -450,7 +450,8 @@ findpcb: * Reset idle time and keep-alive timer. */ tp->t_idle = 0; - tp->t_timer[TCPT_KEEP] = tcp_keepidle; + if (TCPS_HAVEESTABLISHED(tp->t_state)) + tp->t_timer[TCPT_KEEP] = tcp_keepidle; /* * Process options if not in LISTEN state, @@ -832,9 +833,10 @@ findpcb: tp->t_state = TCPS_FIN_WAIT_1; tp->t_flags &= ~TF_NEEDFIN; tiflags &= ~TH_SYN; - } else + } else { tp->t_state = TCPS_ESTABLISHED; - + tp->t_timer[TCPT_KEEP] = tcp_keepidle; + } } else { /* * Received initial SYN in SYN-SENT[*] state => simul- @@ -859,8 +861,10 @@ findpcb: if (tp->t_flags & TF_NEEDFIN) { tp->t_state = TCPS_FIN_WAIT_1; tp->t_flags &= ~TF_NEEDFIN; - } else + } else { tp->t_state = TCPS_ESTABLISHED; + tp->t_timer[TCPT_KEEP] = tcp_keepidle; + } tp->t_flags |= TF_NEEDSYN; } else tp->t_state = TCPS_SYN_RECEIVED; @@ -1183,8 +1187,10 @@ trimthenstep6: if (tp->t_flags & TF_NEEDFIN) { tp->t_state = TCPS_FIN_WAIT_1; tp->t_flags &= ~TF_NEEDFIN; - } else + } else { tp->t_state = TCPS_ESTABLISHED; + tp->t_timer[TCPT_KEEP] = tcp_keepidle; + } /* * If segment contains data or ACK, will call tcp_reass() * later; if not, do so now to pass queued data to user. diff --git a/sys/netinet/tcp_reass.c b/sys/netinet/tcp_reass.c index 67f57168719e..329cf2504931 100644 --- a/sys/netinet/tcp_reass.c +++ b/sys/netinet/tcp_reass.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)tcp_input.c 8.12 (Berkeley) 5/24/95 - * $Id: tcp_input.c,v 1.45 1996/05/02 05:31:12 fenner Exp $ + * $Id: tcp_input.c,v 1.46 1996/05/02 05:54:12 fenner Exp $ */ #ifndef TUBA_INCLUDE @@ -450,7 +450,8 @@ findpcb: * Reset idle time and keep-alive timer. */ tp->t_idle = 0; - tp->t_timer[TCPT_KEEP] = tcp_keepidle; + if (TCPS_HAVEESTABLISHED(tp->t_state)) + tp->t_timer[TCPT_KEEP] = tcp_keepidle; /* * Process options if not in LISTEN state, @@ -832,9 +833,10 @@ findpcb: tp->t_state = TCPS_FIN_WAIT_1; tp->t_flags &= ~TF_NEEDFIN; tiflags &= ~TH_SYN; - } else + } else { tp->t_state = TCPS_ESTABLISHED; - + tp->t_timer[TCPT_KEEP] = tcp_keepidle; + } } else { /* * Received initial SYN in SYN-SENT[*] state => simul- @@ -859,8 +861,10 @@ findpcb: if (tp->t_flags & TF_NEEDFIN) { tp->t_state = TCPS_FIN_WAIT_1; tp->t_flags &= ~TF_NEEDFIN; - } else + } else { tp->t_state = TCPS_ESTABLISHED; + tp->t_timer[TCPT_KEEP] = tcp_keepidle; + } tp->t_flags |= TF_NEEDSYN; } else tp->t_state = TCPS_SYN_RECEIVED; @@ -1183,8 +1187,10 @@ trimthenstep6: if (tp->t_flags & TF_NEEDFIN) { tp->t_state = TCPS_FIN_WAIT_1; tp->t_flags &= ~TF_NEEDFIN; - } else + } else { tp->t_state = TCPS_ESTABLISHED; + tp->t_timer[TCPT_KEEP] = tcp_keepidle; + } /* * If segment contains data or ACK, will call tcp_reass() * later; if not, do so now to pass queued data to user.