mirror of
https://github.com/FreeRTOS/FreeRTOS.git
synced 2025-06-23 01:21:42 +08:00
Comment style consistency and Yuhui's suggestions
This commit is contained in:

committed by
Yuhui Zheng

parent
e43f7cd086
commit
4e8ac8de25
@ -48,8 +48,8 @@
|
|||||||
|
|
||||||
|
|
||||||
/* When the age of an entry in the ARP table reaches this value (it counts down
|
/* When the age of an entry in the ARP table reaches this value (it counts down
|
||||||
to zero, so this is an old entry) an ARP request will be sent to see if the
|
* to zero, so this is an old entry) an ARP request will be sent to see if the
|
||||||
entry is still valid and can therefore be refreshed. */
|
* entry is still valid and can therefore be refreshed. */
|
||||||
#define arpMAX_ARP_AGE_BEFORE_NEW_ARP_REQUEST ( 3 )
|
#define arpMAX_ARP_AGE_BEFORE_NEW_ARP_REQUEST ( 3 )
|
||||||
|
|
||||||
/* The time between gratuitous ARPs. */
|
/* The time between gratuitous ARPs. */
|
||||||
@ -70,7 +70,7 @@ static eARPLookupResult_t prvCacheLookup( uint32_t ulAddressToLookup, MACAddress
|
|||||||
static ARPCacheRow_t xARPCache[ ipconfigARP_CACHE_ENTRIES ];
|
static ARPCacheRow_t xARPCache[ ipconfigARP_CACHE_ENTRIES ];
|
||||||
|
|
||||||
/* The time at which the last gratuitous ARP was sent. Gratuitous ARPs are used
|
/* The time at which the last gratuitous ARP was sent. Gratuitous ARPs are used
|
||||||
to ensure ARP tables are up to date and to detect IP address conflicts. */
|
* to ensure ARP tables are up to date and to detect IP address conflicts. */
|
||||||
static TickType_t xLastGratuitousARPTime = ( TickType_t ) 0;
|
static TickType_t xLastGratuitousARPTime = ( TickType_t ) 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -86,12 +86,12 @@ static TickType_t xLastGratuitousARPTime = ( TickType_t ) 0;
|
|||||||
#endif /* ipconfigARP_USE_CLASH_DETECTION */
|
#endif /* ipconfigARP_USE_CLASH_DETECTION */
|
||||||
|
|
||||||
/* Part of the Ethernet and ARP headers are always constant when sending an IPv4
|
/* Part of the Ethernet and ARP headers are always constant when sending an IPv4
|
||||||
ARP packet. This array defines the constant parts, allowing this part of the
|
* ARP packet. This array defines the constant parts, allowing this part of the
|
||||||
packet to be filled in using a simple memcpy() instead of individual writes. */
|
* packet to be filled in using a simple memcpy() instead of individual writes. */
|
||||||
|
|
||||||
/* Rule has been relaxed since this is a configuration parameter. And this location provides
|
/* Rule has been relaxed since this is a configuration parameter. And this location provides
|
||||||
* more readability. */
|
* more readability. */
|
||||||
/* coverity[misra_c_2012_rule_8_9_violation] */
|
/* coverity[misra_c_2012_rule_8_9_violation] */
|
||||||
static const uint8_t xDefaultPartARPPacketHeader[] =
|
static const uint8_t xDefaultPartARPPacketHeader[] =
|
||||||
{
|
{
|
||||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* Ethernet destination address. */
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* Ethernet destination address. */
|
||||||
@ -125,21 +125,21 @@ uint32_t ulTargetProtocolAddress, ulSenderProtocolAddress;
|
|||||||
traceARP_PACKET_RECEIVED();
|
traceARP_PACKET_RECEIVED();
|
||||||
|
|
||||||
/* Don't do anything if the local IP address is zero because
|
/* Don't do anything if the local IP address is zero because
|
||||||
that means a DHCP request has not completed. */
|
* that means a DHCP request has not completed. */
|
||||||
if( *ipLOCAL_IP_ADDRESS_POINTER != 0UL )
|
if( *ipLOCAL_IP_ADDRESS_POINTER != 0UL )
|
||||||
{
|
{
|
||||||
switch( pxARPHeader->usOperation )
|
switch( pxARPHeader->usOperation )
|
||||||
{
|
{
|
||||||
case ipARP_REQUEST :
|
case ipARP_REQUEST :
|
||||||
/* The packet contained an ARP request. Was it for the IP
|
/* The packet contained an ARP request. Was it for the IP
|
||||||
address of the node running this code? */
|
* address of the node running this code? */
|
||||||
if( ulTargetProtocolAddress == *ipLOCAL_IP_ADDRESS_POINTER )
|
if( ulTargetProtocolAddress == *ipLOCAL_IP_ADDRESS_POINTER )
|
||||||
{
|
{
|
||||||
iptraceSENDING_ARP_REPLY( ulSenderProtocolAddress );
|
iptraceSENDING_ARP_REPLY( ulSenderProtocolAddress );
|
||||||
|
|
||||||
/* The request is for the address of this node. Add the
|
/* The request is for the address of this node. Add the
|
||||||
entry into the ARP cache, or refresh the entry if it
|
* entry into the ARP cache, or refresh the entry if it
|
||||||
already exists. */
|
* already exists. */
|
||||||
vARPRefreshCacheEntry( &( pxARPHeader->xSenderHardwareAddress ), ulSenderProtocolAddress );
|
vARPRefreshCacheEntry( &( pxARPHeader->xSenderHardwareAddress ), ulSenderProtocolAddress );
|
||||||
|
|
||||||
/* Generate a reply payload in the same buffer. */
|
/* Generate a reply payload in the same buffer. */
|
||||||
@ -202,7 +202,7 @@ uint32_t ulTargetProtocolAddress, ulSenderProtocolAddress;
|
|||||||
if( ( memcmp( xARPCache[ x ].xMACAddress.ucBytes, pxMACAddress->ucBytes, sizeof( pxMACAddress->ucBytes ) ) == 0 ) )
|
if( ( memcmp( xARPCache[ x ].xMACAddress.ucBytes, pxMACAddress->ucBytes, sizeof( pxMACAddress->ucBytes ) ) == 0 ) )
|
||||||
{
|
{
|
||||||
lResult = xARPCache[ x ].ulIPAddress;
|
lResult = xARPCache[ x ].ulIPAddress;
|
||||||
( void ) memset( &xARPCache[ x ], '\0', sizeof( xARPCache[ x ] ) );
|
( void ) memset( &xARPCache[ x ], 0, sizeof( xARPCache[ x ] ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -223,17 +223,17 @@ uint8_t ucMinAgeFound = 0U;
|
|||||||
|
|
||||||
#if( ipconfigARP_STORES_REMOTE_ADDRESSES == 0 )
|
#if( ipconfigARP_STORES_REMOTE_ADDRESSES == 0 )
|
||||||
/* Only process the IP address if it is on the local network.
|
/* Only process the IP address if it is on the local network.
|
||||||
Unless: when '*ipLOCAL_IP_ADDRESS_POINTER' equals zero, the IP-address
|
* Unless: when '*ipLOCAL_IP_ADDRESS_POINTER' equals zero, the IP-address
|
||||||
and netmask are still unknown. */
|
* and netmask are still unknown. */
|
||||||
if( ( ( ulIPAddress & xNetworkAddressing.ulNetMask ) == ( ( *ipLOCAL_IP_ADDRESS_POINTER ) & xNetworkAddressing.ulNetMask ) ) ||
|
if( ( ( ulIPAddress & xNetworkAddressing.ulNetMask ) == ( ( *ipLOCAL_IP_ADDRESS_POINTER ) & xNetworkAddressing.ulNetMask ) ) ||
|
||||||
( *ipLOCAL_IP_ADDRESS_POINTER == 0uL ) )
|
( *ipLOCAL_IP_ADDRESS_POINTER == 0uL ) )
|
||||||
#else
|
#else
|
||||||
/* If ipconfigARP_STORES_REMOTE_ADDRESSES is non-zero, IP addresses with
|
/* If ipconfigARP_STORES_REMOTE_ADDRESSES is non-zero, IP addresses with
|
||||||
a different netmask will also be stored. After when replying to a UDP
|
* a different netmask will also be stored. After when replying to a UDP
|
||||||
message from a different netmask, the IP address can be looped up and a
|
* message from a different netmask, the IP address can be looped up and a
|
||||||
reply sent. This option is useful for systems with multiple gateways,
|
* reply sent. This option is useful for systems with multiple gateways,
|
||||||
the reply will surely arrive. If ipconfigARP_STORES_REMOTE_ADDRESSES is
|
* the reply will surely arrive. If ipconfigARP_STORES_REMOTE_ADDRESSES is
|
||||||
zero the the gateway address is the only option. */
|
* zero the the gateway address is the only option. */
|
||||||
if( pdTRUE )
|
if( pdTRUE )
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
@ -244,14 +244,14 @@ uint8_t ucMinAgeFound = 0U;
|
|||||||
for( x = 0; x < ipconfigARP_CACHE_ENTRIES; x++ )
|
for( x = 0; x < ipconfigARP_CACHE_ENTRIES; x++ )
|
||||||
{
|
{
|
||||||
/* Does this line in the cache table hold an entry for the IP
|
/* Does this line in the cache table hold an entry for the IP
|
||||||
address being queried? */
|
* address being queried? */
|
||||||
if( xARPCache[ x ].ulIPAddress == ulIPAddress )
|
if( xARPCache[ x ].ulIPAddress == ulIPAddress )
|
||||||
{
|
{
|
||||||
if( pxMACAddress == NULL )
|
if( pxMACAddress == NULL )
|
||||||
{
|
{
|
||||||
/* In case the parameter pxMACAddress is NULL, an entry will be reserved to
|
/* In case the parameter pxMACAddress is NULL, an entry will be reserved to
|
||||||
indicate that there is an outstanding ARP request, This entry will have
|
* indicate that there is an outstanding ARP request, This entry will have
|
||||||
"ucValid == pdFALSE". */
|
* "ucValid == pdFALSE". */
|
||||||
xIpEntry = x;
|
xIpEntry = x;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -260,30 +260,30 @@ uint8_t ucMinAgeFound = 0U;
|
|||||||
if( memcmp( xARPCache[ x ].xMACAddress.ucBytes, pxMACAddress->ucBytes, sizeof( pxMACAddress->ucBytes ) ) == 0 )
|
if( memcmp( xARPCache[ x ].xMACAddress.ucBytes, pxMACAddress->ucBytes, sizeof( pxMACAddress->ucBytes ) ) == 0 )
|
||||||
{
|
{
|
||||||
/* This function will be called for each received packet
|
/* This function will be called for each received packet
|
||||||
As this is by far the most common path the coding standard
|
* As this is by far the most common path the coding standard
|
||||||
is relaxed in this case and a return is permitted as an
|
* is relaxed in this case and a return is permitted as an
|
||||||
optimisation. */
|
* optimisation. */
|
||||||
xARPCache[ x ].ucAge = ( uint8_t ) ipconfigMAX_ARP_AGE;
|
xARPCache[ x ].ucAge = ( uint8_t ) ipconfigMAX_ARP_AGE;
|
||||||
xARPCache[ x ].ucValid = ( uint8_t ) pdTRUE;
|
xARPCache[ x ].ucValid = ( uint8_t ) pdTRUE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Found an entry containing ulIPAddress, but the MAC address
|
/* Found an entry containing ulIPAddress, but the MAC address
|
||||||
doesn't match. Might be an entry with ucValid=pdFALSE, waiting
|
* doesn't match. Might be an entry with ucValid=pdFALSE, waiting
|
||||||
for an ARP reply. Still want to see if there is match with the
|
* for an ARP reply. Still want to see if there is match with the
|
||||||
given MAC address.ucBytes. If found, either of the two entries
|
* given MAC address.ucBytes. If found, either of the two entries
|
||||||
must be cleared. */
|
* must be cleared. */
|
||||||
xIpEntry = x;
|
xIpEntry = x;
|
||||||
}
|
}
|
||||||
else if( ( pxMACAddress != NULL ) && ( memcmp( xARPCache[ x ].xMACAddress.ucBytes, pxMACAddress->ucBytes, sizeof( pxMACAddress->ucBytes ) ) == 0 ) )
|
else if( ( pxMACAddress != NULL ) && ( memcmp( xARPCache[ x ].xMACAddress.ucBytes, pxMACAddress->ucBytes, sizeof( pxMACAddress->ucBytes ) ) == 0 ) )
|
||||||
{
|
{
|
||||||
/* Found an entry with the given MAC-address, but the IP-address
|
/* Found an entry with the given MAC-address, but the IP-address
|
||||||
is different. Continue looping to find a possible match with
|
* is different. Continue looping to find a possible match with
|
||||||
ulIPAddress. */
|
* ulIPAddress. */
|
||||||
#if( ipconfigARP_STORES_REMOTE_ADDRESSES != 0 )
|
#if( ipconfigARP_STORES_REMOTE_ADDRESSES != 0 )
|
||||||
/* If ARP stores the MAC address of IP addresses outside the
|
/* If ARP stores the MAC address of IP addresses outside the
|
||||||
network, than the MAC address of the gateway should not be
|
* network, than the MAC address of the gateway should not be
|
||||||
overwritten. */
|
* overwritten. */
|
||||||
BaseType_t bIsLocal[ 2 ];
|
BaseType_t bIsLocal[ 2 ];
|
||||||
bIsLocal[ 0 ] = ( ( xARPCache[x].ulIPAddress & xNetworkAddressing.ulNetMask ) == ( ( *ipLOCAL_IP_ADDRESS_POINTER ) & xNetworkAddressing.ulNetMask ) );
|
bIsLocal[ 0 ] = ( ( xARPCache[x].ulIPAddress & xNetworkAddressing.ulNetMask ) == ( ( *ipLOCAL_IP_ADDRESS_POINTER ) & xNetworkAddressing.ulNetMask ) );
|
||||||
bIsLocal[ 1 ] = ( ( ulIPAddress & xNetworkAddressing.ulNetMask ) == ( ( *ipLOCAL_IP_ADDRESS_POINTER ) & xNetworkAddressing.ulNetMask ) );
|
bIsLocal[ 1 ] = ( ( ulIPAddress & xNetworkAddressing.ulNetMask ) == ( ( *ipLOCAL_IP_ADDRESS_POINTER ) & xNetworkAddressing.ulNetMask ) );
|
||||||
@ -296,13 +296,13 @@ uint8_t ucMinAgeFound = 0U;
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
/* _HT_
|
/* _HT_
|
||||||
Shouldn't we test for xARPCache[ x ].ucValid == pdFALSE here ? */
|
* Shouldn't we test for xARPCache[ x ].ucValid == pdFALSE here ? */
|
||||||
else if( xARPCache[ x ].ucAge < ucMinAgeFound )
|
else if( xARPCache[ x ].ucAge < ucMinAgeFound )
|
||||||
{
|
{
|
||||||
/* As the table is traversed, remember the table row that
|
/* As the table is traversed, remember the table row that
|
||||||
contains the oldest entry (the lowest age count, as ages are
|
* contains the oldest entry (the lowest age count, as ages are
|
||||||
decremented to zero) so the row can be re-used if this function
|
* decremented to zero) so the row can be re-used if this function
|
||||||
needs to add an entry that does not already exist. */
|
* needs to add an entry that does not already exist. */
|
||||||
ucMinAgeFound = xARPCache[ x ].ucAge;
|
ucMinAgeFound = xARPCache[ x ].ucAge;
|
||||||
xUseEntry = x;
|
xUseEntry = x;
|
||||||
}
|
}
|
||||||
@ -319,8 +319,8 @@ uint8_t ucMinAgeFound = 0U;
|
|||||||
if( xIpEntry >= 0 )
|
if( xIpEntry >= 0 )
|
||||||
{
|
{
|
||||||
/* Both the MAC address as well as the IP address were found in
|
/* Both the MAC address as well as the IP address were found in
|
||||||
different locations: clear the entry which matches the
|
* different locations: clear the entry which matches the
|
||||||
IP-address */
|
* IP-address */
|
||||||
( void ) memset( &xARPCache[ xIpEntry ], 0, sizeof( xARPCache[ xIpEntry ] ) );
|
( void ) memset( &xARPCache[ xIpEntry ], 0, sizeof( xARPCache[ xIpEntry ] ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -371,7 +371,7 @@ uint8_t ucMinAgeFound = 0U;
|
|||||||
for( x = 0; x < ipconfigARP_CACHE_ENTRIES; x++ )
|
for( x = 0; x < ipconfigARP_CACHE_ENTRIES; x++ )
|
||||||
{
|
{
|
||||||
/* Does this row in the ARP cache table hold an entry for the MAC
|
/* Does this row in the ARP cache table hold an entry for the MAC
|
||||||
address being searched? */
|
* address being searched? */
|
||||||
if( memcmp( ( void * ) pxMACAddress->ucBytes, ( const void * ) xARPCache[ x ].xMACAddress.ucBytes, sizeof( MACAddress_t ) ) == 0 )
|
if( memcmp( ( void * ) pxMACAddress->ucBytes, ( const void * ) xARPCache[ x ].xMACAddress.ucBytes, sizeof( MACAddress_t ) ) == 0 )
|
||||||
{
|
{
|
||||||
*pulIPAddress = xARPCache[ x ].ulIPAddress;
|
*pulIPAddress = xARPCache[ x ].ulIPAddress;
|
||||||
@ -410,7 +410,7 @@ uint32_t ulAddressToLookup;
|
|||||||
else if( *ipLOCAL_IP_ADDRESS_POINTER == 0UL )
|
else if( *ipLOCAL_IP_ADDRESS_POINTER == 0UL )
|
||||||
{
|
{
|
||||||
/* The IP address has not yet been assigned, so there is nothing that
|
/* The IP address has not yet been assigned, so there is nothing that
|
||||||
can be done. */
|
* can be done. */
|
||||||
eReturn = eCantSendPacket;
|
eReturn = eCantSendPacket;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -425,14 +425,14 @@ uint32_t ulAddressToLookup;
|
|||||||
if( eReturn == eARPCacheHit )
|
if( eReturn == eARPCacheHit )
|
||||||
{
|
{
|
||||||
/* The stack is configured to store 'remote IP addresses', i.e. addresses
|
/* The stack is configured to store 'remote IP addresses', i.e. addresses
|
||||||
belonging to a different the netmask. prvCacheLookup() returned a hit, so
|
* belonging to a different the netmask. prvCacheLookup() returned a hit, so
|
||||||
the MAC address is known */
|
* the MAC address is known */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
/* The IP address is off the local network, so look up the
|
/* The IP address is off the local network, so look up the
|
||||||
hardware address of the router, if any. */
|
* hardware address of the router, if any. */
|
||||||
if( xNetworkAddressing.ulGatewayAddress != ( uint32_t )0u )
|
if( xNetworkAddressing.ulGatewayAddress != ( uint32_t )0u )
|
||||||
{
|
{
|
||||||
ulAddressToLookup = xNetworkAddressing.ulGatewayAddress;
|
ulAddressToLookup = xNetworkAddressing.ulGatewayAddress;
|
||||||
@ -446,7 +446,7 @@ uint32_t ulAddressToLookup;
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* The IP address is on the local network, so lookup the requested
|
/* The IP address is on the local network, so lookup the requested
|
||||||
IP address directly. */
|
* IP address directly. */
|
||||||
ulAddressToLookup = *pulIPAddress;
|
ulAddressToLookup = *pulIPAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -455,7 +455,7 @@ uint32_t ulAddressToLookup;
|
|||||||
if( ulAddressToLookup == 0UL )
|
if( ulAddressToLookup == 0UL )
|
||||||
{
|
{
|
||||||
/* The address is not on the local network, and there is not a
|
/* The address is not on the local network, and there is not a
|
||||||
router. */
|
* router. */
|
||||||
eReturn = eCantSendPacket;
|
eReturn = eCantSendPacket;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -485,7 +485,7 @@ eARPLookupResult_t eReturn = eARPCacheMiss;
|
|||||||
for( x = 0; x < ipconfigARP_CACHE_ENTRIES; x++ )
|
for( x = 0; x < ipconfigARP_CACHE_ENTRIES; x++ )
|
||||||
{
|
{
|
||||||
/* Does this row in the ARP cache table hold an entry for the IP address
|
/* Does this row in the ARP cache table hold an entry for the IP address
|
||||||
being queried? */
|
* being queried? */
|
||||||
if( xARPCache[ x ].ulIPAddress == ulAddressToLookup )
|
if( xARPCache[ x ].ulIPAddress == ulAddressToLookup )
|
||||||
{
|
{
|
||||||
/* A matching valid entry was found. */
|
/* A matching valid entry was found. */
|
||||||
@ -520,11 +520,11 @@ TickType_t xTimeNow;
|
|||||||
if( xARPCache[ x ].ucAge > 0U )
|
if( xARPCache[ x ].ucAge > 0U )
|
||||||
{
|
{
|
||||||
/* Decrement the age value of the entry in this ARP cache table row.
|
/* Decrement the age value of the entry in this ARP cache table row.
|
||||||
When the age reaches zero it is no longer considered valid. */
|
* When the age reaches zero it is no longer considered valid. */
|
||||||
( xARPCache[ x ].ucAge )--;
|
( xARPCache[ x ].ucAge )--;
|
||||||
|
|
||||||
/* If the entry is not yet valid, then it is waiting an ARP
|
/* If the entry is not yet valid, then it is waiting an ARP
|
||||||
reply, and the ARP request should be retransmitted. */
|
* reply, and the ARP request should be retransmitted. */
|
||||||
if( xARPCache[ x ].ucValid == ( uint8_t )pdFALSE )
|
if( xARPCache[ x ].ucValid == ( uint8_t )pdFALSE )
|
||||||
{
|
{
|
||||||
FreeRTOS_OutputARPRequest( xARPCache[ x ].ulIPAddress );
|
FreeRTOS_OutputARPRequest( xARPCache[ x ].ulIPAddress );
|
||||||
@ -532,7 +532,7 @@ TickType_t xTimeNow;
|
|||||||
else if( xARPCache[ x ].ucAge <= ( uint8_t )arpMAX_ARP_AGE_BEFORE_NEW_ARP_REQUEST )
|
else if( xARPCache[ x ].ucAge <= ( uint8_t )arpMAX_ARP_AGE_BEFORE_NEW_ARP_REQUEST )
|
||||||
{
|
{
|
||||||
/* This entry will get removed soon. See if the MAC address is
|
/* This entry will get removed soon. See if the MAC address is
|
||||||
still valid to prevent this happening. */
|
* still valid to prevent this happening. */
|
||||||
iptraceARP_TABLE_ENTRY_WILL_EXPIRE( xARPCache[ x ].ulIPAddress );
|
iptraceARP_TABLE_ENTRY_WILL_EXPIRE( xARPCache[ x ].ulIPAddress );
|
||||||
FreeRTOS_OutputARPRequest( xARPCache[ x ].ulIPAddress );
|
FreeRTOS_OutputARPRequest( xARPCache[ x ].ulIPAddress );
|
||||||
}
|
}
|
||||||
@ -563,7 +563,7 @@ TickType_t xTimeNow;
|
|||||||
void vARPSendGratuitous( void )
|
void vARPSendGratuitous( void )
|
||||||
{
|
{
|
||||||
/* Setting xLastGratuitousARPTime to 0 will force a gratuitous ARP the next
|
/* Setting xLastGratuitousARPTime to 0 will force a gratuitous ARP the next
|
||||||
time vARPAgeCache() is called. */
|
* time vARPAgeCache() is called. */
|
||||||
xLastGratuitousARPTime = ( TickType_t )0;
|
xLastGratuitousARPTime = ( TickType_t )0;
|
||||||
|
|
||||||
/* Let the IP-task call vARPAgeCache(). */
|
/* Let the IP-task call vARPAgeCache(). */
|
||||||
@ -576,7 +576,7 @@ void FreeRTOS_OutputARPRequest( uint32_t ulIPAddress )
|
|||||||
NetworkBufferDescriptor_t *pxNetworkBuffer;
|
NetworkBufferDescriptor_t *pxNetworkBuffer;
|
||||||
|
|
||||||
/* This is called from the context of the IP event task, so a block time
|
/* This is called from the context of the IP event task, so a block time
|
||||||
must not be used. */
|
* must not be used. */
|
||||||
pxNetworkBuffer = pxGetNetworkBufferWithDescriptor( sizeof( ARPPacket_t ), ( TickType_t )0 );
|
pxNetworkBuffer = pxGetNetworkBufferWithDescriptor( sizeof( ARPPacket_t ), ( TickType_t )0 );
|
||||||
|
|
||||||
if( pxNetworkBuffer != NULL )
|
if( pxNetworkBuffer != NULL )
|
||||||
@ -628,24 +628,24 @@ void vARPGenerateRequestPacket( NetworkBufferDescriptor_t * const pxNetworkBuffe
|
|||||||
ARPPacket_t *pxARPPacket;
|
ARPPacket_t *pxARPPacket;
|
||||||
|
|
||||||
/* Buffer allocation ensures that buffers always have space
|
/* Buffer allocation ensures that buffers always have space
|
||||||
for an ARP packet. See buffer allocation implementations 1
|
* for an ARP packet. See buffer allocation implementations 1
|
||||||
and 2 under portable/BufferManagement. */
|
* and 2 under portable/BufferManagement. */
|
||||||
configASSERT( pxNetworkBuffer != NULL );
|
configASSERT( pxNetworkBuffer != NULL );
|
||||||
configASSERT( pxNetworkBuffer->xDataLength >= sizeof( ARPPacket_t ) );
|
configASSERT( pxNetworkBuffer->xDataLength >= sizeof( ARPPacket_t ) );
|
||||||
|
|
||||||
pxARPPacket = ( ARPPacket_t * ) pxNetworkBuffer->pucEthernetBuffer;
|
pxARPPacket = ( ARPPacket_t * ) pxNetworkBuffer->pucEthernetBuffer;
|
||||||
|
|
||||||
/* memcpy the const part of the header information into the correct
|
/* memcpy the const part of the header information into the correct
|
||||||
location in the packet. This copies:
|
* location in the packet. This copies:
|
||||||
xEthernetHeader.ulDestinationAddress
|
* xEthernetHeader.ulDestinationAddress
|
||||||
xEthernetHeader.usFrameType;
|
* xEthernetHeader.usFrameType;
|
||||||
xARPHeader.usHardwareType;
|
* xARPHeader.usHardwareType;
|
||||||
xARPHeader.usProtocolType;
|
* xARPHeader.usProtocolType;
|
||||||
xARPHeader.ucHardwareAddressLength;
|
* xARPHeader.ucHardwareAddressLength;
|
||||||
xARPHeader.ucProtocolAddressLength;
|
* xARPHeader.ucProtocolAddressLength;
|
||||||
xARPHeader.usOperation;
|
* xARPHeader.usOperation;
|
||||||
xARPHeader.xTargetHardwareAddress;
|
* xARPHeader.xTargetHardwareAddress;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
( void ) memcpy( ( void * ) pxARPPacket, ( const void * )xDefaultPartARPPacketHeader, sizeof( xDefaultPartARPPacketHeader ) );
|
( void ) memcpy( ( void * ) pxARPPacket, ( const void * )xDefaultPartARPPacketHeader, sizeof( xDefaultPartARPPacketHeader ) );
|
||||||
( void ) memcpy( ( void * ) pxARPPacket->xEthernetHeader.xSourceAddress.ucBytes, ( const void * ) ipLOCAL_MAC_ADDRESS, ( size_t )ipMAC_ADDRESS_LENGTH_BYTES );
|
( void ) memcpy( ( void * ) pxARPPacket->xEthernetHeader.xSourceAddress.ucBytes, ( const void * ) ipLOCAL_MAC_ADDRESS, ( size_t )ipMAC_ADDRESS_LENGTH_BYTES );
|
||||||
|
Reference in New Issue
Block a user