]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/org.freedesktop.resolve1.xml
man: fix link markup
[thirdparty/systemd.git] / man / org.freedesktop.resolve1.xml
CommitLineData
ffd10e5a
ZJS
1<?xml version="1.0"?>
2<!--*-nxml-*-->
3<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
4 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
5<!ENTITY % entities SYSTEM "custom-entities.ent" >
6%entities;
7]>
8<!-- SPDX-License-Identifier: LGPL-2.1+ -->
9
10<refentry id="org.freedesktop.resolve1" conditional='ENABLE_RESOLVE'
11 xmlns:xi="http://www.w3.org/2001/XInclude">
12 <refentryinfo>
13 <title>org.freedesktop.resolve1</title>
14 <productname>systemd</productname>
15 </refentryinfo>
16
17 <refmeta>
18 <refentrytitle>org.freedesktop.resolve1</refentrytitle>
19 <manvolnum>5</manvolnum>
20 </refmeta>
21
22 <refnamediv>
23 <refname>org.freedesktop.resolve1</refname>
24 <refpurpose>The D-Bus interface of systemd-resolved</refpurpose>
25 </refnamediv>
26
27 <refsect1>
28 <title>Introduction</title>
29
30 <para>
31 <citerefentry><refentrytitle>systemd-resolved.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
ca264f7d 32 is a system service that provides hostname resolution and caching using DNS, LLMNR, and mDNS. It also
ffd10e5a
ZJS
33 does DNSSEC validation. This page describes the resolve semantics and the D-Bus interface.</para>
34
35 <para>This page contains an API reference only. If you are looking for a longer explanation how to use
36 this API, please consult
37 <ulink url="https://wiki.freedesktop.org/www/Software/systemd/writing-network-configuration-managers">
ca264f7d 38 Writing Network Configuration Managers</ulink> and
ffd10e5a
ZJS
39 <ulink url="https://wiki.freedesktop.org/www/Software/systemd/writing-resolver-clients">Writing Resolver
40 Clients</ulink>.
41 </para>
42 </refsect1>
43
44 <refsect1>
45 <title>The Manager Object</title>
46
47 <para>The service exposes the following interfaces on the Manager object on the bus:</para>
48
48f99d7c 49 <programlisting executable="systemd-resolved" node="/org/freedesktop/resolve1" interface="org.freedesktop.resolve1.Manager">
ffd10e5a
ZJS
50node /org/freedesktop/resolve1 {
51 interface org.freedesktop.resolve1.Manager {
52 methods:
53 ResolveHostname(in i ifindex,
54 in s name,
55 in i family,
56 in t flags,
57 out a(iiay) addresses,
58 out s canonical,
59 out t flags);
60 ResolveAddress(in i ifindex,
61 in i family,
62 in ay address,
63 in t flags,
64 out a(is) names,
65 out t flags);
66 ResolveRecord(in i ifindex,
67 in s name,
68 in q class,
69 in q type,
70 in t flags,
71 out a(iqqay) records,
72 out t flags);
73 ResolveService(in i ifindex,
74 in s name,
75 in s type,
76 in s domain,
77 in i family,
78 in t flags,
79 out a(qqqsa(iiay)s) srv_data,
80 out aay txt_data,
81 out s canonical_name,
82 out s canonical_type,
83 out s canonical_domain,
84 out t flags);
ffd10e5a
ZJS
85 GetLink(in i ifindex,
86 out o path);
87 SetLinkDNS(in i ifindex,
88 in a(iay) addresses);
89 SetLinkDomains(in i ifindex,
90 in a(sb) domains);
4fb222c4
ZJS
91 SetLinkDefaultRoute(in i ifindex,
92 in b enable);
ffd10e5a
ZJS
93 SetLinkLLMNR(in i ifindex,
94 in s mode);
95 SetLinkMulticastDNS(in i ifindex,
96 in s mode);
4fb222c4
ZJS
97 SetLinkDNSOverTLS(in i ifindex,
98 in s mode);
ffd10e5a
ZJS
99 SetLinkDNSSEC(in i ifindex,
100 in s mode);
101 SetLinkDNSSECNegativeTrustAnchors(in i ifindex,
102 in as names);
103 RevertLink(in i ifindex);
4fb222c4
ZJS
104 RegisterService(in s name,
105 in s name_template,
106 in s type,
107 in q service_port,
108 in q service_priority,
0894f08b 109 in q service_weight,
4fb222c4
ZJS
110 in aa{say} txt_datas,
111 out o service_path);
112 UnregisterService(in o service_path);
113 ResetStatistics();
114 FlushCaches();
115 ResetServerFeatures();
ffd10e5a 116 properties:
4fb222c4
ZJS
117 readonly s LLMNRHostname = '...';
118 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
119 readonly s LLMNR = '...';
120 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
121 readonly s MulticastDNS = '...';
122 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
123 readonly s DNSOverTLS = '...';
124 readonly a(iiay) DNS = [...];
125 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
126 readonly a(iiay) FallbackDNS = [...];
127 readonly (iiay) CurrentDNSServer = ...;
128 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
129 readonly a(isb) Domains = [...];
130 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
131 readonly (tt) TransactionStatistics = ...;
132 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
133 readonly (ttt) CacheStatistics = ...;
134 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
135 readonly s DNSSEC = '...';
136 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
137 readonly (tttt) DNSSECStatistics = ...;
138 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
139 readonly b DNSSECSupported = ...;
140 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
141 readonly as DNSSECNegativeTrustAnchors = ['...', ...];
142 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
143 readonly s DNSStubListener = '...';
ffd10e5a 144 };
4fb222c4
ZJS
145 interface org.freedesktop.DBus.Peer { ... };
146 interface org.freedesktop.DBus.Introspectable { ... };
147 interface org.freedesktop.DBus.Properties { ... };
ffd10e5a
ZJS
148};
149 </programlisting>
150
4fb222c4
ZJS
151 <!--method SetLinkDefaultRoute is not documented!-->
152
153 <!--method SetLinkDNSOverTLS is not documented!-->
154
155 <!--method RegisterService is not documented!-->
156
157 <!--method UnregisterService is not documented!-->
158
159 <!--method FlushCaches is not documented!-->
160
161 <!--method ResetServerFeatures is not documented!-->
162
163 <!--property LLMNR is not documented!-->
164
165 <!--property MulticastDNS is not documented!-->
166
167 <!--property DNSOverTLS is not documented!-->
168
169 <!--property FallbackDNS is not documented!-->
170
171 <!--property CurrentDNSServer is not documented!-->
172
173 <!--property DNSSEC is not documented!-->
174
175 <!--property DNSSECNegativeTrustAnchors is not documented!-->
176
177 <!--property DNSStubListener is not documented!-->
178
00bb75d7
ZJS
179 <!--Autogenerated cross-references for systemd.directives, do not edit-->
180
181 <variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.resolve1.Manager"/>
182
183 <variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.resolve1.Manager"/>
184
185 <variablelist class="dbus-method" generated="True" extra-ref="ResolveHostname()"/>
186
187 <variablelist class="dbus-method" generated="True" extra-ref="ResolveAddress()"/>
188
189 <variablelist class="dbus-method" generated="True" extra-ref="ResolveRecord()"/>
190
191 <variablelist class="dbus-method" generated="True" extra-ref="ResolveService()"/>
192
193 <variablelist class="dbus-method" generated="True" extra-ref="GetLink()"/>
194
195 <variablelist class="dbus-method" generated="True" extra-ref="SetLinkDNS()"/>
196
197 <variablelist class="dbus-method" generated="True" extra-ref="SetLinkDomains()"/>
198
199 <variablelist class="dbus-method" generated="True" extra-ref="SetLinkDefaultRoute()"/>
200
201 <variablelist class="dbus-method" generated="True" extra-ref="SetLinkLLMNR()"/>
202
203 <variablelist class="dbus-method" generated="True" extra-ref="SetLinkMulticastDNS()"/>
204
205 <variablelist class="dbus-method" generated="True" extra-ref="SetLinkDNSOverTLS()"/>
206
207 <variablelist class="dbus-method" generated="True" extra-ref="SetLinkDNSSEC()"/>
208
209 <variablelist class="dbus-method" generated="True" extra-ref="SetLinkDNSSECNegativeTrustAnchors()"/>
210
211 <variablelist class="dbus-method" generated="True" extra-ref="RevertLink()"/>
212
213 <variablelist class="dbus-method" generated="True" extra-ref="RegisterService()"/>
214
215 <variablelist class="dbus-method" generated="True" extra-ref="UnregisterService()"/>
216
217 <variablelist class="dbus-method" generated="True" extra-ref="ResetStatistics()"/>
218
219 <variablelist class="dbus-method" generated="True" extra-ref="FlushCaches()"/>
220
221 <variablelist class="dbus-method" generated="True" extra-ref="ResetServerFeatures()"/>
222
223 <variablelist class="dbus-property" generated="True" extra-ref="LLMNRHostname"/>
224
225 <variablelist class="dbus-property" generated="True" extra-ref="LLMNR"/>
226
227 <variablelist class="dbus-property" generated="True" extra-ref="MulticastDNS"/>
228
229 <variablelist class="dbus-property" generated="True" extra-ref="DNSOverTLS"/>
230
231 <variablelist class="dbus-property" generated="True" extra-ref="DNS"/>
232
233 <variablelist class="dbus-property" generated="True" extra-ref="FallbackDNS"/>
234
235 <variablelist class="dbus-property" generated="True" extra-ref="CurrentDNSServer"/>
236
237 <variablelist class="dbus-property" generated="True" extra-ref="Domains"/>
238
239 <variablelist class="dbus-property" generated="True" extra-ref="TransactionStatistics"/>
240
241 <variablelist class="dbus-property" generated="True" extra-ref="CacheStatistics"/>
242
243 <variablelist class="dbus-property" generated="True" extra-ref="DNSSEC"/>
244
245 <variablelist class="dbus-property" generated="True" extra-ref="DNSSECStatistics"/>
246
247 <variablelist class="dbus-property" generated="True" extra-ref="DNSSECSupported"/>
248
249 <variablelist class="dbus-property" generated="True" extra-ref="DNSSECNegativeTrustAnchors"/>
250
251 <variablelist class="dbus-property" generated="True" extra-ref="DNSStubListener"/>
252
00bb75d7
ZJS
253 <!--End of Autogenerated section-->
254
ffd10e5a
ZJS
255 <refsect2>
256 <title>Methods</title>
257
ca264f7d
DDM
258 <para><function>ResolveHostname()</function> takes a hostname and resolves it to one or more IP addresses.
259 As parameters it takes the Linux network interface index to execute the query on, or 0 if it may be
ffd10e5a 260 done on any suitable interface. The <varname>name</varname> parameter specifies the hostname to
ca264f7d
DDM
261 resolve. Note that if required, IDNA conversion is applied to this name unless it is resolved via LLMNR or MulticastDNS. The <varname>family</varname> parameter
262 limits the results to a specific address family. It may be <constant>AF_INET</constant>,
263 <constant>AF_INET6</constant> or <constant>AF_UNSPEC</constant>. If <constant>AF_UNSPEC</constant> is specified (recommended), both kinds are retrieved, subject
ffd10e5a 264 to local network configuration (i.e. if no local, routable IPv6 address is found, no IPv6 address is
ca264f7d 265 retrieved; and similarly for IPv4). A 64-bit <varname>flags</varname> field may be used to alter the
ffd10e5a 266 behaviour of the resolver operation (see below). The method returns an array of address records. Each
ca264f7d 267 address record consists of the interface index the address belongs to, an address family as well as a
ffd10e5a
ZJS
268 byte array with the actual IP address data (which either has 4 or 16 elements, depending on the address
269 family). The returned address family will be one of <constant>AF_INET</constant> or
270 <constant>AF_INET6</constant>. For IPv6, the returned address interface index should be used to
ca264f7d 271 initialize the .sin6_scope_id field of a <structname>struct sockaddr_in6</structname> instance to permit
ffd10e5a 272 support for resolution to link-local IP addresses. The address array is followed by the canonical name
ca264f7d
DDM
273 of the host, which may or may not be identical to the resolved hostname. Finally, a 64-bit
274 <varname>flags</varname> field is returned that is defined similarly to the <varname>flags</varname>
ffd10e5a 275 field that was passed in, but contains information about the resolved data (see below). If the hostname
ca264f7d
DDM
276 passed in is an IPv4 or IPv6 address formatted as string, it is parsed, and the result is returned. In
277 this case, no network communication is done.</para>
ffd10e5a
ZJS
278
279 <para><function>ResolveAddress()</function> executes the reverse operation: it takes an IP address and
280 acquires one or more hostnames for it. As parameters it takes the interface index to execute the query
281 on, or <constant>0</constant> if all suitable interfaces are OK. The <varname>family</varname>
ca264f7d 282 parameter indicates the address family of the IP address to resolve. It may be either
ffd10e5a 283 <constant>AF_INET</constant> or <constant>AF_INET6</constant>. The <varname>address</varname> parameter
ca264f7d
DDM
284 takes the raw IP address data (as either a 4 or 16 byte array). The <varname>flags</varname> input
285 parameter may be used to alter the resolver operation (see below). The method returns an array of name
286 records, each consisting of an interface index and a hostname. The <varname>flags</varname> output
ffd10e5a
ZJS
287 field contains additional information about the resolver operation (see below).</para>
288
289 <para><function>ResolveRecord()</function> takes a DNS resource record (RR) type, class and name, and
290 retrieves the full resource record set (RRset), including the RDATA, for it. As parameter it takes the
291 Linux network interface index to execute the query on, or <constant>0</constant> if it may be done on
292 any suitable interface. The <varname>name</varname> parameter specifies the RR domain name to look up
293 (no IDNA conversion is applied), followed by the 16-bit class and type fields (which may be
294 ANY). Finally, a <varname>flags</varname> field may be passed in to alter behaviour of the look-up (see
ca264f7d 295 below). On completion, an array of RR items is returned. Each array entry consists of the network interface
ffd10e5a 296 index the RR was discovered on, the type and class field of the RR found, and a byte array of the raw
4fb222c4 297 RR discovered. The raw RR data starts with the RR's domain name, in the original casing, followed
ffd10e5a
ZJS
298 by the RR type, class, TTL and RDATA, in the binary format documented in
299 <ulink url="https://www.ietf.org/rfc/rfc1035.txt">RFC 1035</ulink>. For RRs that support name
300 compression in the payload (such as MX or PTR), the compression is expanded in the returned
301 data.</para>
302
ca264f7d 303 <para>Note that currently, the class field has to be specified as IN or ANY. Specifying a different
ffd10e5a 304 class will return an error indicating that look-ups of this kind are unsupported. Similarly, some
ca264f7d
DDM
305 special types are not supported either (AXFR, OPT, …). While <filename>systemd-resolved</filename> parses and validates resource
306 records of many types, it is crucial that clients using this API understand that the RR data originates
ffd10e5a
ZJS
307 from the network and should be thoroughly validated before use.</para>
308
ca264f7d 309 <para><function>ResolveService()</function> may be used to resolve a DNS SRV service record, as well as the
ffd10e5a 310 hostnames referenced in it, and possibly an accompanying DNS-SD TXT record containing additional
ca264f7d 311 service metadata. The primary benefit of using this method over <function>ResolveRecord()</function>
ffd10e5a
ZJS
312 specifying the SRV type is that it will resolve the SRV and TXT RRs as well as the hostnames referenced
313 in the SRV in a single operation. As parameters it takes a Linux network interface index, a service
ca264f7d 314 name, a service type and a service domain. This method may be invoked in three different modes:</para>
ffd10e5a
ZJS
315
316 <orderedlist>
4fb222c4 317 <listitem><para>To resolve a DNS-SD service, specify the service name (e.g. <literal>Lennart's
ffd10e5a 318 Files</literal>), the service type (e.g. <literal>_webdav._tcp</literal>) and the domain to search in
ca264f7d 319 (e.g. <literal>local</literal>) as the three service parameters. The service name must be in UTF-8
ffd10e5a 320 format, and no IDNA conversion is applied to it in this mode (as mandated by the DNS-SD
ca264f7d 321 specifications). However, if necessary, IDNA conversion is applied to the domain parameter.</para>
ffd10e5a
ZJS
322 </listitem>
323
ca264f7d 324 <listitem><para>To resolve a plain SRV record, set the service name parameter to the empty string
ffd10e5a
ZJS
325 and set the service type and domain properly. (IDNA conversion is applied to the domain, if
326 necessary.)</para></listitem>
327
ca264f7d 328 <listitem><para>Alternatively, leave both the service name and type empty and specify the full
ffd10e5a
ZJS
329 domain name of the SRV record (i.e. prefixed with the service type) in the domain parameter. (No IDNA
330 coversion is applied in this mode.)</para></listitem>
331 </orderedlist>
332
ca264f7d 333 <para>The <varname>family</varname> parameter of the <function>ResolveService()</function> method encodes
ffd10e5a 334 the desired family of the addresses to resolve (use <constant>AF_INET</constant>,
ca264f7d 335 <constant>AF_INET6</constant>, or <constant>AF_UNSPEC</constant>). If this is enabled (Use the
ffd10e5a
ZJS
336 <constant>NO_ADDRESS</constant> flag to turn address resolution off, see below). The
337 <varname>flags</varname> parameter takes a couple of flags that may be used to alter the resolver
338 operation.</para>
339
ca264f7d
DDM
340 <para>On completion, <function>ResolveService()</function> returns an array of SRV record structures. Each
341 items consisting of the priority, weight and port fields as well as the hostname to contact, as encoded in the SRV
342 record. Immediately following is an array of the addresses of this hostname, with each item consisting
ffd10e5a 343 of the interface index, the address family and the address data in a byte array. This address array is
ca264f7d
DDM
344 followed by the canonicalized hostname. After this array of SRV record structures an array of byte
345 arrays follows that encodes the TXT RR strings, in case DNS-SD look-ups are enabled. The next parameters
ffd10e5a
ZJS
346 are the canonical service name, type and domain. This may or may not be identical to the parameters
347 passed in. Finally, a <varname>flags</varname> field is returned that contains information about the
348 resolver operation performed.</para>
349
ca264f7d
DDM
350 <para>The <function>ResetStatistics()</function> method resets the various statistics counters that
351 <filename>systemd-resolved</filename> maintains to zero. (For details, see the statistics properties below.)</para>
ffd10e5a
ZJS
352
353 <para>The <function>GetLink()</function> method takes a network interface index and returns the object
354 path to the <interfacename>org.freedesktop.resolve1.Link</interfacename> object corresponding to it.
355 </para>
356
357 <para>The <function>SetLinkDNS()</function> method sets the DNS servers to use on a specific
ca264f7d 358 interface. This method (and the following ones) may be used by network management software to configure
ffd10e5a
ZJS
359 per-interface DNS settings. It takes a network interface index as well as an array of DNS server IP
360 address records. Each array item consists of an address family (either <constant>AF_INET</constant> or
361 <constant>AF_INET6</constant>), followed by a 4-byte or 16-byte array with the raw address data. This
ca264f7d
DDM
362 method is a one-step shortcut for retrieving the Link object for a network interface using
363 <function>GetLink()</function> (see above) and then invoking the <function>SetDNS()</function> method
ffd10e5a
ZJS
364 (see below) on it.
365 </para>
366
ca264f7d
DDM
367 <para>Network management software integrating with <filename>systemd-resolved</filename> should
368 call this method (and the five below) after the interface appeared in the kernel (and thus after a
369 network interface index has been assigned), but before the network interfaces is activated
370 (<constant>IFF_UP</constant> set) so that all settings take effect during the full time the network
371 interface is up. It is safe to alter settings while the interface is up, however. Use
ffd10e5a
ZJS
372 <function>RevertLink()</function> (described below) to reset all per-interface settings.</para>
373
374 <para>The <function>SetLinkDomains()</function> method sets the search and routing domains to use on a
ca264f7d
DDM
375 specific network interface for DNS look-ups. It takes a network interface index and an array of domains,
376 each with a boolean parameter indicating whether the specified domain shall be used as a search domain
377 (false), or just as a routing domain (true). Search domains are used for qualifying single-label names into
ffd10e5a 378 FQDN when looking up hostnames, as well as for making routing decisions on which interface to send
ca264f7d
DDM
379 queries ending in the domain to. Routing domains are only used for routing decisions and not used for single-label
380 name qualification. Pass the search domains in the order they should be used.</para>
ffd10e5a
ZJS
381
382 <para>The <function>SetLinkLLMNR()</function> method enables or disables LLMNR support on a specific
ca264f7d 383 network interface. It takes a network interface index as well as a string that may either be empty or one of
ffd10e5a 384 <literal>yes</literal>, <literal>no</literal> or <literal>resolve</literal>. If empty, the systemd-wide
ca264f7d
DDM
385 default LLMNR setting is used. If <literal>yes</literal>, LLMNR is used for resolution of single-label
386 names and the local hostname is registered on all local LANs for LLMNR resolution by peers. If
387 <literal>no</literal>, LLMNR is turned off fully on this interface. If <literal>resolve</literal>, LLMNR
38b38500 388 is only enabled for resolving names, but the local hostname is not registered for other peers to
ffd10e5a
ZJS
389 use.</para>
390
391 <para>Similarly, the <function>SetLinkMulticastDNS()</function> method enables or disables MulticastDNS
392 support on a specific interface. It takes the same parameters as <function>SetLinkLLMNR()</function>
393 described above.</para>
394
395 <para>The <function>SetLinkDNSSEC()</function> method enables or disables DNSSEC validation on a
ca264f7d
DDM
396 specific network interface. It takes a network interface index as well as a string that may either be
397 empty or one of <literal>yes</literal>, <literal>no</literal>, or <literal>allow-downgrade</literal>. When
398 empty, the system-wide default DNSSEC setting is used. If <literal>yes</literal>, full DNSSEC validation
399 is done for all look-ups. If the selected DNS server does not support DNSSEC, look-ups will fail if this
400 mode is used. If <literal>no</literal>, DNSSEC validation is fully disabled. If
401 <literal>allow-downgrade</literal>, DNSSEC validation is enabled, but is turned off automatically if the
ffd10e5a
ZJS
402 selected server does not support it (thus opening up behaviour to downgrade attacks). Note that DNSSEC
403 only applies to traditional DNS, not to LLMNR or MulticastDNS.</para>
404
405 <para>The <function>SetLinkDNSSECNegativeTrustAnchors()</function> method may be used to configure DNSSEC
406 Negative Trust Anchors (NTAs) for a specific network interface. It takes a network interface index and a
ca264f7d 407 list of domains as arguments.</para>
ffd10e5a
ZJS
408
409 <para>The <function>RevertLink()</function> method may be used to revert all per-link settings done with
ca264f7d 410 the six methods described above to the defaults again.</para>
ffd10e5a
ZJS
411
412 <refsect3>
413 <title>The Flags Parameter</title>
414
ca264f7d 415 <para>The four methods above accept and return a 64-bit flags value. In most cases passing 0 is sufficient
ffd10e5a
ZJS
416 and recommended. However, the following flags are defined to alter the look-up:</para>
417
418 <programlisting>
419#define SD_RESOLVED_DNS (UINT64_C(1) &lt;&lt; 0)
420#define SD_RESOLVED_LLMNR_IPV4 (UINT64_C(1) &lt;&lt; 1)
421#define SD_RESOLVED_LLMNR_IPV6 (UINT64_C(1) &lt;&lt; 2)
422#define SD_RESOLVED_MDNS_IPV4 (UINT64_C(1) &lt;&lt; 3)
423#define SD_RESOLVED_MDNS_IPV6 (UINT64_C(1) &lt;&lt; 4)
424#define SD_RESOLVED_NO_CNAME (UINT64_C(1) &lt;&lt; 5)
425#define SD_RESOLVED_NO_TXT (UINT64_C(1) &lt;&lt; 6)
426#define SD_RESOLVED_NO_ADDRESS (UINT64_C(1) &lt;&lt; 7)
427#define SD_RESOLVED_NO_SEARCH (UINT64_C(1) &lt;&lt; 8)
428#define SD_RESOLVED_AUTHENTICATED (UINT64_C(1) &lt;&lt; 9)
429 </programlisting>
430
431 <para>On input, the first five flags control the protocols to use for the look-up. They refer to
432 classic unicast DNS, LLMNR via IPv4/UDP and IPv6/UDP respectively, as well as MulticastDNS via
433 IPv4/UDP and IPv6/UDP. If all of these five bits are off on input (which is strongly recommended) the
434 look-up will be done via all suitable protocols for the specific look-up. Note that these flags
ca264f7d 435 operate as filter only, but cannot force a look-up to be done via a protocol. Specifically, <filename>systemd-resolved</filename>
ffd10e5a
ZJS
436 will only route look-ups within the .local TLD to MulticastDNS (plus some reverse look-up address
437 domains), and single-label names to LLMNR (plus some reverse address lookup domains). It will route
438 neither of these to Unicast DNS servers. Also, it will do LLMNR and Multicast DNS only on interfaces
ca264f7d 439 suitable for multicast.</para>
ffd10e5a 440
ca264f7d 441 <para>On output, these five flags indicate which protocol was used to execute the operation, and hence
ffd10e5a
ZJS
442 where the data was found.</para>
443
ca264f7d 444 <para>The primary use cases for these five flags are follow-up look-ups based on DNS data retrieved
ffd10e5a 445 earlier. In this case it is often a good idea to limit the follow-up look-up to the protocol that was
ca264f7d 446 used to discover the first DNS result.</para>
ffd10e5a
ZJS
447
448 <para>The NO_CNAME flag controls whether CNAME/DNAME resource records shall be followed during the
449 look-up. This flag is only available at input, none of the functions will return it on output. If a
ca264f7d 450 CNAME/DNAME RR is discovered while resolving a hostname, an error is returned instead. By default,
ffd10e5a
ZJS
451 when the flag is off, CNAME/DNAME RRs are followed.</para>
452
ca264f7d
DDM
453 <para>The NO_TXT and NO_ADDRESS flags only influence operation of the
454 <function>ResolveService()</function> method. They are only defined for input, not output. If
455 NO_TXT set, the DNS-SD TXT RR look-up is not done in the same operation. If NO_ADDRESS is specified,
ffd10e5a
ZJS
456 the hostnames discovered are not implicitly translated to their addresses.</para>
457
458 <para>The NO_SEARCH flag turns off the search domain logic. It is only defined for input in
459 <function>ResolveHostname()</function>. When specified, single-label hostnames are not qualified
460 using defined search domains, if any are configured. Note that <function>ResolveRecord()</function>
ca264f7d 461 will never qualify single-label domain names using search domains. Also note that
ffd10e5a
ZJS
462 multi-label hostnames are never subject to search list expansion.</para>
463
464 <para>The AUTHENTICATED bit is defined only in the output flags of the four functions. If set, the
465 returned data has been fully authenticated. Specifically, this bit is set for all DNSSEC-protected data
466 for which a full trust chain may be established to a trusted domain anchor. It is also set for locally
467 synthesized data, such as <literal>localhost</literal> or data from
468 <filename>/etc/hosts</filename>. Moreover, it is set for all LLMNR or mDNS RRs which originate from the
469 local host. Applications that require authenticated RR data for operation should check this flag before
ca264f7d 470 trusting the data. Note that <filename>systemd-resolved</filename> will never return invalidated data, hence this flag
ffd10e5a
ZJS
471 simply allows to discern the cases where data is known to be trustable, or where there is proof that
472 the data is "rightfully" unauthenticated (which includes cases where the underlying protocol or server
473 does not support authenticating data).</para>
474 </refsect3>
475
476 </refsect2>
477
478 <refsect2>
479 <title>Properties</title>
480
7f255076
ZJS
481 <para><varname>LLMNRHostname</varname> contains the hostname currently exposed on the network via
482 LLMNR. It usually follows the system hostname as may be queried via
4fb222c4 483 <citerefentry project="man-pages"><refentrytitle>gethostname</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
7f255076 484 but may differ if a conflict is detected on the network.</para>
ffd10e5a 485
ca264f7d
DDM
486 <para><varname>DNS</varname> contains an array of all DNS servers currently used by
487 <filename>systemd-resolved</filename>. It contains similar information as the DNS server data written to
ffd10e5a
ZJS
488 /run/systemd/resolve/resolv.conf. Each structure in the array consists of a numeric network interface
489 index, an address family, and a byte array containing the DNS server address (either 4 bytes in length
490 for IPv4 or 16 bytes in lengths for IPv6). The array contains DNS servers configured system-wide,
491 including those possibly read from a foreign <filename>/etc/resolv.conf</filename> or the
492 <varname>DNS=</varname> setting in <filename>/etc/systemd/resolved.conf</filename>, as well as
493 per-interface DNS server information either retrieved from
494 <citerefentry><refentrytitle>systemd-networkd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
495 or configured by external software via <function>SetLinkDNS()</function> (see above). The network
ca264f7d 496 interface index will be 0 for the system-wide configured services and non-zero for the per-link
ffd10e5a
ZJS
497 servers.</para>
498
ca264f7d
DDM
499 <para>Similarly, the <varname>Domains</varname> property contains an array of all search and
500 routing domains currently used by <filename>systemd-resolved</filename>. Each entry consists of a network interface index (again, 0
ffd10e5a 501 encodes system-wide entries), the actual domain name, and whether the entry is used only for routing
ca264f7d 502 (true) or for both routing and searching (false).</para>
ffd10e5a
ZJS
503
504 <para>The <varname>TransactionStatistics</varname> property contains information about the number of
ca264f7d 505 transactions <filename>systemd-resolved</filename> has processed. It contains a pair of unsigned 64-bit counters, the first
ffd10e5a 506 containing the number of currently ongoing transactions, the second the number of total transactions
ca264f7d
DDM
507 <filename>systemd-resolved</filename> is processing or has processed. The latter value may be reset using the
508 <function>ResetStatistics()</function> method described above. Note that the number of transactions does
509 not directly map to the number of issued resolver bus method calls. While simple look-ups usually require a
ffd10e5a
ZJS
510 single transaction only, more complex look-ups might result in more, for example when CNAMEs or DNSSEC
511 are in use.</para>
512
513 <para>The <varname>CacheStatistics</varname> property contains information about the executed cache
514 operations so far. It exposes three 64-bit counters: the first being the total number of current cache
ca264f7d 515 entries (both positive and negative), the second the number of cache hits, and the third the number of
ffd10e5a
ZJS
516 cache misses. The latter counters may be reset using <function>ResetStatistics()</function> (see
517 above). </para>
518
519 <para>The <varname>DNSSECStatistics</varname> property contains information about the DNSSEC
520 validations executed so far. It contains four 64-bit counters: the number of secure, insecure, bogus,
521 and indeterminate DNSSEC validations so far. The counters are increased for each validated RRset, and
522 each non-existance proof. The secure counter is increased for each operation that successfully verified
523 a signed reply, the insecure counter is increased for each operation that successfully verified that an
524 unsigned reply is rightfully unsigned. The bogus counter is increased for each operation where the
ca264f7d 525 validation did not check out and the data is likely to have been tempered with. Finally the
ffd10e5a
ZJS
526 indeterminate counter is increased for each operation which did not complete because the necessary keys
527 could not be acquired or the cryptographic algorithms were unknown.</para>
528
529 <para>The <varname>DNSSECSupported</varname> boolean property reports whether DNSSEC is enabled and
530 the selected DNS servers support it. It combines information about system-wide and per-link DNS
531 settings (see below), and only reports true if DNSSEC is enabled and supported on every interface for
ca264f7d
DDM
532 which DNS is configured and for the system-wide settings if there are any. Note that <filename>systemd-resolved</filename> assumes
533 DNSSEC is supported by DNS servers until it verifies that this is not the case. Thus, the reported
ffd10e5a 534 value may initially be true, until the first transactions are executed.</para>
df957849
ZJS
535
536 <para>The <varname>LogLevel</varname> property shows the (maximum) log level of the manager, with the
537 same values as the <option>--log-level=</option> option described in
538 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>.</para>
ffd10e5a
ZJS
539 </refsect2>
540 </refsect1>
541
542 <refsect1>
543 <title>Link Object</title>
544
48f99d7c
ZJS
545 <programlisting executable="systemd-resolved" node="/org/freedesktop/resolve1/link/_1" interface="org.freedesktop.resolve1.Link">
546node /org/freedesktop/resolve1/link/_1 {
ffd10e5a
ZJS
547 interface org.freedesktop.resolve1.Link {
548 methods:
4fb222c4
ZJS
549 SetDNS(in a(iay) addresses);
550 SetDomains(in a(sb) domains);
551 SetDefaultRoute(in b enable);
552 SetLLMNR(in s mode);
553 SetMulticastDNS(in s mode);
554 SetDNSOverTLS(in s mode);
555 SetDNSSEC(in s mode);
556 SetDNSSECNegativeTrustAnchors(in as names);
ffd10e5a 557 Revert();
ffd10e5a 558 properties:
4fb222c4
ZJS
559 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
560 readonly t ScopesMask = ...;
561 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
562 readonly a(iay) DNS = [...];
563 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
564 readonly (iay) CurrentDNSServer = ...;
565 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
566 readonly a(sb) Domains = [...];
567 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
568 readonly b DefaultRoute = ...;
569 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
570 readonly s LLMNR = '...';
571 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
572 readonly s MulticastDNS = '...';
573 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
574 readonly s DNSOverTLS = '...';
575 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
576 readonly s DNSSEC = '...';
577 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
578 readonly as DNSSECNegativeTrustAnchors = ['...', ...];
579 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
580 readonly b DNSSECSupported = ...;
ffd10e5a 581 };
4fb222c4
ZJS
582 interface org.freedesktop.DBus.Peer { ... };
583 interface org.freedesktop.DBus.Introspectable { ... };
584 interface org.freedesktop.DBus.Properties { ... };
ffd10e5a
ZJS
585};
586 </programlisting>
587
4fb222c4
ZJS
588 <!--method SetDomains is not documented!-->
589
590 <!--method SetDefaultRoute is not documented!-->
591
592 <!--method SetLLMNR is not documented!-->
593
594 <!--method SetMulticastDNS is not documented!-->
595
596 <!--method SetDNSOverTLS is not documented!-->
597
598 <!--method SetDNSSEC is not documented!-->
599
600 <!--method SetDNSSECNegativeTrustAnchors is not documented!-->
601
602 <!--method Revert is not documented!-->
603
604 <!--property CurrentDNSServer is not documented!-->
605
606 <!--property DefaultRoute is not documented!-->
607
608 <!--property LLMNR is not documented!-->
609
610 <!--property MulticastDNS is not documented!-->
611
612 <!--property DNSOverTLS is not documented!-->
613
614 <!--property DNSSEC is not documented!-->
615
616 <!--property DNSSECNegativeTrustAnchors is not documented!-->
617
00bb75d7
ZJS
618 <!--Autogenerated cross-references for systemd.directives, do not edit-->
619
620 <variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.resolve1.Link"/>
621
622 <variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.resolve1.Link"/>
623
624 <variablelist class="dbus-method" generated="True" extra-ref="SetDNS()"/>
625
626 <variablelist class="dbus-method" generated="True" extra-ref="SetDomains()"/>
627
628 <variablelist class="dbus-method" generated="True" extra-ref="SetDefaultRoute()"/>
629
630 <variablelist class="dbus-method" generated="True" extra-ref="SetLLMNR()"/>
631
632 <variablelist class="dbus-method" generated="True" extra-ref="SetMulticastDNS()"/>
633
634 <variablelist class="dbus-method" generated="True" extra-ref="SetDNSOverTLS()"/>
635
636 <variablelist class="dbus-method" generated="True" extra-ref="SetDNSSEC()"/>
637
638 <variablelist class="dbus-method" generated="True" extra-ref="SetDNSSECNegativeTrustAnchors()"/>
639
640 <variablelist class="dbus-method" generated="True" extra-ref="Revert()"/>
641
642 <variablelist class="dbus-property" generated="True" extra-ref="ScopesMask"/>
643
644 <variablelist class="dbus-property" generated="True" extra-ref="DNS"/>
645
646 <variablelist class="dbus-property" generated="True" extra-ref="CurrentDNSServer"/>
647
648 <variablelist class="dbus-property" generated="True" extra-ref="Domains"/>
649
650 <variablelist class="dbus-property" generated="True" extra-ref="DefaultRoute"/>
651
652 <variablelist class="dbus-property" generated="True" extra-ref="LLMNR"/>
653
654 <variablelist class="dbus-property" generated="True" extra-ref="MulticastDNS"/>
655
656 <variablelist class="dbus-property" generated="True" extra-ref="DNSOverTLS"/>
657
658 <variablelist class="dbus-property" generated="True" extra-ref="DNSSEC"/>
659
660 <variablelist class="dbus-property" generated="True" extra-ref="DNSSECNegativeTrustAnchors"/>
661
662 <variablelist class="dbus-property" generated="True" extra-ref="DNSSECSupported"/>
663
664 <!--End of Autogenerated section-->
665
ca264f7d 666 <para>For each Linux network interface a "Link" object is created which exposes per-link DNS
ffd10e5a
ZJS
667 configuration and state. Use <function>GetLink()</function> on the Manager interface to retrieve the
668 object path for a link object given the network interface index (see above).</para>
669
670 <refsect2>
671 <title>Methods</title>
672
673 <para>The various methods exposed by the Link interface are equivalent to their similarly named
674 counterparts on the Manager interface. e.g. <function>SetDNS()</function> on the Link object maps to
675 <function>SetLinkDNS()</function> on the Manager object, the main difference being that the later
ca264f7d 676 expects an interface index to be specified. Invoking the methods on the Manager interface has the
ffd10e5a 677 benefit of reducing roundtrips, as it is not necessary to first request the Link object path via
ca264f7d
DDM
678 <function>GetLink()</function> before invoking the methods. For further details on these methods see
679 the <interfacename>Manager</interfacename> documentation above.</para>
ffd10e5a
ZJS
680 </refsect2>
681
682 <refsect2>
683 <title>Properties</title>
684
685 <para><varname>ScopesMask</varname> defines which resolver scopes are currently active on this
ca264f7d 686 interface. This 64-bit unsigned integer field is a bit mask consisting of a subset of the bits of the
ffd10e5a
ZJS
687 flags parameter describe above. Specifically, it may have the DNS, LLMNR and MDNS bits (the latter in
688 IPv4 and IPv6 flavours) set. Each individual bit is set when the protocol applies to a specific
689 interface and is enabled for it. It is unset otherwise. Specifically, a multicast-capable interface in
ca264f7d 690 the "UP" state with an IP address is suitable for LLMNR or MulticastDNS, and any interface that is UP and
ffd10e5a
ZJS
691 has an IP address is suitable for DNS. Note the relationship of the bits exposed here with the LLMNR
692 and MulticastDNS properties also exposed on the Link interface. The latter expose what is *configured*
693 to be used on the interface, the former expose what is actually used on the interface, taking into
694 account the abilities of the interface.</para>
695
696 <para><varname>DNSSECSupported</varname> exposes a boolean field that indicates whether DNSSEC is
ca264f7d 697 currently configured and in use on the interface. Note that if DNSSEC is enabled on an interface, it is
ffd10e5a
ZJS
698 assumed available until it is detected that the configured server does not actually support it. Thus,
699 this property may initially report that DNSSEC is supported on an interface.</para>
700
ca264f7d 701 <para>The other properties reflect the state of the various configuration settings for the link which
ffd10e5a
ZJS
702 may be set with the various methods calls such as SetDNS() or SetLLMNR().</para>
703 </refsect2>
704 </refsect1>
705
706 <refsect1>
707 <title>Common Errors</title>
708
ca264f7d
DDM
709 <para>Many bus methods <filename>systemd-resolved</filename> exposes (in particular the resolver methods such
710 as <function>ResolveHostname()</function> on the <interfacename>Manager</interfacename> interface) may return
ffd10e5a
ZJS
711 some of the following errors:</para>
712
713 <variablelist>
714 <varlistentry><term><constant>org.freedesktop.resolve1.NoNameServers</constant></term>
ca264f7d 715 <listitem><para>No suitable DNS servers were found to resolve a request.</para></listitem>
ffd10e5a
ZJS
716 </varlistentry>
717
718 <varlistentry><term><constant>org.freedesktop.resolve1.InvalidReply</constant></term>
ca264f7d 719 <listitem><para>A response from the selected DNS server was not understood.</para></listitem>
ffd10e5a
ZJS
720 </varlistentry>
721
722 <varlistentry><term><constant>org.freedesktop.resolve1.NoSuchRR</constant></term>
723 <listitem><para>The requested name exists, but there is no resource record of the requested type for
724 it. (This is the DNS NODATA case).</para></listitem></varlistentry>
725
726 <varlistentry><term><constant>org.freedesktop.resolve1.CNameLoop</constant></term>
727 <listitem><para>The look-up failed because a CNAME or DNAME loop was detected.</para></listitem>
728 </varlistentry>
729
730 <varlistentry><term><constant>org.freedesktop.resolve1.Aborted</constant></term>
ca264f7d 731 <listitem><para>The look-up was aborted because the selected protocol became unavailable while the
ffd10e5a
ZJS
732 operation was ongoing.</para></listitem>
733 </varlistentry>
734
735 <varlistentry><term><constant>org.freedesktop.resolve1.NoSuchService</constant></term>
736 <listitem><para>A service look-up was successful, but the SRV record reported that the service is not
737 available.</para></listitem></varlistentry>
738
739 <varlistentry><term><constant>org.freedesktop.resolve1.DnssecFailed</constant></term>
740 <listitem><para>The acquired response did not pass DNSSEC validation.</para></listitem>
741 </varlistentry>
742
743 <varlistentry><term><constant>org.freedesktop.resolve1.NoTrustAnchor</constant></term>
ca264f7d 744 <listitem><para>No chain of trust could be established for the response to a configured DNSSEC trust
ffd10e5a
ZJS
745 anchor.</para></listitem>
746 </varlistentry>
747
748 <varlistentry><term><constant>org.freedesktop.resolve1.ResourceRecordTypeUnsupported</constant></term>
749 <listitem><para>The requested resource record type is not supported on the selected DNS servers. This
750 error is generated for example when an RRSIG record is requested from a DNS server that does not
751 support DNSSEC.</para></listitem>
752
753 </varlistentry>
754
755 <varlistentry><term><constant>org.freedesktop.resolve1.NoSuchLink</constant></term>
756 <listitem><para>No network interface with the specified network interface index exists.
757 </para></listitem></varlistentry>
758
759 <varlistentry><term><constant>org.freedesktop.resolve1.LinkBusy</constant></term>
ca264f7d 760 <listitem><para>The requested configuration change could not be made because
ffd10e5a
ZJS
761 <citerefentry><refentrytitle>systemd-networkd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
762 already took possession of the interface and supplied configuration data for it.</para></listitem>
763 </varlistentry>
764
765 <varlistentry><term><constant>org.freedesktop.resolve1.NetworkDown</constant></term>
766 <listitem><para>The requested look-up failed because the system is currently not connected to any
767 suitable network.</para></listitem></varlistentry>
768
769 <varlistentry><term><constant>org.freedesktop.resolve1.DnsError.NXDOMAIN</constant></term>
770 <term><constant>org.freedesktop.resolve1.DnsError.REFUSED</constant></term>
771 <term>...</term>
772 <listitem><para>The look-up failed with a DNS return code reporting a failure. The error names used as
773 suffixes here are defined in by IANA in
774 <ulink url="https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-6">DNS RCODEs</ulink>.
775 </para></listitem>
776 </varlistentry>
777 </variablelist>
778 </refsect1>
779
48f99d7c
ZJS
780 <refsect1>
781 <title>Examples</title>
782
783 <example>
784 <title>Introspect <interfacename>org.freedesktop.resolve1.Manager</interfacename> on the bus</title>
785
786 <programlisting>
787$ gdbus introspect --system \
788 --dest org.freedesktop.resolve1 \
789 --object-path /org/freedesktop/resolve1
790 </programlisting>
791 </example>
792
793 <example>
794 <title>Introspect <interfacename>org.freedesktop.resolve1.Link</interfacename> on the bus</title>
795
796 <programlisting>
797$ gdbus introspect --system \
798 --dest org.freedesktop.resolve1 \
799 --object-path /org/freedesktop/resolve1/link/_11
800 </programlisting>
801 </example>
802 </refsect1>
803
ffd10e5a
ZJS
804 <refsect1>
805 <title>Versioning</title>
806
807 <para>These D-Bus interfaces follow <ulink url="http://0pointer.de/blog/projects/versioning-dbus.html">
808 the usual interface versioning guidelines</ulink>.</para>
809 </refsect1>
810</refentry>