Compare commits

..

No commits in common. "842a362c3a439f88186fa3a2d5903390f9fe5181" and "f294b60204e985eef87a4492f128391b9c0eaa9c" have entirely different histories.

9 changed files with 159 additions and 245 deletions

View File

@ -1,5 +1,9 @@
<?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">
@ -92,21 +96,6 @@
</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,27 +288,17 @@
</refsect1> </refsect1>
<refsect1> <refsect1>
<title>Compatibility with <title>Compatibility with <citerefentry><refentrytitle>resolvconf</refentrytitle><manvolnum>8</manvolnum></citerefentry></title>
<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 is run in a limited <citerefentry><refentrytitle>resolvconf</refentrytitle><manvolnum>8</manvolnum></citerefentry>
<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.</para> implementations of this command. Note that not all operations supported by other implementations are supported
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>
@ -369,9 +359,7 @@
</variablelist> </variablelist>
<para>See <para>See <citerefentry><refentrytitle>resolvconf</refentrytitle><manvolnum>8</manvolnum></citerefentry> for details on this command line options.</para>
<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 <listitem><para>Takes a boolean or <literal>no-negative</literal> as argument. If <literal>yes</literal> (the default), resolving a domain name
<literal>yes</literal> (the default), resolving a domain name which already got queried earlier will which already got queried earlier will return the previous result as long as it is still valid, and thus does
return the previous result as long as it is still valid, and thus does not result in a new network not result in a new network request. Be aware that turning off caching comes at a performance penalty, which
request. Be aware that turning off caching comes at a performance penalty, which is particularly high is particularly high when DNSSEC is used.</para>
when DNSSEC is used. If <literal>no-negative</literal>, only positive answers are cached.</para> If <literal>no-negative</literal>, only positive answers are cached.
<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,13 +398,7 @@ 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', ['sd_bus_set_server', '3', ['sd_bus_get_bus_id'], ''],
'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,8 +80,6 @@
<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>,
@ -127,7 +125,6 @@
<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,12 +55,13 @@
<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
<function>sd_bus_get_current_handler()</function>, these <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>, these functions return <constant>NULL</constant>.</para> <parameter>bus</parameter> when calling any of these functions, they return
<constant>NULL</constant>.</para>
</refsect1> </refsect1>
<refsect1> <refsect1>

View File

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

View File

@ -496,8 +496,9 @@ DnsScopeMatch dns_scope_good_domain(
assert(s); assert(s);
assert(domain); assert(domain);
/* Checks if the specified domain is something to look up on this scope. Note that this accepts /* Checks if the specified domain is something to look up on
* non-qualified hostnames, i.e. those without any search path suffixed. */ * this scope. Note that this accepts non-qualified hostnames,
* 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;