Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions source/FreeRTOS_IP_Utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -1029,10 +1029,6 @@ void vPreCheckConfigs( void )
#endif /* if ( ipconfigSUPPRESS_BUFFER_PADDING_CHECK == 0 ) */

/* LCOV_EXCL_BR_START */
uxSize = ipconfigNETWORK_MTU;
/* Check if MTU is big enough. */
configASSERT( uxSize >= ( ipSIZE_OF_IPv4_HEADER + ipSIZE_OF_TCP_HEADER + ipconfigTCP_MSS ) );

uxSize = sizeof( EthernetHeader_t );
/* Check structure packing is correct. */
configASSERT( uxSize == ipEXPECTED_EthernetHeader_t_SIZE );
Expand All @@ -1051,6 +1047,10 @@ void vPreCheckConfigs( void )

#if ipconfigUSE_TCP == 1
{
uxSize = ipconfigNETWORK_MTU;
/* Check if MTU is big enough for the configured TCP MSS. */
configASSERT( uxSize >= ( ipSIZE_OF_IPv4_HEADER + ipSIZE_OF_TCP_HEADER + ipconfigTCP_MSS ) );

uxSize = sizeof( TCPHeader_t );
configASSERT( uxSize == ( ipEXPECTED_TCPHeader_t_SIZE + ipSIZE_TCP_OPTIONS ) );
}
Expand Down
16 changes: 9 additions & 7 deletions source/include/FreeRTOSIPConfigDefaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -1453,7 +1453,7 @@ STATIC_ASSERT( ipconfigTCP_KEEP_ALIVE_INTERVAL <= ( portMAX_DELAY / configTICK_R
*
* Type: size_t
* Unit: bytes
* Minimum: 536 ( tcpMINIMUM_SEGMENT_LENGTH )
* Minimum when ipconfigUSE_TCP is enabled: 536 ( tcpMINIMUM_SEGMENT_LENGTH )
*
* Sets the MSS value (in bytes) for all TCP packets.
*
Expand All @@ -1474,13 +1474,15 @@ STATIC_ASSERT( ipconfigTCP_KEEP_ALIVE_INTERVAL <= ( portMAX_DELAY / configTICK_R
#define ipconfigTCP_MSS ( ipconfigNETWORK_MTU - 40U )
#endif

#if ( ipconfigTCP_MSS < 536 )
#error ipconfigTCP_MSS must be at least 536 ( tcpMINIMUM_SEGMENT_LENGTH )
#endif
#if ( ipconfigUSE_TCP == ipconfigENABLE )
#if ( ipconfigTCP_MSS < 536 )
#error ipconfigTCP_MSS must be at least 536 ( tcpMINIMUM_SEGMENT_LENGTH )
#endif

#if ( ipconfigTCP_MSS > SIZE_MAX )
#error ipconfigTCP_MSS overflows a size_t
#endif
#if ( ipconfigTCP_MSS > SIZE_MAX )
#error ipconfigTCP_MSS overflows a size_t
#endif
#endif /* if ( ipconfigUSE_TCP == ipconfigENABLE ) */

/*---------------------------------------------------------------------------*/

Expand Down
3 changes: 2 additions & 1 deletion test/build-combination/AllDisable/FreeRTOSIPConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,8 @@
* lower value can save RAM, depending on the buffer management scheme used. If
* ipconfigCAN_FRAGMENT_OUTGOING_PACKETS is 1 then (ipconfigNETWORK_MTU - 28) must
* be divisible by 8. */
#define ipconfigNETWORK_MTU 1500U
/* Use the minimum valid MTU to verify that disabled protocols add no constraints. */
#define ipconfigNETWORK_MTU 46U

/* Set ipconfigUSE_DNS to 1 to include a basic DNS client/resolver. DNS is used
* through the FreeRTOS_gethostbyname() API function. */
Expand Down