FullTcpAgent::recv()
*** 1784,1789 ****
--- 1828,1842 ----
goto step6;
case TCPS_LAST_ACK:
+ /*
+ * The only way we're in LAST_ACK is if we've already
+ * received a FIN, so ignore all retranmitted FINS.
+ * -M. Weigle 7/23/02
+ */
+ if (tiflags & TH_FIN) {
+ goto drop;
+ }
+ break;
case TCPS_CLOSING:
break;
} /* end switch(state_) */
FullTcpAgent::timeout()
*** 2486,2492 ****
FullTcpAgent::timeout(int tno)
{
! if (state_ == TCPS_CLOSED || state_ == TCPS_LISTEN) {
// shouldn't be getting timeouts here
fprintf(stderr, "%f: FullTcpAgent(%s): unexpected timeout %d in state %s\n",
now(), name(), tno, statestr(state_));
--- 2549,2559 ----
FullTcpAgent::timeout(int tno)
{
! /*
! * Due to F. Hernandez-Campos' fix in recv(), we may send an ACK
! * while in the CLOSED state. -M. Weigle 7/24/01
! */
! if (state_ == TCPS_LISTEN) {
// shouldn't be getting timeouts here
fprintf(stderr, "%f: FullTcpAgent(%s): unexpected timeout %d in state %s\n",
now(), name(), tno, statestr(state_));
FullTcpAgent::recv()
*** 1921,1930 ****
}
if ((tiflags & TH_ACK) == 0) {
! fprintf(stderr, "%f: FullTcpAgent::recv(%s) got packet lacking ACK (state:%d): ",
! now(), name(), state_);
! prpkt(pkt);
! goto drop;
}
/*
--- 1974,1993 ----
}
if ((tiflags & TH_ACK) == 0) {
! /*
! * Added check for state != SYN_RECEIVED. We will receive a
! * duplicate SYN in SYN_RECEIVED when our SYN/ACK was dropped.
! * We should just ignore the duplicate SYN (our timeout for
! * resending the SYN/ACK is about the same as the client's
! * timeout for resending the SYN), but give no error message.
! * -M. Weigle 07/24/01
! */
! if (state_ != TCPS_SYN_RECEIVED) {
! fprintf(stderr, "%f: FullTcpAgent::recv(%s) got packet lacking ACK (state:%d): ",
! now(), name(), state_);
! prpkt(pkt);
! }
! goto drop;
}
/*
FullTcpAgent::recv()
*** 1461,1466 ****
--- 1494,1510 ----
//prpkt(pkt);
//}
+ /*
+ * Acknowledge FIN from passive closer even in TCPS_CLOSED state
+ * (since we lack TIME_WAIT state and RST packets,
+ * the loss of the FIN packet from the passive closer will make that
+ * endpoint retransmit the FIN forever)
+ * -F. Hernandez-Campos 8/6/00
+ */
+ if ( (state_ == TCPS_CLOSED) && (tiflags & TH_FIN) ) {
+ goto dropafterack;
+ }
+
/*
* Don't expect to see anything while closed
*/