Skip to content

Commit

Permalink
Merge branch 'FreeRTOS:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
moninom1 authored Nov 21, 2023
2 parents 47d3bb3 + c263e33 commit d1f4bb5
Show file tree
Hide file tree
Showing 45 changed files with 133 additions and 111 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,15 @@ jobs:
asset_path: ./FreeRTOS-Plus-TCP-${{ github.event.inputs.version_number }}.zip
asset_name: FreeRTOS-Plus-TCP-${{ github.event.inputs.version_number }}.zip
asset_content_type: application/zip
cleanup:
needs:
- create-release
name: Cleanup
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Delete branch created for Tag by SBOM generator
run: |
# Delete the branch created for Tag by SBOM generator
git push -u origin --delete refs/heads/${{ github.event.inputs.version_number }}
2 changes: 1 addition & 1 deletion source/FreeRTOS_ARP.c
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ BaseType_t xCheckRequiresARPResolution( const NetworkBufferDescriptor_t * pxNetw
NetworkBufferDescriptor_t * pxTempBuffer;
size_t uxNeededSize;

uxNeededSize = ipSIZE_OF_ETH_HEADER + ipSIZE_OF_IPv6_HEADER + sizeof( ICMPRouterSolicitation_IPv6_t );
uxNeededSize = sizeof( ICMPPacket_IPv6_t );
pxTempBuffer = pxGetNetworkBufferWithDescriptor( BUFFER_FROM_WHERE_CALL( 199 ) uxNeededSize, 0U );

if( pxTempBuffer != NULL )
Expand Down
50 changes: 34 additions & 16 deletions source/FreeRTOS_ND.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,8 @@
{
BaseType_t x;
BaseType_t xFreeEntry = -1, xEntryFound = -1;
BaseType_t xOldestValue = ipconfigMAX_ARP_AGE + 1;
BaseType_t xOldestEntry = 0;

/* For each entry in the ND cache table. */
for( x = 0; x < ipconfigND_CACHE_ENTRIES; x++ )
Expand All @@ -304,29 +306,45 @@
else
{
/* Entry is valid but the IP-address doesn't match. */

/* Keep track of the oldest entry in case we need to overwrite it. The problem we are trying to avoid is
* that there may be a queued packet in pxARPWaitingNetworkBuffer and we may have just received the
* neighbor advertisement needed for that packet. If we don't store this network advertisement in cache,
* the parting of the frame from pxARPWaitingNetworkBuffer will cause the sending of neighbor solicitation
* and stores the frame in pxARPWaitingNetworkBuffer. This becomes a vicious circle with thousands of
* neighbor solicitation/advertisement packets going back and forth because the ND cache is full.
* Overwriting the oldest cache entry is not a fool-proof solution, but it's something. */
if( xNDCache[ x ].ucAge < xOldestValue )
{
xOldestValue = xNDCache[ x ].ucAge;
xOldestEntry = x;
}
}
}

if( xEntryFound < 0 )
{
/* The IP-address was not found, use the first free location. */
xEntryFound = xFreeEntry;
if( xFreeEntry >= 0 )
{
xEntryFound = xFreeEntry;
}
else
{
/* No free location. Overwrite the oldest. */
xEntryFound = xOldestEntry;
FreeRTOS_printf( ( "vNDRefreshCacheEntry: Cache FULL! Overwriting oldest entry %i with %02X-%02X-%02X-%02X-%02X-%02X\n", ( int ) xEntryFound, pxMACAddress->ucBytes[ 0 ], pxMACAddress->ucBytes[ 1 ], pxMACAddress->ucBytes[ 2 ], pxMACAddress->ucBytes[ 3 ], pxMACAddress->ucBytes[ 4 ], pxMACAddress->ucBytes[ 5 ] ) );
}
}

if( xEntryFound >= 0 )
{
/* Copy the IP-address. */
( void ) memcpy( xNDCache[ xEntryFound ].xIPAddress.ucBytes, pxIPAddress->ucBytes, ipSIZE_OF_IPv6_ADDRESS );
/* Copy the MAC-address. */
( void ) memcpy( xNDCache[ xEntryFound ].xMACAddress.ucBytes, pxMACAddress->ucBytes, sizeof( MACAddress_t ) );
xNDCache[ xEntryFound ].pxEndPoint = pxEndPoint;
xNDCache[ xEntryFound ].ucAge = ( uint8_t ) ipconfigMAX_ARP_AGE;
xNDCache[ xEntryFound ].ucValid = ( uint8_t ) pdTRUE;
}
else
{
FreeRTOS_printf( ( "vNDRefreshCacheEntry: %pip not found\n", ( void * ) pxIPAddress->ucBytes ) );
}
/* At this point, xEntryFound is always a valid index. */
/* Copy the IP-address. */
( void ) memcpy( xNDCache[ xEntryFound ].xIPAddress.ucBytes, pxIPAddress->ucBytes, ipSIZE_OF_IPv6_ADDRESS );
/* Copy the MAC-address. */
( void ) memcpy( xNDCache[ xEntryFound ].xMACAddress.ucBytes, pxMACAddress->ucBytes, sizeof( MACAddress_t ) );
xNDCache[ xEntryFound ].pxEndPoint = pxEndPoint;
xNDCache[ xEntryFound ].ucAge = ( uint8_t ) ipconfigMAX_ARP_AGE;
xNDCache[ xEntryFound ].ucValid = ( uint8_t ) pdTRUE;
}
/*-----------------------------------------------------------*/

Expand Down Expand Up @@ -482,7 +500,7 @@
char pcBuffer[ 40 ];

/* Loop through each entry in the ND cache. */
for( x = 0; x < ipconfigARP_CACHE_ENTRIES; x++ )
for( x = 0; x < ipconfigND_CACHE_ENTRIES; x++ )
{
if( xNDCache[ x ].ucValid != ( uint8_t ) 0U )
{
Expand Down
2 changes: 1 addition & 1 deletion source/FreeRTOS_Sockets.c
Original file line number Diff line number Diff line change
Expand Up @@ -4546,7 +4546,7 @@ void vSocketWakeUpUser( FreeRTOS_Socket_t * pxSocket )
xBytesLeft -= xByteCount;
xBytesSent += xByteCount;

if( ( xBytesLeft == 0 ) && ( pvBuffer == NULL ) )
if( ( xBytesLeft == 0 ) || ( pvBuffer == NULL ) )
{
/* pvBuffer can be NULL in case TCP zero-copy transmissions are used. */
break;
Expand Down
4 changes: 2 additions & 2 deletions source/include/FreeRTOS_BitConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@


#ifdef __cplusplus
} /* extern "C" */
} /* extern "C" */
#endif

#endif /* !defined( FREERTOS_STREAM_BUFFER_H ) */
#endif /* FREERTOS_STREAM_BUFFER_H */
6 changes: 3 additions & 3 deletions source/include/FreeRTOS_DHCPv6.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@

/** @brief Default v6 DHCP client port. */
#define ipDHCPv6_CLIENT_PORT 546U
/** @brief Default v6 DHCP server port. */
/** @brief Default v6 DHCP server port. */
#define ipDHCPv6_SERVER_PORT 547U

/** @brief The ID of a client or a server. */
Expand Down Expand Up @@ -158,12 +158,12 @@
void vDHCPv6Stop( struct xNetworkEndPoint * pxEndPoint );

#ifdef __cplusplus
} /* extern "C" */
} /* extern "C" */
#endif

/* The application should supply the following time-function.
* It must return the number of seconds that have passed since
* 1/1/1970. */
extern uint32_t ulApplicationTimeHook( void );

#endif /* FREERTOS_DHCPv6_H */
#endif /* FREERTOS_DHCPV6_H */
2 changes: 1 addition & 1 deletion source/include/FreeRTOS_DNS_Cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@
struct freertos_addrinfo ** ppxAddressInfo );
#endif /* if ( ipconfigUSE_DNS_CACHE == 1 ) */

#endif /* ifndef FREERTOS_DNS_CACHE_H */
#endif /* FREERTOS_DNS_CACHE_H */
2 changes: 1 addition & 1 deletion source/include/FreeRTOS_DNS_Callback.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@
#endif
/* *INDENT-ON* */

#endif /* ifndef FREERTOS_DNS_CALLBACK_H */
#endif /* FREERTOS_DNS_CALLBACK_H */
2 changes: 1 addition & 1 deletion source/include/FreeRTOS_DNS_Globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -314,4 +314,4 @@
#define ipMDNS_IP_ADDRESS 0xfb0000e0U /* 224.0.0.251 */
#endif

#endif /* ifndef FREERTOS_DNS_GLOBALS_H */
#endif /* FREERTOS_DNS_GLOBALS_H */
2 changes: 1 addition & 1 deletion source/include/FreeRTOS_DNS_Networking.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@
void DNS_CloseSocket( Socket_t xDNSSocket );

#endif /* if ( ipconfigUSE_DNS != 0 ) */
#endif /* ifndef FREERTOS_DNS_NETWORKING_H */
#endif /* FREERTOS_DNS_NETWORKING_H */
16 changes: 15 additions & 1 deletion source/include/FreeRTOS_DNS_Parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@

/* Standard includes. */
#include <stdint.h>

/* *INDENT-OFF* */
#ifdef __cplusplus
extern "C" {
#endif
/* *INDENT-ON* */

#if ( ipconfigUSE_DNS != 0 )

/** @brief Flag DNS parsing errors in situations where an IPv4 address is the return
Expand Down Expand Up @@ -87,4 +94,11 @@
size_t * uxBytesRead );

#endif /* if ( ipconfigUSE_DNS != 0 ) */
#endif /* ifndef FREERTOS_DNS_PARSER_H */

/* *INDENT-OFF* */
#ifdef __cplusplus
} /* extern "C" */
#endif
/* *INDENT-ON* */

#endif /* FREERTOS_DNS_PARSER_H */
2 changes: 1 addition & 1 deletion source/include/FreeRTOS_IPv4.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,4 @@ enum eFrameProcessingResult prvCheckIP4HeaderOptions( struct xNETWORK_BUFFER * c
#endif
/* *INDENT-ON* */

#endif /* FREERTOS_IP_H */
#endif /* FREERTOS_IPV4_H */
2 changes: 1 addition & 1 deletion source/include/FreeRTOS_IPv4_Private.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,4 @@ typedef struct xTCP_PACKET TCPPacket_t;
#endif
/* *INDENT-ON* */

#endif /* FREERTOS_IP_PRIVATE_H */
#endif /* FREERTOS_IPV4_PRIVATE_H */
3 changes: 2 additions & 1 deletion source/include/FreeRTOS_IPv4_Sockets.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
struct freertos_sockaddr * pxSourceAddress );

#ifdef __cplusplus
} /* extern "C" */
} /* extern "C" */
#endif

#endif /* FREERTOS_IPV4_SOCKETS_H */
2 changes: 1 addition & 1 deletion source/include/FreeRTOS_IPv4_Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ BaseType_t prvChecksumIPv4Checks( uint8_t * pucEthernetBuffer,
#endif
/* *INDENT-ON* */

#endif /* FREERTOS_IP_UTILS_H */
#endif /* FREERTOS_IPV4_UTILS_H */
4 changes: 2 additions & 2 deletions source/include/FreeRTOS_IPv6.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ BaseType_t xGetExtensionOrder( uint8_t ucProtocol,

/* *INDENT-OFF* */
#ifdef __cplusplus
} /* extern "C" */
} /* extern "C" */
#endif
/* *INDENT-ON* */

#endif /* FREERTOS_IP_H */
#endif /* FREERTOS_IPV6_H */
2 changes: 1 addition & 1 deletion source/include/FreeRTOS_IPv6_Private.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,4 +270,4 @@ eFrameProcessingResult_t prvProcessICMPMessage_IPv6( NetworkBufferDescriptor_t *
#endif
/* *INDENT-ON* */

#endif /* FREERTOS_IP_PRIVATE_H */
#endif /* FREERTOS_IPV6_PRIVATE_H */
2 changes: 1 addition & 1 deletion source/include/FreeRTOS_IPv6_Sockets.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
struct freertos_sockaddr * pxSourceAddress );

#ifdef __cplusplus
} /* extern "C" */
} /* extern "C" */
#endif

#endif /* FREERTOS_IPV6_SOCKETS_H */
2 changes: 1 addition & 1 deletion source/include/FreeRTOS_IPv6_Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ size_t usGetExtensionHeaderLength( const uint8_t * pucEthernetBuffer,
#endif
/* *INDENT-ON* */

#endif /* FREERTOS_IP_UTILS_H */
#endif /* FREERTOS_IPV6_UTILS_H */
2 changes: 1 addition & 1 deletion source/include/FreeRTOS_ND.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@

/* *INDENT-OFF* */
#ifdef __cplusplus
}
} /* extern "C" */
#endif
/* *INDENT-ON* */

Expand Down
2 changes: 1 addition & 1 deletion source/include/FreeRTOS_Routing.h
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@
#endif

#ifdef __cplusplus
} /* extern "C" */
} /* extern "C" */
#endif

#endif /* FREERTOS_ROUTING_H */
2 changes: 1 addition & 1 deletion source/include/FreeRTOS_Sockets.h
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@
#endif

#ifdef __cplusplus
} /* extern "C" */
} /* extern "C" */
#endif

#endif /* FREERTOS_SOCKETS_H */
12 changes: 6 additions & 6 deletions source/portable/NetworkInterface/ATSAM4E/ethernet_phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@
#include "instance/gmac.h"

/*/ @cond 0 */
/**INDENT-OFF**/
/* *INDENT-OFF* */
#ifdef __cplusplus
extern "C" {
extern "C" {
#endif
/**INDENT-ON**/
/* *INDENT-ON* */
/*/ @endcond */

/**
Expand Down Expand Up @@ -506,11 +506,11 @@ uint8_t ethernet_phy_reset( Gmac * p_gmac,
}

/*/ @cond 0 */
/**INDENT-OFF**/
/* *INDENT-OFF* */
#ifdef __cplusplus
}
} /* extern "C" */
#endif
/**INDENT-ON**/
/* *INDENT-ON* */
/*/ @endcond */

/**
Expand Down
2 changes: 1 addition & 1 deletion source/portable/NetworkInterface/ATSAM4E/ethernet_phy.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@
extern PhyProps_t phy_props;

#ifdef __cplusplus
} /* extern "C" */
} /* extern "C" */
#endif

#endif /* #ifndef ETHERNET_PHY_H_INCLUDED */
6 changes: 1 addition & 5 deletions source/portable/NetworkInterface/ATSAM4E/gmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,9 @@
#include "ethernet_phy.h"

/*/ @cond 0 */
/**INDENT-OFF**/
#ifdef __cplusplus
extern "C" {
#endif
/**INDENT-ON**/
/*/ @endcond */

#ifndef ARRAY_SIZE
Expand Down Expand Up @@ -1028,9 +1026,7 @@ void gmac_handler( gmac_device_t * p_gmac_dev )
/*@} */

/*/ @cond 0 */
/**INDENT-OFF**/
#ifdef __cplusplus
}
} /* extern "C" */
#endif
/**INDENT-ON**/
/*/ @endcond */
6 changes: 1 addition & 5 deletions source/portable/NetworkInterface/ATSAM4E/gmac.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,9 @@
#include "compiler.h"

/*/ @cond 0 */
/**INDENT-OFF**/
#ifdef __cplusplus
extern "C" {
#endif
/**INDENT-ON**/
/*/ @endcond */

/** The buffer addresses written into the descriptors must be aligned, so the
Expand Down Expand Up @@ -1228,11 +1226,9 @@
void gmac_handler( gmac_device_t * p_gmac_dev );

/*/ @cond 0 */
/**INDENT-OFF**/
#ifdef __cplusplus
}
} /* extern "C" */
#endif
/**INDENT-ON**/
/*/ @endcond */

/**
Expand Down
6 changes: 1 addition & 5 deletions source/portable/NetworkInterface/ATSAM4E/instance/gmac.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,9 @@
#include "component/gmac.h"

/*/ @cond 0 */
/**INDENT-OFF**/
#ifdef __cplusplus
extern "C" {
#endif
/**INDENT-ON**/
/*/ @endcond */

/** The buffer addresses written into the descriptors must be aligned, so the
Expand Down Expand Up @@ -1232,11 +1230,9 @@
void gmac_handler( gmac_device_t * p_gmac_dev );

/*/ @cond 0 */
/**INDENT-OFF**/
#ifdef __cplusplus
}
} /* extern "C" */
#endif
/**INDENT-ON**/
/*/ @endcond */

/**
Expand Down
Loading

0 comments on commit d1f4bb5

Please sign in to comment.