Skip to content

Commit 000226f

Browse files
rlubosjukkar
authored andcommitted
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 <[email protected]>
1 parent d70a854 commit 000226f

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

subsys/net/lib/lwm2m/Kconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ config LWM2M_DTLS_SUPPORT
2626
select NET_SOCKETS_SOCKOPT_TLS
2727
select NET_SOCKETS_ENABLE_DTLS
2828

29+
config LWM2M_DNS_SUPPORT
30+
bool "Enable DNS support in the LWM2M client"
31+
default y if DNS_RESOLVER
32+
2933
config LWM2M_ENGINE_STACK_SIZE
3034
int "LWM2M engine stack size"
3135
default 2560 if NET_LOG

subsys/net/lib/lwm2m/lwm2m_engine.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4202,7 +4202,7 @@ int lwm2m_socket_start(struct lwm2m_ctx *client_ctx)
42024202
int lwm2m_parse_peerinfo(char *url, struct sockaddr *addr, bool *use_dtls)
42034203
{
42044204
struct http_parser_url parser;
4205-
#if defined(CONFIG_DNS_RESOLVER)
4205+
#if defined(CONFIG_LWM2M_DNS_SUPPORT)
42064206
struct addrinfo hints, *res;
42074207
#endif
42084208
int ret;
@@ -4263,7 +4263,7 @@ int lwm2m_parse_peerinfo(char *url, struct sockaddr *addr, bool *use_dtls)
42634263
}
42644264

42654265
if (ret < 0) {
4266-
#if defined(CONFIG_DNS_RESOLVER)
4266+
#if defined(CONFIG_LWM2M_DNS_SUPPORT)
42674267
#if defined(CONFIG_NET_IPV6) && defined(CONFIG_NET_IPV4)
42684268
hints.ai_family = AF_UNSPEC;
42694269
#elif defined(CONFIG_NET_IPV6)
@@ -4290,7 +4290,7 @@ int lwm2m_parse_peerinfo(char *url, struct sockaddr *addr, bool *use_dtls)
42904290
freeaddrinfo(res);
42914291
#else
42924292
goto cleanup;
4293-
#endif /* CONFIG_DNS_RESOLVER */
4293+
#endif /* CONFIG_LWM2M_DNS_SUPPORT */
42944294
}
42954295

42964296
/* set port */

0 commit comments

Comments
 (0)