Fix mixed tabs and spaces in the latest TCP patches.

pull/4/head
Richard Barry 7 years ago
parent e2750cd388
commit 97a686b2e1

@ -471,7 +471,7 @@ TickType_t xIdentifier = 0;
}
#endif
if( ulIPAddress == 0UL && 0 != xIdentifier )
if( ( ulIPAddress == 0UL ) && ( 0 != xIdentifier ) )
{
ulIPAddress = prvGetHostByName( pcHostName, xIdentifier, xReadTimeOut_ms );
}
@ -699,11 +699,11 @@ static const DNSMessage_t xDefaultPartDNSHeader =
else
{
/* pucByte points to the full name. Walk over the string. */
while( NULL != pucByte && *pucByte != 0x00 && xSourceLen > 1 )
while( ( NULL != pucByte ) && ( *pucByte != 0x00 ) && ( xSourceLen > 1 ) )
{
/* If this is not the first time through the loop, then add a
separator in the output. */
if( xNameLen > 0 && xNameLen < xDestLen - 1 )
if( ( xNameLen > 0 ) && ( xNameLen < ( xDestLen - 1 ) ) )
{
pcName[ xNameLen++ ] = '.';
}
@ -773,7 +773,7 @@ static uint8_t *prvSkipNameField( uint8_t *pucByte, size_t xSourceLen )
else
{
/* pucByte points to the full name. Walk over the string. */
while( *pucByte != 0x00 && xSourceLen > 1 )
while( ( *pucByte != 0x00 ) && ( xSourceLen > 1 ) )
{
xChunkLength = *pucByte + 1;
@ -1055,8 +1055,7 @@ uint16_t x, usDataLength, usQuestions;
if( ( xBufferAllocFixedSize == pdFALSE ) && ( pxNetworkBuffer != NULL ) )
{
BaseType_t xDataLength = xBufferLength + sizeof( UDPHeader_t ) +
sizeof( EthernetHeader_t ) + sizeof( IPHeader_t );
BaseType_t xDataLength = xBufferLength + sizeof( UDPHeader_t ) + sizeof( EthernetHeader_t ) + sizeof( IPHeader_t );
/* The field xDataLength was set to the length of the UDP payload.
The answer (reply) will be longer than the request, so the packet
@ -1341,8 +1340,7 @@ TickType_t xTimeoutTime = pdMS_TO_TICKS( 200 );
{
BaseType_t x;
BaseType_t xFound = pdFALSE;
uint32_t ulCurrentTimeSeconds =
xTaskGetTickCount( ) / portTICK_PERIOD_MS / 1000;
uint32_t ulCurrentTimeSeconds = ( xTaskGetTickCount() / portTICK_PERIOD_MS ) / 1000;
static BaseType_t xFreeEntry = 0;
/* For each entry in the DNS cache table. */
@ -1359,9 +1357,7 @@ TickType_t xTimeoutTime = pdMS_TO_TICKS( 200 );
if( xLookUp != pdFALSE )
{
/* Confirm that the record is still fresh. */
if( ulCurrentTimeSeconds <
xDNSCache[ x ].ulTimeWhenAddedInSeconds +
FreeRTOS_ntohl( xDNSCache[ x ].ulTTL ) )
if( ulCurrentTimeSeconds < ( xDNSCache[ x ].ulTimeWhenAddedInSeconds + FreeRTOS_ntohl( xDNSCache[ x ].ulTTL ) ) )
{
*pulIP = xDNSCache[ x ].ulIPAddress;
}
@ -1425,3 +1421,4 @@ TickType_t xTimeoutTime = pdMS_TO_TICKS( 200 );
#ifdef AMAZON_FREERTOS_ENABLE_UNIT_TESTS
#include "aws_freertos_tcp_test_access_dns_define.h"
#endif

@ -357,7 +357,8 @@ struct freertos_sockaddr xAddress;
/* Wait until there is something to do. If the following call exits
* due to a time out rather than a message being received, set a
* 'NoEvent' value. */
if ( xQueueReceive( xNetworkEventQueue, ( void * ) &xReceivedEvent, xNextIPSleep ) == pdFALSE ) {
if ( xQueueReceive( xNetworkEventQueue, ( void * ) &xReceivedEvent, xNextIPSleep ) == pdFALSE )
{
xReceivedEvent.eEventType = eNoEvent;
}
@ -804,8 +805,7 @@ void *pvReturn;
if( pxNetworkBuffer != NULL )
{
/* Set the actual packet size in case a bigger buffer was returned. */
pxNetworkBuffer->xDataLength =
sizeof( UDPPacket_t ) + xRequestedSizeBytes;
pxNetworkBuffer->xDataLength = sizeof( UDPPacket_t ) + xRequestedSizeBytes;
/* Leave space for the UPD header. */
pvReturn = ( void * ) &( pxNetworkBuffer->pucEthernetBuffer[ ipUDP_PAYLOAD_OFFSET_IPv4 ] );
@ -1516,8 +1516,8 @@ uint8_t ucProtocol;
/* Bound the calculated header length: take away the Ethernet header size,
then check if the IP header is claiming to be longer than the remaining
total packet size. Also check for minimal header field length. */
if( uxHeaderLength > pxNetworkBuffer->xDataLength - ipSIZE_OF_ETH_HEADER ||
uxHeaderLength < ipSIZE_OF_IPv4_HEADER )
if( ( uxHeaderLength > ( pxNetworkBuffer->xDataLength - ipSIZE_OF_ETH_HEADER ) ) ||
( uxHeaderLength < ipSIZE_OF_IPv4_HEADER ) )
{
return eReleaseBuffer;
}
@ -1545,8 +1545,7 @@ uint8_t ucProtocol;
pxNetworkBuffer->xDataLength -= optlen;
/* Fix-up new version/header length field in IP packet. */
pxIPHeader->ucVersionHeaderLength =
( pxIPHeader->ucVersionHeaderLength & 0xF0 ) | /* High nibble is the version. */
pxIPHeader->ucVersionHeaderLength = ( pxIPHeader->ucVersionHeaderLength & 0xF0 ) | /* High nibble is the version. */
( ( ipSIZE_OF_IPv4_HEADER >> 2 ) & 0x0F ); /* Low nibble is the header size, in bytes, divided by four. */
}
@ -1612,8 +1611,7 @@ uint8_t ucProtocol;
if( ( FreeRTOS_ntohs( pxUDPPacket->xUDPHeader.usLength ) - sizeof( UDPHeader_t ) ) <
pxNetworkBuffer->xDataLength )
{
pxNetworkBuffer->xDataLength = FreeRTOS_ntohs( pxUDPPacket->xUDPHeader.usLength ) -
sizeof( UDPHeader_t );
pxNetworkBuffer->xDataLength = FreeRTOS_ntohs( pxUDPPacket->xUDPHeader.usLength ) - sizeof( UDPHeader_t );
}
/* Fields in pxNetworkBuffer (usPort, ulIPAddress) are network order. */
@ -1814,8 +1812,7 @@ uint8_t ucProtocol;
/* Per https://tools.ietf.org/html/rfc791, the four-bit Internet Header
Length field contains the length of the internet header in 32-bit words. */
uxIPHeaderLength = ( UBaseType_t )
( sizeof( uint32_t ) * ( pxIPPacket->xIPHeader.ucVersionHeaderLength & 0x0Fu ) );
uxIPHeaderLength = ( UBaseType_t ) ( sizeof( uint32_t ) * ( pxIPPacket->xIPHeader.ucVersionHeaderLength & 0x0Fu ) );
/* Check for minimum packet size. */
if( uxBufferLength < sizeof( IPPacket_t ) + uxIPHeaderLength - ipSIZE_OF_IPv4_HEADER )
@ -1840,7 +1837,7 @@ uint8_t ucProtocol;
/* Switch on the Layer 3/4 protocol. */
if( ucProtocol == ( uint8_t ) ipPROTOCOL_UDP )
{
if( uxBufferLength < uxIPHeaderLength + ipSIZE_OF_ETH_HEADER + ipSIZE_OF_UDP_HEADER )
if( uxBufferLength < ( uxIPHeaderLength + ipSIZE_OF_ETH_HEADER + ipSIZE_OF_UDP_HEADER ) )
{
return ipINVALID_LENGTH;
}
@ -1854,7 +1851,7 @@ uint8_t ucProtocol;
}
else if( ucProtocol == ( uint8_t ) ipPROTOCOL_TCP )
{
if( uxBufferLength < uxIPHeaderLength + ipSIZE_OF_ETH_HEADER + ipSIZE_OF_TCP_HEADER )
if( uxBufferLength < ( uxIPHeaderLength + ipSIZE_OF_ETH_HEADER + ipSIZE_OF_TCP_HEADER ) )
{
return ipINVALID_LENGTH;
}
@ -1869,7 +1866,7 @@ uint8_t ucProtocol;
else if( ( ucProtocol == ( uint8_t ) ipPROTOCOL_ICMP ) ||
( ucProtocol == ( uint8_t ) ipPROTOCOL_IGMP ) )
{
if( uxBufferLength < uxIPHeaderLength + ipSIZE_OF_ETH_HEADER + ipSIZE_OF_ICMP_HEADER )
if( uxBufferLength < ( uxIPHeaderLength + ipSIZE_OF_ETH_HEADER + ipSIZE_OF_ICMP_HEADER ) )
{
return ipINVALID_LENGTH;
}

@ -352,8 +352,7 @@ static NetworkBufferDescriptor_t *prvTCPBufferResize( FreeRTOS_Socket_t *pxSocke
/*
* Generate a randomized TCP Initial Sequence Number per RFC.
*/
extern uint32_t ulApplicationGetNextSequenceNumber(
uint32_t ulSourceAddress,
extern uint32_t ulApplicationGetNextSequenceNumber( uint32_t ulSourceAddress,
uint16_t usSourcePort,
uint32_t ulDestinationAddress,
uint16_t usDestinationPort );
@ -1026,8 +1025,7 @@ uint32_t ulInitialSequenceNumber = 0;
if( xReturn != pdFALSE )
{
/* Get a difficult-to-predict initial sequence number for this 4-tuple. */
ulInitialSequenceNumber = ulApplicationGetNextSequenceNumber(
*ipLOCAL_IP_ADDRESS_POINTER,
ulInitialSequenceNumber = ulApplicationGetNextSequenceNumber( *ipLOCAL_IP_ADDRESS_POINTER,
pxSocket->usLocalPort,
pxSocket->u.xTCP.ulRemoteIP,
pxSocket->u.xTCP.usRemotePort );
@ -1186,8 +1184,7 @@ UBaseType_t uxNewMSS;
else if( pucPtr[ 0 ] == TCP_OPT_WSOPT )
{
/* Confirm that the option fits in the remaining buffer space. */
if( xRemainingOptionsBytes < TCP_OPT_WSOPT_LEN ||
pucPtr[ 1 ] != TCP_OPT_WSOPT_LEN )
if( ( xRemainingOptionsBytes < TCP_OPT_WSOPT_LEN ) || ( pucPtr[ 1 ] != TCP_OPT_WSOPT_LEN ) )
{
break;
}
@ -1200,8 +1197,7 @@ UBaseType_t uxNewMSS;
else if( pucPtr[ 0 ] == TCP_OPT_MSS )
{
/* Confirm that the option fits in the remaining buffer space. */
if( xRemainingOptionsBytes < TCP_OPT_MSS_LEN ||
pucPtr[ 1 ] != TCP_OPT_MSS_LEN )
if( ( xRemainingOptionsBytes < TCP_OPT_MSS_LEN )|| ( pucPtr[ 1 ] != TCP_OPT_MSS_LEN ) )
{
break;
}
@ -1253,7 +1249,7 @@ UBaseType_t uxNewMSS;
/* All other options have a length field, so that we easily
can skip past them. */
unsigned char len = pucPtr[ 1 ];
if( len < 2 || len > xRemainingOptionsBytes )
if( ( len < 2 ) || ( len > xRemainingOptionsBytes ) )
{
/* If the length field is too small or too big, the options are malformed.
Don't process them further. */
@ -2906,8 +2902,7 @@ uint16_t xRemotePort;
BaseType_t xResult = pdPASS;
/* Check for a minimum packet size. */
if( pxNetworkBuffer->xDataLength >=
ipSIZE_OF_ETH_HEADER + ipSIZE_OF_IPv4_HEADER + ipSIZE_OF_TCP_HEADER )
if( pxNetworkBuffer->xDataLength >= ( ipSIZE_OF_ETH_HEADER + ipSIZE_OF_IPv4_HEADER + ipSIZE_OF_TCP_HEADER ) )
{
ucTCPFlags = pxTCPPacket->xTCPHeader.ucTCPFlags;
ulLocalIP = FreeRTOS_htonl( pxTCPPacket->xIPHeader.ulDestinationIPAddress );
@ -3088,8 +3083,7 @@ uint32_t ulInitialSequenceNumber;
/* Assume that a new Initial Sequence Number will be required. Request
it now in order to fail out if necessary. */
ulInitialSequenceNumber = ulApplicationGetNextSequenceNumber(
*ipLOCAL_IP_ADDRESS_POINTER,
ulInitialSequenceNumber = ulApplicationGetNextSequenceNumber( *ipLOCAL_IP_ADDRESS_POINTER,
pxSocket->usLocalPort,
pxTCPPacket->xIPHeader.ulSourceIPAddress,
pxTCPPacket->xTCPHeader.usSourcePort );
@ -3143,7 +3137,7 @@ uint32_t ulInitialSequenceNumber;
}
}
if( 0 != ulInitialSequenceNumber && pxReturn != NULL )
if( ( 0 != ulInitialSequenceNumber ) && ( pxReturn != NULL ) )
{
pxReturn->u.xTCP.usRemotePort = FreeRTOS_htons( pxTCPPacket->xTCPHeader.usSourcePort );
pxReturn->u.xTCP.ulRemoteIP = FreeRTOS_htonl( pxTCPPacket->xIPHeader.ulSourceIPAddress );
@ -3312,3 +3306,4 @@ BaseType_t xResult = pdFALSE;
#ifdef AMAZON_FREERTOS_ENABLE_UNIT_TESTS
#include "aws_freertos_tcp_test_access_tcp_define.h"
#endif

Loading…
Cancel
Save