diff --git a/source/FreeRTOS_DNS_Callback.c b/source/FreeRTOS_DNS_Callback.c index fb6b2cadf..6aaf7172d 100644 --- a/source/FreeRTOS_DNS_Callback.c +++ b/source/FreeRTOS_DNS_Callback.c @@ -151,7 +151,7 @@ if( listLIST_IS_EMPTY( &xCallbackList ) != pdFALSE ) { /* This is the first one, start the DNS timer to check for timeouts */ - vDNSTimerReload( FreeRTOS_min_uint32( 1000U, uxTimeout ) ); + vDNSTimerReload( FreeRTOS_min_uint32( 1000U, ( uint32_t ) uxTimeout ) ); } ( void ) strcpy( pxCallback->pcName, pcHostName ); diff --git a/source/FreeRTOS_DNS_Parser.c b/source/FreeRTOS_DNS_Parser.c index fe1036e4d..696587046 100644 --- a/source/FreeRTOS_DNS_Parser.c +++ b/source/FreeRTOS_DNS_Parser.c @@ -786,15 +786,7 @@ { BaseType_t xCallbackResult; - #if ( ipconfigUSE_IPv6 != 0 ) - { - xCallbackResult = xDNSDoCallback( pxSet, ( ppxAddressInfo != NULL ) ? *( ppxAddressInfo ) : NULL ); - } - #else - { - xCallbackResult = xDNSDoCallback( pxSet, pxSet->ulIPAddress ); - } - #endif /* ( ipconfigUSE_IPv6 != 0 ) */ + xCallbackResult = xDNSDoCallback( pxSet, ( ppxAddressInfo != NULL ) ? *( ppxAddressInfo ) : NULL ); /* See if any asynchronous call was made to FreeRTOS_gethostbyname_a() */ if( xCallbackResult != pdFALSE ) @@ -997,7 +989,7 @@ /* Calculate the IP header checksum. */ pxIPHeader->usHeaderChecksum = 0U; pxIPHeader->usHeaderChecksum = usGenerateChecksum( 0U, ( uint8_t * ) &( pxIPHeader->ucVersionHeaderLength ), uxIPHeaderLength ); - pxIPHeader->usHeaderChecksum = ~FreeRTOS_htons( pxIPHeader->usHeaderChecksum ); + pxIPHeader->usHeaderChecksum = ( uint16_t ) ~FreeRTOS_htons( pxIPHeader->usHeaderChecksum ); } /* calculate the UDP checksum for outgoing package */ diff --git a/source/FreeRTOS_ICMP.c b/source/FreeRTOS_ICMP.c index 1c54cbaa7..78cc9c6c5 100644 --- a/source/FreeRTOS_ICMP.c +++ b/source/FreeRTOS_ICMP.c @@ -175,7 +175,7 @@ /* calculate the IP header checksum, in case the driver won't do that. */ pxIPHeader->usHeaderChecksum = 0x00U; pxIPHeader->usHeaderChecksum = usGenerateChecksum( 0U, ( uint8_t * ) &( pxIPHeader->ucVersionHeaderLength ), uxIPHeaderSizePacket( pxNetworkBuffer ) ); - pxIPHeader->usHeaderChecksum = ~FreeRTOS_htons( pxIPHeader->usHeaderChecksum ); + pxIPHeader->usHeaderChecksum = ( uint16_t ) ~FreeRTOS_htons( pxIPHeader->usHeaderChecksum ); /* calculate the ICMP checksum for an outgoing packet. */ ( void ) usGenerateProtocolChecksum( ( uint8_t * ) pxICMPPacket, pxNetworkBuffer->xDataLength, pdTRUE ); diff --git a/source/FreeRTOS_TCP_Transmission_IPV4.c b/source/FreeRTOS_TCP_Transmission_IPV4.c index 3e5f69cd5..002e8357f 100644 --- a/source/FreeRTOS_TCP_Transmission_IPV4.c +++ b/source/FreeRTOS_TCP_Transmission_IPV4.c @@ -213,7 +213,7 @@ void prvTCPReturnPacket_IPV4( FreeRTOS_Socket_t * pxSocket, /* calculate the IP header checksum, in case the driver won't do that. */ pxIPHeader->usHeaderChecksum = 0x00U; pxIPHeader->usHeaderChecksum = usGenerateChecksum( 0U, ( uint8_t * ) &( pxIPHeader->ucVersionHeaderLength ), uxIPHeaderSize ); - pxIPHeader->usHeaderChecksum = ~FreeRTOS_htons( pxIPHeader->usHeaderChecksum ); + pxIPHeader->usHeaderChecksum = ( uint16_t ) ~FreeRTOS_htons( pxIPHeader->usHeaderChecksum ); /* calculate the TCP checksum for an outgoing packet. */ ( void ) usGenerateProtocolChecksum( ( uint8_t * ) pxTCPPacket, pxNetworkBuffer->xDataLength, pdTRUE ); diff --git a/source/FreeRTOS_UDP_IPv4.c b/source/FreeRTOS_UDP_IPv4.c index 0ef6f7694..8b545616c 100644 --- a/source/FreeRTOS_UDP_IPv4.c +++ b/source/FreeRTOS_UDP_IPv4.c @@ -233,7 +233,7 @@ void vProcessGeneratedUDPPacket_IPv4( NetworkBufferDescriptor_t * const pxNetwor { pxIPHeader->usHeaderChecksum = 0U; pxIPHeader->usHeaderChecksum = usGenerateChecksum( 0U, ( uint8_t * ) &( pxIPHeader->ucVersionHeaderLength ), uxIPHeaderSizePacket( pxNetworkBuffer ) ); - pxIPHeader->usHeaderChecksum = ~FreeRTOS_htons( pxIPHeader->usHeaderChecksum ); + pxIPHeader->usHeaderChecksum = ( uint16_t ) ~FreeRTOS_htons( pxIPHeader->usHeaderChecksum ); if( ( ucSocketOptions & ( uint8_t ) FREERTOS_SO_UDPCKSUM_OUT ) != 0U ) { diff --git a/source/include/FreeRTOS_DNS_Callback.h b/source/include/FreeRTOS_DNS_Callback.h index 5a0094f12..0c940b0ef 100644 --- a/source/include/FreeRTOS_DNS_Callback.h +++ b/source/include/FreeRTOS_DNS_Callback.h @@ -62,7 +62,7 @@ void vDNSCheckCallBack( void * pvSearchID ); - void vDNSCallbackInitialise(); + void vDNSCallbackInitialise( void ); #endif /* ipconfigDNS_USE_CALLBACKS && ipconfigUSE_DNS */ diff --git a/test/build-combination/AllEnable/FreeRTOSIPConfig.h b/test/build-combination/AllEnable/FreeRTOSIPConfig.h index 4f89b7383..a6fbdde0e 100644 --- a/test/build-combination/AllEnable/FreeRTOSIPConfig.h +++ b/test/build-combination/AllEnable/FreeRTOSIPConfig.h @@ -56,6 +56,14 @@ #define ipconfigSELECT_USES_NOTIFY 1 #define ipconfigSUPPORT_SIGNALS 1 #define ipconfigPROCESS_CUSTOM_ETHERNET_FRAMES 1 +#define ipconfigDNS_USE_CALLBACKS 1 +#define ipconfigCOMPATIBLE_WITH_SINGLE 1 +#define ipconfigIGNORE_UNKNOWN_PACKETS 1 +#define ipconfigCHECK_IP_QUEUE_SPACE 1 +#define ipconfigUDP_MAX_RX_PACKETS 1 +#define ipconfigETHERNET_MINIMUM_PACKET_BYTES 1 +#define ipconfigTCP_IP_SANITY 1 +#define ipconfigSUPPORT_NETWORK_DOWN_EVENT 1 /* Set to 1 to print out debug messages. If ipconfigHAS_DEBUG_PRINTF is set to * 1 then FreeRTOS_debug_printf should be defined to the function used to print diff --git a/test/build-combination/Enable_IPv4/FreeRTOSIPConfig.h b/test/build-combination/Enable_IPv4/FreeRTOSIPConfig.h index 4cdbc3e83..a60a44a3e 100644 --- a/test/build-combination/Enable_IPv4/FreeRTOSIPConfig.h +++ b/test/build-combination/Enable_IPv4/FreeRTOSIPConfig.h @@ -60,6 +60,13 @@ #define ipconfigSELECT_USES_NOTIFY 1 #define ipconfigSUPPORT_SIGNALS 1 #define ipconfigPROCESS_CUSTOM_ETHERNET_FRAMES 1 +#define ipconfigDNS_USE_CALLBACKS 1 +#define ipconfigIGNORE_UNKNOWN_PACKETS 1 +#define ipconfigCHECK_IP_QUEUE_SPACE 1 +#define ipconfigUDP_MAX_RX_PACKETS 1 +#define ipconfigETHERNET_MINIMUM_PACKET_BYTES 1 +#define ipconfigTCP_IP_SANITY 1 +#define ipconfigSUPPORT_NETWORK_DOWN_EVENT 1 /* Set to 1 to print out debug messages. If ipconfigHAS_DEBUG_PRINTF is set to * 1 then FreeRTOS_debug_printf should be defined to the function used to print diff --git a/test/build-combination/Enable_IPv4_IPv6/FreeRTOSIPConfig.h b/test/build-combination/Enable_IPv4_IPv6/FreeRTOSIPConfig.h index 84a53f428..0beab5729 100644 --- a/test/build-combination/Enable_IPv4_IPv6/FreeRTOSIPConfig.h +++ b/test/build-combination/Enable_IPv4_IPv6/FreeRTOSIPConfig.h @@ -60,6 +60,13 @@ #define ipconfigSELECT_USES_NOTIFY 1 #define ipconfigSUPPORT_SIGNALS 1 #define ipconfigPROCESS_CUSTOM_ETHERNET_FRAMES 1 +#define ipconfigDNS_USE_CALLBACKS 1 +#define ipconfigIGNORE_UNKNOWN_PACKETS 1 +#define ipconfigCHECK_IP_QUEUE_SPACE 1 +#define ipconfigUDP_MAX_RX_PACKETS 1 +#define ipconfigETHERNET_MINIMUM_PACKET_BYTES 1 +#define ipconfigTCP_IP_SANITY 1 +#define ipconfigSUPPORT_NETWORK_DOWN_EVENT 1 /* Set to 1 to print out debug messages. If ipconfigHAS_DEBUG_PRINTF is set to * 1 then FreeRTOS_debug_printf should be defined to the function used to print diff --git a/test/build-combination/Enable_IPv4_TCP/FreeRTOSIPConfig.h b/test/build-combination/Enable_IPv4_TCP/FreeRTOSIPConfig.h index 9687ca502..cbec621ff 100644 --- a/test/build-combination/Enable_IPv4_TCP/FreeRTOSIPConfig.h +++ b/test/build-combination/Enable_IPv4_TCP/FreeRTOSIPConfig.h @@ -60,6 +60,13 @@ #define ipconfigSELECT_USES_NOTIFY 1 #define ipconfigSUPPORT_SIGNALS 1 #define ipconfigPROCESS_CUSTOM_ETHERNET_FRAMES 1 +#define ipconfigDNS_USE_CALLBACKS 1 +#define ipconfigIGNORE_UNKNOWN_PACKETS 1 +#define ipconfigCHECK_IP_QUEUE_SPACE 1 +#define ipconfigUDP_MAX_RX_PACKETS 1 +#define ipconfigETHERNET_MINIMUM_PACKET_BYTES 1 +#define ipconfigTCP_IP_SANITY 1 +#define ipconfigSUPPORT_NETWORK_DOWN_EVENT 1 /* Set to 1 to print out debug messages. If ipconfigHAS_DEBUG_PRINTF is set to * 1 then FreeRTOS_debug_printf should be defined to the function used to print diff --git a/test/build-combination/Enable_IPv6/FreeRTOSIPConfig.h b/test/build-combination/Enable_IPv6/FreeRTOSIPConfig.h index 72e2eea04..663a02950 100644 --- a/test/build-combination/Enable_IPv6/FreeRTOSIPConfig.h +++ b/test/build-combination/Enable_IPv6/FreeRTOSIPConfig.h @@ -60,6 +60,13 @@ #define ipconfigSELECT_USES_NOTIFY 1 #define ipconfigSUPPORT_SIGNALS 1 #define ipconfigPROCESS_CUSTOM_ETHERNET_FRAMES 1 +#define ipconfigDNS_USE_CALLBACKS 0 +#define ipconfigIGNORE_UNKNOWN_PACKETS 1 +#define ipconfigCHECK_IP_QUEUE_SPACE 1 +#define ipconfigUDP_MAX_RX_PACKETS 1 +#define ipconfigETHERNET_MINIMUM_PACKET_BYTES 1 +#define ipconfigTCP_IP_SANITY 1 +#define ipconfigSUPPORT_NETWORK_DOWN_EVENT 1 /* Set to 1 to print out debug messages. If ipconfigHAS_DEBUG_PRINTF is set to * 1 then FreeRTOS_debug_printf should be defined to the function used to print diff --git a/test/build-combination/Enable_IPv6_TCP/FreeRTOSIPConfig.h b/test/build-combination/Enable_IPv6_TCP/FreeRTOSIPConfig.h index 49b49e0a5..f2050ce1d 100644 --- a/test/build-combination/Enable_IPv6_TCP/FreeRTOSIPConfig.h +++ b/test/build-combination/Enable_IPv6_TCP/FreeRTOSIPConfig.h @@ -60,6 +60,13 @@ #define ipconfigSELECT_USES_NOTIFY 1 #define ipconfigSUPPORT_SIGNALS 1 #define ipconfigPROCESS_CUSTOM_ETHERNET_FRAMES 1 +#define ipconfigDNS_USE_CALLBACKS 0 +#define ipconfigIGNORE_UNKNOWN_PACKETS 1 +#define ipconfigCHECK_IP_QUEUE_SPACE 1 +#define ipconfigUDP_MAX_RX_PACKETS 1 +#define ipconfigETHERNET_MINIMUM_PACKET_BYTES 1 +#define ipconfigTCP_IP_SANITY 1 +#define ipconfigSUPPORT_NETWORK_DOWN_EVENT 1 /* Set to 1 to print out debug messages. If ipconfigHAS_DEBUG_PRINTF is set to * 1 then FreeRTOS_debug_printf should be defined to the function used to print diff --git a/test/build-combination/Header_Self_Contain/FreeRTOSIPConfig.h b/test/build-combination/Header_Self_Contain/FreeRTOSIPConfig.h index e71380221..4c4e4e187 100644 --- a/test/build-combination/Header_Self_Contain/FreeRTOSIPConfig.h +++ b/test/build-combination/Header_Self_Contain/FreeRTOSIPConfig.h @@ -56,6 +56,13 @@ #define ipconfigSELECT_USES_NOTIFY 1 #define ipconfigSUPPORT_SIGNALS 1 #define ipconfigPROCESS_CUSTOM_ETHERNET_FRAMES 1 +#define ipconfigDNS_USE_CALLBACKS 1 +#define ipconfigIGNORE_UNKNOWN_PACKETS 1 +#define ipconfigCHECK_IP_QUEUE_SPACE 1 +#define ipconfigUDP_MAX_RX_PACKETS 1 +#define ipconfigETHERNET_MINIMUM_PACKET_BYTES 1 +#define ipconfigTCP_IP_SANITY 1 +#define ipconfigSUPPORT_NETWORK_DOWN_EVENT 1 /* Set to 1 to print out debug messages. If ipconfigHAS_DEBUG_PRINTF is set to * 1 then FreeRTOS_debug_printf should be defined to the function used to print diff --git a/tools/tcp_utilities/plus_tcp_demo_cli.c b/tools/tcp_utilities/plus_tcp_demo_cli.c index 6e2d7894c..d548acfbf 100644 --- a/tools/tcp_utilities/plus_tcp_demo_cli.c +++ b/tools/tcp_utilities/plus_tcp_demo_cli.c @@ -146,17 +146,9 @@ static struct freertos_addrinfo * pxDNSLookup( char * pcHost, BaseType_t xAsynchronous, BaseType_t xDoClear ); -#if ( ipconfigUSE_IPv6 == 0 ) - /* In the old days, an IP-address was just a number. */ - static void vDNSEvent( const char * pcName, - void * pvSearchID, - uint32_t ulIPAddress ); -#else - /* freertos_addrinfo can contain either an IPv4 or an IPv6 address. */ - static void vDNSEvent( const char * pcName, - void * pvSearchID, - struct freertos_addrinfo * pxAddrInfo ); -#endif +static void vDNSEvent( const char * pcName, + void * pvSearchID, + struct freertos_addrinfo * pxAddrInfo ); #if ( ipconfigMULTI_INTERFACE != 0 ) /* Defined in FreeRTOS_DNS.c */ @@ -1485,95 +1477,80 @@ void xHandleTesting() #endif /* ( ipconfigMULTI_INTERFACE != 0 ) */ /*-----------------------------------------------------------*/ -#if ( ipconfigUSE_IPv6 != 0 ) - static void vDNSEvent( const char * pcName, - void * pvSearchID, - struct freertos_addrinfo * pxAddrInfo ) + +static void vDNSEvent( const char * pcName, + void * pvSearchID, + struct freertos_addrinfo * pxAddrInfo ) +{ + ( void ) pvSearchID; + + if( pxAddrInfo == NULL ) + { + FreeRTOS_printf( ( "vDNSEvent(%s) : nothing found\n", pcName ) ); + } + else { - ( void ) pvSearchID; + FreeRTOS_printf( ( "vDNSEvent: family = %d\n", ( int ) pxAddrInfo->ai_family ) ); - if( pxAddrInfo == NULL ) - { - FreeRTOS_printf( ( "vDNSEvent(%s) : nothing found\n", pcName ) ); - } - else + switch( pxAddrInfo->ai_family ) { - FreeRTOS_printf( ( "vDNSEvent: family = %d\n", ( int ) pxAddrInfo->ai_family ) ); + #if ( ipconfigUSE_IPv4 != 0 ) + case FREERTOS_AF_INET: + { + uint32_t ulIPaddress = pxAddrInfo->ai_addr->sin_address.ulIP_IPv4; - switch( pxAddrInfo->ai_family ) - { - #if ( ipconfigUSE_IPv4 != 0 ) - case FREERTOS_AF_INET: + if( ulIPaddress == 0uL ) { - uint32_t ulIPaddress = pxAddrInfo->ai_addr->sin_address.ulIP_IPv4; - - if( ulIPaddress == 0uL ) - { - FreeRTOS_printf( ( "vDNSEvent/v4: '%s' timed out\n", pcName ) ); - } - else - { - FreeRTOS_printf( ( "vDNSEvent/v4: found '%s' on %lxip\n", pcName, FreeRTOS_ntohl( ulIPaddress ) ) ); - } + FreeRTOS_printf( ( "vDNSEvent/v4: '%s' timed out\n", pcName ) ); } - break; - #endif /* ( ipconfigUSE_IPv4 != 0 ) */ - - #if ( ipconfigUSE_IPv6 != 0 ) - case FREERTOS_AF_INET6: + else { - BaseType_t xIsEmpty = pdTRUE, xIndex; + FreeRTOS_printf( ( "vDNSEvent/v4: found '%s' on %lxip\n", pcName, FreeRTOS_ntohl( ulIPaddress ) ) ); + } + } + break; + #endif /* ( ipconfigUSE_IPv4 != 0 ) */ - for( xIndex = 0; xIndex < ( BaseType_t ) ARRAY_SIZE( pxAddrInfo->ai_addr->sin_address.xIP_IPv6.ucBytes ); xIndex++ ) - { - if( pxAddrInfo->ai_addr->sin_address.xIP_IPv6.ucBytes[ xIndex ] != ( uint8_t ) 0u ) - { - xIsEmpty = pdFALSE; - break; - } - } + #if ( ipconfigUSE_IPv6 != 0 ) + case FREERTOS_AF_INET6: + { + BaseType_t xIsEmpty = pdTRUE, xIndex; - if( xIsEmpty ) - { - FreeRTOS_printf( ( "vDNSEvent/v6: '%s' timed out\n", pcName ) ); - } - else + for( xIndex = 0; xIndex < ( BaseType_t ) ARRAY_SIZE( pxAddrInfo->ai_addr->sin_address.xIP_IPv6.ucBytes ); xIndex++ ) + { + if( pxAddrInfo->ai_addr->sin_address.xIP_IPv6.ucBytes[ xIndex ] != ( uint8_t ) 0u ) { - FreeRTOS_printf( ( "vDNSEvent/v6: found '%s' on %pip\n", pcName, pxAddrInfo->ai_addr->sin_address.xIP_IPv6.ucBytes ) ); + xIsEmpty = pdFALSE; + break; } } - break; - #endif /* ( ipconfigUSE_IPv6 != 0 ) */ - default: - /* MISRA 16.4 Compliance */ - FreeRTOS_debug_printf( ( "vDNSEvent: Undefined Family Type \n" ) ); - break; - } - } + if( xIsEmpty ) + { + FreeRTOS_printf( ( "vDNSEvent/v6: '%s' timed out\n", pcName ) ); + } + else + { + FreeRTOS_printf( ( "vDNSEvent/v6: found '%s' on %pip\n", pcName, pxAddrInfo->ai_addr->sin_address.xIP_IPv6.ucBytes ) ); + } + } + break; + #endif /* ( ipconfigUSE_IPv6 != 0 ) */ - if( xServerWorkTaskHandle != NULL ) - { - xDNSCount++; - xTaskNotifyGive( xServerWorkTaskHandle ); + default: + /* MISRA 16.4 Compliance */ + FreeRTOS_debug_printf( ( "vDNSEvent: Undefined Family Type \n" ) ); + break; } } -#else /* if ( ipconfigUSE_IPv6 != 0 ) */ - static void vDNSEvent( const char * pcName, - void * pvSearchID, - uint32_t ulIPAddress ) - { - ( void ) pvSearchID; - - FreeRTOS_printf( ( "vDNSEvent: found '%s' on %lxip\n", pcName, FreeRTOS_ntohl( ulIPAddress ) ) ); - if( xServerWorkTaskHandle != NULL ) - { - xDNSCount++; - xTaskNotifyGive( xServerWorkTaskHandle ); - } + if( xServerWorkTaskHandle != NULL ) + { + xDNSCount++; + xTaskNotifyGive( xServerWorkTaskHandle ); } -#endif /* if ( ipconfigUSE_IPv6 != 0 ) */ +} + /*-----------------------------------------------------------*/ #if ( ipconfigMULTI_INTERFACE != 0 )