net: lwm2m: Add config to enable DNS support
Add new config option `LWM2M_DNS_SUPPORT` to the LWM2M library, instead of relying on `DNS_RESOLVER` which is only compatible with native network stack. This allows to use DNS with offloaded interfaces seamlessly. Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
parent
d70a854904
commit
000226ff54
2 changed files with 7 additions and 3 deletions
|
@ -26,6 +26,10 @@ config LWM2M_DTLS_SUPPORT
|
|||
select NET_SOCKETS_SOCKOPT_TLS
|
||||
select NET_SOCKETS_ENABLE_DTLS
|
||||
|
||||
config LWM2M_DNS_SUPPORT
|
||||
bool "Enable DNS support in the LWM2M client"
|
||||
default y if DNS_RESOLVER
|
||||
|
||||
config LWM2M_ENGINE_STACK_SIZE
|
||||
int "LWM2M engine stack size"
|
||||
default 2560 if NET_LOG
|
||||
|
|
|
@ -4202,7 +4202,7 @@ int lwm2m_socket_start(struct lwm2m_ctx *client_ctx)
|
|||
int lwm2m_parse_peerinfo(char *url, struct sockaddr *addr, bool *use_dtls)
|
||||
{
|
||||
struct http_parser_url parser;
|
||||
#if defined(CONFIG_DNS_RESOLVER)
|
||||
#if defined(CONFIG_LWM2M_DNS_SUPPORT)
|
||||
struct addrinfo hints, *res;
|
||||
#endif
|
||||
int ret;
|
||||
|
@ -4263,7 +4263,7 @@ int lwm2m_parse_peerinfo(char *url, struct sockaddr *addr, bool *use_dtls)
|
|||
}
|
||||
|
||||
if (ret < 0) {
|
||||
#if defined(CONFIG_DNS_RESOLVER)
|
||||
#if defined(CONFIG_LWM2M_DNS_SUPPORT)
|
||||
#if defined(CONFIG_NET_IPV6) && defined(CONFIG_NET_IPV4)
|
||||
hints.ai_family = AF_UNSPEC;
|
||||
#elif defined(CONFIG_NET_IPV6)
|
||||
|
@ -4290,7 +4290,7 @@ int lwm2m_parse_peerinfo(char *url, struct sockaddr *addr, bool *use_dtls)
|
|||
freeaddrinfo(res);
|
||||
#else
|
||||
goto cleanup;
|
||||
#endif /* CONFIG_DNS_RESOLVER */
|
||||
#endif /* CONFIG_LWM2M_DNS_SUPPORT */
|
||||
}
|
||||
|
||||
/* set port */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue