|
@@ -384,7 +384,6 @@ void tcp_expired ( struct retry_timer *timer, int over ) {
|
384
|
384
|
case TCP_SYN_SENT:
|
385
|
385
|
if ( over ) {
|
386
|
386
|
tcp_trans ( conn, TCP_CLOSED );
|
387
|
|
- stop_timer ( &conn->timer );
|
388
|
387
|
DBG ( "Timeout! Connection closed\n" );
|
389
|
388
|
return;
|
390
|
389
|
}
|
|
@@ -392,7 +391,6 @@ void tcp_expired ( struct retry_timer *timer, int over ) {
|
392
|
391
|
case TCP_SYN_RCVD:
|
393
|
392
|
if ( over ) {
|
394
|
393
|
tcp_trans ( conn, TCP_CLOSED );
|
395
|
|
- stop_timer ( &conn->timer );
|
396
|
394
|
goto send_tcp_nomsg;
|
397
|
395
|
}
|
398
|
396
|
goto send_tcp_nomsg;
|
|
@@ -417,7 +415,6 @@ void tcp_expired ( struct retry_timer *timer, int over ) {
|
417
|
415
|
return;
|
418
|
416
|
case TCP_TIME_WAIT:
|
419
|
417
|
tcp_trans ( conn, TCP_CLOSED );
|
420
|
|
- stop_timer ( &conn->timer );
|
421
|
418
|
return;
|
422
|
419
|
}
|
423
|
420
|
/* Retransmit the data */
|
|
@@ -632,6 +629,10 @@ int tcp_senddata ( struct tcp_connection *conn ) {
|
632
|
629
|
/* Call the senddata() call back function */
|
633
|
630
|
conn->tcp_op->senddata ( conn, conn->tx_pkb->data,
|
634
|
631
|
pkb_available ( conn->tx_pkb ) );
|
|
632
|
+ /* Send pure ACK if senddata() didn't call tcp_send() */
|
|
633
|
+ if ( conn->tx_pkb ) {
|
|
634
|
+ tcp_send ( conn, TCP_NOMSG, TCP_NOMSG_LEN );
|
|
635
|
+ }
|
635
|
636
|
return 0;
|
636
|
637
|
}
|
637
|
638
|
|
|
@@ -685,7 +686,8 @@ int tcp_send ( struct tcp_connection *conn, const void *data, size_t len ) {
|
685
|
686
|
/* Start the timer */
|
686
|
687
|
if ( ( conn->tcp_state == TCP_ESTABLISHED && conn->tcp_lstate == TCP_SYN_SENT ) ||
|
687
|
688
|
( conn->tcp_state == TCP_LISTEN && conn->tcp_lstate == TCP_SYN_RCVD ) ||
|
688
|
|
- ( conn->tcp_state == TCP_CLOSED && conn->tcp_lstate == TCP_SYN_RCVD ) ) {
|
|
689
|
+ ( conn->tcp_state == TCP_CLOSED && conn->tcp_lstate == TCP_SYN_RCVD ) ||
|
|
690
|
+ ( conn->tcp_state == TCP_ESTABLISHED && ( len == 0 ) ) ) {
|
689
|
691
|
// Don't start the timer
|
690
|
692
|
} else {
|
691
|
693
|
start_timer ( &conn->timer );
|
|
@@ -912,13 +914,10 @@ static int tcp_rx ( struct pk_buff *pkb,
|
912
|
914
|
ntohl ( tcphdr->seq ), conn->rcv_nxt );
|
913
|
915
|
}
|
914
|
916
|
|
915
|
|
- /* Send an ACK only if required to */
|
916
|
|
- if ( conn->rcv_nxt <= ntohl ( tcphdr->seq ) ) {
|
917
|
|
- /* Acknowledge new data */
|
918
|
|
- conn->tcp_flags |= TCP_ACK;
|
919
|
|
- if ( !( tcphdr->flags & TCP_ACK ) ) {
|
920
|
|
- goto send_tcp_nomsg;
|
921
|
|
- }
|
|
917
|
+ /* Acknowledge new data */
|
|
918
|
+ conn->tcp_flags |= TCP_ACK;
|
|
919
|
+ if ( !( tcphdr->flags & TCP_ACK ) ) {
|
|
920
|
+ goto send_tcp_nomsg;
|
922
|
921
|
}
|
923
|
922
|
}
|
924
|
923
|
|