Describe the bug
The TCP state machine incorrectly transitions from eCONNECT_SYN (SYN-SENT) to eCLOSE_WAIT in error scenarios. Per RFC 793, connections that fail during establishment should transition to eCLOSED, not eCLOSE_WAIT.
|
if( pxSocket->u.xTCP.eTCPState != eCONNECT_SYN ) |
|
{ |
|
/* The connection is in a state other than SYN. */ |
|
pxNetworkBuffer = NULL; |
|
|
|
/* prvTCPSendRepeated() will only create a network buffer if necessary, |
|
* i.e. when data must be sent to the peer. */ |
|
lResult = prvTCPSendRepeated( pxSocket, &pxNetworkBuffer ); |
|
|
|
if( pxNetworkBuffer != NULL ) |
|
{ |
|
vReleaseNetworkBufferAndDescriptor( pxNetworkBuffer ); |
|
} |
|
} |
|
else |
|
{ |
|
if( pxSocket->u.xTCP.ucRepCount >= 3U ) |
|
{ |
|
/* The connection is in the SYN status. The packet will be repeated |
|
* to most 3 times. When there is no response, the socket get the |
|
* status 'eCLOSE_WAIT'. */ |
|
FreeRTOS_debug_printf( ( "Connect: giving up %xip:%u\n", |
|
( unsigned ) pxSocket->u.xTCP.xRemoteIP.ulIP_IPv4, /* IP address of remote machine. */ |
|
pxSocket->u.xTCP.usRemotePort ) ); /* Port on remote machine. */ |
|
vTCPStateChange( pxSocket, eCLOSE_WAIT ); |
RFC 793 Compliance Issue
RFC 793 specifies that SYN-SENT state errors/timeouts should transition to CLOSED, not CLOSE-WAIT.
Describe the bug
The TCP state machine incorrectly transitions from
eCONNECT_SYN(SYN-SENT) toeCLOSE_WAITin error scenarios. Per RFC 793, connections that fail during establishment should transition toeCLOSED, noteCLOSE_WAIT.FreeRTOS-Plus-TCP/source/FreeRTOS_TCP_Transmission.c
Lines 115 to 139 in 22c095e
RFC 793 Compliance Issue
RFC 793 specifies that SYN-SENT state errors/timeouts should transition to CLOSED, not CLOSE-WAIT.