Skip to content

Commit b8c0fd8

Browse files
Merge branch 'main' into dev-stm32
2 parents 445dc68 + c1fc5fe commit b8c0fd8

File tree

118 files changed

+2638
-790
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+2638
-790
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ FreeRTOS-Plus-TCP is a lightweight TCP/IP stack for FreeRTOS. It provides a fami
33

44
This library has undergone static code analysis and checks for compliance with the [MISRA coding standard](https://www.misra.org.uk/). Any deviations from the MISRA C:2012 guidelines are documented under [MISRA Deviations](https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md). The library is validated for memory safety and data structure invariance through the [CBMC automated reasoning tool](https://www.cprover.org/cbmc/) for the functions that parse data originating from the network. The library is also protocol tested using Maxwell protocol tester for both IPv4 and IPv6.
55

6-
**FreeRTOS-Plus-TCP Library V4.2.1
7-
[source code](https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/tree/V4.2.1/source)
6+
**FreeRTOS-Plus-TCP Library V4.2.2
7+
[source code](https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/tree/V4.2.2/source)
88
is part of the
9-
[FreeRTOS 202406.00 LTS](https://github.com/FreeRTOS/FreeRTOS-LTS/tree/202406.00-LTS)
9+
[FreeRTOS 202406.01 LTS](https://github.com/FreeRTOS/FreeRTOS-LTS/tree/202406.01-LTS)
1010
release.**
1111

1212
## Getting started
1313
The easiest way to use version 4.0.0 and later of FreeRTOS-Plus-TCP is to refer the Getting started Guide (found [here](https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/GettingStarted.md))
1414
Another way is to start with the pre-configured IPv4 Windows Simulator demo (found in [this directory](https://github.com/FreeRTOS/FreeRTOS/tree/main/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Minimal_Windows_Simulator)) or IPv6 Multi-endpoint Windows Simulator demo (found in [this directory](https://github.com/FreeRTOS/FreeRTOS/tree/main/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_IPv6_Demo/IPv6_Multi_WinSim_demo)). That way you will have the correct FreeRTOS source files included, and the correct include paths configured. Once a demo application is building and executing you can remove the demo application files, and start to add in your own application source files. See the [FreeRTOS Kernel Quick Start Guide](https://www.freertos.org/FreeRTOS-quick-start-guide.html) for detailed instructions and other useful links.
1515

16-
Additionally, for FreeRTOS-Plus-TCP source code organization refer to the [Documentation](http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_Networking_Tutorial.html), and [API Reference](https://freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/FreeRTOS_TCP_API_Functions.html).
16+
Additionally, for FreeRTOS-Plus-TCP source code organization refer to the [Documentation](http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_Networking_Tutorial.html), and [API Reference](https://freertos.org/Documentation/03-Libraries/02-FreeRTOS-plus/02-FreeRTOS-plus-TCP/09-API-reference/01-FreeRTOS-plus-TCP-APIs).
1717

1818
### Getting help
1919
If you have any questions or need assistance troubleshooting your FreeRTOS project, we have an active community that can help on the [FreeRTOS Community Support Forum](https://forums.freertos.org). Please also refer to [FAQ](http://www.freertos.org/FAQHelp.html) for frequently asked questions.

source/FreeRTOS_ARP.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ _static ARPCacheRow_t xARPCache[ ipconfigARP_CACHE_ENTRIES ];
244244
/* Process received ARP frame to see if there is a clash. */
245245
#if ( ipconfigARP_USE_CLASH_DETECTION != 0 )
246246
{
247-
NetworkEndPoint_t * pxSourceEndPoint = FreeRTOS_FindEndPointOnIP_IPv4( ulSenderProtocolAddress, 2 );
247+
NetworkEndPoint_t * pxSourceEndPoint = FreeRTOS_FindEndPointOnIP_IPv4( ulSenderProtocolAddress );
248248

249249
if( ( pxSourceEndPoint != NULL ) && ( pxSourceEndPoint->ipv4_settings.ulIPAddress == ulSenderProtocolAddress ) )
250250
{
@@ -699,7 +699,7 @@ void vARPRefreshCacheEntry( const MACAddress_t * pxMACAddress,
699699
{
700700
#if ( ipconfigARP_STORES_REMOTE_ADDRESSES == 0 )
701701
/* Only process the IP address if it is on the local network. */
702-
BaseType_t xAddressIsLocal = ( FreeRTOS_FindEndPointOnNetMask( ulIPAddress, 2 ) != NULL ) ? 1 : 0; /* ARP remote address. */
702+
BaseType_t xAddressIsLocal = ( FreeRTOS_FindEndPointOnNetMask( ulIPAddress ) != NULL ) ? 1 : 0; /* ARP remote address. */
703703

704704
/* Only process the IP address if it matches with one of the end-points. */
705705
if( xAddressIsLocal != 0 )
@@ -789,7 +789,7 @@ static BaseType_t prvFindCacheEntry( const MACAddress_t * pxMACAddress,
789789
BaseType_t xReturn = pdFALSE;
790790

791791
#if ( ipconfigARP_STORES_REMOTE_ADDRESSES != 0 )
792-
BaseType_t xAddressIsLocal = ( FreeRTOS_FindEndPointOnNetMask( ulIPAddress, 2 ) != NULL ) ? 1 : 0; /* ARP remote address. */
792+
BaseType_t xAddressIsLocal = ( FreeRTOS_FindEndPointOnNetMask( ulIPAddress ) != NULL ) ? 1 : 0; /* ARP remote address. */
793793
#endif
794794

795795
/* Start with the maximum possible number. */
@@ -855,7 +855,7 @@ static BaseType_t prvFindCacheEntry( const MACAddress_t * pxMACAddress,
855855
/* If ARP stores the MAC address of IP addresses outside the
856856
* network, than the MAC address of the gateway should not be
857857
* overwritten. */
858-
BaseType_t xOtherIsLocal = ( FreeRTOS_FindEndPointOnNetMask( xARPCache[ x ].ulIPAddress, 3 ) != NULL ) ? 1 : 0; /* ARP remote address. */
858+
BaseType_t xOtherIsLocal = ( FreeRTOS_FindEndPointOnNetMask( xARPCache[ x ].ulIPAddress ) != NULL ) ? 1 : 0; /* ARP remote address. */
859859

860860
if( xAddressIsLocal == xOtherIsLocal )
861861
{
@@ -972,7 +972,7 @@ static BaseType_t prvFindCacheEntry( const MACAddress_t * pxMACAddress,
972972

973973
*( ppxEndPoint ) = NULL;
974974
ulAddressToLookup = *pulIPAddress;
975-
pxEndPoint = FreeRTOS_FindEndPointOnIP_IPv4( ulAddressToLookup, 0 );
975+
pxEndPoint = FreeRTOS_FindEndPointOnIP_IPv4( ulAddressToLookup );
976976

977977
if( xIsIPv4Multicast( ulAddressToLookup ) != 0 )
978978
{
@@ -999,7 +999,7 @@ static BaseType_t prvFindCacheEntry( const MACAddress_t * pxMACAddress,
999999
{
10001000
/* This is a broadcast so it uses the broadcast MAC address. */
10011001
( void ) memcpy( pxMACAddress->ucBytes, xBroadcastMACAddress.ucBytes, sizeof( MACAddress_t ) );
1002-
pxEndPoint = FreeRTOS_FindEndPointOnNetMask( ulAddressToLookup, 4 );
1002+
pxEndPoint = FreeRTOS_FindEndPointOnNetMask( ulAddressToLookup );
10031003

10041004
if( pxEndPoint != NULL )
10051005
{
@@ -1036,7 +1036,7 @@ static BaseType_t prvFindCacheEntry( const MACAddress_t * pxMACAddress,
10361036

10371037
/* It is assumed that devices with the same netmask are on the same
10381038
* LAN and don't need a gateway. */
1039-
pxEndPoint = FreeRTOS_FindEndPointOnNetMask( ulAddressToLookup, 4 );
1039+
pxEndPoint = FreeRTOS_FindEndPointOnNetMask( ulAddressToLookup );
10401040

10411041
if( pxEndPoint == NULL )
10421042
{
@@ -1346,7 +1346,7 @@ static BaseType_t prvFindCacheEntry( const MACAddress_t * pxMACAddress,
13461346
/* Its assumed that IPv4 endpoints belonging to different physical interface
13471347
* in the system will have a different subnet, but endpoints on same interface
13481348
* may have it. */
1349-
NetworkEndPoint_t * pxEndPoint = FreeRTOS_FindEndPointOnNetMask( ulIPAddress, 12 );
1349+
NetworkEndPoint_t * pxEndPoint = FreeRTOS_FindEndPointOnNetMask( ulIPAddress );
13501350

13511351
if( pxEndPoint != NULL )
13521352
{

source/FreeRTOS_DNS.c

Lines changed: 42 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,48 @@
5757
#include "FreeRTOS_DNS_Callback.h"
5858

5959

60+
/** @brief The MAC address used for LLMNR. */
61+
const MACAddress_t xLLMNR_MacAddress = { { 0x01, 0x00, 0x5e, 0x00, 0x00, 0xfc } };
62+
63+
/** @brief The IPv6 link-scope multicast MAC address */
64+
const MACAddress_t xLLMNR_MacAddressIPv6 = { { 0x33, 0x33, 0x00, 0x01, 0x00, 0x03 } };
65+
66+
/** @brief The IPv6 link-scope multicast address */
67+
const IPv6_Address_t ipLLMNR_IP_ADDR_IPv6 =
68+
{
69+
{ /* ff02::1:3 */
70+
0xff, 0x02,
71+
0x00, 0x00,
72+
0x00, 0x00,
73+
0x00, 0x00,
74+
0x00, 0x00,
75+
0x00, 0x00,
76+
0x00, 0x01,
77+
0x00, 0x03,
78+
}
79+
};
80+
81+
/** @brief The MAC address used for MDNS. */
82+
const MACAddress_t xMDNS_MacAddress = { { 0x01, 0x00, 0x5e, 0x00, 0x00, 0xfb } };
83+
84+
/** @brief The IPv6 multicast DNS MAC address. */
85+
const MACAddress_t xMDNS_MacAddressIPv6 = { { 0x33, 0x33, 0x00, 0x00, 0x00, 0xFB } };
86+
87+
/** @brief multicast DNS IPv6 address */
88+
const IPv6_Address_t ipMDNS_IP_ADDR_IPv6 =
89+
{
90+
{ /* ff02::fb */
91+
0xff, 0x02,
92+
0x00, 0x00,
93+
0x00, 0x00,
94+
0x00, 0x00,
95+
0x00, 0x00,
96+
0x00, 0x00,
97+
0x00, 0x00,
98+
0x00, 0xfb,
99+
}
100+
};
101+
60102
/* Exclude the entire file if DNS is not enabled. */
61103
#if ( ipconfigUSE_DNS != 0 )
62104

@@ -95,69 +137,7 @@
95137
struct freertos_addrinfo ** ppxAddressInfo,
96138
BaseType_t xFamily );
97139

98-
#if ( ipconfigUSE_LLMNR == 1 )
99-
/** @brief The MAC address used for LLMNR. */
100-
const MACAddress_t xLLMNR_MacAddress = { { 0x01, 0x00, 0x5e, 0x00, 0x00, 0xfc } };
101-
#endif /* ipconfigUSE_LLMNR == 1 */
102-
103140
/*-----------------------------------------------------------*/
104-
#if ( ipconfigUSE_LLMNR == 1 ) && ( ipconfigUSE_IPv6 != 0 )
105-
106-
/**
107-
* @brief The IPv6 link-scope multicast address
108-
*/
109-
const IPv6_Address_t ipLLMNR_IP_ADDR_IPv6 =
110-
{
111-
{ /* ff02::1:3 */
112-
0xff, 0x02,
113-
0x00, 0x00,
114-
0x00, 0x00,
115-
0x00, 0x00,
116-
0x00, 0x00,
117-
0x00, 0x00,
118-
0x00, 0x01,
119-
0x00, 0x03,
120-
}
121-
};
122-
123-
/**
124-
* @brief The IPv6 link-scope multicast MAC address
125-
*/
126-
const MACAddress_t xLLMNR_MacAddressIPv6 = { { 0x33, 0x33, 0x00, 0x01, 0x00, 0x03 } };
127-
#endif /* ipconfigUSE_LLMNR && ipconfigUSE_IPv6 */
128-
129-
#if ( ipconfigUSE_MDNS == 1 ) && ( ipconfigUSE_IPv6 != 0 )
130-
131-
/**
132-
* @brief multicast DNS IPv6 address
133-
*/
134-
const IPv6_Address_t ipMDNS_IP_ADDR_IPv6 =
135-
{
136-
{ /* ff02::fb */
137-
0xff, 0x02,
138-
0x00, 0x00,
139-
0x00, 0x00,
140-
0x00, 0x00,
141-
0x00, 0x00,
142-
0x00, 0x00,
143-
0x00, 0x00,
144-
0x00, 0xfb,
145-
}
146-
};
147-
148-
/**
149-
* @brief The IPv6 multicast DNS MAC address.
150-
* The MAC-addresses are provided here in case a network
151-
* interface needs it.
152-
*/
153-
const MACAddress_t xMDNS_MacAddressIPv6 = { { 0x33, 0x33, 0x00, 0x00, 0x00, 0xFB } };
154-
#endif /* ( ipconfigUSE_MDNS == 1 ) && ( ipconfigUSE_IPv6 != 0 ) */
155-
156-
157-
#if ( ipconfigUSE_MDNS == 1 )
158-
/** @brief The MAC address used for MDNS. */
159-
const MACAddress_t xMDNS_MacAddress = { { 0x01, 0x00, 0x5e, 0x00, 0x00, 0xfb } };
160-
#endif /* ipconfigUSE_MDNS == 1 */
161141

162142
/** @brief This global variable is being used to indicate to the driver which IP type
163143
* is preferred for name service lookup, either IPv6 or IPv4. */

source/FreeRTOS_DNS_Cache.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,10 +448,9 @@
448448
/* Add or update the item. */
449449
if( strlen( pcName ) < ( size_t ) ipconfigDNS_CACHE_NAME_LENGTH )
450450
{
451-
( void ) strncpy( xDNSCache[ uxFreeEntry ].pcName, pcName, ipconfigDNS_CACHE_NAME_LENGTH );
451+
( void ) strncpy( xDNSCache[ uxFreeEntry ].pcName, pcName, strlen( pcName ) );
452452
( void ) memcpy( &( xDNSCache[ uxFreeEntry ].xAddresses[ 0 ] ), pxIP, sizeof( *pxIP ) );
453453

454-
455454
xDNSCache[ uxFreeEntry ].ulTTL = ulTTL;
456455
xDNSCache[ uxFreeEntry ].ulTimeWhenAddedInSeconds = ulCurrentTimeSeconds;
457456
#if ( ipconfigDNS_CACHE_ADDRESSES_PER_ENTRY > 1 )

0 commit comments

Comments
 (0)