In FreeRTOS_DNS_Globals.h the freertos_addrinfo struct adds in a member ucName when using ipCONFIG_USE_DNS_CACHE:
/** @brief freertos_addrinfo is the equivalent of 'struct addrinfo'. */
struct freertos_addrinfo
{
BaseType_t ai_flags; /**< The field is included for completeness, but it is not used. */
BaseType_t ai_family; /**< The type of IP-address, either FREERTOS_AF_INET4 or FREERTOS_AF_INET6. */
BaseType_t ai_socktype; /**< n.a. */
BaseType_t ai_protocol; /**< n.a. */
socklen_t ai_addrlen; /**< The length of the address, either ipSIZE_OF_IPv4_ADDRESS or ipSIZE_OF_IPv6_ADDRESS. */
struct freertos_sockaddr * ai_addr; /**< The socket address. */
char * ai_canonname; /**< The name of the host. */
struct freertos_addrinfo * ai_next; /**< A pointer to the next find result, or NULL. */
struct
{
/* In order to avoid allocations, reserve space here for *ai_addr and *ai_canonname. */
struct freertos_sockaddr sockaddr;
#if ( ipconfigUSE_DNS_CACHE != 0 )
char ucName[ ipconfigDNS_CACHE_NAME_LENGTH ];
#endif
}
xPrivateStorage; /**< In order to avoid extra calls to malloc, the necessary space is reserved 'statically'. */
};
Description
In FreeRTOS_DNS_Globals.h the
freertos_addrinfo
struct adds in a memberucName
when usingipCONFIG_USE_DNS_CACHE
:The
ucName
variable is currently used without performing this check in FreeRTOS_DNS.c:pxNew_AddrInfo():This PR wraps the usage of the
ucName
variable in a#if ( ipconfigUSE_DNS_CACHE != 0 )
block.Test Steps
Perform a build with the following options set:
Receive a build error as in FreeRTOS_DNS.c there is no check for if
ipCONFIG_USE_DNS_CACHE
is enabled.Perform the build with this change added without error.
Checklist:
Related Issue
https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/issues/1128
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.