1# Copyright (c) 2016 Intel Corporation
2# SPDX-License-Identifier: Apache-2.0
3
4config DNS_RESOLVER
5	bool "DNS resolver"
6	depends on NET_NATIVE
7	select NET_SOCKETS
8	select NET_SOCKETS_SERVICE
9	select CRC
10	help
11	  This option enables the DNS client side support for Zephyr
12
13if DNS_RESOLVER
14
15config DNS_RESOLVER_AUTO_INIT
16	bool "Automatically initialize the default DNS context"
17	default y
18	help
19	  Automatically initialize the default DNS context so dns_resolve_init
20	  does not need to be manually called.
21
22config MDNS_RESOLVER
23	bool "MDNS support"
24	help
25	  This option enables multicast DNS client side support.
26	  See RFC 6762 for details.
27
28config LLMNR_RESOLVER
29	bool "LLMNR support"
30	help
31	  This option enables link local multicast name resolution client side
32	  support. See RFC 4795 for details. LLMNR is typically used by Windows
33	  hosts. If you enable this option, then the DNS requests are ONLY sent
34	  to LLMNR well known multicast address 224.0.0.252:5355 or
35	  [ff02::1:3]:5355 and other DNS server addresses are ignored.
36
37config DNS_RESOLVER_ADDITIONAL_QUERIES
38	int "Additional DNS queries"
39	range 0 2
40	default 1
41	help
42	  Number of additional DNS queries that the DNS resolver may
43	  generate when the RR ANSWER only contains CNAME(s).
44	  The maximum value of this variable is constrained to avoid
45	  'alias loops'.
46
47config DNS_RESOLVER_AI_MAX_ENTRIES
48	int "Maximum number of IP addresses for DNS name"
49	default 2
50	help
51	  Defines the max number of IP addresses per domain name
52	  resolution the DNS resolver can handle.
53
54
55config DNS_RESOLVER_MAX_SERVERS
56	int "Number of DNS server addresses"
57	range 1 NET_MAX_CONTEXTS
58	default 1
59	help
60	  Max number of DNS servers that we can connect to. Normally one
61	  DNS server is enough. Each connection to DNS server will use one
62	  network context.
63
64config DNS_RESOLVER_MAX_ANSWER_SIZE
65	int "Max length of a DNS answer"
66	range 1 $(UINT16_MAX)
67	default 512
68	help
69	  Max length of the returned DNS answer we can process.
70	  Recommended value by RFC 1035 is 512 bytes.
71
72config DNS_RESOLVER_MAX_QUERY_LEN
73	int "Max length of a DNS query"
74	range 1 $(UINT8_MAX)
75	default $(UINT8_MAX)
76	help
77	  Max length of a DNS query that should be looked up including the
78	  trailing 0. So e.g. "example.com" would have a query len of 12.
79
80config DNS_RESOLVER_MAX_NAME_LEN
81	int "Max length of the resolved DNS name"
82	range 1 $(UINT8_MAX)
83	default 128 if DNS_SD
84	default 20
85	help
86	  Max length of a buffer that is used to store information returned from
87	  DNS server. For example if we query a DNS-SD service, then this value should
88	  be long enough to store the returned string.
89
90menuconfig DNS_SERVER_IP_ADDRESSES
91	bool "Set DNS server IP addresses"
92	help
93	  Allow DNS IP addresses to be set in config file for
94	  networking applications.
95
96if DNS_SERVER_IP_ADDRESSES
97
98config DNS_SERVER1
99	string "DNS server 1"
100	help
101	  DNS server IP address 1. The address can be either IPv4 or IPv6
102	  address. An optional port number can be given.
103	  Following syntax is supported:
104	  192.0.2.1
105	  192.0.2.1:5353
106	  2001:db8::1
107	  [2001:db8::1]:5353
108	  It is possible to bind the DNS connection via a certain network
109	  interface by appending "%" and network interface name to the server
110	  address. For example: 192.0.2.1%eth1 would bind the connection socket
111	  to the network interface eth1. This is optional and by default the
112	  resolver connects to server by selecting the output network interface
113	  using normal IP routing.
114	  It is not mandatory to use this Kconfig option at all.
115	  The one calling dns_resolve_init() can use this option or not
116	  to populate the server list. If the DNS server addresses are
117	  set here, then we automatically create default DNS context
118	  for the user.
119
120config DNS_SERVER2
121	string "DNS server 2"
122	help
123	  See help in "DNS server 1" option.
124
125config DNS_SERVER3
126	string "DNS server 3"
127	help
128	  See help in "DNS server 1" option.
129
130config DNS_SERVER4
131	string "DNS server 4"
132	help
133	  See help in "DNS server 1" option.
134
135config DNS_SERVER5
136	string "DNS server 5"
137	help
138	  See help in "DNS server 1" option.
139
140endif # DNS_SERVER_IP_ADDRESSES
141
142config DNS_RECONFIGURE_CLEANUP
143	bool "Cleanup old DNS server entries when reconfiguring"
144	help
145	  If calling dns_resolve_reconfigure() when new DNS servers
146	  are being set, for example if receiving new ones from DHCP server,
147	  remove the old entries before setting up the new ones.
148	  If you have only one network interface, then this can be enabled.
149	  If you have multiple network interfaces, then this should be disabled
150	  because the later configuration update would remove the entries
151	  set by the other network interface configuration.
152	  The previous default in Zephyr 4.1 or earlier was to have this enabled.
153	  The current default in Zephyr 4.2 is to disable this option.
154
155config DNS_NUM_CONCUR_QUERIES
156	int "Number of simultaneous DNS queries per one DNS context"
157	default 1
158	help
159	  This defines how many concurrent DNS queries can be generated using
160	  same DNS context. Normally 1 is a good default value.
161
162module = DNS_RESOLVER
163module-dep = NET_LOG
164module-str = Log level for DNS resolver
165module-help = Enables DNS resolver code to output debug messages.
166source "subsys/net/Kconfig.template.log_config.net"
167
168menuconfig DNS_RESOLVER_CACHE
169	bool "DNS resolver cache"
170	help
171	   This option enables the dns resolver cache. DNS queries
172	   will be cached based on TTL and delivered from cache
173	   whenever possible. This reduces network usage.
174
175if DNS_RESOLVER_CACHE
176
177config DNS_RESOLVER_CACHE_MAX_ENTRIES
178	int "Number of cache entries supported by the dns cache"
179	default 6
180	help
181	  This defines how many entries the DNS cache can hold. If
182	  not enough entries for caching are available the oldest
183	  entry gets replaced. Adjusting this value will affect
184	  RAM usage.
185
186endif # DNS_RESOLVER_CACHE
187
188endif # DNS_RESOLVER
189
190config MDNS_RESPONDER
191	bool "mDNS responder"
192	select NET_IPV4_IGMP if NET_IPV4
193	select NET_IPV6_MLD if NET_IPV6
194	select NET_MGMT
195	select NET_MGMT_EVENT
196	select NET_SOCKETS
197	select NET_SOCKETS_SERVICE
198	depends on NET_HOSTNAME_ENABLE
199	help
200	  This option enables the mDNS responder support for Zephyr.
201	  It will listen well-known address ff02::fb and 224.0.0.251.
202	  Currently this only returns IP address information.
203	  You must set CONFIG_NET_HOSTNAME to some meaningful value and
204	  then mDNS will start to respond to <hostname>.local mDNS queries.
205	  See RFC 6762 for more details about mDNS.
206
207if MDNS_RESPONDER
208
209config MDNS_RESOLVER_BUF_SIZE
210	int "Size of the net_buf pool buffers"
211	default 512
212	help
213	  For larger DNS SD TXT records and long service instance names, bigger buffers are necessary
214
215config MDNS_RESPONDER_TTL
216	int "Time-to-Live of returned DNS name"
217	default 600
218	help
219	  DNS answers will use the TTL (in seconds).
220
221config MDNS_RESPONDER_INIT_PRIO
222	int "Startup priority for the mDNS responder init"
223	default 96
224	help
225	  Note that if NET_CONFIG_AUTO_INIT is enabled, then this value
226	  should be bigger than its value.
227
228config MDNS_RESPONDER_PROBE
229	bool "mDNS probing support [EXPERIMENTAL]"
230	select NET_CONNECTION_MANAGER
231	select MDNS_RESOLVER
232	select DNS_RESOLVER
233	select EXPERIMENTAL
234	help
235	  Note that for probing to work, the mDNS and DNS resolver need to
236	  be enabled. The probing is made optional to allow smaller memory
237	  usage.
238
239config MDNS_WORKQ_STACK_SIZE
240	int "mDNS work queue thread stack size"
241	default 1200 if X86
242	default 1024
243	depends on MDNS_RESPONDER_PROBE
244	help
245	  Set the mDNS work queue thread stack size in bytes.
246
247config MDNS_WORKER_PRIO
248	int "Priority of the mDNS work queue"
249	default 2
250	depends on MDNS_RESPONDER_PROBE
251	help
252	  Set the priority of the mDNS worker queue, that handles all
253	  mDNS probing. Value 0 = highest priortity.
254	  When CONFIG_NET_TC_THREAD_COOPERATIVE = y, lowest priority is
255	  CONFIG_NUM_COOP_PRIORITIES-1 else lowest priority is
256	  CONFIG_NUM_PREEMPT_PRIORITIES-1.
257
258config MDNS_RESPONDER_DNS_SD
259	bool "DNS Service Discovery via mDNS"
260	default y
261	depends on DNS_SD
262	help
263	  Selecting this option ensures that the MDNS Responder
264	  processes PTR, SRV, and TXT records according to RFC 6763.
265	  By doing so, Zephyr network services are discoverable
266	  using e.g. 'avahi-browse -t -r _greybus._tcp'.
267
268if MDNS_RESPONDER_DNS_SD
269config MDNS_RESPONDER_DNS_SD_SERVICE_TYPE_ENUMERATION
270	bool "DNS SD Service Type Enumeration"
271	default y
272	help
273	  Selecting this option ensures that the MDNS Responder
274	  performs DNS-SD Service Type Enumeration according to RFC 6763,
275	  Chapter 9. By doing so, Zephyr network services are discoverable
276	  using e.g. 'avahi-browse -t -r _services._dns-sd._udp.local'.
277endif # MDNS_RESPONDER_DNS_SD
278
279module = MDNS_RESPONDER
280module-dep = NET_LOG
281module-str = Log level for mDNS responder
282module-help = Enables mDNS responder code to output debug messages.
283source "subsys/net/Kconfig.template.log_config.net"
284
285config MDNS_RESOLVER_ADDITIONAL_BUF_CTR
286	int "Additional DNS buffers"
287	default 0
288	help
289	  Number of additional buffers available for the mDNS responder.
290
291endif # MDNS_RESPONDER
292
293config LLMNR_RESPONDER
294	bool "LLMNR responder"
295	select NET_IPV4_IGMP if NET_IPV4
296	select NET_IPV6_MLD if NET_IPV6
297	select NET_MGMT
298	select NET_MGMT_EVENT
299	select NET_SOCKETS
300	select NET_SOCKETS_SERVICE
301	depends on NET_HOSTNAME_ENABLE
302	help
303	  This option enables the LLMNR responder support for Zephyr.
304	  It will listen well-known address ff02::1:3 and 224.0.0.252.
305	  Currently this only returns IP address information.
306	  You must set CONFIG_NET_HOSTNAME to some meaningful value and
307	  then LLMNR will start to respond to <hostname> LLMNR queries.
308	  Note that LLMNR queries should only contain single-label names
309	  so there should be NO dot (".") in the name (RFC 4795 ch 3).
310	  Current implementation does not support TCP.
311	  See RFC 4795 for more details about LLMNR.
312
313if LLMNR_RESPONDER
314
315config LLMNR_RESPONDER_TTL
316	int "Time-to-Live of returned DNS name"
317	default 30
318	help
319	  DNS answers will use the TTL (in seconds). A default value is 30
320	  seconds as recommended by RFC 4795 chapter 2.8
321
322config LLMNR_RESPONDER_INIT_PRIO
323	int "Startup priority for the LLMNR responder init"
324	default 96
325	help
326	  Note that if NET_CONFIG_AUTO_INIT is enabled, then this value
327	  should be bigger than its value.
328
329module = LLMNR_RESPONDER
330module-dep = NET_LOG
331module-str = Log level for LLMNR responder
332module-help = Enables LLMNR responder code to output debug messages.
333source "subsys/net/Kconfig.template.log_config.net"
334
335config LLMNR_RESOLVER_ADDITIONAL_BUF_CTR
336	int "Additional DNS buffers"
337	default 0
338	help
339	  Number of additional buffers available for the LLMNR responder.
340
341endif # LLMNR_RESPONDER
342
343config DNS_SD
344	bool "DNS Service Discovery"
345	help
346	  This option enables DNS Service Discovery for Zephyr. It can
347	  be enabled for virtually any network service with only a few
348	  lines of code and works for both Unicast and Multicast DNS.
349	  See RFC 6763 for more details about DNS-SD.
350
351if DNS_SD
352
353module = DNS_SD
354module-dep = NET_LOG
355module-str = Log level for DNS-SD
356module-help = Enables DNS Service Discovery code to output debug messages.
357source "subsys/net/Kconfig.template.log_config.net"
358
359endif # DNS_SD
360
361# Note that we enable the DNS socket dispatcher always if either responder or
362# resolver support is enabled to simplify things. Strictly speaking the
363# dispatcher is really needed for supporting resolver and responder at the same
364# time.
365config DNS_SOCKET_DISPATCHER
366	bool
367	depends on (DNS_RESOLVER || MDNS_RESPONDER)
368	select NET_SOCKETS_SERVICE
369	default y
370	help
371	  A DNS socket dispatcher that allows both the DNS resolver and
372	  mDNS responder to be used at the same time.
373
374if DNS_SOCKET_DISPATCHER
375
376config DNS_RESOLVER_ADDITIONAL_BUF_CTR
377	int "Additional DNS buffers"
378	default 1
379	help
380	  Number of additional buffers available for the DNS resolver.
381	  The DNS resolver requires at least one buffer. This option
382	  enables additional buffers required for multiple concurrent
383	  DNS connections.
384
385module = DNS_SOCKET_DISPATCHER
386module-dep = NET_LOG
387module-str = Log level for DNS socket dispatcher
388module-help = Enables DNS socket dispatcher code to output debug messages.
389source "subsys/net/Kconfig.template.log_config.net"
390
391endif # DNS_SOCKET_DISPATCHER
392