resolved: use standard paths for .dnssd files
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 2 Jan 2019 13:20:00 +0000 (14:20 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 18 Feb 2019 09:25:25 +0000 (10:25 +0100)
/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.

man/systemd.dnssd.xml
src/resolve/resolved-dnssd.c

index 7538a46..1c05cff 100644 (file)
     <para>The main network service file must have the extension <filename>.dnssd</filename>; other
     extensions are ignored.</para>
 
-    <para>The <filename>.dnssd</filename> files are read from the files located in the system
-    network directory <filename>/usr/lib/systemd/dnssd</filename>, the volatile runtime network
-    directory <filename>/run/systemd/dnssd</filename> and the local administration network
-    directory <filename>/etc/systemd/dnssd</filename>. All configuration files are collectively
-    sorted and processed in lexical order, regardless of the directories in which they live.
-    However, files with identical filenames replace each other. Files in <filename>/etc</filename>
-    have the highest priority, files in <filename>/run</filename> take precedence over files with
-    the same name in <filename>/usr/lib</filename>. This can be used to override a system-supplied
-    configuration file with a local file if needed.</para>
+    <para>The <filename>.dnssd</filename> files are read from the files located in the system network
+    directories <filename>/usr/lib/systemd/dnssd</filename> and
+    <filename>/usr/local/lib/systemd/dnssd</filename>, the volatile runtime network directory
+    <filename>/run/systemd/dnssd</filename> and the local administration network directory
+    <filename>/etc/systemd/dnssd</filename>. All configuration files are collectively sorted and processed in
+    lexical order, regardless of the directories in which they live. However, files with identical filenames
+    replace each other. Files in <filename>/etc</filename> have the highest priority, files in
+    <filename>/run</filename> take precedence over files with the same name in
+    <filename>/usr/lib</filename>. This can be used to override a system-supplied configuration file with a
+    local file if needed.</para>
 
     <para>Along with the network service file <filename>foo.dnssd</filename>, a "drop-in" directory
     <filename>foo.dnssd.d/</filename> may exist. All files with the suffix
     parsed. This is useful to alter or add configuration settings, without having to modify the main
     configuration file. Each drop-in file must have appropriate section headers.</para>
 
-    <para>In addition to <filename>/etc/systemd/dnssd</filename>, drop-in <literal>.d</literal>
-    directories can be placed in <filename>/usr/lib/systemd/dnssd</filename> or
-    <filename>/run/systemd/dnssd</filename> directories. Drop-in files in
-    <filename>/etc</filename> take precedence over those in <filename>/run</filename> which in turn
-    take precedence over those in <filename>/usr/lib</filename>. Drop-in files under any of these
-    directories take precedence over the main network service file wherever located. (Of course, since
-    <filename>/run</filename> is temporary and <filename>/usr/lib</filename> is for vendors, it is
-    unlikely drop-ins should be used in either of those places.)</para>
+    <para>In addition to <filename>/etc/systemd/dnssd</filename>, drop-in <literal>.d</literal> directories
+    can be placed in <filename>/usr/lib/systemd/dnssd</filename> or <filename>/run/systemd/dnssd</filename>
+    directories. Drop-in files in <filename>/etc</filename> take precedence over those in
+    <filename>/run</filename> which in turn take precedence over those in <filename>/usr/lib</filename> or
+    <filename>/usr/local/lib</filename>. Drop-in files under any of these directories take precedence over
+    the main network service file wherever located.</para>
   </refsect1>
 
   <refsect1>
index b5346a9..0e6fa1d 100644 (file)
@@ -2,21 +2,14 @@
 
 #include "conf-files.h"
 #include "conf-parser.h"
+#include "def.h"
 #include "resolved-dnssd.h"
 #include "resolved-dns-rr.h"
 #include "resolved-manager.h"
 #include "specifier.h"
 #include "strv.h"
 
-const char* const dnssd_service_dirs[] = {
-        "/etc/systemd/dnssd",
-        "/run/systemd/dnssd",
-        "/usr/lib/systemd/dnssd",
-#if HAVE_SPLIT_USR
-        "/lib/systemd/dnssd",
-#endif
-    NULL
-};
+#define DNSSD_SERVICE_DIRS ((const char* const*) CONF_PATHS_STRV("systemd/dnssd"))
 
 DnssdTxtData *dnssd_txtdata_free(DnssdTxtData *txt_data) {
         if (!txt_data)
@@ -93,7 +86,7 @@ static int dnssd_service_load(Manager *manager, const char *filename) {
 
         dropin_dirname = strjoina(service->name, ".dnssd.d");
 
-        r = config_parse_many(filename, dnssd_service_dirs, dropin_dirname,
+        r = config_parse_many(filename, DNSSD_SERVICE_DIRS, dropin_dirname,
                               "Service\0",
                               config_item_perf_lookup, resolved_dnssd_gperf_lookup,
                               false, service);
@@ -196,7 +189,7 @@ int dnssd_load(Manager *manager) {
         if (manager->mdns_support != RESOLVE_SUPPORT_YES)
                 return 0;
 
-        r = conf_files_list_strv(&files, ".dnssd", NULL, 0, dnssd_service_dirs);
+        r = conf_files_list_strv(&files, ".dnssd", NULL, 0, DNSSD_SERVICE_DIRS);
         if (r < 0)
                 return log_error_errno(r, "Failed to enumerate .dnssd files: %m");