Skip to content

Commit eb5f4dd

Browse files
committed
resolved: use standard paths for .dnssd files
/usr/local/lib/systemd/dnssd is now also included in the search path. This path is of limited usefulness, but it makes sense to be consistent. Documentation is updated to match. Outdated advice against drop-ins in /usr is removed.
1 parent 8864425 commit eb5f4dd

File tree

2 files changed

+20
-28
lines changed

2 files changed

+20
-28
lines changed

man/systemd.dnssd.xml

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,30 +34,29 @@
3434
<para>The main network service file must have the extension <filename>.dnssd</filename>; other
3535
extensions are ignored.</para>
3636

37-
<para>The <filename>.dnssd</filename> files are read from the files located in the system
38-
network directory <filename>/usr/lib/systemd/dnssd</filename>, the volatile runtime network
39-
directory <filename>/run/systemd/dnssd</filename> and the local administration network
40-
directory <filename>/etc/systemd/dnssd</filename>. All configuration files are collectively
41-
sorted and processed in lexical order, regardless of the directories in which they live.
42-
However, files with identical filenames replace each other. Files in <filename>/etc</filename>
43-
have the highest priority, files in <filename>/run</filename> take precedence over files with
44-
the same name in <filename>/usr/lib</filename>. This can be used to override a system-supplied
45-
configuration file with a local file if needed.</para>
37+
<para>The <filename>.dnssd</filename> files are read from the files located in the system network
38+
directories <filename>/usr/lib/systemd/dnssd</filename> and
39+
<filename>/usr/local/lib/systemd/dnssd</filename>, the volatile runtime network directory
40+
<filename>/run/systemd/dnssd</filename> and the local administration network directory
41+
<filename>/etc/systemd/dnssd</filename>. All configuration files are collectively sorted and processed in
42+
lexical order, regardless of the directories in which they live. However, files with identical filenames
43+
replace each other. Files in <filename>/etc</filename> have the highest priority, files in
44+
<filename>/run</filename> take precedence over files with the same name in
45+
<filename>/usr/lib</filename>. This can be used to override a system-supplied configuration file with a
46+
local file if needed.</para>
4647

4748
<para>Along with the network service file <filename>foo.dnssd</filename>, a "drop-in" directory
4849
<filename>foo.dnssd.d/</filename> may exist. All files with the suffix
4950
<literal>.conf</literal> from this directory will be parsed after the file itself is
5051
parsed. This is useful to alter or add configuration settings, without having to modify the main
5152
configuration file. Each drop-in file must have appropriate section headers.</para>
5253

53-
<para>In addition to <filename>/etc/systemd/dnssd</filename>, drop-in <literal>.d</literal>
54-
directories can be placed in <filename>/usr/lib/systemd/dnssd</filename> or
55-
<filename>/run/systemd/dnssd</filename> directories. Drop-in files in
56-
<filename>/etc</filename> take precedence over those in <filename>/run</filename> which in turn
57-
take precedence over those in <filename>/usr/lib</filename>. Drop-in files under any of these
58-
directories take precedence over the main network service file wherever located. (Of course, since
59-
<filename>/run</filename> is temporary and <filename>/usr/lib</filename> is for vendors, it is
60-
unlikely drop-ins should be used in either of those places.)</para>
54+
<para>In addition to <filename>/etc/systemd/dnssd</filename>, drop-in <literal>.d</literal> directories
55+
can be placed in <filename>/usr/lib/systemd/dnssd</filename> or <filename>/run/systemd/dnssd</filename>
56+
directories. Drop-in files in <filename>/etc</filename> take precedence over those in
57+
<filename>/run</filename> which in turn take precedence over those in <filename>/usr/lib</filename> or
58+
<filename>/usr/local/lib</filename>. Drop-in files under any of these directories take precedence over
59+
the main network service file wherever located.</para>
6160
</refsect1>
6261

6362
<refsect1>

src/resolve/resolved-dnssd.c

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,14 @@
22

33
#include "conf-files.h"
44
#include "conf-parser.h"
5+
#include "def.h"
56
#include "resolved-dnssd.h"
67
#include "resolved-dns-rr.h"
78
#include "resolved-manager.h"
89
#include "specifier.h"
910
#include "strv.h"
1011

11-
const char* const dnssd_service_dirs[] = {
12-
"/etc/systemd/dnssd",
13-
"/run/systemd/dnssd",
14-
"/usr/lib/systemd/dnssd",
15-
#if HAVE_SPLIT_USR
16-
"/lib/systemd/dnssd",
17-
#endif
18-
NULL
19-
};
12+
#define DNSSD_SERVICE_DIRS ((const char* const*) CONF_PATHS_STRV("systemd/dnssd"))
2013

2114
DnssdTxtData *dnssd_txtdata_free(DnssdTxtData *txt_data) {
2215
if (!txt_data)
@@ -93,7 +86,7 @@ static int dnssd_service_load(Manager *manager, const char *filename) {
9386

9487
dropin_dirname = strjoina(service->name, ".dnssd.d");
9588

96-
r = config_parse_many(filename, dnssd_service_dirs, dropin_dirname,
89+
r = config_parse_many(filename, DNSSD_SERVICE_DIRS, dropin_dirname,
9790
"Service\0",
9891
config_item_perf_lookup, resolved_dnssd_gperf_lookup,
9992
false, service);
@@ -196,7 +189,7 @@ int dnssd_load(Manager *manager) {
196189
if (manager->mdns_support != RESOLVE_SUPPORT_YES)
197190
return 0;
198191

199-
r = conf_files_list_strv(&files, ".dnssd", NULL, 0, dnssd_service_dirs);
192+
r = conf_files_list_strv(&files, ".dnssd", NULL, 0, DNSSD_SERVICE_DIRS);
200193
if (r < 0)
201194
return log_error_errno(r, "Failed to enumerate .dnssd files: %m");
202195

0 commit comments

Comments
 (0)