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_DNS_SD
192	bool "DNS Service Discovery via mDNS"
193	default y
194	depends on DNS_SD
195	help
196	  Selecting this option ensures that the MDNS Responder
197	  processes PTR, SRV, and TXT records according to RFC 6763.
198	  By doing so, Zephyr network services are discoverable
199	  using e.g. 'avahi-browse -t -r _greybus._tcp'.
200
201if MDNS_RESPONDER_DNS_SD
202config MDNS_RESPONDER_DNS_SD_SERVICE_TYPE_ENUMERATION
203	bool "DNS SD Service Type Enumeration"
204	default y
205	help
206	  Selecting this option ensures that the MDNS Responder
207	  performs DNS-SD Service Type Enumeration according to RFC 6763,
208	  Chapter 9. By doing so, Zephyr network services are discoverable
209	  using e.g. 'avahi-browse -t -r _services._dns-sd._udp.local'.
210endif # MDNS_RESPONDER_DNS_SD
211
212module = MDNS_RESPONDER
213module-dep = NET_LOG
214module-str = Log level for mDNS responder
215module-help = Enables mDNS responder code to output debug messages.
216source "subsys/net/Kconfig.template.log_config.net"
217
218config MDNS_RESOLVER_ADDITIONAL_BUF_CTR
219	int "Additional DNS buffers"
220	default 0
221	help
222	  Number of additional buffers available for the mDNS responder.
223
224endif # MDNS_RESPONDER
225
226config LLMNR_RESPONDER
227	bool "LLMNR responder"
228	select NET_IPV4_IGMP if NET_IPV4
229	select NET_IPV6_MLD if NET_IPV6
230	select NET_MGMT
231	select NET_MGMT_EVENT
232	select NET_SOCKETS
233	select NET_SOCKETS_SERVICE
234	depends on NET_HOSTNAME_ENABLE
235	help
236	  This option enables the LLMNR responder support for Zephyr.
237	  It will listen well-known address ff02::1:3 and 224.0.0.252.
238	  Currently this only returns IP address information.
239	  You must set CONFIG_NET_HOSTNAME to some meaningful value and
240	  then LLMNR will start to respond to <hostname> LLMNR queries.
241	  Note that LLMNR queries should only contain single-label names
242	  so there should be NO dot (".") in the name (RFC 4795 ch 3).
243	  Current implementation does not support TCP.
244	  See RFC 4795 for more details about LLMNR.
245
246if LLMNR_RESPONDER
247
248config LLMNR_RESPONDER_TTL
249	int "Time-to-Live of returned DNS name"
250	default 30
251	help
252	  DNS answers will use the TTL (in seconds). A default value is 30
253	  seconds as recommended by RFC 4795 chapter 2.8
254
255config LLMNR_RESPONDER_INIT_PRIO
256	int "Startup priority for the LLMNR responder init"
257	default 96
258	help
259	  Note that if NET_CONFIG_AUTO_INIT is enabled, then this value
260	  should be bigger than its value.
261
262module = LLMNR_RESPONDER
263module-dep = NET_LOG
264module-str = Log level for LLMNR responder
265module-help = Enables LLMNR responder code to output debug messages.
266source "subsys/net/Kconfig.template.log_config.net"
267
268config LLMNR_RESOLVER_ADDITIONAL_BUF_CTR
269	int "Additional DNS buffers"
270	default 0
271	help
272	  Number of additional buffers available for the LLMNR responder.
273
274endif # LLMNR_RESPONDER
275
276config DNS_SD
277	bool "DNS Service Discovery"
278	help
279	  This option enables DNS Service Discovery for Zephyr. It can
280	  be enabled for virtually any network service with only a few
281	  lines of code and works for both Unicast and Multicast DNS.
282	  See RFC 6763 for more details about DNS-SD.
283
284if DNS_SD
285
286module = DNS_SD
287module-dep = NET_LOG
288module-str = Log level for DNS-SD
289module-help = Enables DNS Service Discovery code to output debug messages.
290source "subsys/net/Kconfig.template.log_config.net"
291
292endif # DNS_SD
293
294# Note that we enable the DNS socket dispatcher always if either responder or
295# resolver support is enabled to simplify things. Strictly speaking the
296# dispatcher is really needed for supporting resolver and responder at the same
297# time.
298config DNS_SOCKET_DISPATCHER
299	bool
300	depends on (DNS_RESOLVER || MDNS_RESPONDER)
301	select NET_SOCKETS_SERVICE
302	default y
303	help
304	  A DNS socket dispatcher that allows both the DNS resolver and
305	  mDNS responder to be used at the same time.
306
307if DNS_SOCKET_DISPATCHER
308
309config DNS_RESOLVER_ADDITIONAL_BUF_CTR
310	int "Additional DNS buffers"
311	default 1
312	help
313	  Number of additional buffers available for the DNS resolver.
314	  The DNS resolver requires at least one buffer. This option
315	  enables additional buffers required for multiple concurrent
316	  DNS connections.
317
318module = DNS_SOCKET_DISPATCHER
319module-dep = NET_LOG
320module-str = Log level for DNS socket dispatcher
321module-help = Enables DNS socket dispatcher code to output debug messages.
322source "subsys/net/Kconfig.template.log_config.net"
323
324endif # DNS_SOCKET_DISPATCHER
325