Skip to content

Commit d93e085

Browse files
authored
Merge branch 'main' into dev-ip-build-sep
2 parents 5fc03b7 + fa073ea commit d93e085

File tree

10 files changed

+28
-23
lines changed

10 files changed

+28
-23
lines changed

source/FreeRTOS_IPv4.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,9 +321,7 @@ enum eFrameProcessingResult prvAllowIPPacketIPv4( const struct xIP_PACKET * cons
321321
( FreeRTOS_FindEndPointOnIP_IPv4( ulDestinationIPAddress ) == NULL ) &&
322322
/* Is it an IPv4 broadcast address x.x.x.255 ? */
323323
( ( FreeRTOS_ntohl( ulDestinationIPAddress ) & 0xffU ) != 0xffU ) &&
324-
( xIsIPv4Multicast( ulDestinationIPAddress ) == pdFALSE ) &&
325-
/* Or (during DHCP negotiation) we have no IP-address yet? */
326-
( FreeRTOS_IsNetworkUp() != pdFALSE ) )
324+
( xIsIPv4Multicast( ulDestinationIPAddress ) == pdFALSE ) )
327325
{
328326
/* Packet is not for this node, release it */
329327
eReturn = eReleaseBuffer;

source/FreeRTOS_Routing.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,6 @@ struct xIPv6_Couple
389389
#endif
390390
{
391391
if( ( ulIPAddress == 0U ) ||
392-
( pxEndPoint->ipv4_settings.ulIPAddress == 0U ) ||
393392
( pxEndPoint->ipv4_settings.ulIPAddress == ulIPAddress ) )
394393
{
395394
break;

source/portable/NetworkInterface/ATSAM4E/NetworkInterface.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@
8888
static BaseType_t xGMACWaitLS( TickType_t xMaxTime );
8989

9090
#if ( ipconfigDRIVER_INCLUDED_TX_IP_CHECKSUM == 1 ) && ( ipconfigHAS_TX_CRC_OFFLOADING == 0 )
91-
void vGMACGenerateChecksum( uint8_t * apBuffer );
91+
void vGMACGenerateChecksum( uint8_t * pucBuffer,
92+
size_t uxLength );
9293
#endif
9394

9495
/*
@@ -405,9 +406,10 @@ static BaseType_t xGMACWaitLS( TickType_t xMaxTime )
405406

406407
/*#if( ipconfigDRIVER_INCLUDED_TX_IP_CHECKSUM == 1 ) && ( ipconfigHAS_TX_CRC_OFFLOADING == 0 ) */
407408

408-
void vGMACGenerateChecksum( uint8_t * apBuffer )
409+
void vGMACGenerateChecksum( uint8_t * pucBuffer,
410+
size_t uxLength )
409411
{
410-
ProtocolPacket_t * xProtPacket = ( ProtocolPacket_t * ) apBuffer;
412+
ProtocolPacket_t * xProtPacket = ( ProtocolPacket_t * ) pucBuffer;
411413

412414
if( xProtPacket->xTCPPacket.xEthernetHeader.usFrameType == ipIPv4_FRAME_TYPE )
413415
{
@@ -419,7 +421,7 @@ void vGMACGenerateChecksum( uint8_t * apBuffer )
419421
pxIPHeader->usHeaderChecksum = ~FreeRTOS_htons( pxIPHeader->usHeaderChecksum );
420422

421423
/* Calculate the TCP checksum for an outgoing packet. */
422-
usGenerateProtocolChecksum( ( uint8_t * ) apBuffer, pdTRUE );
424+
usGenerateProtocolChecksum( ( uint8_t * ) pucBuffer, uxLength, pdTRUE );
423425
}
424426
}
425427

source/portable/NetworkInterface/ATSAM4E/gmac.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,8 @@ uint32_t gmac_dev_read( gmac_device_t * p_gmac_dev,
642642
}
643643

644644

645-
extern void vGMACGenerateChecksum( uint8_t * apBuffer );
645+
extern void vGMACGenerateChecksum( uint8_t * pucBuffer,
646+
size_t uxLength );
646647

647648
/**
648649
* \brief Send ulLength bytes from pcFrom. This copies the buffer to one of the
@@ -715,7 +716,7 @@ uint32_t gmac_dev_write( gmac_device_t * p_gmac_dev,
715716
memcpy( ( void * ) p_tx_td->addr, p_buffer, ul_size );
716717
}
717718
#endif /* ipconfigZERO_COPY_TX_DRIVER */
718-
vGMACGenerateChecksum( ( uint8_t * ) p_tx_td->addr );
719+
vGMACGenerateChecksum( ( uint8_t * ) p_tx_td->addr, ( size_t ) ul_size );
719720
}
720721

721722
#if ( GMAC_USES_TX_CALLBACK != 0 )

source/portable/NetworkInterface/DriverSAM/NetworkInterface.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ static BaseType_t xPHY_Write( BaseType_t xAddress,
161161
uint32_t ulValue );
162162

163163
#if ( ipconfigDRIVER_INCLUDED_TX_IP_CHECKSUM == 1 ) && ( ipconfigHAS_TX_CRC_OFFLOADING == 0 )
164-
void vGMACGenerateChecksum( uint8_t * apBuffer,
164+
void vGMACGenerateChecksum( uint8_t * pucBuffer,
165165
size_t uxLength );
166166
#endif
167167

source/portable/NetworkInterface/DriverSAM/gmac_SAM.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1539,7 +1539,7 @@
15391539

15401540
/* The SAM4E has problems offloading checksums for transmission.
15411541
* The SAME70 does not set the CRC for ICMP packets (ping). */
1542-
extern void vGMACGenerateChecksum( uint8_t * apBuffer,
1542+
extern void vGMACGenerateChecksum( uint8_t * pucBuffer,
15431543
size_t uxLength );
15441544

15451545
/*/ @cond 0 */

source/portable/NetworkInterface/RX/NetworkInterface.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability of
1313
* this software. By using this software, you agree to the additional terms and conditions found by accessing the
1414
* following link:
15-
* http://www.renesas.com/disclaimer
15+
* https://www.renesas.com/en/document/oth/disclaimer8
1616
*
1717
* Copyright (C) 2020 Renesas Electronics Corporation. All rights reserved.
1818
***********************************************************************************************************************/

source/portable/NetworkInterface/RX/ether_callback.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability of
1313
* this software. By using this software, you agree to the additional terms and conditions found by accessing the
1414
* following link:
15-
* http://www.renesas.com/disclaimer
15+
* https://www.renesas.com/en/document/oth/disclaimer8
1616
*
1717
* Copyright (C) 2015 Renesas Electronics Corporation. All rights reserved.
1818
***********************************************************************************************************************/

test/unit-test/FreeRTOS_IPv4/FreeRTOS_IPv4_utest.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,6 @@ void test_prvAllowIPPacketIPv4_NotMatchingIP( void )
262262
pxIPHeader->ulDestinationIPAddress = pxEndpoint->ipv4_settings.ulIPAddress + 1;
263263

264264
FreeRTOS_FindEndPointOnIP_IPv4_ExpectAnyArgsAndReturn( NULL ); /* From prvAllowIPPacketIPv4() */
265-
FreeRTOS_IsNetworkUp_ExpectAndReturn( pdTRUE );
266265

267266
eResult = prvAllowIPPacketIPv4( pxIPPacket, pxNetworkBuffer, uxHeaderLength );
268267

@@ -417,7 +416,6 @@ void test_prvAllowIPPacketIPv4_SourceIPBrdCast_NoLocalIP( void )
417416

418417

419418
FreeRTOS_FindEndPointOnIP_IPv4_ExpectAnyArgsAndReturn( NULL ); /* From prvAllowIPPacketIPv4() */
420-
FreeRTOS_IsNetworkUp_ExpectAndReturn( pdFALSE );
421419

422420
eResult = prvAllowIPPacketIPv4( pxIPPacket, pxNetworkBuffer, uxHeaderLength );
423421

@@ -455,7 +453,6 @@ void test_prvAllowIPPacketIPv4_DestMACBrdCast_DestIPUnicast( void )
455453

456454

457455
FreeRTOS_FindEndPointOnIP_IPv4_ExpectAnyArgsAndReturn( NULL ); /* From prvAllowIPPacketIPv4() */
458-
FreeRTOS_IsNetworkUp_ExpectAndReturn( pdTRUE );
459456

460457
eResult = prvAllowIPPacketIPv4( pxIPPacket, pxNetworkBuffer, uxHeaderLength );
461458

test/unit-test/FreeRTOS_Routing/FreeRTOS_Routing_utest.c

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1443,25 +1443,33 @@ void test_FreeRTOS_FindEndPointOnIP_IPv4_AnyEndpoint( void )
14431443
* pxNetworkEndPoints is a global variable using in FreeRTOS_Routing as link list head of all endpoints.
14441444
*
14451445
* Test step:
1446-
* - Create 1 endpoint with IP address 0 and add it to the list.
1447-
* - Call FreeRTOS_FindEndPointOnIP_IPv4 to query with IPV4_DEFAULT_ADDRESS.
1446+
* - Create 1 endpoint with IP address 0xAB12CD34 and add it to the list.
1447+
* - Call FreeRTOS_FindEndPointOnIP_IPv4 to query with 0xAB12CD34.
14481448
* - Check if returned endpoint is same.
1449-
* - Call FreeRTOS_FindEndPointOnIP_IPv4 to query with IPV4_DEFAULT_GATEWAY.
1449+
* - Call FreeRTOS_FindEndPointOnIP_IPv4 to query with 0.
14501450
* - Check if returned endpoint is same.
1451+
* - Call FreeRTOS_FindEndPointOnIP_IPv4 to query with IPV4_DEFAULT_ADDRESS.
1452+
* - Check if returned endpoint is NULL.
1453+
* - Call FreeRTOS_FindEndPointOnIP_IPv4 to query with IPV4_DEFAULT_GATEWAY.
1454+
* - Check if returned endpoint is NULL.
14511455
*/
14521456
void test_FreeRTOS_FindEndPointOnIP_IPv4_ZeroAddressEndpoint( void )
14531457
{
14541458
NetworkEndPoint_t xEndPoint;
14551459
NetworkEndPoint_t * pxEndPoint = NULL;
14561460

14571461
memset( &xEndPoint, 0, sizeof( NetworkEndPoint_t ) );
1458-
xEndPoint.ipv4_settings.ulIPAddress = 0;
1462+
xEndPoint.ipv4_settings.ulIPAddress = 0xAB12CD34;
14591463
pxNetworkEndPoints = &xEndPoint;
14601464

1461-
pxEndPoint = FreeRTOS_FindEndPointOnIP_IPv4( IPV4_DEFAULT_ADDRESS );
1465+
pxEndPoint = FreeRTOS_FindEndPointOnIP_IPv4( 0xAB12CD34 );
14621466
TEST_ASSERT_EQUAL( &xEndPoint, pxEndPoint );
1463-
pxEndPoint = FreeRTOS_FindEndPointOnIP_IPv4( IPV4_DEFAULT_GATEWAY );
1467+
pxEndPoint = FreeRTOS_FindEndPointOnIP_IPv4( 0 );
14641468
TEST_ASSERT_EQUAL( &xEndPoint, pxEndPoint );
1469+
pxEndPoint = FreeRTOS_FindEndPointOnIP_IPv4( IPV4_DEFAULT_ADDRESS );
1470+
TEST_ASSERT_EQUAL( NULL, pxEndPoint );
1471+
pxEndPoint = FreeRTOS_FindEndPointOnIP_IPv4( IPV4_DEFAULT_GATEWAY );
1472+
TEST_ASSERT_EQUAL( NULL, pxEndPoint );
14651473
}
14661474

14671475
/**

0 commit comments

Comments
 (0)