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_QUERY_LEN
65	int "Max length of a DNS query"
66	range 1 $(UINT8_MAX)
67	default $(UINT8_MAX)
68	help
69	  Max length of a DNS query that should be looked up including the
70	  trailing 0. So e.g. "example.com" would have a query len of 12.
71
72menuconfig DNS_SERVER_IP_ADDRESSES
73	bool "Set DNS server IP addresses"
74	help
75	  Allow DNS IP addresses to be set in config file for
76	  networking applications.
77
78if DNS_SERVER_IP_ADDRESSES
79
80config DNS_SERVER1
81	string "DNS server 1"
82	help
83	  DNS server IP address 1. The address can be either IPv4 or IPv6
84	  address. An optional port number can be given.
85	  Following syntax is supported:
86	  192.0.2.1
87	  192.0.2.1:5353
88	  2001:db8::1
89	  [2001:db8::1]:5353
90	  It is possible to bind the DNS connection via a certain network
91	  interface by appending "%" and network interface name to the server
92	  address. For example: 192.0.2.1%eth1 would bind the connection socket
93	  to the network interface eth1. This is optional and by default the
94	  resolver connects to server by selecting the output network interface
95	  using normal IP routing.
96	  It is not mandatory to use this Kconfig option at all.
97	  The one calling dns_resolve_init() can use this option or not
98	  to populate the server list. If the DNS server addresses are
99	  set here, then we automatically create default DNS context
100	  for the user.
101
102config DNS_SERVER2
103	string "DNS server 2"
104	help
105	  See help in "DNS server 1" option.
106
107config DNS_SERVER3
108	string "DNS server 3"
109	help
110	  See help in "DNS server 1" option.
111
112config DNS_SERVER4
113	string "DNS server 4"
114	help
115	  See help in "DNS server 1" option.
116
117config DNS_SERVER5
118	string "DNS server 5"
119	help
120	  See help in "DNS server 1" option.
121
122endif # DNS_SERVER_IP_ADDRESSES
123
124config DNS_NUM_CONCUR_QUERIES
125	int "Number of simultaneous DNS queries per one DNS context"
126	default 1
127	help
128	  This defines how many concurrent DNS queries can be generated using
129	  same DNS context. Normally 1 is a good default value.
130
131module = DNS_RESOLVER
132module-dep = NET_LOG
133module-str = Log level for DNS resolver
134module-help = Enables DNS resolver code to output debug messages.
135source "subsys/net/Kconfig.template.log_config.net"
136
137menuconfig DNS_RESOLVER_CACHE
138	bool "DNS resolver cache"
139	help
140	   This option enables the dns resolver cache. DNS queries
141	   will be cached based on TTL and delivered from cache
142	   whenever possible. This reduces network usage.
143
144if DNS_RESOLVER_CACHE
145
146config DNS_RESOLVER_CACHE_MAX_ENTRIES
147	int "Number of cache entries supported by the dns cache"
148	default 6
149	help
150	  This defines how many entries the DNS cache can hold. If
151	  not enough entries for caching are available the oldest
152	  entry gets replaced. Adjusting this value will affect
153	  RAM usage.
154
155endif # DNS_RESOLVER_CACHE
156
157endif # DNS_RESOLVER
158
159config MDNS_RESPONDER
160	bool "mDNS responder"
161	select NET_IPV4_IGMP if NET_IPV4
162	select NET_IPV6_MLD if NET_IPV6
163	select NET_MGMT
164	select NET_MGMT_EVENT
165	select NET_SOCKETS
166	select NET_SOCKETS_SERVICE
167	depends on NET_HOSTNAME_ENABLE
168	help
169	  This option enables the mDNS responder support for Zephyr.
170	  It will listen well-known address ff02::fb and 224.0.0.251.
171	  Currently this only returns IP address information.
172	  You must set CONFIG_NET_HOSTNAME to some meaningful value and
173	  then mDNS will start to respond to <hostname>.local mDNS queries.
174	  See RFC 6762 for more details about mDNS.
175
176if MDNS_RESPONDER
177
178config MDNS_RESPONDER_TTL
179	int "Time-to-Live of returned DNS name"
180	default 600
181	help
182	  DNS answers will use the TTL (in seconds).
183
184config MDNS_RESPONDER_INIT_PRIO
185	int "Startup priority for the mDNS responder init"
186	default 96
187	help
188	  Note that if NET_CONFIG_AUTO_INIT is enabled, then this value
189	  should be bigger than its value.
190
191config MDNS_RESPONDER_PROBE
192	bool "mDNS probing support [EXPERIMENTAL]"
193	select NET_CONNECTION_MANAGER
194	select MDNS_RESOLVER
195	select DNS_RESOLVER
196	select EXPERIMENTAL
197	help
198	  Note that for probing to work, the mDNS and DNS resolver need to
199	  be enabled. The probing is made optional to allow smaller memory
200	  usage.
201
202config MDNS_WORKQ_STACK_SIZE
203	int "mDNS work queue thread stack size"
204	default 1200 if X86
205	default 1024
206	depends on MDNS_RESPONDER_PROBE
207	help
208	  Set the mDNS work queue thread stack size in bytes.
209
210config MDNS_WORKER_PRIO
211	int "Priority of the mDNS work queue"
212	default 2
213	depends on MDNS_RESPONDER_PROBE
214	help
215	  Set the priority of the mDNS worker queue, that handles all
216	  mDNS probing. Value 0 = highest priortity.
217	  When CONFIG_NET_TC_THREAD_COOPERATIVE = y, lowest priority is
218	  CONFIG_NUM_COOP_PRIORITIES-1 else lowest priority is
219	  CONFIG_NUM_PREEMPT_PRIORITIES-1.
220
221config MDNS_RESPONDER_DNS_SD
222	bool "DNS Service Discovery via mDNS"
223	default y
224	depends on DNS_SD
225	help
226	  Selecting this option ensures that the MDNS Responder
227	  processes PTR, SRV, and TXT records according to RFC 6763.
228	  By doing so, Zephyr network services are discoverable
229	  using e.g. 'avahi-browse -t -r _greybus._tcp'.
230
231if MDNS_RESPONDER_DNS_SD
232config MDNS_RESPONDER_DNS_SD_SERVICE_TYPE_ENUMERATION
233	bool "DNS SD Service Type Enumeration"
234	default y
235	help
236	  Selecting this option ensures that the MDNS Responder
237	  performs DNS-SD Service Type Enumeration according to RFC 6763,
238	  Chapter 9. By doing so, Zephyr network services are discoverable
239	  using e.g. 'avahi-browse -t -r _services._dns-sd._udp.local'.
240endif # MDNS_RESPONDER_DNS_SD
241
242module = MDNS_RESPONDER
243module-dep = NET_LOG
244module-str = Log level for mDNS responder
245module-help = Enables mDNS responder code to output debug messages.
246source "subsys/net/Kconfig.template.log_config.net"
247
248config MDNS_RESOLVER_ADDITIONAL_BUF_CTR
249	int "Additional DNS buffers"
250	default 0
251	help
252	  Number of additional buffers available for the mDNS responder.
253
254endif # MDNS_RESPONDER
255
256config LLMNR_RESPONDER
257	bool "LLMNR responder"
258	select NET_IPV4_IGMP if NET_IPV4
259	select NET_IPV6_MLD if NET_IPV6
260	select NET_MGMT
261	select NET_MGMT_EVENT
262	select NET_SOCKETS
263	select NET_SOCKETS_SERVICE
264	depends on NET_HOSTNAME_ENABLE
265	help
266	  This option enables the LLMNR responder support for Zephyr.
267	  It will listen well-known address ff02::1:3 and 224.0.0.252.
268	  Currently this only returns IP address information.
269	  You must set CONFIG_NET_HOSTNAME to some meaningful value and
270	  then LLMNR will start to respond to <hostname> LLMNR queries.
271	  Note that LLMNR queries should only contain single-label names
272	  so there should be NO dot (".") in the name (RFC 4795 ch 3).
273	  Current implementation does not support TCP.
274	  See RFC 4795 for more details about LLMNR.
275
276if LLMNR_RESPONDER
277
278config LLMNR_RESPONDER_TTL
279	int "Time-to-Live of returned DNS name"
280	default 30
281	help
282	  DNS answers will use the TTL (in seconds). A default value is 30
283	  seconds as recommended by RFC 4795 chapter 2.8
284
285config LLMNR_RESPONDER_INIT_PRIO
286	int "Startup priority for the LLMNR responder init"
287	default 96
288	help
289	  Note that if NET_CONFIG_AUTO_INIT is enabled, then this value
290	  should be bigger than its value.
291
292module = LLMNR_RESPONDER
293module-dep = NET_LOG
294module-str = Log level for LLMNR responder
295module-help = Enables LLMNR responder code to output debug messages.
296source "subsys/net/Kconfig.template.log_config.net"
297
298config LLMNR_RESOLVER_ADDITIONAL_BUF_CTR
299	int "Additional DNS buffers"
300	default 0
301	help
302	  Number of additional buffers available for the LLMNR responder.
303
304endif # LLMNR_RESPONDER
305
306config DNS_SD
307	bool "DNS Service Discovery"
308	help
309	  This option enables DNS Service Discovery for Zephyr. It can
310	  be enabled for virtually any network service with only a few
311	  lines of code and works for both Unicast and Multicast DNS.
312	  See RFC 6763 for more details about DNS-SD.
313
314if DNS_SD
315
316module = DNS_SD
317module-dep = NET_LOG
318module-str = Log level for DNS-SD
319module-help = Enables DNS Service Discovery code to output debug messages.
320source "subsys/net/Kconfig.template.log_config.net"
321
322endif # DNS_SD
323
324# Note that we enable the DNS socket dispatcher always if either responder or
325# resolver support is enabled to simplify things. Strictly speaking the
326# dispatcher is really needed for supporting resolver and responder at the same
327# time.
328config DNS_SOCKET_DISPATCHER
329	bool
330	depends on (DNS_RESOLVER || MDNS_RESPONDER)
331	select NET_SOCKETS_SERVICE
332	default y
333	help
334	  A DNS socket dispatcher that allows both the DNS resolver and
335	  mDNS responder to be used at the same time.
336
337if DNS_SOCKET_DISPATCHER
338
339config DNS_RESOLVER_ADDITIONAL_BUF_CTR
340	int "Additional DNS buffers"
341	default 1
342	help
343	  Number of additional buffers available for the DNS resolver.
344	  The DNS resolver requires at least one buffer. This option
345	  enables additional buffers required for multiple concurrent
346	  DNS connections.
347
348module = DNS_SOCKET_DISPATCHER
349module-dep = NET_LOG
350module-str = Log level for DNS socket dispatcher
351module-help = Enables DNS socket dispatcher code to output debug messages.
352source "subsys/net/Kconfig.template.log_config.net"
353
354endif # DNS_SOCKET_DISPATCHER
355