Commit 7799f0c9 authored by Jukka Rissanen's avatar Jukka Rissanen Committed by Anas Nashif
Browse files

net: dns: Allow user to specify max answer length via Kconfig

If the default max. answer length of 512 bytes is not enough,
user can specify it by setting CONFIG_DNS_RESOLVER_MAX_ANSWER_SIZE
to suitable value.

Signed-off-by: default avatarJukka Rissanen <jukka.rissanen@nordicsemi.no>
parent cf8b7d71
Loading
Loading
Loading
Loading
+4 −0
Changes for include/zephyr/net/dns_resolve.h: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -56,7 +56,11 @@ enum dns_query_type {
#define DNS_BUF_TIMEOUT K_MSEC(500) /* ms */

/* This value is recommended by RFC 1035 */
#if defined(CONFIG_DNS_RESOLVER_MAX_ANSWER_SIZE)
#define DNS_RESOLVER_MAX_BUF_SIZE CONFIG_DNS_RESOLVER_MAX_ANSWER_SIZE
#else
#define DNS_RESOLVER_MAX_BUF_SIZE 512
#endif /* CONFIG_DNS_RESOLVER_MAX_ANSWER_SIZE */

/* Make sure that we can compile things even if CONFIG_DNS_RESOLVER
 * is not enabled.
+8 −0
Changes for subsys/net/lib/dns/Kconfig: 8 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -61,6 +61,14 @@ config DNS_RESOLVER_MAX_SERVERS
	  DNS server is enough. Each connection to DNS server will use one
	  network context.

config DNS_RESOLVER_MAX_ANSWER_SIZE
	int "Max length of a DNS answer"
	range 1 $(UINT16_MAX)
	default 512
	help
	  Max length of the returned DNS answer we can process.
	  Recommended value by RFC 1035 is 512 bytes.

config DNS_RESOLVER_MAX_QUERY_LEN
	int "Max length of a DNS query"
	range 1 $(UINT8_MAX)
+0 −1
Changes for subsys/net/lib/dns/llmnr_responder.c: 0 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -53,7 +53,6 @@ static struct net_mgmt_event_callback mgmt_cb;
#define BUF_ALLOC_TIMEOUT K_MSEC(100)

/* This value is recommended by RFC 1035 */
#define DNS_RESOLVER_MAX_BUF_SIZE	512
#define DNS_RESOLVER_MIN_BUF		2
#define DNS_RESOLVER_BUF_CTR	(DNS_RESOLVER_MIN_BUF + \
				 CONFIG_LLMNR_RESOLVER_ADDITIONAL_BUF_CTR)
+0 −1
Changes for tests/net/lib/dns_packet/src/main.c: 0 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -1144,7 +1144,6 @@ static void run_dns_valid_response(const char *test_case,
		      test_case, ret);
}

#define DNS_RESOLVER_MAX_BUF_SIZE	512
#define DNS_RESOLVER_MIN_BUF	1
#define DNS_RESOLVER_BUF_CTR	(DNS_RESOLVER_MIN_BUF + 1)
#define DNS_MAX_NAME_LEN	255