net: dns: Fix end-of-results callback on error
net: dns: Fix end-of-results callback on error

Callers of dns_get_addr_info() depends on receiving an end-of-results
callback (where 'info' is NULL) when finished. Do this on failure in
cb_recv() instead of pointing to an empty object.

This fix will avoid a deadlock situation in getaddrinfo().

A reply code other than "no error" in the DNS response is a typical
case when the lookup failed and this occurs.

Moved "struct dns_addrinfo info" variable from cb_recv() to dns_read()
because it was now unused in cb_recv().

Adding tests for this requires network access and a DNS server,
or a mechanism for generating a DNS response with a reply code.

Signed-off-by: Stig Bjørlykke <ea07fa156e332ba20900aa10589adbee8ec38deb@nordicsemi.no>

Vudentz/zephyr,galak/zephyr,punitvara/zephyr,GiulianoFranchetto/zephyr,mbolivar/zephyr,zephyrproject-rtos/zephyr,finikorg/zephyr,finikorg/zephyr,zephyrproject-rtos/zephyr,kraj/zephyr,finikorg/zephyr,zephyrproject-rtos/zephyr,nashif/zephyr,mbolivar/zephyr,mbolivar/zephyr,finikorg/zephyr,ldts/zephyr,nashif/zephyr,galak/zephyr,galak/zephyr,Vudentz/zephyr,explora26/zephyr,punitvara/zephyr,galak/zephyr,GiulianoFranchetto/zephyr,explora26/zephyr,zephyrproject-rtos/zephyr,punitvara/zephyr,finikorg/zephyr,kraj/zephyr,kraj/zephyr,zephyriot/zephyr,Vudentz/zephyr,nashif/zephyr,GiulianoFranchetto/zephyr,kraj/zephyr,explora26/zephyr,kraj/zephyr,mbolivar/zephyr,Vudentz/zephyr,ldts/zephyr,nashif/zephyr,zephyriot/zephyr,punitvara/zephyr,zephyriot/zephyr,ldts/zephyr,Vudentz/zephyr,punitvara/zephyr,ldts/zephyr,zephyriot/zephyr,ldts/zephyr,GiulianoFranchetto/zephyr,Vudentz/zephyr,mbolivar/zephyr,zephyriot/zephyr,GiulianoFranchetto/zephyr,zephyrproject-rtos/zephyr,explora26/zephyr,galak/zephyr,explora26/zephyr,nashif/zephyr