From 3282b3571bc87908e4fb5f83d95387a1e66542ca Mon Sep 17 00:00:00 2001 From: tony-josi-aws Date: Thu, 6 Jun 2024 17:06:22 +0530 Subject: [PATCH] API changes --- source/FreeRTOS_DNS.c | 29 +++++++++++++++++++++++++++++ source/include/FreeRTOS_DNS.h | 4 ++++ 2 files changed, 33 insertions(+) diff --git a/source/FreeRTOS_DNS.c b/source/FreeRTOS_DNS.c index 73388b515c..95de898669 100644 --- a/source/FreeRTOS_DNS.c +++ b/source/FreeRTOS_DNS.c @@ -1637,6 +1637,35 @@ /*-----------------------------------------------------------*/ +BaseType_t FreeRTOS_SetDNSIPPreference( IPPreference_t eIPPreference ) +{ + BaseType_t xReturn = pdPASS; + switch ( eIPPreference ) + { + + #if ( ipconfigUSE_IPv4 != 0 ) + case xPreferenceIPv4: + xDNS_IP_Preference = xPreferenceIPv4; + break; + #endif + + #if ( ipconfigUSE_IPv6 != 0 ) + case xPreferenceIPv6: + xDNS_IP_Preference = xPreferenceIPv6; + break; + #endif + + default: + xReturn = pdFAIL; + FreeRTOS_printf( ( "Invalid DNS IPPreference_t\n" ) ); + break; + } + + return xReturn; +} + +/*-----------------------------------------------------------*/ + #endif /* ipconfigUSE_DNS != 0 */ /*-----------------------------------------------------------*/ diff --git a/source/include/FreeRTOS_DNS.h b/source/include/FreeRTOS_DNS.h index 04daeb2329..28312b14f6 100644 --- a/source/include/FreeRTOS_DNS.h +++ b/source/include/FreeRTOS_DNS.h @@ -154,6 +154,10 @@ BaseType_t FreeRTOS_getaddrinfo( const char * pcName, /* Th */ void FreeRTOS_freeaddrinfo( struct freertos_addrinfo * pxInfo ); +/* Sets the DNS IP preference while doing DNS lookup to indicate the preference + * for a DNS server: either IPv4 or IPv6. Defaults to xPreferenceIPv4 */ +BaseType_t FreeRTOS_SetDNSIPPreference( IPPreference_t eIPPreference ); + #if ( ipconfigDNS_USE_CALLBACKS == 1 ) /*