Skip to content

Fix compilation error if DNS features are disabled #1243

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 30, 2025
Merged
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
14 changes: 14 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,20 @@ jobs:
echo "::endgroup::"
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"

- env:
stepName: Build checks (Disable DNS features)
name: ${{ env.stepName }}
run: |
# ${{ env.stepName }}
echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"

cmake -S . -B build -DFREERTOS_PLUS_TCP_ENABLE_BUILD_CHECKS=ON -DFREERTOS_PLUS_TCP_TEST_CONFIGURATION=DISABLE_DNS_FEATURES
cmake --build build --target clean
cmake --build build --target freertos_plus_tcp_build_test

echo "::endgroup::"
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"

- env:
stepName: Build checks (Disable all functionalities)
name: ${{ env.stepName }}
Expand Down
22 changes: 13 additions & 9 deletions source/FreeRTOS_DNS_Parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -737,10 +737,12 @@
&( pxSet->pucByte[ sizeof( DNSAnswerRecord_t ) ] ),
ipSIZE_OF_IPv6_ADDRESS );

if( ppxAddressInfo != NULL )
{
pxNewAddress = pxNew_AddrInfo( pxSet->pcName, FREERTOS_AF_INET6, xIP_Address.xIPAddress.xIP_IPv6.ucBytes );
}
#if ( ( ipconfigUSE_DNS_CACHE != 0 ) || ( ipconfigDNS_USE_CALLBACKS != 0 ) || ( ipconfigUSE_MDNS != 0 ) || ( ipconfigUSE_LLMNR != 0 ) )
if( ppxAddressInfo != NULL )
{
pxNewAddress = pxNew_AddrInfo( pxSet->pcName, FREERTOS_AF_INET6, xIP_Address.xIPAddress.xIP_IPv6.ucBytes );
}
#endif

xIP_Address.xIs_IPv6 = pdTRUE;

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

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

pxNewAddress = pxNew_AddrInfo( pxSet->pcName, FREERTOS_AF_INET4, ucBytes );
}
pxNewAddress = pxNew_AddrInfo( pxSet->pcName, FREERTOS_AF_INET4, ucBytes );
}
#endif

xIP_Address.xIPAddress.ulIP_IPv4 = pxSet->ulIPAddress;
xIP_Address.xIs_IPv6 = pdFALSE;
Expand Down
8 changes: 8 additions & 0 deletions test/build-combination/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ set(FREERTOS_PLUS_TCP_TEST_CONFIGURATION_LIST
ENABLE_ALL_IPV4_TCP # Enable all configuration settings IPv4 TCP
ENABLE_ALL_IPV6_TCP # Enable all configuration settings IPv6 TCP
ENABLE_ALL_IPV4_IPV6 # Enable all configuration settings IPv4 IPv6 UDP
DISABLE_DNS_FEATURES # Enable all except DNS caching, callbacks, mDNS
DISABLE_ALL # Disable all configuration settings
HEADER_SELF_CONTAIN # Enable header self contain test
DEFAULT_CONF # Default (typical) configuration
Expand Down Expand Up @@ -59,6 +60,11 @@ add_library( freertos_plus_tcp_config_all_enable_ipv6_tcp INTERFACE)
target_include_directories(freertos_plus_tcp_config_all_enable_ipv6_tcp INTERFACE Enable_IPv6_TCP)
target_link_libraries(freertos_plus_tcp_config_all_enable_ipv6_tcp INTERFACE freertos_plus_tcp_config_common)

# -------------------------------------------------------------------
add_library( freertos_plus_tcp_config_disable_dns_features INTERFACE)
target_include_directories(freertos_plus_tcp_config_disable_dns_features INTERFACE DisableDnsFeatures)
target_link_libraries(freertos_plus_tcp_config_disable_dns_features INTERFACE freertos_plus_tcp_config_common)

# -------------------------------------------------------------------
add_library( freertos_plus_tcp_config_header_self_contain INTERFACE)
target_include_directories(freertos_plus_tcp_config_header_self_contain INTERFACE Header_Self_Contain)
Expand Down Expand Up @@ -90,6 +96,8 @@ elseif(FREERTOS_PLUS_TCP_TEST_CONFIGURATION STREQUAL "ENABLE_ALL_IPV6_TCP" )
add_library( freertos_config ALIAS freertos_plus_tcp_config_all_enable_ipv6_tcp)
elseif(FREERTOS_PLUS_TCP_TEST_CONFIGURATION STREQUAL "ENABLE_ALL_IPV4_IPV6" )
add_library( freertos_config ALIAS freertos_plus_tcp_config_all_enable_ipv4_ipv6)
elseif(FREERTOS_PLUS_TCP_TEST_CONFIGURATION STREQUAL "DISABLE_DNS_FEATURES" )
add_library( freertos_config ALIAS freertos_plus_tcp_config_disable_dns_features)
elseif(FREERTOS_PLUS_TCP_TEST_CONFIGURATION STREQUAL "HEADER_SELF_CONTAIN" )
add_library( freertos_config ALIAS freertos_plus_tcp_config_header_self_contain)
include( Header_Self_Contain/headerSelfContain.cmake )
Expand Down
Loading