Skip to content

Commit a1b95e5

Browse files
committed
Fix compilation error if DNS features are disabled
The code would fail to compile unless one of ipconfigUSE_DNS_CACHE, ipconfigUSE_MDNS, ipconfigUSE_LLMNR, and ipconfigDNS_USE_CALLBACKS were set.
1 parent 8e437be commit a1b95e5

File tree

4 files changed

+357
-0
lines changed

4 files changed

+357
-0
lines changed

.github/workflows/ci.yml

+14
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,20 @@ jobs:
303303
echo "::endgroup::"
304304
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"
305305
306+
- env:
307+
stepName: Build checks (Disable DNS features)
308+
name: ${{ env.stepName }}
309+
run: |
310+
# ${{ env.stepName }}
311+
echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"
312+
313+
cmake -S . -B build -DFREERTOS_PLUS_TCP_ENABLE_BUILD_CHECKS=ON -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=DISABLE_DNS_FEATURES
314+
cmake --build build --target clean
315+
cmake --build build --target freertos_plus_tcp_build_test
316+
317+
echo "::endgroup::"
318+
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"
319+
306320
- env:
307321
stepName: Build checks (Disable all functionalities)
308322
name: ${{ env.stepName }}

source/FreeRTOS_DNS_Parser.c

+4
Original file line numberDiff line numberDiff line change
@@ -737,10 +737,12 @@
737737
&( pxSet->pucByte[ sizeof( DNSAnswerRecord_t ) ] ),
738738
ipSIZE_OF_IPv6_ADDRESS );
739739

740+
#if ( ( ipconfigUSE_DNS_CACHE != 0 ) || ( ipconfigDNS_USE_CALLBACKS != 0 ) || ( ipconfigUSE_MDNS != 0 ) || ( ipconfigUSE_LLMNR != 0 ) )
740741
if( ppxAddressInfo != NULL )
741742
{
742743
pxNewAddress = pxNew_AddrInfo( pxSet->pcName, FREERTOS_AF_INET6, xIP_Address.xIPAddress.xIP_IPv6.ucBytes );
743744
}
745+
#endif
744746

745747
xIP_Address.xIs_IPv6 = pdTRUE;
746748

@@ -765,12 +767,14 @@
765767
pvCopyDest = &( pxSet->ulIPAddress );
766768
( void ) memcpy( pvCopyDest, pvCopySource, pxSet->uxAddressLength );
767769

770+
#if ( ( ipconfigUSE_DNS_CACHE != 0 ) || ( ipconfigDNS_USE_CALLBACKS != 0 ) || ( ipconfigUSE_MDNS != 0 ) || ( ipconfigUSE_LLMNR != 0 ) )
768771
if( ppxAddressInfo != NULL )
769772
{
770773
const uint8_t * ucBytes = ( uint8_t * ) &( pxSet->ulIPAddress );
771774

772775
pxNewAddress = pxNew_AddrInfo( pxSet->pcName, FREERTOS_AF_INET4, ucBytes );
773776
}
777+
#endif
774778

775779
xIP_Address.xIPAddress.ulIP_IPv4 = pxSet->ulIPAddress;
776780
xIP_Address.xIs_IPv6 = pdFALSE;

test/build-combination/CMakeLists.txt

+8
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ set(FREERTOS_PLUS_TCP_TEST_CONFIGURATION_LIST
88
ENABLE_ALL_IPV4_TCP # Enable all configuration settings IPv4 TCP
99
ENABLE_ALL_IPV6_TCP # Enable all configuration settings IPv6 TCP
1010
ENABLE_ALL_IPV4_IPV6 # Enable all configuration settings IPv4 IPv6 UDP
11+
DISABLE_DNS_FEATURES # Enable all except DNS caching, callbacks, mDNS
1112
DISABLE_ALL # Disable all configuration settings
1213
HEADER_SELF_CONTAIN # Enable header self contain test
1314
DEFAULT_CONF # Default (typical) configuration
@@ -59,6 +60,11 @@ add_library( freertos_plus_tcp_config_all_enable_ipv6_tcp INTERFACE)
5960
target_include_directories(freertos_plus_tcp_config_all_enable_ipv6_tcp INTERFACE Enable_IPv6_TCP)
6061
target_link_libraries(freertos_plus_tcp_config_all_enable_ipv6_tcp INTERFACE freertos_plus_tcp_config_common)
6162

63+
# -------------------------------------------------------------------
64+
add_library( freertos_plus_tcp_config_disable_dns_features INTERFACE)
65+
target_include_directories(freertos_plus_tcp_config_disable_dns_features INTERFACE DisableDnsFeatures)
66+
target_link_libraries(freertos_plus_tcp_config_disable_dns_features INTERFACE freertos_plus_tcp_config_common)
67+
6268
# -------------------------------------------------------------------
6369
add_library( freertos_plus_tcp_config_header_self_contain INTERFACE)
6470
target_include_directories(freertos_plus_tcp_config_header_self_contain INTERFACE Header_Self_Contain)
@@ -90,6 +96,8 @@ elseif(FREERTOS_PLUS_TCP_TEST_CONFIGURATION STREQUAL "ENABLE_ALL_IPV6_TCP" )
9096
add_library( freertos_config ALIAS freertos_plus_tcp_config_all_enable_ipv6_tcp)
9197
elseif(FREERTOS_PLUS_TCP_TEST_CONFIGURATION STREQUAL "ENABLE_ALL_IPV4_IPV6" )
9298
add_library( freertos_config ALIAS freertos_plus_tcp_config_all_enable_ipv4_ipv6)
99+
elseif(FREERTOS_PLUS_TCP_TEST_CONFIGURATION STREQUAL "DISABLE_DNS_FEATURES" )
100+
add_library( freertos_config ALIAS freertos_plus_tcp_config_disable_dns_features)
93101
elseif(FREERTOS_PLUS_TCP_TEST_CONFIGURATION STREQUAL "HEADER_SELF_CONTAIN" )
94102
add_library( freertos_config ALIAS freertos_plus_tcp_config_header_self_contain)
95103
include( Header_Self_Contain/headerSelfContain.cmake )

0 commit comments

Comments
 (0)