net: lwm2m: Cleanup special handling of DNS for offloading

With `CONFIG_NET_NATIVE`, offloaded drivers can specify capabilites with
`NET_IPV4/6` configs, so there is no longer need to handle socket
offloading separately.

Also, initialize hints structure with zeros, as according to man pages
unused fields should be set to 0:
`All the other fields in the structure pointed to by hints must contain
either 0 or a NULL pointer, as appropriate.`

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
Robert Lubos 2019-10-15 10:44:15 +02:00 committed by Jukka Rissanen
commit 399f213227

View file

@ -4203,7 +4203,7 @@ int lwm2m_parse_peerinfo(char *url, struct sockaddr *addr, bool *use_dtls)
{
struct http_parser_url parser;
#if defined(CONFIG_LWM2M_DNS_SUPPORT)
struct addrinfo hints, *res;
struct addrinfo *res, hints = { 0 };
#endif
int ret;
u16_t off, len;
@ -4270,9 +4270,6 @@ int lwm2m_parse_peerinfo(char *url, struct sockaddr *addr, bool *use_dtls)
hints.ai_family = AF_INET6;
#elif defined(CONFIG_NET_IPV4)
hints.ai_family = AF_INET;
#elif defined(CONFIG_NET_SOCKETS_OFFLOAD)
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_INET;
#else
hints.ai_family = AF_UNSPEC;
#endif /* defined(CONFIG_NET_IPV6) && defined(CONFIG_NET_IPV4) */