View | Details | Raw Unified | Return to bug 818
Collapse All | Expand All

(-)a/src/internet-stack/tcp-l4-protocol.cc (-3 / +6 lines)
 Lines 158-164    Link Here 
158
  aT[LAST_ACK][SEQ_RECV]    = SA (LAST_ACK,    NEW_SEQ_RX);
158
  aT[LAST_ACK][SEQ_RECV]    = SA (LAST_ACK,    NEW_SEQ_RX);
159
  aT[LAST_ACK][APP_CLOSE]   = SA (CLOSED,      NO_ACT);
159
  aT[LAST_ACK][APP_CLOSE]   = SA (CLOSED,      NO_ACT);
160
  aT[LAST_ACK][TIMEOUT]     = SA (CLOSED,      NO_ACT);
160
  aT[LAST_ACK][TIMEOUT]     = SA (CLOSED,      NO_ACT);
161
  aT[LAST_ACK][ACK_RX]      = SA (CLOSED,      APP_CLOSED);
161
  aT[LAST_ACK][ACK_RX]      = SA (LAST_ACK,    NO_ACT);
162
  aT[LAST_ACK][FIN_ACKED]   = SA (CLOSED,      APP_CLOSED);
162
  aT[LAST_ACK][SYN_RX]      = SA (CLOSED,      RST_TX);
163
  aT[LAST_ACK][SYN_RX]      = SA (CLOSED,      RST_TX);
163
  aT[LAST_ACK][SYN_ACK_RX]  = SA (CLOSED,      RST_TX);
164
  aT[LAST_ACK][SYN_ACK_RX]  = SA (CLOSED,      RST_TX);
164
  aT[LAST_ACK][FIN_RX]      = SA (LAST_ACK,    FIN_ACK_TX);
165
  aT[LAST_ACK][FIN_RX]      = SA (LAST_ACK,    FIN_ACK_TX);
 Lines 173-179    Link Here 
173
  aT[FIN_WAIT_1][SEQ_RECV]    = SA (FIN_WAIT_1, NEW_SEQ_RX);
174
  aT[FIN_WAIT_1][SEQ_RECV]    = SA (FIN_WAIT_1, NEW_SEQ_RX);
174
  aT[FIN_WAIT_1][APP_CLOSE]   = SA (FIN_WAIT_1, NO_ACT);
175
  aT[FIN_WAIT_1][APP_CLOSE]   = SA (FIN_WAIT_1, NO_ACT);
175
  aT[FIN_WAIT_1][TIMEOUT]     = SA (FIN_WAIT_1, NO_ACT);
176
  aT[FIN_WAIT_1][TIMEOUT]     = SA (FIN_WAIT_1, NO_ACT);
176
  aT[FIN_WAIT_1][ACK_RX]      = SA (FIN_WAIT_2, NEW_ACK);
177
  aT[FIN_WAIT_1][ACK_RX]      = SA (FIN_WAIT_1, NEW_ACK);
178
  aT[FIN_WAIT_1][FIN_ACKED]   = SA (FIN_WAIT_2, NEW_ACK);
177
  aT[FIN_WAIT_1][SYN_RX]      = SA (CLOSED,     RST_TX);
179
  aT[FIN_WAIT_1][SYN_RX]      = SA (CLOSED,     RST_TX);
178
  aT[FIN_WAIT_1][SYN_ACK_RX]  = SA (CLOSED,     RST_TX);
180
  aT[FIN_WAIT_1][SYN_ACK_RX]  = SA (CLOSED,     RST_TX);
179
  aT[FIN_WAIT_1][FIN_RX]      = SA (CLOSING,    ACK_TX);
181
  aT[FIN_WAIT_1][FIN_RX]      = SA (CLOSING,    ACK_TX);
 Lines 203-209    Link Here 
203
  aT[CLOSING][SEQ_RECV]    = SA (CLOSED,      RST_TX);
205
  aT[CLOSING][SEQ_RECV]    = SA (CLOSED,      RST_TX);
204
  aT[CLOSING][APP_CLOSE]   = SA (CLOSED,      RST_TX);
206
  aT[CLOSING][APP_CLOSE]   = SA (CLOSED,      RST_TX);
205
  aT[CLOSING][TIMEOUT]     = SA (CLOSING,     NO_ACT);
207
  aT[CLOSING][TIMEOUT]     = SA (CLOSING,     NO_ACT);
206
  aT[CLOSING][ACK_RX]      = SA (TIMED_WAIT,  NO_ACT);
208
  aT[CLOSING][ACK_RX]      = SA (CLOSING,     NO_ACT);
209
  aT[CLOSING][FIN_ACKED]   = SA (TIMED_WAIT,  NO_ACT);
207
  aT[CLOSING][SYN_RX]      = SA (CLOSED,      RST_TX);
210
  aT[CLOSING][SYN_RX]      = SA (CLOSED,      RST_TX);
208
  aT[CLOSING][SYN_ACK_RX]  = SA (CLOSED,      RST_TX);
211
  aT[CLOSING][SYN_ACK_RX]  = SA (CLOSED,      RST_TX);
209
  aT[CLOSING][FIN_RX]      = SA (CLOSED,      ACK_TX);
212
  aT[CLOSING][FIN_RX]      = SA (CLOSED,      ACK_TX);
(-)a/src/internet-stack/tcp-socket-impl.cc (-1 / +14 lines)
 Lines 694-699    Link Here 
694
  m_rxWindowSize = tcpHeader.GetWindowSize (); //update the flow control window
694
  m_rxWindowSize = tcpHeader.GetWindowSize (); //update the flow control window
695
695
696
  Events_t event = SimulationSingleton<TcpStateMachine>::Get ()->FlagsEvent (tcpHeader.GetFlags () );
696
  Events_t event = SimulationSingleton<TcpStateMachine>::Get ()->FlagsEvent (tcpHeader.GetFlags () );
697
  // Given an ACK_RX event and FIN_WAIT_1, CLOSING, or LAST_ACK state, 
698
  // we have to check the sequence numbers to determine if the 
699
  // ACK is for the FIN
700
  if ((m_state == FIN_WAIT_1 || m_state == CLOSING 
701
                             || m_state == LAST_ACK) && event == ACK_RX)
702
    {
703
      if (tcpHeader.GetSequenceNumber () == m_nextRxSequence)
704
        {
705
          // This ACK is for the fin, change event to 
706
          // recognize this
707
          event = FIN_ACKED;
708
        }
709
    }
697
  Actions_t action = ProcessEvent (event); //updates the state
710
  Actions_t action = ProcessEvent (event); //updates the state
698
  NS_LOG_DEBUG("Socket " << this << 
711
  NS_LOG_DEBUG("Socket " << this << 
699
               " processing pkt action, " << action <<
712
               " processing pkt action, " << action <<
 Lines 1648-1654    Link Here 
1648
void TcpSocketImpl::Retransmit ()
1661
void TcpSocketImpl::Retransmit ()
1649
{
1662
{
1650
  NS_LOG_FUNCTION (this);
1663
  NS_LOG_FUNCTION (this);
1651
  uint8_t flags = TcpHeader::NONE;
1664
  uint8_t flags = TcpHeader::ACK;
1652
  if (m_state == SYN_SENT) 
1665
  if (m_state == SYN_SENT) 
1653
    {
1666
    {
1654
      if (m_cnCount > 0) 
1667
      if (m_cnCount > 0) 
(-)a/src/internet-stack/tcp-typedefs.h (-2 / +3 lines)
 Lines 56-63    Link Here 
56
  SYN_ACK_RX,   // 8
56
  SYN_ACK_RX,   // 8
57
  FIN_RX,       // 9
57
  FIN_RX,       // 9
58
  FIN_ACK_RX,   // 10
58
  FIN_ACK_RX,   // 10
59
  RST_RX,       // 11
59
  FIN_ACKED,    // 11
60
  BAD_FLAGS,    // 12
60
  RST_RX,       // 12
61
  BAD_FLAGS,    // 13
61
  LAST_EVENT } Events_t;
62
  LAST_EVENT } Events_t;
62
63
63
typedef enum {
64
typedef enum {

Return to bug 818