From eb5f4dde96aabedd3cb4dc9e830de4c24de11c6f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 2 Jan 2019 14:20:00 +0100 Subject: [PATCH] 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. --- man/systemd.dnssd.xml | 33 ++++++++++++++++----------------- src/resolve/resolved-dnssd.c | 15 ++++----------- 2 files changed, 20 insertions(+), 28 deletions(-) diff --git a/man/systemd.dnssd.xml b/man/systemd.dnssd.xml index 7538a46..1c05cff 100644 --- a/man/systemd.dnssd.xml +++ b/man/systemd.dnssd.xml @@ -34,15 +34,16 @@ The main network service file must have the extension .dnssd; other extensions are ignored. - The .dnssd files are read from the files located in the system - network directory /usr/lib/systemd/dnssd, the volatile runtime network - directory /run/systemd/dnssd and the local administration network - directory /etc/systemd/dnssd. 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 /etc - have the highest priority, files in /run take precedence over files with - the same name in /usr/lib. This can be used to override a system-supplied - configuration file with a local file if needed. + The .dnssd files are read from the files located in the system network + directories /usr/lib/systemd/dnssd and + /usr/local/lib/systemd/dnssd, the volatile runtime network directory + /run/systemd/dnssd and the local administration network directory + /etc/systemd/dnssd. 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 /etc have the highest priority, files in + /run take precedence over files with the same name in + /usr/lib. This can be used to override a system-supplied configuration file with a + local file if needed. Along with the network service file foo.dnssd, a "drop-in" directory foo.dnssd.d/ may exist. All files with the suffix @@ -50,14 +51,12 @@ 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. - In addition to /etc/systemd/dnssd, drop-in .d - directories can be placed in /usr/lib/systemd/dnssd or - /run/systemd/dnssd directories. Drop-in files in - /etc take precedence over those in /run which in turn - take precedence over those in /usr/lib. Drop-in files under any of these - directories take precedence over the main network service file wherever located. (Of course, since - /run is temporary and /usr/lib is for vendors, it is - unlikely drop-ins should be used in either of those places.) + In addition to /etc/systemd/dnssd, drop-in .d directories + can be placed in /usr/lib/systemd/dnssd or /run/systemd/dnssd + directories. Drop-in files in /etc take precedence over those in + /run which in turn take precedence over those in /usr/lib or + /usr/local/lib. Drop-in files under any of these directories take precedence over + the main network service file wherever located. diff --git a/src/resolve/resolved-dnssd.c b/src/resolve/resolved-dnssd.c index b5346a9..0e6fa1d 100644 --- a/src/resolve/resolved-dnssd.c +++ b/src/resolve/resolved-dnssd.c @@ -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"); -- 2.7.4