diff --git a/source/FreeRTOS_ARP.c b/source/FreeRTOS_ARP.c index 112dbea1d..2290728b5 100644 --- a/source/FreeRTOS_ARP.c +++ b/source/FreeRTOS_ARP.c @@ -476,11 +476,11 @@ BaseType_t xIsIPInARPCache( uint32_t ulAddressToLookup ) * * @return pdTRUE if the packet needs ARP resolution, pdFALSE otherwise. */ -BaseType_t xCheckRequiresARPResolution( NetworkBufferDescriptor_t * pxNetworkBuffer ) +BaseType_t xCheckRequiresARPResolution( const NetworkBufferDescriptor_t * pxNetworkBuffer ) { BaseType_t xNeedsARPResolution = pdFALSE; - switch( uxIPHeaderSizePacket( ( const NetworkBufferDescriptor_t * ) pxNetworkBuffer ) ) + switch( uxIPHeaderSizePacket( pxNetworkBuffer ) ) { #if ( ipconfigUSE_IPv4 != 0 ) case ipSIZE_OF_IPv4_HEADER: @@ -1457,9 +1457,6 @@ void FreeRTOS_ClearARP( const struct xNetworkEndPoint * pxEndPoint ) BaseType_t xResult = pdFALSE; NetworkBufferDescriptor_t * pxUseDescriptor = pxDescriptor; - /* MISRA Ref 11.3.1 [Misaligned access] */ - /* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-113 */ - /* coverity[misra_c_2012_rule_11_3_violation] */ const IPPacket_t * pxIPPacket; if( ( pxUseDescriptor == NULL ) || ( pxUseDescriptor->xDataLength < sizeof( IPPacket_t ) ) ) @@ -1468,6 +1465,9 @@ void FreeRTOS_ClearARP( const struct xNetworkEndPoint * pxEndPoint ) } else { + /* MISRA Ref 11.3.1 [Misaligned access] */ + /* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-113 */ + /* coverity[misra_c_2012_rule_11_3_violation] */ pxIPPacket = ( ( IPPacket_t * ) pxUseDescriptor->pucEthernetBuffer ); if( pxIPPacket->xEthernetHeader.usFrameType == ipIPv4_FRAME_TYPE ) diff --git a/source/FreeRTOS_DHCPv6.c b/source/FreeRTOS_DHCPv6.c index c9b34e282..8a2eccad0 100644 --- a/source/FreeRTOS_DHCPv6.c +++ b/source/FreeRTOS_DHCPv6.c @@ -351,6 +351,7 @@ static BaseType_t xDHCPv6Process_PassReplyToEndPoint( struct xNetworkEndPoint * } else { + /* do nothing, coverity happy */ } } diff --git a/source/FreeRTOS_DNS_Cache.c b/source/FreeRTOS_DNS_Cache.c index 5021306fa..4c3f5715a 100644 --- a/source/FreeRTOS_DNS_Cache.c +++ b/source/FreeRTOS_DNS_Cache.c @@ -51,7 +51,7 @@ /*! * @brief DNS cache structure instantiation */ - static DNSCacheRow_t xDNSCache[ ipconfigDNS_CACHE_ENTRIES ] = { 0x0 }; + static DNSCacheRow_t xDNSCache[ ipconfigDNS_CACHE_ENTRIES ]; /*! * @brief indicates the index of a free entry in the cache structure @@ -82,11 +82,9 @@ const IPv46_Address_t * pxIP, uint32_t ulCurrentTimeSeconds ); - #if ( ipconfigUSE_DNS_CACHE == 1 ) - /** Copy DNS cache entries at xIndex to a linked struct addrinfo. */ - static void prvReadDNSCache( BaseType_t uxIndex, - struct freertos_addrinfo ** ppxAddressInfo ); - #endif +/** Copy DNS cache entries at xIndex to a linked struct addrinfo. */ + static void prvReadDNSCache( BaseType_t uxIndex, + struct freertos_addrinfo ** ppxAddressInfo ); /*-----------------------------------------------------------*/ @@ -476,76 +474,71 @@ } /*-----------------------------------------------------------*/ - #if ( ipconfigUSE_DNS_CACHE == 1 ) - /** * @brief Copy DNS cache entries at uxIndex to a linked struct addrinfo. * @param[in] uxIndex The index from where entries must be copied. * @param[out] ppxAddressInfo Target to store the DNS entries. */ - static void prvReadDNSCache( BaseType_t uxIndex, - struct freertos_addrinfo ** ppxAddressInfo ) - { - size_t uxIPAddressIndex; - size_t uxNumIPAddresses = 1U; - const IPv46_Address_t * pxAddresses; - struct freertos_addrinfo * pxNewAddress = NULL; - struct freertos_addrinfo ** ppxLastAddress = ppxAddressInfo; - - #if ( ipconfigDNS_CACHE_ADDRESSES_PER_ENTRY > 1 ) - uxNumIPAddresses = ( size_t ) xDNSCache[ uxIndex ].ucNumIPAddresses; + static void prvReadDNSCache( BaseType_t uxIndex, + struct freertos_addrinfo ** ppxAddressInfo ) + { + size_t uxIPAddressIndex; + size_t uxNumIPAddresses = 1U; + const IPv46_Address_t * pxAddresses; + struct freertos_addrinfo * pxNewAddress = NULL; + struct freertos_addrinfo ** ppxLastAddress = ppxAddressInfo; - if( uxNumIPAddresses > ( size_t ) ipconfigDNS_CACHE_ADDRESSES_PER_ENTRY ) - { - /* Make this a configASSERT()? */ - uxNumIPAddresses = ipconfigDNS_CACHE_ADDRESSES_PER_ENTRY; - } - #endif /* ( ipconfigDNS_CACHE_ADDRESSES_PER_ENTRY > 1 ) */ + #if ( ipconfigDNS_CACHE_ADDRESSES_PER_ENTRY > 1 ) + uxNumIPAddresses = ( size_t ) xDNSCache[ uxIndex ].ucNumIPAddresses; - for( uxIPAddressIndex = 0; uxIPAddressIndex < uxNumIPAddresses; uxIPAddressIndex++ ) + if( uxNumIPAddresses > ( size_t ) ipconfigDNS_CACHE_ADDRESSES_PER_ENTRY ) { - pxAddresses = &( xDNSCache[ uxIndex ].xAddresses[ uxIPAddressIndex ] ); - - switch( pxAddresses->xIs_IPv6 ) /* LCOV_EXCL_BR_LINE - xIs_IPv6 is always either pdFALSE or pdTRUE. */ - { - #if ( ipconfigUSE_IPv4 != 0 ) - case pdFALSE: - { - const uint8_t * ucBytes = ( const uint8_t * ) &( pxAddresses->xIPAddress.ulIP_IPv4 ); - pxNewAddress = pxNew_AddrInfo( xDNSCache[ uxIndex ].pcName, FREERTOS_AF_INET4, ucBytes ); - } - break; - #endif /* ( ipconfigUSE_IPv4 != 0 ) */ + /* Make this a configASSERT()? */ + uxNumIPAddresses = ipconfigDNS_CACHE_ADDRESSES_PER_ENTRY; + } + #endif /* ( ipconfigDNS_CACHE_ADDRESSES_PER_ENTRY > 1 ) */ - #if ( ipconfigUSE_IPv6 != 0 ) - case pdTRUE: - pxNewAddress = pxNew_AddrInfo( xDNSCache[ uxIndex ].pcName, FREERTOS_AF_INET6, pxAddresses->xIPAddress.xIP_IPv6.ucBytes ); - break; - #endif /* ( ipconfigUSE_IPv6 != 0 ) */ + for( uxIPAddressIndex = 0; uxIPAddressIndex < uxNumIPAddresses; uxIPAddressIndex++ ) + { + pxAddresses = &( xDNSCache[ uxIndex ].xAddresses[ uxIPAddressIndex ] ); - default: /* LCOV_EXCL_LINE - xIs_IPv6 is always either pdFALSE or FREERTOS_AF_INET6. */ - /* MISRA 16.4 Compliance */ - FreeRTOS_debug_printf( ( "prvReadDNSCache: Undefined IP Type \n" ) ); - break; /* LCOV_EXCL_LINE - xIs_IPv6 is always either pdFALSE or FREERTOS_AF_INET6. */ - } + switch( pxAddresses->xIs_IPv6 ) /* LCOV_EXCL_BR_LINE - xIs_IPv6 is always either pdFALSE or pdTRUE. */ + { + #if ( ipconfigUSE_IPv4 != 0 ) + case pdFALSE: + { + const uint8_t * ucBytes = ( const uint8_t * ) &( pxAddresses->xIPAddress.ulIP_IPv4 ); + pxNewAddress = pxNew_AddrInfo( xDNSCache[ uxIndex ].pcName, FREERTOS_AF_INET4, ucBytes ); + } + break; + #endif /* ( ipconfigUSE_IPv4 != 0 ) */ - if( pxNewAddress == NULL ) - { - /* Malloc must has failed. */ - break; - } + #if ( ipconfigUSE_IPv6 != 0 ) + case pdTRUE: + pxNewAddress = pxNew_AddrInfo( xDNSCache[ uxIndex ].pcName, FREERTOS_AF_INET6, pxAddresses->xIPAddress.xIP_IPv6.ucBytes ); + break; + #endif /* ( ipconfigUSE_IPv6 != 0 ) */ - /* Set either 'ppxAddressInfo' or 'pxNewAddress->ai_next'. */ - *( ppxLastAddress ) = pxNewAddress; + default: /* LCOV_EXCL_LINE - xIs_IPv6 is always either pdFALSE or FREERTOS_AF_INET6. */ + /* MISRA 16.4 Compliance */ + FreeRTOS_debug_printf( ( "prvReadDNSCache: Undefined IP Type \n" ) ); + break; /* LCOV_EXCL_LINE - xIs_IPv6 is always either pdFALSE or FREERTOS_AF_INET6. */ + } - ppxLastAddress = &( pxNewAddress->ai_next ); + if( pxNewAddress == NULL ) + { + /* Malloc must has failed. */ + break; } + + /* Set either 'ppxAddressInfo' or 'pxNewAddress->ai_next'. */ + *( ppxLastAddress ) = pxNewAddress; + + ppxLastAddress = &( pxNewAddress->ai_next ); } - #endif /* #if( ipconfigUSE_DNS_CACHE == 1 ) */ + } /*-----------------------------------------------------------*/ - #if ( ipconfigUSE_DNS_CACHE == 1 ) - /** * @brief Lookup the given hostname in the DNS cache * @param[in] pcHostName THe host name to lookup @@ -554,74 +547,73 @@ * @returns This function returns either a valid IPv4 address, or * in case of an IPv6 lookup, it will return a non-zero. */ - uint32_t Prepare_CacheLookup( const char * pcHostName, - BaseType_t xFamily, - struct freertos_addrinfo ** ppxAddressInfo ) - { - uint32_t ulIPAddress = 0U; - IPv46_Address_t xIPv46_Address; + uint32_t Prepare_CacheLookup( const char * pcHostName, + BaseType_t xFamily, + struct freertos_addrinfo ** ppxAddressInfo ) + { + uint32_t ulIPAddress = 0U; + IPv46_Address_t xIPv46_Address; - switch( xFamily ) - { - #if ( ipconfigUSE_IPv4 != 0 ) - case FREERTOS_AF_INET: - { - BaseType_t xFound; + switch( xFamily ) + { + #if ( ipconfigUSE_IPv4 != 0 ) + case FREERTOS_AF_INET: + { + BaseType_t xFound; - xIPv46_Address.xIs_IPv6 = pdFALSE; - xFound = FreeRTOS_ProcessDNSCache( pcHostName, &( xIPv46_Address ), 0, pdTRUE, ppxAddressInfo ); + xIPv46_Address.xIs_IPv6 = pdFALSE; + xFound = FreeRTOS_ProcessDNSCache( pcHostName, &( xIPv46_Address ), 0, pdTRUE, ppxAddressInfo ); - if( xFound != 0 ) + if( xFound != 0 ) + { + if( ( ppxAddressInfo != NULL ) && ( *( ppxAddressInfo ) != NULL ) ) { - if( ( ppxAddressInfo != NULL ) && ( *( ppxAddressInfo ) != NULL ) ) - { - const struct freertos_sockaddr * sockaddr = ( *( ppxAddressInfo ) )->ai_addr; + const struct freertos_sockaddr * sockaddr = ( *( ppxAddressInfo ) )->ai_addr; - ulIPAddress = sockaddr->sin_address.ulIP_IPv4; - } - } - else - { - /* prvGetHostByName will be called to start a DNS lookup. */ + ulIPAddress = sockaddr->sin_address.ulIP_IPv4; } } - break; - #endif /* ( ipconfigUSE_IPv4 != 0 ) */ - - #if ( ipconfigUSE_IPv6 != 0 ) - case FREERTOS_AF_INET6: + else { - BaseType_t xFound; + /* prvGetHostByName will be called to start a DNS lookup. */ + } + } + break; + #endif /* ( ipconfigUSE_IPv4 != 0 ) */ - xIPv46_Address.xIs_IPv6 = pdTRUE; - xFound = FreeRTOS_ProcessDNSCache( pcHostName, &( xIPv46_Address ), 0, pdTRUE, ppxAddressInfo ); + #if ( ipconfigUSE_IPv6 != 0 ) + case FREERTOS_AF_INET6: + { + BaseType_t xFound; - if( xFound != 0 ) - { - if( ( ppxAddressInfo != NULL ) && ( *( ppxAddressInfo ) != NULL ) ) - { - /* This function returns either a valid IPv4 address, or - * in case of an IPv6 lookup, it will return a non-zero */ - ulIPAddress = 1U; - } - } - else + xIPv46_Address.xIs_IPv6 = pdTRUE; + xFound = FreeRTOS_ProcessDNSCache( pcHostName, &( xIPv46_Address ), 0, pdTRUE, ppxAddressInfo ); + + if( xFound != 0 ) + { + if( ( ppxAddressInfo != NULL ) && ( *( ppxAddressInfo ) != NULL ) ) { - /* prvGetHostByName will be called to start a DNS lookup. */ + /* This function returns either a valid IPv4 address, or + * in case of an IPv6 lookup, it will return a non-zero */ + ulIPAddress = 1U; } } - break; - #endif /* ( ipconfigUSE_IPv6 != 0 ) */ - - default: - /* MISRA 16.4 Compliance */ - FreeRTOS_debug_printf( ( "Prepare_CacheLookup: Undefined xFamily \n" ) ); - break; - } - - return ulIPAddress; + else + { + /* prvGetHostByName will be called to start a DNS lookup. */ + } + } + break; + #endif /* ( ipconfigUSE_IPv6 != 0 ) */ + + default: + /* MISRA 16.4 Compliance */ + FreeRTOS_debug_printf( ( "Prepare_CacheLookup: Undefined xFamily \n" ) ); + break; } - #endif /* ( ipconfigUSE_DNS_CACHE == 1 ) */ + + return ulIPAddress; + } /*-----------------------------------------------------------*/ #if ( ipconfigDNS_CACHE_ADDRESSES_PER_ENTRY > 1 ) @@ -688,5 +680,4 @@ #endif /* if ( ipconfigDNS_CACHE_ADDRESSES_PER_ENTRY > 1 ) */ /*-----------------------------------------------------------*/ - #endif /* if ( ( ipconfigUSE_DNS != 0 ) && ( ipconfigUSE_DNS_CACHE == 1 ) ) */ diff --git a/source/FreeRTOS_IP.c b/source/FreeRTOS_IP.c index cde09c0ac..5266bbf68 100644 --- a/source/FreeRTOS_IP.c +++ b/source/FreeRTOS_IP.c @@ -519,13 +519,20 @@ static void prvIPTask_Initialise( void ) /* Mark the timer as inactive since we are not waiting on any ARP resolution as of now. */ vIPSetARPResolutionTimerEnableState( pdFALSE ); - #if ( ipconfigDNS_USE_CALLBACKS != 0 ) + #if ( ( ipconfigDNS_USE_CALLBACKS != 0 ) && ( ipconfigUSE_DNS != 0 ) ) { - /* The following function is declared in FreeRTOS_DNS.c and 'private' to + /* The following function is declared in FreeRTOS_DNS.c and 'private' to * this library */ vDNSInitialise(); } - #endif /* ipconfigDNS_USE_CALLBACKS != 0 */ + #endif /* ( ipconfigDNS_USE_CALLBACKS != 0 ) && ( ipconfigUSE_DNS != 0 ) */ + + #if ( ( ipconfigUSE_DNS_CACHE != 0 ) && ( ipconfigUSE_DNS != 0 ) ) + { + /* Clear the DNS cache once only. */ + FreeRTOS_dnsclear(); + } + #endif /* ( ( ipconfigUSE_DNS_CACHE != 0 ) && ( ipconfigUSE_DNS != 0 ) ) */ /* Initialisation is complete and events can now be processed. */ xIPTaskInitialised = pdTRUE; diff --git a/source/FreeRTOS_IP_Utils.c b/source/FreeRTOS_IP_Utils.c index 33f277981..767ccdeaa 100644 --- a/source/FreeRTOS_IP_Utils.c +++ b/source/FreeRTOS_IP_Utils.c @@ -430,7 +430,7 @@ static BaseType_t prvChecksumProtocolChecks( size_t uxBufferLength, } else { - uxOptionsLength = ( size_t ) ( ( ucLength - 5U ) << 2U ); + uxOptionsLength = ( ( ( size_t ) ucLength - 5U ) << 2U ); pxSet->uxProtocolHeaderLength = ipSIZE_OF_TCP_HEADER + uxOptionsLength; #if ( ipconfigHAS_DEBUG_PRINTF != 0 ) diff --git a/source/FreeRTOS_ND.c b/source/FreeRTOS_ND.c index 031233176..2a8c496de 100644 --- a/source/FreeRTOS_ND.c +++ b/source/FreeRTOS_ND.c @@ -234,7 +234,7 @@ if( eMyType == eIPType ) { - eReturn = prvNDCacheLookup( pxIPAddress, pxMACAddress, &pxEndPoint ); + eReturn = prvNDCacheLookup( pxIPAddress, pxMACAddress, ppxEndPoint ); break; } } diff --git a/source/FreeRTOS_RA.c b/source/FreeRTOS_RA.c index 6792677af..1995c4393 100644 --- a/source/FreeRTOS_RA.c +++ b/source/FreeRTOS_RA.c @@ -267,7 +267,7 @@ size_t uxPrefixLength = ( size_t ) pucBytes[ uxIndex + 1U ]; size_t uxLength = uxPrefixLength * 8U; - if( uxPrefixLength == 0 ) + if( uxPrefixLength == 0U ) { /* According to RFC 4861, length of the option value 0 is invalid. Hence returning from here */ FreeRTOS_printf( ( "RA: Invalid length of the option value as zero. " ) ); diff --git a/source/FreeRTOS_Routing.c b/source/FreeRTOS_Routing.c index d1859b83b..d0dfbbb3d 100644 --- a/source/FreeRTOS_Routing.c +++ b/source/FreeRTOS_Routing.c @@ -740,8 +740,8 @@ struct xIPv6_Couple NetworkEndPoint_t * pxEndPoint; NetworkEndPoint_t * pxReturn = NULL; /* endpoints found for IP-type, IP-address, and MAC-address. */ - NetworkEndPoint_t * pxFound[ rMATCH_COUNT ] = { NULL, NULL, NULL }; - BaseType_t xCount[ rMATCH_COUNT ] = { 0, 0, 0 }; + NetworkEndPoint_t * pxFound[ rMATCH_COUNT ] = { NULL, NULL, NULL, NULL }; + BaseType_t xCount[ rMATCH_COUNT ] = { 0, 0, 0, 0 }; BaseType_t xIndex; BaseType_t xIsIPv6 = ( usFrameType == ipIPv6_FRAME_TYPE ) ? pdTRUE : pdFALSE; BaseType_t xGatewayTarget = pdFALSE; @@ -821,9 +821,9 @@ struct xIPv6_Couple break; #endif /* ( ipconfigUSE_IPv6 != 0 ) */ - #if ( ipconfigUSE_IPv4 != 0 ) - case ( BaseType_t ) pdFALSE: - + case ( BaseType_t ) pdFALSE: + default: + #if ( ipconfigUSE_IPv4 != 0 ) if( pxEndPoint->ipv4_settings.ulIPAddress == pxIPAddressTo->ulIP_IPv4 ) { pxFound[ rMATCH_IP_ADDR ] = pxEndPoint; @@ -833,12 +833,9 @@ struct xIPv6_Couple { /* do nothing, coverity happy */ } - break; - #endif /* ( ipconfigUSE_IPv4 != 0 ) */ + #endif /* ( ipconfigUSE_IPv4 != 0 ) */ - default: /* LCOV_EXCL_LINE */ - /* MISRA 16.4 Compliance */ - break; /* LCOV_EXCL_LINE */ + break; } if( xSameMACAddress == pdTRUE ) @@ -1522,6 +1519,9 @@ const char * pcEndpointName( const NetworkEndPoint_t * pxEndPoint, default: /* MISRA 16.4 Compliance */ + /* MISRA Ref 21.6.1 [snprintf and logging] */ + /* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-216 */ + /* coverity[misra_c_2012_rule_21_6_violation] */ ( void ) snprintf( pcBuffer, uxSize, "NULL" ); break; } diff --git a/source/FreeRTOS_Sockets.c b/source/FreeRTOS_Sockets.c index 00b8d2b78..c5a06ad6a 100644 --- a/source/FreeRTOS_Sockets.c +++ b/source/FreeRTOS_Sockets.c @@ -4642,6 +4642,10 @@ void vSocketWakeUpUser( FreeRTOS_Socket_t * pxSocket ) * @return 0 in case of success, or else a negative error code is * returned. */ + /* MISRA Ref 17.2.1 [Sockets and limited recursion] */ + /* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-172 */ + /* coverity[misra_c_2012_rule_17_2_violation] */ + /* coverity[recursive_step] */ BaseType_t FreeRTOS_listen( Socket_t xSocket, BaseType_t xBacklog ) { diff --git a/source/FreeRTOS_TCP_State_Handling_IPV4.c b/source/FreeRTOS_TCP_State_Handling_IPV4.c index 8f9960a0b..6aa2bf2c5 100644 --- a/source/FreeRTOS_TCP_State_Handling_IPV4.c +++ b/source/FreeRTOS_TCP_State_Handling_IPV4.c @@ -77,9 +77,6 @@ FreeRTOS_Socket_t * prvHandleListen_IPV4( FreeRTOS_Socket_t * pxSocket, { /* Map the ethernet buffer onto a TCPPacket_t struct for easy access to the fields. */ - /* MISRA Ref 11.3.1 [Misaligned access] */ - /* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-113 */ - /* coverity[misra_c_2012_rule_11_3_violation] */ const TCPPacket_t * pxTCPPacket = NULL; FreeRTOS_Socket_t * pxReturn = NULL; uint32_t ulInitialSequenceNumber = 0U; @@ -88,6 +85,9 @@ FreeRTOS_Socket_t * prvHandleListen_IPV4( FreeRTOS_Socket_t * pxSocket, if( ( pxSocket != NULL ) && ( pxNetworkBuffer != NULL ) ) { /* Initialize pointers if inputs are valid. */ + /* MISRA Ref 11.3.1 [Misaligned access] */ + /* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-113 */ + /* coverity[misra_c_2012_rule_11_3_violation] */ pxTCPPacket = ( ( const TCPPacket_t * ) pxNetworkBuffer->pucEthernetBuffer ); pxEndpoint = pxNetworkBuffer->pxEndPoint; } diff --git a/source/FreeRTOS_TCP_Utils_IPV6.c b/source/FreeRTOS_TCP_Utils_IPV6.c index f7c68e67f..5df69b646 100644 --- a/source/FreeRTOS_TCP_Utils_IPV6.c +++ b/source/FreeRTOS_TCP_Utils_IPV6.c @@ -63,7 +63,7 @@ void prvSocketSetMSS_IPV6( FreeRTOS_Socket_t * pxSocket ) char cIPv6Address[ 40 ]; #endif - NetworkEndPoint_t * pxEndPoint = NULL; + const NetworkEndPoint_t * pxEndPoint = NULL; do { diff --git a/source/include/FreeRTOS_ARP.h b/source/include/FreeRTOS_ARP.h index b824b120f..81a23349e 100644 --- a/source/include/FreeRTOS_ARP.h +++ b/source/include/FreeRTOS_ARP.h @@ -110,7 +110,7 @@ void vARPRefreshCacheEntry( const MACAddress_t * pxMACAddress, BaseType_t xIsIPInARPCache( uint32_t ulAddressToLookup ); -BaseType_t xCheckRequiresARPResolution( NetworkBufferDescriptor_t * pxNetworkBuffer ); +BaseType_t xCheckRequiresARPResolution( const NetworkBufferDescriptor_t * pxNetworkBuffer ); /* * Look for ulIPAddress in the ARP cache. If the IP address exists, copy the diff --git a/test/unit-test/FreeRTOS_IP/FreeRTOS_IP_utest.c b/test/unit-test/FreeRTOS_IP/FreeRTOS_IP_utest.c index 4eef3d75d..ac37212d9 100644 --- a/test/unit-test/FreeRTOS_IP/FreeRTOS_IP_utest.c +++ b/test/unit-test/FreeRTOS_IP/FreeRTOS_IP_utest.c @@ -56,6 +56,7 @@ #include "mock_FreeRTOS_Sockets.h" #include "mock_FreeRTOS_Routing.h" #include "mock_FreeRTOS_DNS.h" +#include "mock_FreeRTOS_DNS_Cache.h" #include "mock_FreeRTOS_UDP_IP.h" #include "mock_FreeRTOS_ND.h" #include "mock_FreeRTOS_IPv6.h" @@ -476,6 +477,7 @@ void test_prvIPTask( void ) vTCPTimerReload_ExpectAnyArgs(); vIPSetARPResolutionTimerEnableState_Expect( pdFALSE ); vDNSInitialise_Ignore(); + FreeRTOS_dnsclear_Ignore(); /* In prvIPTask. */ ipFOREVER_ExpectAndReturn( 0 ); @@ -516,6 +518,7 @@ void test_prvIPTask_NetworkDown( void ) vTCPTimerReload_ExpectAnyArgs(); vIPSetARPResolutionTimerEnableState_Expect( pdFALSE ); vDNSInitialise_Ignore(); + FreeRTOS_dnsclear_Ignore(); /* In prvIPTask. */ ipFOREVER_ExpectAndReturn( pdTRUE );