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-*--> <?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"> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
@ -96,6 +92,21 @@
</a> </a>
</xsl:template> </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']"> <xsl:template match="citerefentry[@project='freebsd']">
<a> <a>
<xsl:attribute name="href"> <xsl:attribute name="href">

View File

@ -288,17 +288,27 @@
</refsect1> </refsect1>
<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> <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 (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 compatibility mode. It accepts mostly the same arguments and pushes all data into
<citerefentry><refentrytitle>systemd-resolved.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>, <citerefentry><refentrytitle>systemd-resolved.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
similar to how <option>dns</option> and <option>domain</option> commands operate. Note that 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 <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 implementations of this command.</para>
natively. Specifically:</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> <variablelist>
<varlistentry> <varlistentry>
@ -359,7 +369,9 @@
</variablelist> </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>
<refsect1> <refsect1>

View File

@ -234,11 +234,11 @@
<varlistentry> <varlistentry>
<term><varname>Cache=</varname></term> <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 <listitem><para>Takes a boolean or <literal>no-negative</literal> as argument. If
which already got queried earlier will return the previous result as long as it is still valid, and thus does <literal>yes</literal> (the default), resolving a domain name which already got queried earlier will
not result in a new network request. Be aware that turning off caching comes at a performance penalty, which return the previous result as long as it is still valid, and thus does not result in a new network
is particularly high when DNSSEC is used.</para> request. Be aware that turning off caching comes at a performance penalty, which is particularly high
If <literal>no-negative</literal>, only positive answers are cached. 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 <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> (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_propertyv'],
''], ''],
['sd_bus_set_sender', '3', ['sd_bus_get_sender'], ''], ['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_set_watch_bind', '3', ['sd_bus_get_watch_bind'], ''],
['sd_bus_slot_get_bus', ['sd_bus_slot_get_bus',
'3', '3',

View File

@ -80,6 +80,8 @@
<citerefentry><refentrytitle>sd_bus_get_fd</refentrytitle><manvolnum>3</manvolnum></citerefentry>, <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_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_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</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_message_append_array</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>, <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_property</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_set_propertyv</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_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_server</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_set_watch_bind</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>, <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 <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 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_message()</function>,
<function>sd_bus_get_current_slot()</function> and <function>sd_bus_get_current_slot()</function> and
<function>sd_bus_get_current_userdata()</function>, respectively. If <parameter>bus</parameter> <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 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 <parameter>bus</parameter>, these functions return <constant>NULL</constant>.</para>
<constant>NULL</constant>.</para>
</refsect1> </refsect1>
<refsect1> <refsect1>

View File

@ -18,9 +18,12 @@
<refnamediv> <refnamediv>
<refname>sd_bus_set_server</refname> <refname>sd_bus_set_server</refname>
<refname>sd_bus_is_server</refname>
<refname>sd_bus_get_bus_id</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> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
@ -34,11 +37,27 @@
<paramdef>sd_id128_t <parameter>id</parameter></paramdef> <paramdef>sd_id128_t <parameter>id</parameter></paramdef>
</funcprototype> </funcprototype>
<funcprototype>
<funcdef>int <function>sd_bus_is_server</function></funcdef>
<paramdef>sd_bus *<parameter>bus</parameter></paramdef>
</funcprototype>
<funcprototype> <funcprototype>
<funcdef>int <function>sd_bus_get_bus_id</function></funcdef> <funcdef>int <function>sd_bus_get_bus_id</function></funcdef>
<paramdef>sd_bus *<parameter>bus</parameter></paramdef> <paramdef>sd_bus *<parameter>bus</parameter></paramdef>
<paramdef>sd_id128_t *<parameter>id</parameter></paramdef> <paramdef>sd_id128_t *<parameter>id</parameter></paramdef>
</funcprototype> </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> </funcsynopsis>
</refsynopsisdiv> </refsynopsisdiv>
@ -55,16 +74,44 @@
<citerefentry><refentrytitle>sd_id128_randomize</refentrytitle><manvolnum>3</manvolnum></citerefentry> <citerefentry><refentrytitle>sd_id128_randomize</refentrytitle><manvolnum>3</manvolnum></citerefentry>
can be used to generate a random id instead.</para> 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 <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 <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> 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>
<refsect1> <refsect1>
<title>Return Value</title> <title>Return Value</title>
<para>On success, these functions return a non-negative integer. On failure, they return a <para>On success, <function>sd_bus_set_server()</function>,
negative errno-style error code.</para> <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> <refsect2>
<title>Errors</title> <title>Errors</title>

View File

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

View File

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