mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-08-29 14:38:32 -04:00
Fix mixed tabs and spaces in the latest TCP patches.
This commit is contained in:
parent
e2750cd388
commit
97a686b2e1
8 changed files with 724 additions and 735 deletions
|
@ -359,19 +359,19 @@ BaseType_t xGivingUp = pdFALSE;
|
|||
|
||||
if( xDHCPData.xDHCPTxPeriod <= ipconfigMAXIMUM_DISCOVER_TX_PERIOD )
|
||||
{
|
||||
xDHCPData.ulTransactionId = ipconfigRAND32( );
|
||||
xDHCPData.ulTransactionId = ipconfigRAND32( );
|
||||
|
||||
if( 0 != xDHCPData.ulTransactionId )
|
||||
{
|
||||
xDHCPData.xDHCPTxTime = xTaskGetTickCount( );
|
||||
xDHCPData.xUseBroadcast = !xDHCPData.xUseBroadcast;
|
||||
prvSendDHCPDiscover( );
|
||||
FreeRTOS_debug_printf( ( "vDHCPProcess: timeout %lu ticks\n", xDHCPData.xDHCPTxPeriod ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
FreeRTOS_debug_printf( ( "vDHCPProcess: failed to generate a random Transaction ID\n" ) );
|
||||
}
|
||||
if( 0 != xDHCPData.ulTransactionId )
|
||||
{
|
||||
xDHCPData.xDHCPTxTime = xTaskGetTickCount( );
|
||||
xDHCPData.xUseBroadcast = !xDHCPData.xUseBroadcast;
|
||||
prvSendDHCPDiscover( );
|
||||
FreeRTOS_debug_printf( ( "vDHCPProcess: timeout %lu ticks\n", xDHCPData.xDHCPTxPeriod ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
FreeRTOS_debug_printf( ( "vDHCPProcess: failed to generate a random Transaction ID\n" ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -592,23 +592,23 @@ TickType_t xTimeoutTime = ( TickType_t ) 0;
|
|||
static void prvInitialiseDHCP( void )
|
||||
{
|
||||
/* Initialise the parameters that will be set by the DHCP process. Per
|
||||
https://www.ietf.org/rfc/rfc2131.txt, Transaction ID should be a random
|
||||
value chosen by the client. */
|
||||
xDHCPData.ulTransactionId = ipconfigRAND32();
|
||||
https://www.ietf.org/rfc/rfc2131.txt, Transaction ID should be a random
|
||||
value chosen by the client. */
|
||||
xDHCPData.ulTransactionId = ipconfigRAND32();
|
||||
|
||||
/* Check for random number generator API failure. */
|
||||
if( 0 != xDHCPData.ulTransactionId )
|
||||
{
|
||||
xDHCPData.xUseBroadcast = 0;
|
||||
xDHCPData.ulOfferedIPAddress = 0UL;
|
||||
xDHCPData.ulDHCPServerAddress = 0UL;
|
||||
xDHCPData.xDHCPTxPeriod = dhcpINITIAL_DHCP_TX_PERIOD;
|
||||
/* Check for random number generator API failure. */
|
||||
if( 0 != xDHCPData.ulTransactionId )
|
||||
{
|
||||
xDHCPData.xUseBroadcast = 0;
|
||||
xDHCPData.ulOfferedIPAddress = 0UL;
|
||||
xDHCPData.ulDHCPServerAddress = 0UL;
|
||||
xDHCPData.xDHCPTxPeriod = dhcpINITIAL_DHCP_TX_PERIOD;
|
||||
|
||||
/* Create the DHCP socket if it has not already been created. */
|
||||
prvCreateDHCPSocket();
|
||||
FreeRTOS_debug_printf( ( "prvInitialiseDHCP: start after %lu ticks\n", dhcpINITIAL_TIMER_PERIOD ) );
|
||||
vIPReloadDHCPTimer( dhcpINITIAL_TIMER_PERIOD );
|
||||
}
|
||||
/* Create the DHCP socket if it has not already been created. */
|
||||
prvCreateDHCPSocket();
|
||||
FreeRTOS_debug_printf( ( "prvInitialiseDHCP: start after %lu ticks\n", dhcpINITIAL_TIMER_PERIOD ) );
|
||||
vIPReloadDHCPTimer( dhcpINITIAL_TIMER_PERIOD );
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -633,13 +633,13 @@ const uint32_t ulMandatoryOptions = 2ul; /* DHCP server address, and the correct
|
|||
|
||||
/* Sanity check. */
|
||||
if( ( lBytes >= sizeof( DHCPMessage_t ) ) &&
|
||||
( pxDHCPMessage->ulDHCPCookie == ( uint32_t ) dhcpCOOKIE ) &&
|
||||
( pxDHCPMessage->ulDHCPCookie == ( uint32_t ) dhcpCOOKIE ) &&
|
||||
( pxDHCPMessage->ucOpcode == ( uint8_t ) dhcpREPLY_OPCODE ) &&
|
||||
( pxDHCPMessage->ulTransactionID == FreeRTOS_htonl( xDHCPData.ulTransactionId ) ) )
|
||||
{
|
||||
if( memcmp( ( void * ) &( pxDHCPMessage->ucClientHardwareAddress ),
|
||||
( void * ) ipLOCAL_MAC_ADDRESS,
|
||||
sizeof( MACAddress_t ) ) == 0 )
|
||||
if( memcmp( ( void * ) &( pxDHCPMessage->ucClientHardwareAddress ),
|
||||
( void * ) ipLOCAL_MAC_ADDRESS,
|
||||
sizeof( MACAddress_t ) ) == 0 )
|
||||
{
|
||||
/* None of the essential options have been processed yet. */
|
||||
ulProcessed = 0ul;
|
||||
|
@ -665,36 +665,36 @@ const uint32_t ulMandatoryOptions = 2ul; /* DHCP server address, and the correct
|
|||
continue;
|
||||
}
|
||||
|
||||
/* Stop if the response is malformed. */
|
||||
if( pucByte < pucLastByte - 1 )
|
||||
{
|
||||
ucLength = pucByte[ 1 ];
|
||||
pucByte += 2;
|
||||
/* Stop if the response is malformed. */
|
||||
if( pucByte < pucLastByte - 1 )
|
||||
{
|
||||
ucLength = pucByte[ 1 ];
|
||||
pucByte += 2;
|
||||
|
||||
if( pucByte >= pucLastByte - ucLength )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
if( pucByte >= pucLastByte - ucLength )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
/* In most cases, a 4-byte network-endian parameter follows,
|
||||
just get it once here and use later. */
|
||||
if( ucLength >= sizeof( ulParameter ) )
|
||||
{
|
||||
memcpy( ( void * ) &( ulParameter ),
|
||||
( void * ) pucByte,
|
||||
( size_t ) sizeof( ulParameter ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
ulParameter = 0;
|
||||
}
|
||||
if( ucLength >= sizeof( ulParameter ) )
|
||||
{
|
||||
memcpy( ( void * ) &( ulParameter ),
|
||||
( void * ) pucByte,
|
||||
( size_t ) sizeof( ulParameter ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
ulParameter = 0;
|
||||
}
|
||||
|
||||
/* Option-specific handling. */
|
||||
/* Option-specific handling. */
|
||||
switch( ucOptionCode )
|
||||
{
|
||||
case dhcpMESSAGE_TYPE_OPTION_CODE :
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue