Using DNS Callbacks without DNS caching

mstroven wrote on Thursday, May 30, 2019:

I’m setting ipconfigDNS_USE_CALLBACKS (1), but not setting ipconfigUSE_DNS_CACHE. Is this supposed to be a supported combination? If so, it doesn’t work. There is a compile error where the variable “pcName” is undeclared in the callback code. I’ve implemented a bit of a hack which just feeds a NULL to the callback function, but would appreciate advice from the community.


heinbali01 wrote on Friday, May 31, 2019:

Hi Mike, thanks for reporting this. This combination was indeed not yet supported:

#define ipconfigDNS_USE_CALLBACKS  1
#define ipconfigUSE_DNS_CACHE      0

It would be nice to have pcName properly set when doing the call-back.

The DNS call-back feature has been disabled for a while because it lacked security. It would update DNS cache entries even if the DNS reply was unsolicited.
Currently, there is a safer version in this pull request.

I am attaching this more secure version, along with the changes that you propose: using the call-back without the caching. contains two files:

    FreeRTOS_UDP_IP.c  // Forward DNS replies to the DNS module
    FreeRTOS_DNS.c     // with the above changes

I just did a quick test with it in real hardware, and it worked. I don’t have the time now for more testing. Please report back how it works for you, thanks.