Compare commits

..

9 Commits

Author SHA1 Message Date
Daan De Meyer 842a362c3a sd-bus: Add sd_bus_is_server + sd_bus_set/is_bus_client docs 2020-04-20 19:12:36 +02:00
Daan De Meyer d512670a1f sd-bus: sd_bus_get_current_* docs fixes 2020-04-20 17:49:05 +02:00
Zbigniew Jędrzejewski-Szmek 59eb35bd94
Merge pull request #15439 from keszybz/man-resolve
Fix formatting in in resolved.conf(5) and nss-resolve(8)
2020-04-20 15:32:14 +02:00
Zbigniew Jędrzejewski-Szmek b136cf54fc
Merge pull request #15491 from keszybz/resolvconf-compat
Two tweaks to the description of resolvconf compatibility
2020-04-20 15:24:54 +02:00
Zbigniew Jędrzejewski-Szmek 3d334c40b4 resolved: fix minor confusion in comment
Suffixing != prefixing.
2020-04-20 12:16:56 +02:00
Zbigniew Jędrzejewski-Szmek 42ecca2e68 man: use manpages.ubuntu.com for resolvconf(8) link
Add manpages.debian.org as a man citeref "project", so we can refer to man
pages hosted there. resolvconf(8) doesn't seem to appear on any of the ones we
currently have defined.

We are doing a trick, where our man page is installed as resolvconf(1), and
we refer the reader to resolvconf(8). This can be pretty confusing, so the
least we can do is to provide a non-broken symlink ;)

v2:
- link to manpages.d.o instead of manpages.ubuntu.com, because debian is the
  upstream here, and because with debian we can use /unstable/ as the version,
  and ubuntu doesn't seem to have any such shortcut, so the version would need
  to be periodically updated.
2020-04-20 12:14:33 +02:00
Zbigniew Jędrzejewski-Szmek d8c73cb7c2 man: fix formatting in resolved.conf(5) 2020-04-20 09:47:55 +02:00
Zbigniew Jędrzejewski-Szmek b0fb800c9b man: reindent nss-resolve(8) 2020-04-20 09:47:53 +02:00
Zbigniew Jędrzejewski-Szmek 924ccc35f9 man: add a note that resolvconf updates /etc/resolv.conf in specific circumstances
When someone knows how the whole ecosystem works, this is understandable.
But for someone coming from a system where resolvconf updates /etc/resolv.conf
directly, this can be rather surprising.

For https://bugzilla.redhat.com/show_bug.cgi?id=1815605.
2020-04-19 22:01:21 +02:00
9 changed files with 245 additions and 159 deletions

View File

@ -1,9 +1,5 @@
<?xml version='1.0'?> <!--*-nxml-*-->
<!--
SPDX-License-Identifier: LGPL-2.1+
-->
<!-- SPDX-License-Identifier: LGPL-2.1+ -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
@ -96,6 +92,21 @@
</a>
</xsl:template>
<xsl:template match="citerefentry[@project='debian']">
<a>
<xsl:attribute name="href">
<xsl:text>https://manpages.debian.org/unstable/</xsl:text>
<xsl:value-of select="refentrytitle"/>
<xsl:text>/</xsl:text>
<xsl:value-of select="refentrytitle"/>
<xsl:text>.</xsl:text>
<xsl:value-of select="manvolnum"/>
<xsl:text>.en.html</xsl:text>
</xsl:attribute>
<xsl:call-template name="inline.charseq"/>
</a>
</xsl:template>
<xsl:template match="citerefentry[@project='freebsd']">
<a>
<xsl:attribute name="href">

View File

@ -288,17 +288,27 @@
</refsect1>
<refsect1>
<title>Compatibility with <citerefentry><refentrytitle>resolvconf</refentrytitle><manvolnum>8</manvolnum></citerefentry></title>
<title>Compatibility with
<citerefentry project="debian"><refentrytitle>resolvconf</refentrytitle><manvolnum>8</manvolnum></citerefentry></title>
<para><command>resolvectl</command> is a multi-call binary. When invoked as <literal>resolvconf</literal>
(generally achieved by means of a symbolic link of this name to the <command>resolvectl</command> binary) it
is run in a limited <citerefentry><refentrytitle>resolvconf</refentrytitle><manvolnum>8</manvolnum></citerefentry>
is run in a limited
<citerefentry project="debian"><refentrytitle>resolvconf</refentrytitle><manvolnum>8</manvolnum></citerefentry>
compatibility mode. It accepts mostly the same arguments and pushes all data into
<citerefentry><refentrytitle>systemd-resolved.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
similar to how <option>dns</option> and <option>domain</option> commands operate. Note that
<command>systemd-resolved.service</command> is the only supported backend, which is different from other
implementations of this command. Note that not all operations supported by other implementations are supported
natively. Specifically:</para>
implementations of this command.</para>
<para><filename>/etc/resolv.conf</filename> will only be updated with servers added with this command
when <filename>/etc/resolv.conf</filename> is a symlink to
<filename>/run/systemd/resolve/resolv.conf</filename>, and not a static file. See the discussion of
<filename>/etc/resolv.conf</filename> handling in
<citerefentry><refentrytitle>systemd-resolved.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
</para>
<para>Not all operations supported by other implementations are supported natively. Specifically:</para>
<variablelist>
<varlistentry>
@ -359,7 +369,9 @@
</variablelist>
<para>See <citerefentry><refentrytitle>resolvconf</refentrytitle><manvolnum>8</manvolnum></citerefentry> for details on this command line options.</para>
<para>See
<citerefentry project="debian"><refentrytitle>resolvconf</refentrytitle><manvolnum>8</manvolnum></citerefentry>
for details on those command line options.</para>
</refsect1>
<refsect1>

View File

@ -234,11 +234,11 @@
<varlistentry>
<term><varname>Cache=</varname></term>
<listitem><para>Takes a boolean or <literal>no-negative</literal> as argument. If <literal>yes</literal> (the default), resolving a domain name
which already got queried earlier will return the previous result as long as it is still valid, and thus does
not result in a new network request. Be aware that turning off caching comes at a performance penalty, which
is particularly high when DNSSEC is used.</para>
If <literal>no-negative</literal>, only positive answers are cached.
<listitem><para>Takes a boolean or <literal>no-negative</literal> as argument. If
<literal>yes</literal> (the default), resolving a domain name which already got queried earlier will
return the previous result as long as it is still valid, and thus does not result in a new network
request. Be aware that turning off caching comes at a performance penalty, which is particularly high
when DNSSEC is used. If <literal>no-negative</literal>, only positive answers are cached.</para>
<para>Note that caching is turned off implicitly if the configured DNS server is on a host-local IP address
(such as 127.0.0.1 or ::1), in order to avoid duplicate local caching.</para></listitem>

View File

@ -398,7 +398,13 @@ manpages = [
'sd_bus_set_propertyv'],
''],
['sd_bus_set_sender', '3', ['sd_bus_get_sender'], ''],
['sd_bus_set_server', '3', ['sd_bus_get_bus_id'], ''],
['sd_bus_set_server',
'3',
['sd_bus_get_bus_id',
'sd_bus_is_bus_client',
'sd_bus_is_server',
'sd_bus_set_bus_client'],
''],
['sd_bus_set_watch_bind', '3', ['sd_bus_get_watch_bind'], ''],
['sd_bus_slot_get_bus',
'3',

View File

@ -80,6 +80,8 @@
<citerefentry><refentrytitle>sd_bus_get_fd</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_get_method_call_timeout</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_get_n_queued_read</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_is_bus_client</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_is_server</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_message_append</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_message_append_array</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_message_append_basic</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
@ -125,6 +127,7 @@
<citerefentry><refentrytitle>sd_bus_set_property</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_set_propertyv</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_set_sender</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_set_bus_client</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_set_server</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_set_watch_bind</refentrytitle><manvolnum>3</manvolnum></citerefentry>
<citerefentry><refentrytitle>sd_bus_set_close_on_exit</refentrytitle><manvolnum>3</manvolnum></citerefentry>,

View File

@ -55,13 +55,12 @@
<para>Whenever sd-bus is about to invoke a user-supplied callback function, it stores the
current callback, D-Bus message, slot and userdata pointer and allows these to be queried via
these <function>sd_bus_get_current_handler()</function>,
<function>sd_bus_get_current_handler()</function>,
<function>sd_bus_get_current_message()</function>,
<function>sd_bus_get_current_slot()</function> and
<function>sd_bus_get_current_userdata()</function>, respectively. If <parameter>bus</parameter>
cannot be resolved or if execution does not reside in a user-supplied callback of
<parameter>bus</parameter> when calling any of these functions, they return
<constant>NULL</constant>.</para>
<parameter>bus</parameter>, these functions return <constant>NULL</constant>.</para>
</refsect1>
<refsect1>

View File

@ -18,9 +18,12 @@
<refnamediv>
<refname>sd_bus_set_server</refname>
<refname>sd_bus_is_server</refname>
<refname>sd_bus_get_bus_id</refname>
<refname>sd_bus_set_bus_client</refname>
<refname>sd_bus_is_bus_client</refname>
<refpurpose>Configure server mode for a bus object</refpurpose>
<refpurpose>Configure direct connection mode for a bus object</refpurpose>
</refnamediv>
<refsynopsisdiv>
@ -34,11 +37,27 @@
<paramdef>sd_id128_t <parameter>id</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>int <function>sd_bus_is_server</function></funcdef>
<paramdef>sd_bus *<parameter>bus</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>int <function>sd_bus_get_bus_id</function></funcdef>
<paramdef>sd_bus *<parameter>bus</parameter></paramdef>
<paramdef>sd_id128_t *<parameter>id</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>int <function>sd_bus_set_bus_client</function></funcdef>
<paramdef>sd_bus *<parameter>bus</parameter></paramdef>
<paramdef>int <parameter>b</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>int <function>sd_bus_is_bus_client</function></funcdef>
<paramdef>sd_bus *<parameter>bus</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
@ -55,16 +74,44 @@
<citerefentry><refentrytitle>sd_id128_randomize</refentrytitle><manvolnum>3</manvolnum></citerefentry>
can be used to generate a random id instead.</para>
<para><function>sd_bus_is_server()</function> returns whether the server mode is enabled for
the given bus object.</para>
<para><function>sd_bus_get_bus_id()</function> stores the D-Bus server id configured using
<function>sd_bus_set_server()</function> (for server bus objects) or received during
D-Bus authentication (for client bus objects) in <parameter>id</parameter>.</para>
<para><function>sd_bus_set_bus_client()</function> configures the bus object as a D-Bus daemon
client. <parameter>b</parameter> enables/disables the client mode. If zero, the client mode is
disabled and the bus object should connect directly to a D-Bus server. Otherwise, the client
mode is enabled and the bus object should connect to a D-Bus daemon. When connecting to an
existing bus using any of the functions in the
<citerefentry><refentrytitle>sd_bus_open</refentrytitle><manvolnum>3</manvolnum></citerefentry>
family of functions or any of the functions in the
<citerefentry><refentrytitle>sd_bus_default</refentrytitle><manvolnum>3</manvolnum></citerefentry>
family of functions, the bus object is automatically configured as a bus client. However, when
connecting to a D-Bus daemon by calling
<citerefentry><refentrytitle>sd_bus_set_address</refentrytitle><manvolnum>3</manvolnum></citerefentry>
followed by
<citerefentry><refentrytitle>sd_bus_start</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
the bus object should be manually configured as a bus client using
<function>sd_bus_set_bus_client()</function>. By default, a bus object is not configured as a
D-Bus daemon client.</para>
<para><function>sd_bus_is_bus_client()</function> returns whether the client mode is
enabled/disabled for the given bus object.</para>
</refsect1>
<refsect1>
<title>Return Value</title>
<para>On success, these functions return a non-negative integer. On failure, they return a
negative errno-style error code.</para>
<para>On success, <function>sd_bus_set_server()</function>,
<function>sd_bus_get_bus_id()</function> and <function>sd_bus_set_bus_client()</function> return
a non-negative integer. On failure, they return a negative errno-style error code.</para>
<para><function>sd_bus_is_server()</function> and <function>sd_bus_is_bus_client()</function>
return 1 when the server or client mode is enabled, respectively. Otherwise, they return 0.
</para>
<refsect2>
<title>Errors</title>

View File

@ -29,9 +29,10 @@
<refsect1>
<title>Description</title>
<para><command>systemd-resolved</command> is a system service that provides network name resolution to local
applications. It implements a caching and validating DNS/DNSSEC stub resolver, as well as an LLMNR and MulticastDNS
resolver and responder. Local applications may submit network name resolution requests via three interfaces:</para>
<para><command>systemd-resolved</command> is a system service that provides network name resolution to
local applications. It implements a caching and validating DNS/DNSSEC stub resolver, as well as an LLMNR
and MulticastDNS resolver and responder. Local applications may submit network name resolution requests
via three interfaces:</para>
<itemizedlist>
<listitem><para>The native, fully-featured API <command>systemd-resolved</command> exposes on the bus,
@ -42,144 +43,149 @@
necessary for supporting link-local networking).</para></listitem>
<listitem><para>The glibc
<citerefentry project='man-pages'><refentrytitle>getaddrinfo</refentrytitle><manvolnum>3</manvolnum></citerefentry> API as defined
by <ulink url="https://tools.ietf.org/html/rfc3493">RFC3493</ulink> and its related resolver functions,
including <citerefentry project='man-pages'><refentrytitle>gethostbyname</refentrytitle><manvolnum>3</manvolnum></citerefentry>. This
API is widely supported, including beyond the Linux platform. In its current form it does not expose DNSSEC
validation status information however, and is synchronous only. This API is backed by the glibc Name Service
Switch (<citerefentry project='man-pages'><refentrytitle>nss</refentrytitle><manvolnum>5</manvolnum></citerefentry>). Usage of the
glibc NSS module <citerefentry><refentrytitle>nss-resolve</refentrytitle><manvolnum>8</manvolnum></citerefentry>
is required in order to allow glibc's NSS resolver functions to resolve host names via
<citerefentry project='man-pages'><refentrytitle>getaddrinfo</refentrytitle><manvolnum>3</manvolnum></citerefentry>
API as defined by <ulink url="https://tools.ietf.org/html/rfc3493">RFC3493</ulink> and its related
resolver functions, including
<citerefentry project='man-pages'><refentrytitle>gethostbyname</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
This API is widely supported, including beyond the Linux platform. In its current form it does not
expose DNSSEC validation status information however, and is synchronous only. This API is backed by the
glibc Name Service Switch
(<citerefentry project='man-pages'><refentrytitle>nss</refentrytitle><manvolnum>5</manvolnum></citerefentry>).
Usage of the glibc NSS module
<citerefentry><refentrytitle>nss-resolve</refentrytitle><manvolnum>8</manvolnum></citerefentry> is
required in order to allow glibc's NSS resolver functions to resolve host names via
<command>systemd-resolved</command>.</para></listitem>
<listitem><para>Additionally, <command>systemd-resolved</command> provides a local DNS stub listener on IP
address 127.0.0.53 on the local loopback interface. Programs issuing DNS requests directly, bypassing any local
API may be directed to this stub, in order to connect them to <command>systemd-resolved</command>. Note however
that it is strongly recommended that local programs use the glibc NSS or bus APIs instead (as described above),
as various network resolution concepts (such as link-local addressing, or LLMNR Unicode domains) cannot be mapped
to the unicast DNS protocol.</para></listitem>
<listitem><para>Additionally, <command>systemd-resolved</command> provides a local DNS stub listener on
IP address 127.0.0.53 on the local loopback interface. Programs issuing DNS requests directly,
bypassing any local API may be directed to this stub, in order to connect them to
<command>systemd-resolved</command>. Note however that it is strongly recommended that local programs
use the glibc NSS or bus APIs instead (as described above), as various network resolution concepts
(such as link-local addressing, or LLMNR Unicode domains) cannot be mapped to the unicast DNS
protocol.</para></listitem>
</itemizedlist>
<para>The DNS servers contacted are determined from the global settings in
<filename>/etc/systemd/resolved.conf</filename>, the per-link static settings in
<filename>/etc/systemd/network/*.network</filename> files (in case
<citerefentry><refentrytitle>systemd-networkd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry> is
used), the per-link dynamic settings received over DHCP, user request made via
<citerefentry><refentrytitle>resolvectl</refentrytitle><manvolnum>1</manvolnum></citerefentry>, and any DNS server
information made available by other system services. See
<citerefentry><refentrytitle>systemd-networkd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
is used), the per-link dynamic settings received over DHCP, user request made via
<citerefentry><refentrytitle>resolvectl</refentrytitle><manvolnum>1</manvolnum></citerefentry>, and any
DNS server information made available by other system services. See
<citerefentry><refentrytitle>resolved.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry> and
<citerefentry><refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum></citerefentry> for details
about systemd's own configuration files for DNS servers. To improve compatibility,
<filename>/etc/resolv.conf</filename> is read in order to discover configured system DNS servers, but only if it is
not a symlink to <filename>/run/systemd/resolve/stub-resolv.conf</filename>,
<filename>/usr/lib/systemd/resolv.conf</filename> or <filename>/run/systemd/resolve/resolv.conf</filename> (see
below).</para>
<citerefentry><refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum></citerefentry> for
details about systemd's own configuration files for DNS servers. To improve compatibility,
<filename>/etc/resolv.conf</filename> is read in order to discover configured system DNS servers, but
only if it is not a symlink to <filename>/run/systemd/resolve/stub-resolv.conf</filename>,
<filename>/usr/lib/systemd/resolv.conf</filename> or
<filename>/run/systemd/resolve/resolv.conf</filename> (see below).</para>
</refsect1>
<refsect1>
<title>Synthetic Records</title>
<para><command>systemd-resolved</command> synthesizes DNS resource records (RRs) for the following cases:</para>
<para><command>systemd-resolved</command> synthesizes DNS resource records (RRs) for the following
cases:</para>
<itemizedlist>
<listitem><para>The local, configured hostname is resolved to
all locally configured IP addresses ordered by their scope, or
— if none are configured — the IPv4 address 127.0.0.2 (which
is on the local loopback) and the IPv6 address ::1 (which is the
local host).</para></listitem>
<listitem><para>The local, configured hostname is resolved to all locally configured IP addresses
ordered by their scope, or — if none are configured — the IPv4 address 127.0.0.2 (which is on the local
loopback) and the IPv6 address ::1 (which is the local host).</para></listitem>
<listitem><para>The hostnames <literal>localhost</literal> and
<literal>localhost.localdomain</literal> (as well as any hostname
ending in <literal>.localhost</literal> or <literal>.localhost.localdomain</literal>)
are resolved to the IP addresses 127.0.0.1 and ::1.</para></listitem>
<listitem><para>The hostnames <literal>localhost</literal> and <literal>localhost.localdomain</literal>
(as well as any hostname ending in <literal>.localhost</literal> or
<literal>.localhost.localdomain</literal>) are resolved to the IP addresses 127.0.0.1 and ::1.
</para></listitem>
<listitem><para>The hostname <literal>_gateway</literal> is
resolved to all current default routing gateway addresses,
ordered by their metric. This assigns a stable hostname to the
current gateway, useful for referencing it independently of the
current network configuration state.</para></listitem>
<listitem><para>The hostname <literal>_gateway</literal> is resolved to all current default routing
gateway addresses, ordered by their metric. This assigns a stable hostname to the current gateway,
useful for referencing it independently of the current network configuration state.</para></listitem>
<listitem><para>The mappings defined in <filename>/etc/hosts</filename> are resolved
to their configured addresses and back, but they will not affect lookups for
non-address types (like MX).</para></listitem>
<listitem><para>The mappings defined in <filename>/etc/hosts</filename> are resolved to their
configured addresses and back, but they will not affect lookups for non-address types (like MX).
</para></listitem>
</itemizedlist>
</refsect1>
<refsect1>
<title>Protocols and Routing</title>
<para>Lookup requests are routed to the available DNS servers, LLMNR and MulticastDNS interfaces according to the
following rules:</para>
<para>Lookup requests are routed to the available DNS servers, LLMNR and MulticastDNS interfaces
according to the following rules:</para>
<itemizedlist>
<listitem><para>Lookups for the special hostname <literal>localhost</literal> are never routed to the network. (A
few other, special domains are handled the same way.)</para></listitem>
<listitem><para>Lookups for the special hostname <literal>localhost</literal> are never routed to the
network. (A few other, special domains are handled the same way.)</para></listitem>
<listitem><para>Single-label names are routed to all local interfaces capable of IP multicasting, using the LLMNR
protocol. Lookups for IPv4 addresses are only sent via LLMNR on IPv4, and lookups for IPv6 addresses are only
sent via LLMNR on IPv6. Lookups for the locally configured host name and the <literal>_gateway</literal> host
name are never routed to LLMNR.</para></listitem>
<listitem><para>Single-label names are routed to all local interfaces capable of IP multicasting, using
the LLMNR protocol. Lookups for IPv4 addresses are only sent via LLMNR on IPv4, and lookups for IPv6
addresses are only sent via LLMNR on IPv6. Lookups for the locally configured host name and the
<literal>_gateway</literal> host name are never routed to LLMNR.</para></listitem>
<listitem><para>Multi-label names with the domain suffix <literal>.local</literal> are routed to all local
interfaces capable of IP multicasting, using the MulticastDNS protocol. As with LLMNR IPv4 address lookups are
sent via IPv4 and IPv6 address lookups are sent via IPv6.</para></listitem>
<listitem><para>Multi-label names with the domain suffix <literal>.local</literal> are routed to all
local interfaces capable of IP multicasting, using the MulticastDNS protocol. As with LLMNR IPv4
address lookups are sent via IPv4 and IPv6 address lookups are sent via IPv6.</para></listitem>
<listitem><para>Other multi-label names are routed to all local interfaces that have a DNS server configured,
plus the globally configured DNS server if there is one. Address lookups from the link-local address range are
never routed to DNS. Note that by default lookups for domains with the <literal>.local</literal> suffix are not
routed to DNS servers, unless the domain is specified explicitly as routing or search domain for the DNS server
and interface. This means that on networks where the <literal>.local</literal> domain is defined in a
site-specific DNS server, explicit search or routing domains need to be configured to make lookups within this
DNS domain work. Note that today it's generally recommended to avoid defining <literal>.local</literal> in a DNS
server, as <ulink url="https://tools.ietf.org/html/rfc6762">RFC6762</ulink> reserves this domain for exclusive
<listitem><para>Other multi-label names are routed to all local interfaces that have a DNS server
configured, plus the globally configured DNS server if there is one. Address lookups from the
link-local address range are never routed to DNS. Note that by default lookups for domains with the
<literal>.local</literal> suffix are not routed to DNS servers, unless the domain is specified
explicitly as routing or search domain for the DNS server and interface. This means that on networks
where the <literal>.local</literal> domain is defined in a site-specific DNS server, explicit search or
routing domains need to be configured to make lookups within this DNS domain work. Note that today it's
generally recommended to avoid defining <literal>.local</literal> in a DNS server, as <ulink
url="https://tools.ietf.org/html/rfc6762">RFC6762</ulink> reserves this domain for exclusive
MulticastDNS use.</para></listitem>
</itemizedlist>
<para>If lookups are routed to multiple interfaces, the first
successful response is returned (thus effectively merging the
lookup zones on all matching interfaces). If the lookup failed on
all interfaces, the last failing response is returned.</para>
<para>If lookups are routed to multiple interfaces, the first successful response is returned (thus
effectively merging the lookup zones on all matching interfaces). If the lookup failed on all interfaces,
the last failing response is returned.</para>
<para>Routing of lookups may be influenced by configuring per-interface domain names and other settings. See
<para>Routing of lookups may be influenced by configuring per-interface domain names and other
settings. See
<citerefentry><refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum></citerefentry> and
<citerefentry><refentrytitle>resolvectl</refentrytitle><manvolnum>1</manvolnum></citerefentry> for details. The
following query routing logic applies for unicast DNS traffic:</para>
<citerefentry><refentrytitle>resolvectl</refentrytitle><manvolnum>1</manvolnum></citerefentry> for
details. The following query routing logic applies for unicast DNS traffic:</para>
<itemizedlist>
<listitem><para>If a name to look up matches (that is: is equal to or has as suffix) any of the configured search
or route-only domains of any link (or the globally configured DNS settings), the "best matching"
search/route-only domain is determined: the matching one with the most labels. The query is then sent to all DNS
servers of any links or the globally configured DNS servers associated with this "best matching"
search/route-only domain. (Note that more than one link might have this same "best matching" search/route-only
domain configured, in which case the query is sent to all of them in parallel).</para></listitem>
<listitem><para>If a name to look up matches (that is: is equal to or has as suffix) any of the
configured search or route-only domains of any link (or the globally configured DNS settings), the
"best matching" search/route-only domain is determined: the matching one with the most labels. The
query is then sent to all DNS servers of any links or the globally configured DNS servers associated
with this "best matching" search/route-only domain. (Note that more than one link might have this same
"best matching" search/route-only domain configured, in which case the query is sent to all of them in
parallel).</para></listitem>
<listitem><para>If a query does not match any configured search/route-only domain (neither per-link nor global),
it is sent to all DNS servers that are configured on links with the "DNS default route" option set, as well as
the globally configured DNS server.</para></listitem>
<listitem><para>If a query does not match any configured search/route-only domain (neither per-link nor
global), it is sent to all DNS servers that are configured on links with the "DNS default route" option
set, as well as the globally configured DNS server.</para></listitem>
<listitem><para>If there is no link configured as "DNS default route" and no global DNS server configured, the
compiled-in fallback DNS server is used.</para></listitem>
<listitem><para>If there is no link configured as "DNS default route" and no global DNS server
configured, the compiled-in fallback DNS server is used.</para></listitem>
<listitem><para>Otherwise the query is failed as no suitable DNS servers could be determined.</para></listitem>
<listitem><para>Otherwise the query is failed as no suitable DNS servers could be determined.
</para></listitem>
</itemizedlist>
<para>The "DNS default route" option is a boolean setting configurable with <command>resolvectl</command> or in
<filename>.network</filename> files. If not set, it is implicitly determined based on the configured DNS domains
for a link: if there's any route-only domain (not matching <literal>~.</literal>) it defaults to false, otherwise
to true.</para>
<para>The "DNS default route" option is a boolean setting configurable with <command>resolvectl</command>
or in <filename>.network</filename> files. If not set, it is implicitly determined based on the
configured DNS domains for a link: if there's any route-only domain (not matching <literal>~.</literal>)
it defaults to false, otherwise to true.</para>
<para>Effectively this means: in order to preferably route all DNS queries not explicitly matched by
search/route-only domain configuration to a specific link, configure a <literal>~.</literal> route-only domain on
it. This will ensure that other links will not be considered for the queries (unless they too carry such a
route-only domain). In order to route all such DNS queries to a specific link only in case no other link is
preferable, then set the "DNS default route" option for the link to true, and do not configure a
<literal>~.</literal> route-only domain on it. Finally, in order to ensure that a specific link never receives any
DNS traffic not matching any of its configured search/route-only domains, set the "DNS default route" option for it
to false.</para>
search/route-only domain configuration to a specific link, configure a <literal>~.</literal> route-only
domain on it. This will ensure that other links will not be considered for the queries (unless they too
carry such a route-only domain). In order to route all such DNS queries to a specific link only in case
no other link is preferable, then set the "DNS default route" option for the link to true, and do not
configure a <literal>~.</literal> route-only domain on it. Finally, in order to ensure that a specific
link never receives any DNS traffic not matching any of its configured search/route-only domains, set the
"DNS default route" option for it to false.</para>
<para>See the <ulink url="https://www.freedesktop.org/wiki/Software/systemd/resolved">resolved D-Bus API
Documentation</ulink> for information about the APIs <filename>systemd-resolved</filename> provides.</para>
Documentation</ulink> for information about the APIs <filename>systemd-resolved</filename> provides.
</para>
</refsect1>
<refsect1>
@ -191,40 +197,41 @@
<itemizedlist>
<listitem><para><command>systemd-resolved</command> maintains the
<filename>/run/systemd/resolve/stub-resolv.conf</filename> file for compatibility with traditional Linux
programs. This file may be symlinked from <filename>/etc/resolv.conf</filename>. This file lists the 127.0.0.53
DNS stub (see above) as the only DNS server. It also contains a list of search domains that are in use by
systemd-resolved. The list of search domains is always kept up-to-date. Note that
<filename>/run/systemd/resolve/stub-resolv.conf</filename> should not be used directly by applications, but only
through a symlink from <filename>/etc/resolv.conf</filename>. This file may be symlinked from
<filename>/etc/resolv.conf</filename> in order to connect all local clients that bypass local DNS APIs to
<command>systemd-resolved</command> with correct search domains settings. This mode of operation is
<filename>/run/systemd/resolve/stub-resolv.conf</filename> file for compatibility with traditional
Linux programs. This file may be symlinked from <filename>/etc/resolv.conf</filename>. This file lists
the 127.0.0.53 DNS stub (see above) as the only DNS server. It also contains a list of search domains
that are in use by systemd-resolved. The list of search domains is always kept up-to-date. Note that
<filename>/run/systemd/resolve/stub-resolv.conf</filename> should not be used directly by applications,
but only through a symlink from <filename>/etc/resolv.conf</filename>. This file may be symlinked from
<filename>/etc/resolv.conf</filename> in order to connect all local clients that bypass local DNS APIs
to <command>systemd-resolved</command> with correct search domains settings. This mode of operation is
recommended.</para></listitem>
<listitem><para>A static file <filename>/usr/lib/systemd/resolv.conf</filename> is provided that lists
the 127.0.0.53 DNS stub (see above) as only DNS server. This file may be symlinked from
<filename>/etc/resolv.conf</filename> in order to connect all local clients that bypass local DNS APIs to
<command>systemd-resolved</command>. This file does not contain any search domains.</para></listitem>
<filename>/etc/resolv.conf</filename> in order to connect all local clients that bypass local DNS APIs
to <command>systemd-resolved</command>. This file does not contain any search domains.
</para></listitem>
<listitem><para><command>systemd-resolved</command> maintains the
<filename>/run/systemd/resolve/resolv.conf</filename> file for compatibility with traditional Linux
programs. This file may be symlinked from <filename>/etc/resolv.conf</filename> and is always kept up-to-date,
containing information about all known DNS servers. Note the file format's limitations: it does not know a
concept of per-interface DNS servers and hence only contains system-wide DNS server definitions. Note that
<filename>/run/systemd/resolve/resolv.conf</filename> should not be used directly by applications, but only
through a symlink from <filename>/etc/resolv.conf</filename>. If this mode of operation is used local clients
that bypass any local DNS API will also bypass <command>systemd-resolved</command> and will talk directly to the
known DNS servers.</para> </listitem>
programs. This file may be symlinked from <filename>/etc/resolv.conf</filename> and is always kept
up-to-date, containing information about all known DNS servers. Note the file format's limitations: it
does not know a concept of per-interface DNS servers and hence only contains system-wide DNS server
definitions. Note that <filename>/run/systemd/resolve/resolv.conf</filename> should not be used
directly by applications, but only through a symlink from <filename>/etc/resolv.conf</filename>. If
this mode of operation is used local clients that bypass any local DNS API will also bypass
<command>systemd-resolved</command> and will talk directly to the known DNS servers.</para></listitem>
<listitem><para>Alternatively, <filename>/etc/resolv.conf</filename> may be managed by other packages, in which
case <command>systemd-resolved</command> will read it for DNS configuration data. In this mode of operation
<command>systemd-resolved</command> is consumer rather than provider of this configuration
<listitem><para>Alternatively, <filename>/etc/resolv.conf</filename> may be managed by other packages,
in which case <command>systemd-resolved</command> will read it for DNS configuration data. In this mode
of operation <command>systemd-resolved</command> is consumer rather than provider of this configuration
file. </para></listitem>
</itemizedlist>
<para>Note that the selected mode of operation for this file is detected fully automatically, depending on whether
<filename>/etc/resolv.conf</filename> is a symlink to <filename>/run/systemd/resolve/resolv.conf</filename> or
lists 127.0.0.53 as DNS server.</para>
<para>Note that the selected mode of operation for this file is detected fully automatically, depending
on whether <filename>/etc/resolv.conf</filename> is a symlink to
<filename>/run/systemd/resolve/resolv.conf</filename> or lists 127.0.0.53 as DNS server.</para>
</refsect1>
<refsect1>
@ -235,20 +242,21 @@
<term><constant>SIGUSR1</constant></term>
<listitem><para>Upon reception of the <constant>SIGUSR1</constant> process signal
<command>systemd-resolved</command> will dump the contents of all DNS resource record caches it maintains, as
well as all feature level information it learnt about configured DNS servers into the system
logs.</para></listitem>
<command>systemd-resolved</command> will dump the contents of all DNS resource record caches it
maintains, as well as all feature level information it learnt about configured DNS servers into the
system logs.</para></listitem>
</varlistentry>
<varlistentry>
<term><constant>SIGUSR2</constant></term>
<listitem><para>Upon reception of the <constant>SIGUSR2</constant> process signal
<command>systemd-resolved</command> will flush all caches it maintains. Note that it should normally not be
necessary to request this explicitly except for debugging purposes as <command>systemd-resolved</command>
flushes the caches automatically anyway any time the host's network configuration changes. Sending this signal
to <command>systemd-resolved</command> is equivalent to the <command>resolvectl flush-caches</command>
command, however the latter is recommended since it operates in a synchronous way.</para></listitem>
<command>systemd-resolved</command> will flush all caches it maintains. Note that it should normally
not be necessary to request this explicitly except for debugging purposes as
<command>systemd-resolved</command> flushes the caches automatically anyway any time the host's
network configuration changes. Sending this signal to <command>systemd-resolved</command> is
equivalent to the <command>resolvectl flush-caches</command> command, however the latter is
recommended since it operates in a synchronous way.</para></listitem>
</varlistentry>
<varlistentry>
@ -256,13 +264,14 @@
<listitem><para>Upon reception of the <constant>SIGRTMIN+1</constant> process signal
<command>systemd-resolved</command> will forget everything it learnt about the configured DNS
servers. Specifically any information about server feature support is flushed out, and the server feature
probing logic is restarted on the next request, starting with the most fully featured level. Note that it
should normally not be necessary to request this explicitly except for debugging purposes as
<command>systemd-resolved</command> automatically forgets learnt information any time the DNS server
configuration changes. Sending this signal to <command>systemd-resolved</command> is equivalent to the
<command>resolvectl reset-server-features</command> command, however the latter is recommended since it
operates in a synchronous way.</para></listitem>
servers. Specifically any information about server feature support is flushed out, and the server
feature probing logic is restarted on the next request, starting with the most fully featured
level. Note that it should normally not be necessary to request this explicitly except for
debugging purposes as <command>systemd-resolved</command> automatically forgets learnt information
any time the DNS server configuration changes. Sending this signal to
<command>systemd-resolved</command> is equivalent to the <command>resolvectl
reset-server-features</command> command, however the latter is recommended since it operates in a
synchronous way.</para></listitem>
</varlistentry>
</variablelist>

View File

@ -496,9 +496,8 @@ DnsScopeMatch dns_scope_good_domain(
assert(s);
assert(domain);
/* Checks if the specified domain is something to look up on
* this scope. Note that this accepts non-qualified hostnames,
* i.e. those without any search path prefixed yet. */
/* Checks if the specified domain is something to look up on this scope. Note that this accepts
* non-qualified hostnames, i.e. those without any search path suffixed. */
if (ifindex != 0 && (!s->link || s->link->ifindex != ifindex))
return DNS_SCOPE_NO;