diff --git a/test/unit-test/FreeRTOS_DNS_Cache/FreeRTOS_DNS_Cache_utest.c b/test/unit-test/FreeRTOS_DNS_Cache/FreeRTOS_DNS_Cache_utest.c index 4d9729571..a615a5d1a 100644 --- a/test/unit-test/FreeRTOS_DNS_Cache/FreeRTOS_DNS_Cache_utest.c +++ b/test/unit-test/FreeRTOS_DNS_Cache/FreeRTOS_DNS_Cache_utest.c @@ -378,8 +378,10 @@ void test_processDNS_CACHE_exceed_host_entry_limit( void ) pxIP[ i ].xIPAddress.ulIP_IPv4 = pulIP_arr[ i ]; pxIP[ i ].xIs_IPv6 = 0; memcpy( template, "helloXXXXXX", strlen( template ) ); - char * name = mktemp( template ); - memcpy( hosts, name, ipconfigDNS_CACHE_ENTRIES ); + if( mkstemp( template ) != -1 ) + { + memcpy( hosts, template, ipconfigDNS_CACHE_ENTRIES ); + } xTaskGetTickCount_ExpectAndReturn( 3000 ); FreeRTOS_inet_ntop_ExpectAnyArgsAndReturn( NULL ); diff --git a/test/unit-test/FreeRTOS_IP_DiffConfig1/FreeRTOS_IP_DiffConfig1_utest.c b/test/unit-test/FreeRTOS_IP_DiffConfig1/FreeRTOS_IP_DiffConfig1_utest.c index 558cc10bb..58b6bb329 100644 --- a/test/unit-test/FreeRTOS_IP_DiffConfig1/FreeRTOS_IP_DiffConfig1_utest.c +++ b/test/unit-test/FreeRTOS_IP_DiffConfig1/FreeRTOS_IP_DiffConfig1_utest.c @@ -133,7 +133,8 @@ static void vSetIPTaskHandle( TaskHandle_t xTaskHandleToSet ) const uint8_t ucDNSServerAddress[ ipIP_ADDRESS_LENGTH_BYTES ]; const uint8_t ucMACAddress[ ipMAC_ADDRESS_LENGTH_BYTES ]; NetworkEndPoint_t xFirstEndPoint = { 0 }, * pxFirstEndPoint = &xFirstEndPoint; - NetworkInterface_t * pxNetworkInterface; + NetworkInterface_t xNetworkInterface; + NetworkInterface_t * pxNetworkInterface = &xNetworkInterface; pxFillInterfaceDescriptor_IgnoreAndReturn( pxNetworkInterface ); FreeRTOS_FillEndPoint_Ignore(); @@ -195,7 +196,8 @@ void test_FreeRTOS_IPInit_HappyPath( void ) QueueHandle_t ulPointerToQueue = ( QueueHandle_t ) 0x1234ABCD; TaskHandle_t xTaskHandleToSet = ( TaskHandle_t ) 0xCDBA9087; NetworkEndPoint_t xFirstEndPoint = { 0 }; - NetworkInterface_t * pxNetworkInterface; + NetworkInterface_t xNetworkInterface; + NetworkInterface_t * pxNetworkInterface = &xNetworkInterface; /* Set the local IP to something other than 0. */ *ipLOCAL_IP_ADDRESS_POINTER = 0xABCD; @@ -248,7 +250,8 @@ void test_FreeRTOS_IPInit_QueueCreationFails( void ) BaseType_t xReturn; QueueHandle_t pxPointerToQueue = NULL; NetworkEndPoint_t xFirstEndPoint = { 0 }; - NetworkInterface_t * pxNetworkInterface; + NetworkInterface_t xNetworkInterface; + NetworkInterface_t * pxNetworkInterface = &xNetworkInterface; /* Set the local IP to something other than 0. */ *ipLOCAL_IP_ADDRESS_POINTER = 0xABCD; @@ -289,7 +292,8 @@ void test_FreeRTOS_IPInit_BufferCreationFails( void ) BaseType_t xReturn; QueueHandle_t pxPointerToQueue = ( QueueHandle_t ) 0x1234ABCD; NetworkEndPoint_t xFirstEndPoint = { 0 }; - NetworkInterface_t * pxNetworkInterface; + NetworkInterface_t xNetworkInterface; + NetworkInterface_t * pxNetworkInterface = &xNetworkInterface; /* Set the local IP to something other than 0. */ *ipLOCAL_IP_ADDRESS_POINTER = 0xABCD; @@ -338,7 +342,8 @@ void test_FreeRTOS_IPInit_TaskCreationFails( void ) BaseType_t xReturn; QueueHandle_t pxPointerToQueue = ( QueueHandle_t ) 0x1234ABCD; NetworkEndPoint_t xFirstEndPoint = { 0 }; - NetworkInterface_t * pxNetworkInterface; + NetworkInterface_t xNetworkInterface; + NetworkInterface_t * pxNetworkInterface = &xNetworkInterface; /* Set the local IP to something other than 0. */ *ipLOCAL_IP_ADDRESS_POINTER = 0xABCD; diff --git a/tools/tcp_utilities/http_client_test.c b/tools/tcp_utilities/http_client_test.c index fbdc3e75e..892f525ea 100644 --- a/tools/tcp_utilities/http_client_test.c +++ b/tools/tcp_utilities/http_client_test.c @@ -307,9 +307,9 @@ #if ( ipconfigUSE_IPv4 != 0 ) pxEndPoint = FreeRTOS_FindGateWay( ipTYPE_IPv4 ); - if( ( pxEndPoint != NULL ) && ( pxEndPoint->ipv4_settings.ulGatewayAddress != 0U ) ) + if( ( pxEndPoint != NULL ) && ( pxEndPoint->u.ipv4_settings.ulGatewayAddress != 0U ) ) { - xARPWaitResolution( pxEndPoint->ipv4_settings.ulGatewayAddress, pdMS_TO_TICKS( 1000U ) ); + xARPWaitResolution( pxEndPoint->u.ipv4_settings.ulGatewayAddress, pdMS_TO_TICKS( 1000U ) ); } #endif /* ( ipconfigUSE_IPv4 != 0 ) */ @@ -400,7 +400,7 @@ if( pxEndPoint != NULL ) { - xBindAddress.sin_address.ulIP_IPv4 = pxEndPoint->ipv4_settings.ulIPAddress; + xBindAddress.sin_address.ulIP_IPv4 = pxEndPoint->u.ipv4_settings.ulIPAddress; xBindAddress.sin_family = FREERTOS_AF_INET; } } diff --git a/tools/tcp_utilities/plus_tcp_demo_cli.c b/tools/tcp_utilities/plus_tcp_demo_cli.c index b6c005f1a..720dc46b1 100644 --- a/tools/tcp_utilities/plus_tcp_demo_cli.c +++ b/tools/tcp_utilities/plus_tcp_demo_cli.c @@ -326,7 +326,7 @@ static const char * pcARPReturnType( eARPLookupResult_t eResult ) pxEndpoint != NULL; pxEndpoint = FreeRTOS_NextEndPoint( NULL, pxEndpoint ) ) { - if( memcmp( pxEndpoint->ipv6_settings.xGatewayAddress.ucBytes, pxAddress->ucBytes, ipSIZE_OF_IPv6_ADDRESS ) == 0 ) + if( memcmp( pxEndpoint->u.ipv6_settings.xGatewayAddress.ucBytes, pxAddress->ucBytes, ipSIZE_OF_IPv6_ADDRESS ) == 0 ) { break; } @@ -895,12 +895,12 @@ size_t uxGetOptions( CommandOptions_t * pxOptions, #if ( ipconfigUSE_IPv6 != 0 ) if( pxEndPoint->bits.bIPv6 ) { - FreeRTOS_printf( ( "IPv6: %pip on '%s'\n", pxEndPoint->ipv6_settings.xIPAddress.ucBytes, pxEndPoint->pxNetworkInterface->pcName ) ); + FreeRTOS_printf( ( "IPv6: %pip on '%s'\n", pxEndPoint->u.ipv6_settings.xIPAddress.ucBytes, pxEndPoint->pxNetworkInterface->pcName ) ); } else #endif { - FreeRTOS_printf( ( "IPv4: %xip on '%s'\n", ( unsigned ) FreeRTOS_ntohl( pxEndPoint->ipv4_settings.ulIPAddress ), pxEndPoint->pxNetworkInterface->pcName ) ); + FreeRTOS_printf( ( "IPv4: %xip on '%s'\n", ( unsigned ) FreeRTOS_ntohl( pxEndPoint->u.ipv4_settings.ulIPAddress ), pxEndPoint->pxNetworkInterface->pcName ) ); } } } @@ -940,17 +940,17 @@ static void handle_help( char * pcBuffer ) #if ( ipconfigUSE_IPv6 != 0 ) if( pxEndPoint->bits.bIPv6 ) { - if( memcmp( pxEndPoint->ipv6_settings.xGatewayAddress.ucBytes, FreeRTOS_in6addr_any.ucBytes, ipSIZE_OF_IPv6_ADDRESS ) != 0 ) + if( memcmp( pxEndPoint->u.ipv6_settings.xGatewayAddress.ucBytes, FreeRTOS_in6addr_any.ucBytes, ipSIZE_OF_IPv6_ADDRESS ) != 0 ) { - FreeRTOS_printf( ( "IPv6: %pip on '%s'\n", pxEndPoint->ipv6_settings.xGatewayAddress.ucBytes, pxEndPoint->pxNetworkInterface->pcName ) ); + FreeRTOS_printf( ( "IPv6: %pip on '%s'\n", pxEndPoint->u.ipv6_settings.xGatewayAddress.ucBytes, pxEndPoint->pxNetworkInterface->pcName ) ); } } else #endif { - if( pxEndPoint->ipv4_settings.ulGatewayAddress != 0U ) + if( pxEndPoint->u.ipv4_settings.ulGatewayAddress != 0U ) { - FreeRTOS_printf( ( "IPv4: %xip on '%s'\n", ( unsigned ) FreeRTOS_ntohl( pxEndPoint->ipv4_settings.ulGatewayAddress ), pxEndPoint->pxNetworkInterface->pcName ) ); + FreeRTOS_printf( ( "IPv4: %xip on '%s'\n", ( unsigned ) FreeRTOS_ntohl( pxEndPoint->u.ipv4_settings.ulGatewayAddress ), pxEndPoint->pxNetworkInterface->pcName ) ); } } } @@ -1590,46 +1590,46 @@ static void vDNSEvent( const char * pcName, IPv6_Address_t xPrefix; /* Extract the prefix from the IP-address */ - FreeRTOS_CreateIPv6Address( &( xPrefix ), &( pxEndPoint->ipv6_settings.xIPAddress ), pxEndPoint->ipv6_settings.uxPrefixLength, pdFALSE ); + FreeRTOS_CreateIPv6Address( &( xPrefix ), &( pxEndPoint->u.ipv6_settings.xIPAddress ), pxEndPoint->u.ipv6_settings.uxPrefixLength, pdFALSE ); - FreeRTOS_printf( ( "IP-address : %pip\n", pxEndPoint->ipv6_settings.xIPAddress.ucBytes ) ); + FreeRTOS_printf( ( "IP-address : %pip\n", pxEndPoint->u.ipv6_settings.xIPAddress.ucBytes ) ); - if( memcmp( pxEndPoint->ipv6_defaults.xIPAddress.ucBytes, pxEndPoint->ipv6_settings.xIPAddress.ucBytes, ipSIZE_OF_IPv6_ADDRESS ) != 0 ) + if( memcmp( pxEndPoint->u.ipv6_defaults.xIPAddress.ucBytes, pxEndPoint->u.ipv6_settings.xIPAddress.ucBytes, ipSIZE_OF_IPv6_ADDRESS ) != 0 ) { - FreeRTOS_printf( ( "Default IP : %pip\n", pxEndPoint->ipv6_defaults.xIPAddress.ucBytes ) ); + FreeRTOS_printf( ( "Default IP : %pip\n", pxEndPoint->u.ipv6_defaults.xIPAddress.ucBytes ) ); } FreeRTOS_printf( ( "End-point : up = %s method %s\n", ( pxEndPoint->bits.bEndPointUp != 0 ) ? "yes" : "no", pcMethodName ) ); - FreeRTOS_printf( ( "Prefix : %pip/%d\n", xPrefix.ucBytes, ( int ) pxEndPoint->ipv6_settings.uxPrefixLength ) ); - FreeRTOS_printf( ( "GW : %pip\n", pxEndPoint->ipv6_settings.xGatewayAddress.ucBytes ) ); + FreeRTOS_printf( ( "Prefix : %pip/%d\n", xPrefix.ucBytes, ( int ) pxEndPoint->u.ipv6_settings.uxPrefixLength ) ); + FreeRTOS_printf( ( "GW : %pip\n", pxEndPoint->u.ipv6_settings.xGatewayAddress.ucBytes ) ); for( uxDNSIndex = 0U; uxDNSIndex < ipconfigENDPOINT_DNS_ADDRESS_COUNT; uxDNSIndex++ ) { - FreeRTOS_printf( ( "DNS-%u : %pip\n", uxDNSIndex, pxEndPoint->ipv6_settings.xDNSServerAddresses[ uxDNSIndex ].ucBytes ) ); + FreeRTOS_printf( ( "DNS-%u : %pip\n", uxDNSIndex, pxEndPoint->u.ipv6_settings.xDNSServerAddresses[ uxDNSIndex ].ucBytes ) ); } } else #endif /* ( ipconfigUSE_IPv6 != 0 ) */ { FreeRTOS_printf( ( "IP-address : %lxip\n", - FreeRTOS_ntohl( pxEndPoint->ipv4_settings.ulIPAddress ) ) ); + FreeRTOS_ntohl( pxEndPoint->u.ipv4_settings.ulIPAddress ) ) ); - if( pxEndPoint->ipv4_settings.ulIPAddress != pxEndPoint->ipv4_defaults.ulIPAddress ) + if( pxEndPoint->u.ipv4_settings.ulIPAddress != pxEndPoint->u.ipv4_defaults.ulIPAddress ) { - FreeRTOS_printf( ( "Default IP : %lxip\n", FreeRTOS_ntohl( pxEndPoint->ipv4_defaults.ulIPAddress ) ) ); + FreeRTOS_printf( ( "Default IP : %lxip\n", FreeRTOS_ntohl( pxEndPoint->u.ipv4_defaults.ulIPAddress ) ) ); } FreeRTOS_printf( ( "End-point : up = %s method %s\n", pxEndPoint->bits.bEndPointUp ? "yes" : "no", pcMethodName ) ); - FreeRTOS_printf( ( "Net mask : %lxip\n", FreeRTOS_ntohl( pxEndPoint->ipv4_settings.ulNetMask ) ) ); - FreeRTOS_printf( ( "GW : %lxip\n", FreeRTOS_ntohl( pxEndPoint->ipv4_settings.ulGatewayAddress ) ) ); + FreeRTOS_printf( ( "Net mask : %lxip\n", FreeRTOS_ntohl( pxEndPoint->u.ipv4_settings.ulNetMask ) ) ); + FreeRTOS_printf( ( "GW : %lxip\n", FreeRTOS_ntohl( pxEndPoint->u.ipv4_settings.ulGatewayAddress ) ) ); for( uxDNSIndex = 0U; uxDNSIndex < ipconfigENDPOINT_DNS_ADDRESS_COUNT; uxDNSIndex++ ) { - FreeRTOS_printf( ( "DNS-%u : %xip\n", uxDNSIndex, ( unsigned ) FreeRTOS_ntohl( pxEndPoint->ipv4_settings.ulDNSServerAddresses[ uxDNSIndex ] ) ) ); + FreeRTOS_printf( ( "DNS-%u : %xip\n", uxDNSIndex, ( unsigned ) FreeRTOS_ntohl( pxEndPoint->u.ipv4_settings.ulDNSServerAddresses[ uxDNSIndex ] ) ) ); } - FreeRTOS_printf( ( "Broadcast : %lxip\n", FreeRTOS_ntohl( pxEndPoint->ipv4_settings.ulBroadcastAddress ) ) ); + FreeRTOS_printf( ( "Broadcast : %lxip\n", FreeRTOS_ntohl( pxEndPoint->u.ipv4_settings.ulBroadcastAddress ) ) ); } FreeRTOS_printf( ( "MAC address: %02x-%02x-%02x-%02x-%02x-%02x\n",