summaryrefslogtreecommitdiff
path: root/src/resolve
diff options
context:
space:
mode:
Diffstat (limited to 'src/resolve')
l---------src/resolve/Makefile1
-rw-r--r--src/resolve/nss-resolve/nss-resolve.c704
-rw-r--r--src/resolve/nss-resolve/nss-resolve.sym19
-rw-r--r--src/resolve/src/.gitignore (renamed from src/resolve/.gitignore)0
-rw-r--r--src/resolve/src/Makefile208
-rw-r--r--src/resolve/src/RFCs (renamed from src/resolve/RFCs)0
-rw-r--r--src/resolve/src/dns-type.c (renamed from src/resolve/dns-type.c)0
-rw-r--r--src/resolve/src/dns-type.h (renamed from src/resolve/dns-type.h)0
-rw-r--r--src/resolve/src/org.freedesktop.resolve1.conf (renamed from src/resolve/org.freedesktop.resolve1.conf)0
-rw-r--r--src/resolve/src/org.freedesktop.resolve1.service (renamed from src/resolve/org.freedesktop.resolve1.service)0
-rw-r--r--src/resolve/src/resolve-tool.c (renamed from src/resolve/resolve-tool.c)2
-rw-r--r--src/resolve/src/resolved-bus.c (renamed from src/resolve/resolved-bus.c)0
-rw-r--r--src/resolve/src/resolved-bus.h (renamed from src/resolve/resolved-bus.h)0
-rw-r--r--src/resolve/src/resolved-conf.c (renamed from src/resolve/resolved-conf.c)0
-rw-r--r--src/resolve/src/resolved-conf.h (renamed from src/resolve/resolved-conf.h)0
-rw-r--r--src/resolve/src/resolved-def.h (renamed from src/resolve/resolved-def.h)0
-rw-r--r--src/resolve/src/resolved-dns-answer.c (renamed from src/resolve/resolved-dns-answer.c)0
-rw-r--r--src/resolve/src/resolved-dns-answer.h (renamed from src/resolve/resolved-dns-answer.h)0
-rw-r--r--src/resolve/src/resolved-dns-cache.c (renamed from src/resolve/resolved-dns-cache.c)0
-rw-r--r--src/resolve/src/resolved-dns-cache.h (renamed from src/resolve/resolved-dns-cache.h)0
-rw-r--r--src/resolve/src/resolved-dns-dnssec.c (renamed from src/resolve/resolved-dns-dnssec.c)0
-rw-r--r--src/resolve/src/resolved-dns-dnssec.h (renamed from src/resolve/resolved-dns-dnssec.h)0
-rw-r--r--src/resolve/src/resolved-dns-packet.c (renamed from src/resolve/resolved-dns-packet.c)0
-rw-r--r--src/resolve/src/resolved-dns-packet.h (renamed from src/resolve/resolved-dns-packet.h)0
-rw-r--r--src/resolve/src/resolved-dns-query.c (renamed from src/resolve/resolved-dns-query.c)0
-rw-r--r--src/resolve/src/resolved-dns-query.h (renamed from src/resolve/resolved-dns-query.h)2
-rw-r--r--src/resolve/src/resolved-dns-question.c (renamed from src/resolve/resolved-dns-question.c)0
-rw-r--r--src/resolve/src/resolved-dns-question.h (renamed from src/resolve/resolved-dns-question.h)0
-rw-r--r--src/resolve/src/resolved-dns-rr.c (renamed from src/resolve/resolved-dns-rr.c)0
-rw-r--r--src/resolve/src/resolved-dns-rr.h (renamed from src/resolve/resolved-dns-rr.h)0
-rw-r--r--src/resolve/src/resolved-dns-scope.c (renamed from src/resolve/resolved-dns-scope.c)0
-rw-r--r--src/resolve/src/resolved-dns-scope.h (renamed from src/resolve/resolved-dns-scope.h)0
-rw-r--r--src/resolve/src/resolved-dns-search-domain.c (renamed from src/resolve/resolved-dns-search-domain.c)0
-rw-r--r--src/resolve/src/resolved-dns-search-domain.h (renamed from src/resolve/resolved-dns-search-domain.h)0
-rw-r--r--src/resolve/src/resolved-dns-server.c (renamed from src/resolve/resolved-dns-server.c)0
-rw-r--r--src/resolve/src/resolved-dns-server.h (renamed from src/resolve/resolved-dns-server.h)0
-rw-r--r--src/resolve/src/resolved-dns-stream.c (renamed from src/resolve/resolved-dns-stream.c)0
-rw-r--r--src/resolve/src/resolved-dns-stream.h (renamed from src/resolve/resolved-dns-stream.h)0
-rw-r--r--src/resolve/src/resolved-dns-synthesize.c (renamed from src/resolve/resolved-dns-synthesize.c)0
-rw-r--r--src/resolve/src/resolved-dns-synthesize.h (renamed from src/resolve/resolved-dns-synthesize.h)0
-rw-r--r--src/resolve/src/resolved-dns-transaction.c (renamed from src/resolve/resolved-dns-transaction.c)0
-rw-r--r--src/resolve/src/resolved-dns-transaction.h (renamed from src/resolve/resolved-dns-transaction.h)0
-rw-r--r--src/resolve/src/resolved-dns-trust-anchor.c (renamed from src/resolve/resolved-dns-trust-anchor.c)0
-rw-r--r--src/resolve/src/resolved-dns-trust-anchor.h (renamed from src/resolve/resolved-dns-trust-anchor.h)0
-rw-r--r--src/resolve/src/resolved-dns-zone.c (renamed from src/resolve/resolved-dns-zone.c)0
-rw-r--r--src/resolve/src/resolved-dns-zone.h (renamed from src/resolve/resolved-dns-zone.h)0
-rw-r--r--src/resolve/src/resolved-etc-hosts.c (renamed from src/resolve/resolved-etc-hosts.c)0
-rw-r--r--src/resolve/src/resolved-etc-hosts.h (renamed from src/resolve/resolved-etc-hosts.h)0
-rw-r--r--src/resolve/src/resolved-gperf.gperf (renamed from src/resolve/resolved-gperf.gperf)0
-rw-r--r--src/resolve/src/resolved-link-bus.c (renamed from src/resolve/resolved-link-bus.c)0
-rw-r--r--src/resolve/src/resolved-link-bus.h (renamed from src/resolve/resolved-link-bus.h)2
-rw-r--r--src/resolve/src/resolved-link.c (renamed from src/resolve/resolved-link.c)2
-rw-r--r--src/resolve/src/resolved-link.h (renamed from src/resolve/resolved-link.h)0
-rw-r--r--src/resolve/src/resolved-llmnr.c (renamed from src/resolve/resolved-llmnr.c)0
-rw-r--r--src/resolve/src/resolved-llmnr.h (renamed from src/resolve/resolved-llmnr.h)0
-rw-r--r--src/resolve/src/resolved-manager.c (renamed from src/resolve/resolved-manager.c)0
-rw-r--r--src/resolve/src/resolved-manager.h (renamed from src/resolve/resolved-manager.h)6
-rw-r--r--src/resolve/src/resolved-mdns.c (renamed from src/resolve/resolved-mdns.c)0
-rw-r--r--src/resolve/src/resolved-mdns.h (renamed from src/resolve/resolved-mdns.h)0
-rw-r--r--src/resolve/src/resolved-resolv-conf.c (renamed from src/resolve/resolved-resolv-conf.c)0
-rw-r--r--src/resolve/src/resolved-resolv-conf.h (renamed from src/resolve/resolved-resolv-conf.h)0
-rw-r--r--src/resolve/src/resolved.c (renamed from src/resolve/resolved.c)4
-rw-r--r--src/resolve/src/resolved.conf.in (renamed from src/resolve/resolved.conf.in)0
-rw-r--r--src/resolve/src/test-dnssec-complex.c (renamed from src/resolve/test-dnssec-complex.c)2
-rw-r--r--src/resolve/src/test-dnssec.c (renamed from src/resolve/test-dnssec.c)0
-rw-r--r--src/resolve/src/test-resolve-tables.c (renamed from src/resolve/test-resolve-tables.c)0
66 files changed, 941 insertions, 11 deletions
diff --git a/src/resolve/Makefile b/src/resolve/Makefile
deleted file mode 120000
index d0b0e8e008..0000000000
--- a/src/resolve/Makefile
+++ /dev/null
@@ -1 +0,0 @@
-../Makefile \ No newline at end of file
diff --git a/src/resolve/nss-resolve/nss-resolve.c b/src/resolve/nss-resolve/nss-resolve.c
new file mode 100644
index 0000000000..d369f1b0c8
--- /dev/null
+++ b/src/resolve/nss-resolve/nss-resolve.c
@@ -0,0 +1,704 @@
+/***
+ This file is part of systemd.
+
+ Copyright 2014 Lennart Poettering
+
+ systemd is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ systemd is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <dlfcn.h>
+#include <errno.h>
+#include <netdb.h>
+#include <nss.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <systemd/sd-bus.h>
+
+#include "bus-common-errors.h"
+#include "in-addr-util.h"
+#include "macro.h"
+#include "nss-util.h"
+#include "string-util.h"
+#include "util.h"
+#include "signal-util.h"
+
+NSS_GETHOSTBYNAME_PROTOTYPES(resolve);
+NSS_GETHOSTBYADDR_PROTOTYPES(resolve);
+
+#define DNS_CALL_TIMEOUT_USEC (45*USEC_PER_SEC)
+
+typedef void (*voidfunc_t)(void);
+
+static voidfunc_t find_fallback(const char *module, const char *symbol) {
+ void *dl;
+
+ /* Try to find a fallback NSS module symbol */
+
+ dl = dlopen(module, RTLD_LAZY|RTLD_NODELETE);
+ if (!dl)
+ return NULL;
+
+ return dlsym(dl, symbol);
+}
+
+static bool bus_error_shall_fallback(sd_bus_error *e) {
+ return sd_bus_error_has_name(e, SD_BUS_ERROR_SERVICE_UNKNOWN) ||
+ sd_bus_error_has_name(e, SD_BUS_ERROR_NAME_HAS_NO_OWNER) ||
+ sd_bus_error_has_name(e, SD_BUS_ERROR_NO_REPLY) ||
+ sd_bus_error_has_name(e, SD_BUS_ERROR_ACCESS_DENIED);
+}
+
+static int count_addresses(sd_bus_message *m, int af, const char **canonical) {
+ int c = 0, r;
+
+ assert(m);
+ assert(canonical);
+
+ r = sd_bus_message_enter_container(m, 'a', "(iiay)");
+ if (r < 0)
+ return r;
+
+ while ((r = sd_bus_message_enter_container(m, 'r', "iiay")) > 0) {
+ int family, ifindex;
+
+ assert_cc(sizeof(int32_t) == sizeof(int));
+
+ r = sd_bus_message_read(m, "ii", &ifindex, &family);
+ if (r < 0)
+ return r;
+
+ r = sd_bus_message_skip(m, "ay");
+ if (r < 0)
+ return r;
+
+ r = sd_bus_message_exit_container(m);
+ if (r < 0)
+ return r;
+
+ if (af != AF_UNSPEC && family != af)
+ continue;
+
+ c ++;
+ }
+ if (r < 0)
+ return r;
+
+ r = sd_bus_message_exit_container(m);
+ if (r < 0)
+ return r;
+
+ r = sd_bus_message_read(m, "s", canonical);
+ if (r < 0)
+ return r;
+
+ r = sd_bus_message_rewind(m, true);
+ if (r < 0)
+ return r;
+
+ return c;
+}
+
+enum nss_status _nss_resolve_gethostbyname4_r(
+ const char *name,
+ struct gaih_addrtuple **pat,
+ char *buffer, size_t buflen,
+ int *errnop, int *h_errnop,
+ int32_t *ttlp) {
+
+ enum nss_status (*fallback)(
+ const char *name,
+ struct gaih_addrtuple **pat,
+ char *buffer, size_t buflen,
+ int *errnop, int *h_errnop,
+ int32_t *ttlp);
+
+ _cleanup_(sd_bus_message_unrefp) sd_bus_message *req = NULL, *reply = NULL;
+ _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
+ struct gaih_addrtuple *r_tuple, *r_tuple_first = NULL;
+ _cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
+ const char *canonical = NULL;
+ size_t l, ms, idx;
+ char *r_name;
+ int c, r, i = 0;
+
+ BLOCK_SIGNALS(NSS_SIGNALS_BLOCK);
+
+ assert(name);
+ assert(pat);
+ assert(buffer);
+ assert(errnop);
+ assert(h_errnop);
+
+ r = sd_bus_open_system(&bus);
+ if (r < 0)
+ goto fallback;
+
+ r = sd_bus_message_new_method_call(
+ bus,
+ &req,
+ "org.freedesktop.resolve1",
+ "/org/freedesktop/resolve1",
+ "org.freedesktop.resolve1.Manager",
+ "ResolveHostname");
+ if (r < 0)
+ goto fail;
+
+ r = sd_bus_message_set_auto_start(req, false);
+ if (r < 0)
+ goto fail;
+
+ r = sd_bus_message_append(req, "isit", 0, name, AF_UNSPEC, (uint64_t) 0);
+ if (r < 0)
+ goto fail;
+
+ r = sd_bus_call(bus, req, DNS_CALL_TIMEOUT_USEC, &error, &reply);
+ if (r < 0) {
+ if (sd_bus_error_has_name(&error, _BUS_ERROR_DNS "NXDOMAIN")) {
+ *errnop = ESRCH;
+ *h_errnop = HOST_NOT_FOUND;
+ return NSS_STATUS_NOTFOUND;
+ }
+
+ if (bus_error_shall_fallback(&error))
+ goto fallback;
+
+ goto fail;
+ }
+
+ c = count_addresses(reply, AF_UNSPEC, &canonical);
+ if (c < 0) {
+ r = c;
+ goto fail;
+ }
+ if (c == 0) {
+ *errnop = ESRCH;
+ *h_errnop = HOST_NOT_FOUND;
+ return NSS_STATUS_NOTFOUND;
+ }
+
+ if (isempty(canonical))
+ canonical = name;
+
+ l = strlen(canonical);
+ ms = ALIGN(l+1) + ALIGN(sizeof(struct gaih_addrtuple)) * c;
+ if (buflen < ms) {
+ *errnop = ENOMEM;
+ *h_errnop = TRY_AGAIN;
+ return NSS_STATUS_TRYAGAIN;
+ }
+
+ /* First, append name */
+ r_name = buffer;
+ memcpy(r_name, canonical, l+1);
+ idx = ALIGN(l+1);
+
+ /* Second, append addresses */
+ r_tuple_first = (struct gaih_addrtuple*) (buffer + idx);
+
+ r = sd_bus_message_enter_container(reply, 'a', "(iiay)");
+ if (r < 0)
+ goto fail;
+
+ while ((r = sd_bus_message_enter_container(reply, 'r', "iiay")) > 0) {
+ int family, ifindex;
+ const void *a;
+ size_t sz;
+
+ assert_cc(sizeof(int32_t) == sizeof(int));
+
+ r = sd_bus_message_read(reply, "ii", &ifindex, &family);
+ if (r < 0)
+ goto fail;
+
+ if (ifindex < 0) {
+ r = -EINVAL;
+ goto fail;
+ }
+
+ r = sd_bus_message_read_array(reply, 'y', &a, &sz);
+ if (r < 0)
+ goto fail;
+
+ r = sd_bus_message_exit_container(reply);
+ if (r < 0)
+ goto fail;
+
+ if (!IN_SET(family, AF_INET, AF_INET6))
+ continue;
+
+ if (sz != FAMILY_ADDRESS_SIZE(family)) {
+ r = -EINVAL;
+ goto fail;
+ }
+
+ r_tuple = (struct gaih_addrtuple*) (buffer + idx);
+ r_tuple->next = i == c-1 ? NULL : (struct gaih_addrtuple*) ((char*) r_tuple + ALIGN(sizeof(struct gaih_addrtuple)));
+ r_tuple->name = r_name;
+ r_tuple->family = family;
+ r_tuple->scopeid = ifindex;
+ memcpy(r_tuple->addr, a, sz);
+
+ idx += ALIGN(sizeof(struct gaih_addrtuple));
+ i++;
+ }
+ if (r < 0)
+ goto fail;
+
+ assert(i == c);
+ assert(idx == ms);
+
+ if (*pat)
+ **pat = *r_tuple_first;
+ else
+ *pat = r_tuple_first;
+
+ if (ttlp)
+ *ttlp = 0;
+
+ /* Explicitly reset all error variables */
+ *errnop = 0;
+ *h_errnop = NETDB_SUCCESS;
+ h_errno = 0;
+
+ return NSS_STATUS_SUCCESS;
+
+fallback:
+ fallback = (enum nss_status (*)(const char *name,
+ struct gaih_addrtuple **pat,
+ char *buffer, size_t buflen,
+ int *errnop, int *h_errnop,
+ int32_t *ttlp))
+ find_fallback("libnss_dns.so.2", "_nss_dns_gethostbyname4_r");
+
+ if (fallback)
+ return fallback(name, pat, buffer, buflen, errnop, h_errnop, ttlp);
+
+fail:
+ *errnop = -r;
+ *h_errnop = NO_RECOVERY;
+ return NSS_STATUS_UNAVAIL;
+}
+
+enum nss_status _nss_resolve_gethostbyname3_r(
+ const char *name,
+ int af,
+ struct hostent *result,
+ char *buffer, size_t buflen,
+ int *errnop, int *h_errnop,
+ int32_t *ttlp,
+ char **canonp) {
+
+ enum nss_status (*fallback)(
+ const char *name,
+ int af,
+ struct hostent *result,
+ char *buffer, size_t buflen,
+ int *errnop, int *h_errnop,
+ int32_t *ttlp,
+ char **canonp);
+
+ _cleanup_(sd_bus_message_unrefp) sd_bus_message *req = NULL, *reply = NULL;
+ _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
+ char *r_name, *r_aliases, *r_addr, *r_addr_list;
+ _cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
+ size_t l, idx, ms, alen;
+ const char *canonical;
+ int c, r, i = 0;
+
+ BLOCK_SIGNALS(NSS_SIGNALS_BLOCK);
+
+ assert(name);
+ assert(result);
+ assert(buffer);
+ assert(errnop);
+ assert(h_errnop);
+
+ if (af == AF_UNSPEC)
+ af = AF_INET;
+
+ if (af != AF_INET && af != AF_INET6) {
+ r = -EAFNOSUPPORT;
+ goto fail;
+ }
+
+ r = sd_bus_open_system(&bus);
+ if (r < 0)
+ goto fallback;
+
+ r = sd_bus_message_new_method_call(
+ bus,
+ &req,
+ "org.freedesktop.resolve1",
+ "/org/freedesktop/resolve1",
+ "org.freedesktop.resolve1.Manager",
+ "ResolveHostname");
+ if (r < 0)
+ goto fail;
+
+ r = sd_bus_message_set_auto_start(req, false);
+ if (r < 0)
+ goto fail;
+
+ r = sd_bus_message_append(req, "isit", 0, name, af, (uint64_t) 0);
+ if (r < 0)
+ goto fail;
+
+ r = sd_bus_call(bus, req, DNS_CALL_TIMEOUT_USEC, &error, &reply);
+ if (r < 0) {
+ if (sd_bus_error_has_name(&error, _BUS_ERROR_DNS "NXDOMAIN")) {
+ *errnop = ESRCH;
+ *h_errnop = HOST_NOT_FOUND;
+ return NSS_STATUS_NOTFOUND;
+ }
+
+ if (bus_error_shall_fallback(&error))
+ goto fallback;
+
+ goto fail;
+ }
+
+ c = count_addresses(reply, af, &canonical);
+ if (c < 0) {
+ r = c;
+ goto fail;
+ }
+ if (c == 0) {
+ *errnop = ESRCH;
+ *h_errnop = HOST_NOT_FOUND;
+ return NSS_STATUS_NOTFOUND;
+ }
+
+ if (isempty(canonical))
+ canonical = name;
+
+ alen = FAMILY_ADDRESS_SIZE(af);
+ l = strlen(canonical);
+
+ ms = ALIGN(l+1) + c * ALIGN(alen) + (c+2) * sizeof(char*);
+
+ if (buflen < ms) {
+ *errnop = ENOMEM;
+ *h_errnop = TRY_AGAIN;
+ return NSS_STATUS_TRYAGAIN;
+ }
+
+ /* First, append name */
+ r_name = buffer;
+ memcpy(r_name, canonical, l+1);
+ idx = ALIGN(l+1);
+
+ /* Second, create empty aliases array */
+ r_aliases = buffer + idx;
+ ((char**) r_aliases)[0] = NULL;
+ idx += sizeof(char*);
+
+ /* Third, append addresses */
+ r_addr = buffer + idx;
+
+ r = sd_bus_message_enter_container(reply, 'a', "(iiay)");
+ if (r < 0)
+ goto fail;
+
+ while ((r = sd_bus_message_enter_container(reply, 'r', "iiay")) > 0) {
+ int ifindex, family;
+ const void *a;
+ size_t sz;
+
+ r = sd_bus_message_read(reply, "ii", &ifindex, &family);
+ if (r < 0)
+ goto fail;
+
+ if (ifindex < 0) {
+ r = -EINVAL;
+ goto fail;
+ }
+
+ r = sd_bus_message_read_array(reply, 'y', &a, &sz);
+ if (r < 0)
+ goto fail;
+
+ r = sd_bus_message_exit_container(reply);
+ if (r < 0)
+ goto fail;
+
+ if (family != af)
+ continue;
+
+ if (sz != alen) {
+ r = -EINVAL;
+ goto fail;
+ }
+
+ memcpy(r_addr + i*ALIGN(alen), a, alen);
+ i++;
+ }
+ if (r < 0)
+ goto fail;
+
+ assert(i == c);
+ idx += c * ALIGN(alen);
+
+ /* Fourth, append address pointer array */
+ r_addr_list = buffer + idx;
+ for (i = 0; i < c; i++)
+ ((char**) r_addr_list)[i] = r_addr + i*ALIGN(alen);
+
+ ((char**) r_addr_list)[i] = NULL;
+ idx += (c+1) * sizeof(char*);
+
+ assert(idx == ms);
+
+ result->h_name = r_name;
+ result->h_aliases = (char**) r_aliases;
+ result->h_addrtype = af;
+ result->h_length = alen;
+ result->h_addr_list = (char**) r_addr_list;
+
+ /* Explicitly reset all error variables */
+ *errnop = 0;
+ *h_errnop = NETDB_SUCCESS;
+ h_errno = 0;
+
+ if (ttlp)
+ *ttlp = 0;
+
+ if (canonp)
+ *canonp = r_name;
+
+ return NSS_STATUS_SUCCESS;
+
+fallback:
+ fallback = (enum nss_status (*)(const char *name,
+ int af,
+ struct hostent *result,
+ char *buffer, size_t buflen,
+ int *errnop, int *h_errnop,
+ int32_t *ttlp,
+ char **canonp))
+ find_fallback("libnss_dns.so.2", "_nss_dns_gethostbyname3_r");
+ if (fallback)
+ return fallback(name, af, result, buffer, buflen, errnop, h_errnop, ttlp, canonp);
+
+fail:
+ *errnop = -r;
+ *h_errnop = NO_RECOVERY;
+ return NSS_STATUS_UNAVAIL;
+}
+
+enum nss_status _nss_resolve_gethostbyaddr2_r(
+ const void* addr, socklen_t len,
+ int af,
+ struct hostent *result,
+ char *buffer, size_t buflen,
+ int *errnop, int *h_errnop,
+ int32_t *ttlp) {
+
+ enum nss_status (*fallback)(
+ const void* addr, socklen_t len,
+ int af,
+ struct hostent *result,
+ char *buffer, size_t buflen,
+ int *errnop, int *h_errnop,
+ int32_t *ttlp);
+
+
+ _cleanup_(sd_bus_message_unrefp) sd_bus_message *req = NULL, *reply = NULL;
+ _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
+ char *r_name, *r_aliases, *r_addr, *r_addr_list;
+ _cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
+ unsigned c = 0, i = 0;
+ size_t ms = 0, idx;
+ const char *n;
+ int r, ifindex;
+
+ BLOCK_SIGNALS(NSS_SIGNALS_BLOCK);
+
+ assert(addr);
+ assert(result);
+ assert(buffer);
+ assert(errnop);
+ assert(h_errnop);
+
+ if (!IN_SET(af, AF_INET, AF_INET6)) {
+ *errnop = EAFNOSUPPORT;
+ *h_errnop = NO_DATA;
+ return NSS_STATUS_UNAVAIL;
+ }
+
+ if (len != FAMILY_ADDRESS_SIZE(af)) {
+ *errnop = EINVAL;
+ *h_errnop = NO_RECOVERY;
+ return NSS_STATUS_UNAVAIL;
+ }
+
+ r = sd_bus_open_system(&bus);
+ if (r < 0)
+ goto fallback;
+
+ r = sd_bus_message_new_method_call(
+ bus,
+ &req,
+ "org.freedesktop.resolve1",
+ "/org/freedesktop/resolve1",
+ "org.freedesktop.resolve1.Manager",
+ "ResolveAddress");
+ if (r < 0)
+ goto fail;
+
+ r = sd_bus_message_set_auto_start(req, false);
+ if (r < 0)
+ goto fail;
+
+ r = sd_bus_message_append(req, "ii", 0, af);
+ if (r < 0)
+ goto fail;
+
+ r = sd_bus_message_append_array(req, 'y', addr, len);
+ if (r < 0)
+ goto fail;
+
+ r = sd_bus_message_append(req, "t", (uint64_t) 0);
+ if (r < 0)
+ goto fail;
+
+ r = sd_bus_call(bus, req, DNS_CALL_TIMEOUT_USEC, &error, &reply);
+ if (r < 0) {
+ if (sd_bus_error_has_name(&error, _BUS_ERROR_DNS "NXDOMAIN")) {
+ *errnop = ESRCH;
+ *h_errnop = HOST_NOT_FOUND;
+ return NSS_STATUS_NOTFOUND;
+ }
+
+ if (bus_error_shall_fallback(&error))
+ goto fallback;
+
+
+ *errnop = -r;
+ *h_errnop = NO_RECOVERY;
+ return NSS_STATUS_UNAVAIL;
+ }
+
+ r = sd_bus_message_enter_container(reply, 'a', "(is)");
+ if (r < 0)
+ goto fail;
+
+ while ((r = sd_bus_message_read(reply, "(is)", &ifindex, &n)) > 0) {
+
+ if (ifindex < 0) {
+ r = -EINVAL;
+ goto fail;
+ }
+
+ c++;
+ ms += ALIGN(strlen(n) + 1);
+ }
+ if (r < 0)
+ goto fail;
+
+ r = sd_bus_message_rewind(reply, false);
+ if (r < 0)
+ return r;
+
+ if (c <= 0) {
+ *errnop = ESRCH;
+ *h_errnop = HOST_NOT_FOUND;
+ return NSS_STATUS_NOTFOUND;
+ }
+
+ ms += ALIGN(len) + /* the address */
+ 2 * sizeof(char*) + /* pointers to the address, plus trailing NULL */
+ c * sizeof(char*); /* pointers to aliases, plus trailing NULL */
+
+ if (buflen < ms) {
+ *errnop = ENOMEM;
+ *h_errnop = TRY_AGAIN;
+ return NSS_STATUS_TRYAGAIN;
+ }
+
+ /* First, place address */
+ r_addr = buffer;
+ memcpy(r_addr, addr, len);
+ idx = ALIGN(len);
+
+ /* Second, place address list */
+ r_addr_list = buffer + idx;
+ ((char**) r_addr_list)[0] = r_addr;
+ ((char**) r_addr_list)[1] = NULL;
+ idx += sizeof(char*) * 2;
+
+ /* Third, reserve space for the aliases array */
+ r_aliases = buffer + idx;
+ idx += sizeof(char*) * c;
+
+ /* Fourth, place aliases */
+ i = 0;
+ r_name = buffer + idx;
+ while ((r = sd_bus_message_read(reply, "(is)", &ifindex, &n)) > 0) {
+ char *p;
+ size_t l;
+
+ l = strlen(n);
+ p = buffer + idx;
+ memcpy(p, n, l+1);
+
+ if (i > 0)
+ ((char**) r_aliases)[i-1] = p;
+ i++;
+
+ idx += ALIGN(l+1);
+ }
+ if (r < 0)
+ goto fail;
+
+ ((char**) r_aliases)[c-1] = NULL;
+ assert(idx == ms);
+
+ result->h_name = r_name;
+ result->h_aliases = (char**) r_aliases;
+ result->h_addrtype = af;
+ result->h_length = len;
+ result->h_addr_list = (char**) r_addr_list;
+
+ if (ttlp)
+ *ttlp = 0;
+
+ /* Explicitly reset all error variables */
+ *errnop = 0;
+ *h_errnop = NETDB_SUCCESS;
+ h_errno = 0;
+
+ return NSS_STATUS_SUCCESS;
+
+fallback:
+ fallback = (enum nss_status (*)(
+ const void* addr, socklen_t len,
+ int af,
+ struct hostent *result,
+ char *buffer, size_t buflen,
+ int *errnop, int *h_errnop,
+ int32_t *ttlp))
+ find_fallback("libnss_dns.so.2", "_nss_dns_gethostbyaddr2_r");
+
+ if (fallback)
+ return fallback(addr, len, af, result, buffer, buflen, errnop, h_errnop, ttlp);
+
+fail:
+ *errnop = -r;
+ *h_errnop = NO_RECOVERY;
+ return NSS_STATUS_UNAVAIL;
+}
+
+NSS_GETHOSTBYNAME_FALLBACKS(resolve);
+NSS_GETHOSTBYADDR_FALLBACKS(resolve);
diff --git a/src/resolve/nss-resolve/nss-resolve.sym b/src/resolve/nss-resolve/nss-resolve.sym
new file mode 100644
index 0000000000..df8dff2a20
--- /dev/null
+++ b/src/resolve/nss-resolve/nss-resolve.sym
@@ -0,0 +1,19 @@
+/***
+ This file is part of systemd.
+
+ systemd is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+***/
+
+{
+global:
+ _nss_resolve_gethostbyname_r;
+ _nss_resolve_gethostbyname2_r;
+ _nss_resolve_gethostbyname3_r;
+ _nss_resolve_gethostbyname4_r;
+ _nss_resolve_gethostbyaddr_r;
+ _nss_resolve_gethostbyaddr2_r;
+local: *;
+};
diff --git a/src/resolve/.gitignore b/src/resolve/src/.gitignore
index f0835923b7..f0835923b7 100644
--- a/src/resolve/.gitignore
+++ b/src/resolve/src/.gitignore
diff --git a/src/resolve/src/Makefile b/src/resolve/src/Makefile
new file mode 100644
index 0000000000..6f62e7b086
--- /dev/null
+++ b/src/resolve/src/Makefile
@@ -0,0 +1,208 @@
+# -*- Mode: makefile; indent-tabs-mode: t -*-
+#
+# This file is part of systemd.
+#
+# Copyright 2010-2012 Lennart Poettering
+# Copyright 2010-2012 Kay Sievers
+# Copyright 2013 Zbigniew Jędrzejewski-Szmek
+# Copyright 2013 David Strauss
+# Copyright 2016 Luke Shumaker
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+#
+# systemd is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with systemd; If not, see <http://www.gnu.org/licenses/>.
+include $(dir $(lastword $(MAKEFILE_LIST)))/../../config.mk
+include $(topsrcdir)/build-aux/Makefile.head.mk
+
+ifneq ($(ENABLE_RESOLVED),)
+
+systemd_resolved_SOURCES = \
+ src/resolve/resolved.c \
+ src/resolve/resolved-manager.c \
+ src/resolve/resolved-manager.h \
+ src/resolve/resolved-conf.c \
+ src/resolve/resolved-conf.h \
+ src/resolve/resolved-resolv-conf.c \
+ src/resolve/resolved-resolv-conf.h \
+ src/resolve/resolved-bus.c \
+ src/resolve/resolved-bus.h \
+ src/resolve/resolved-link.h \
+ src/resolve/resolved-link.c \
+ src/resolve/resolved-link-bus.c \
+ src/resolve/resolved-link-bus.h \
+ src/resolve/resolved-llmnr.h \
+ src/resolve/resolved-llmnr.c \
+ src/resolve/resolved-mdns.h \
+ src/resolve/resolved-mdns.c \
+ src/resolve/resolved-def.h \
+ src/resolve/resolved-dns-rr.h \
+ src/resolve/resolved-dns-rr.c \
+ src/resolve/resolved-dns-question.h \
+ src/resolve/resolved-dns-question.c \
+ src/resolve/resolved-dns-answer.h \
+ src/resolve/resolved-dns-answer.c \
+ src/resolve/resolved-dns-packet.h \
+ src/resolve/resolved-dns-packet.c \
+ src/resolve/resolved-dns-query.h \
+ src/resolve/resolved-dns-query.c \
+ src/resolve/resolved-dns-synthesize.h \
+ src/resolve/resolved-dns-synthesize.c \
+ src/resolve/resolved-dns-transaction.h \
+ src/resolve/resolved-dns-transaction.c \
+ src/resolve/resolved-dns-scope.h \
+ src/resolve/resolved-dns-scope.c \
+ src/resolve/resolved-dns-server.h \
+ src/resolve/resolved-dns-server.c \
+ src/resolve/resolved-dns-search-domain.h \
+ src/resolve/resolved-dns-search-domain.c \
+ src/resolve/resolved-dns-cache.h \
+ src/resolve/resolved-dns-cache.c \
+ src/resolve/resolved-dns-zone.h \
+ src/resolve/resolved-dns-zone.c \
+ src/resolve/resolved-dns-stream.h \
+ src/resolve/resolved-dns-stream.c \
+ src/resolve/resolved-dns-dnssec.h \
+ src/resolve/resolved-dns-dnssec.c \
+ src/resolve/resolved-dns-trust-anchor.h \
+ src/resolve/resolved-dns-trust-anchor.c \
+ src/resolve/resolved-etc-hosts.h \
+ src/resolve/resolved-etc-hosts.c \
+ src/resolve/dns-type.c \
+ src/resolve/dns-type.h
+
+nodist_systemd_resolved_SOURCES = \
+ src/resolve/dns_type-from-name.h \
+ src/resolve/dns_type-to-name.h \
+ src/resolve/resolved-gperf.c
+
+systemd_resolved_LDADD = \
+ libsystemd-network.la \
+ libshared.la
+
+rootlibexec_PROGRAMS += \
+ systemd-resolved
+
+nodist_systemunit_DATA += \
+ units/systemd-resolved.service
+
+dist_systemunit_DATA_busnames += \
+ units/org.freedesktop.resolve1.busname
+
+dist_dbuspolicy_DATA += \
+ src/resolve/org.freedesktop.resolve1.conf
+
+dist_dbussystemservice_DATA += \
+ src/resolve/org.freedesktop.resolve1.service
+
+SYSTEM_UNIT_ALIASES += \
+ systemd-resolved.service dbus-org.freedesktop.resolve1.service
+
+BUSNAMES_TARGET_WANTS += \
+ org.freedesktop.resolve1.busname
+
+GENERAL_ALIASES += \
+ $(systemunitdir)/systemd-resolved.service $(pkgsysconfdir)/system/multi-user.target.wants/systemd-resolved.service
+
+nodist_pkgsysconf_DATA += \
+ src/resolve/resolved.conf
+
+libnss_resolve_la_SOURCES = \
+ src/nss-resolve/nss-resolve.sym \
+ src/nss-resolve/nss-resolve.c
+
+libnss_resolve_la_LDFLAGS = \
+ $(AM_LDFLAGS) \
+ -module \
+ -export-dynamic \
+ -avoid-version \
+ -shared \
+ -shrext .so.2 \
+ -Wl,--version-script=$(top_srcdir)/src/nss-resolve/nss-resolve.sym
+
+libnss_resolve_la_LIBADD = \
+ libsystemd-internal.la \
+ -ldl
+
+lib_LTLIBRARIES += \
+ libnss_resolve.la
+
+systemd_resolve_SOURCES = \
+ src/resolve/resolve-tool.c \
+ src/resolve/resolved-dns-dnssec.c \
+ src/resolve/resolved-dns-dnssec.h \
+ src/resolve/resolved-dns-packet.c \
+ src/resolve/resolved-dns-packet.h \
+ src/resolve/resolved-dns-rr.c \
+ src/resolve/resolved-dns-rr.h \
+ src/resolve/resolved-dns-answer.c \
+ src/resolve/resolved-dns-answer.h \
+ src/resolve/resolved-dns-question.c \
+ src/resolve/resolved-dns-question.h \
+ src/resolve/dns-type.c \
+ src/resolve/dns-type.h
+
+nodist_systemd_resolve_SOURCES = \
+ src/resolve/dns_type-from-name.h \
+ src/resolve/dns_type-to-name.h
+
+systemd_resolve_LDADD = \
+ libshared.la
+
+bin_PROGRAMS += \
+ systemd-resolve
+
+tests += \
+ test-dns-domain \
+ test-dnssec
+
+manual_tests += \
+ test-dnssec-complex
+
+test_dnssec_SOURCES = \
+ src/resolve/test-dnssec.c \
+ src/resolve/resolved-dns-packet.c \
+ src/resolve/resolved-dns-packet.h \
+ src/resolve/resolved-dns-rr.c \
+ src/resolve/resolved-dns-rr.h \
+ src/resolve/resolved-dns-answer.c \
+ src/resolve/resolved-dns-answer.h \
+ src/resolve/resolved-dns-question.c \
+ src/resolve/resolved-dns-question.h \
+ src/resolve/resolved-dns-dnssec.c \
+ src/resolve/resolved-dns-dnssec.h \
+ src/resolve/dns-type.c \
+ src/resolve/dns-type.h
+
+test_dnssec_LDADD = \
+ libshared.la
+
+test_dnssec_complex_SOURCES = \
+ src/resolve/test-dnssec-complex.c \
+ src/resolve/dns-type.c \
+ src/resolve/dns-type.h
+
+test_dnssec_complex_LDADD = \
+ libshared.la
+
+endif
+
+gperf_txt_sources += \
+ src/resolve/dns_type-list.txt
+
+gperf_gperf_sources += \
+ src/resolve/resolved-gperf.gperf
+
+EXTRA_DIST += \
+ units/systemd-resolved.service.m4.in \
+ src/resolve/resolved.conf.in
+
+include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/resolve/RFCs b/src/resolve/src/RFCs
index 22004a00cd..22004a00cd 100644
--- a/src/resolve/RFCs
+++ b/src/resolve/src/RFCs
diff --git a/src/resolve/dns-type.c b/src/resolve/src/dns-type.c
index b2f479cae5..b2f479cae5 100644
--- a/src/resolve/dns-type.c
+++ b/src/resolve/src/dns-type.c
diff --git a/src/resolve/dns-type.h b/src/resolve/src/dns-type.h
index a6c1630021..a6c1630021 100644
--- a/src/resolve/dns-type.h
+++ b/src/resolve/src/dns-type.h
diff --git a/src/resolve/org.freedesktop.resolve1.conf b/src/resolve/src/org.freedesktop.resolve1.conf
index 25b09774e5..25b09774e5 100644
--- a/src/resolve/org.freedesktop.resolve1.conf
+++ b/src/resolve/src/org.freedesktop.resolve1.conf
diff --git a/src/resolve/org.freedesktop.resolve1.service b/src/resolve/src/org.freedesktop.resolve1.service
index 7ac5c323f0..7ac5c323f0 100644
--- a/src/resolve/org.freedesktop.resolve1.service
+++ b/src/resolve/src/org.freedesktop.resolve1.service
diff --git a/src/resolve/resolve-tool.c b/src/resolve/src/resolve-tool.c
index 824cb267b5..3f1b6e32f1 100644
--- a/src/resolve/resolve-tool.c
+++ b/src/resolve/src/resolve-tool.c
@@ -20,7 +20,7 @@
#include <getopt.h>
#include <net/if.h>
-#include "sd-bus.h"
+#include <systemd/sd-bus.h>
#include "af-list.h"
#include "alloc-util.h"
diff --git a/src/resolve/resolved-bus.c b/src/resolve/src/resolved-bus.c
index fc5e6beca0..fc5e6beca0 100644
--- a/src/resolve/resolved-bus.c
+++ b/src/resolve/src/resolved-bus.c
diff --git a/src/resolve/resolved-bus.h b/src/resolve/src/resolved-bus.h
index f49e1337d2..f49e1337d2 100644
--- a/src/resolve/resolved-bus.h
+++ b/src/resolve/src/resolved-bus.h
diff --git a/src/resolve/resolved-conf.c b/src/resolve/src/resolved-conf.c
index bb93fbfda2..bb93fbfda2 100644
--- a/src/resolve/resolved-conf.c
+++ b/src/resolve/src/resolved-conf.c
diff --git a/src/resolve/resolved-conf.h b/src/resolve/src/resolved-conf.h
index e1fd2cceec..e1fd2cceec 100644
--- a/src/resolve/resolved-conf.h
+++ b/src/resolve/src/resolved-conf.h
diff --git a/src/resolve/resolved-def.h b/src/resolve/src/resolved-def.h
index c4c1915b18..c4c1915b18 100644
--- a/src/resolve/resolved-def.h
+++ b/src/resolve/src/resolved-def.h
diff --git a/src/resolve/resolved-dns-answer.c b/src/resolve/src/resolved-dns-answer.c
index 7eb303ab95..7eb303ab95 100644
--- a/src/resolve/resolved-dns-answer.c
+++ b/src/resolve/src/resolved-dns-answer.c
diff --git a/src/resolve/resolved-dns-answer.h b/src/resolve/src/resolved-dns-answer.h
index 8f9c15eab4..8f9c15eab4 100644
--- a/src/resolve/resolved-dns-answer.h
+++ b/src/resolve/src/resolved-dns-answer.h
diff --git a/src/resolve/resolved-dns-cache.c b/src/resolve/src/resolved-dns-cache.c
index 9bcc71724e..9bcc71724e 100644
--- a/src/resolve/resolved-dns-cache.c
+++ b/src/resolve/src/resolved-dns-cache.c
diff --git a/src/resolve/resolved-dns-cache.h b/src/resolve/src/resolved-dns-cache.h
index 2293718e86..2293718e86 100644
--- a/src/resolve/resolved-dns-cache.h
+++ b/src/resolve/src/resolved-dns-cache.h
diff --git a/src/resolve/resolved-dns-dnssec.c b/src/resolve/src/resolved-dns-dnssec.c
index 7123d2d3a8..7123d2d3a8 100644
--- a/src/resolve/resolved-dns-dnssec.c
+++ b/src/resolve/src/resolved-dns-dnssec.c
diff --git a/src/resolve/resolved-dns-dnssec.h b/src/resolve/src/resolved-dns-dnssec.h
index 77bd4d71bf..77bd4d71bf 100644
--- a/src/resolve/resolved-dns-dnssec.h
+++ b/src/resolve/src/resolved-dns-dnssec.h
diff --git a/src/resolve/resolved-dns-packet.c b/src/resolve/src/resolved-dns-packet.c
index c940dd8929..c940dd8929 100644
--- a/src/resolve/resolved-dns-packet.c
+++ b/src/resolve/src/resolved-dns-packet.c
diff --git a/src/resolve/resolved-dns-packet.h b/src/resolve/src/resolved-dns-packet.h
index 0bf34d270c..0bf34d270c 100644
--- a/src/resolve/resolved-dns-packet.h
+++ b/src/resolve/src/resolved-dns-packet.h
diff --git a/src/resolve/resolved-dns-query.c b/src/resolve/src/resolved-dns-query.c
index a378b2b7f7..a378b2b7f7 100644
--- a/src/resolve/resolved-dns-query.c
+++ b/src/resolve/src/resolved-dns-query.c
diff --git a/src/resolve/resolved-dns-query.h b/src/resolve/src/resolved-dns-query.h
index c2ac02f68b..7f7c76ff20 100644
--- a/src/resolve/resolved-dns-query.h
+++ b/src/resolve/src/resolved-dns-query.h
@@ -20,7 +20,7 @@
***/
-#include "sd-bus.h"
+#include <systemd/sd-bus.h>
#include "set.h"
diff --git a/src/resolve/resolved-dns-question.c b/src/resolve/src/resolved-dns-question.c
index 8e452e79a4..8e452e79a4 100644
--- a/src/resolve/resolved-dns-question.c
+++ b/src/resolve/src/resolved-dns-question.c
diff --git a/src/resolve/resolved-dns-question.h b/src/resolve/src/resolved-dns-question.h
index ea41478975..ea41478975 100644
--- a/src/resolve/resolved-dns-question.h
+++ b/src/resolve/src/resolved-dns-question.h
diff --git a/src/resolve/resolved-dns-rr.c b/src/resolve/src/resolved-dns-rr.c
index 40f8e28dfd..40f8e28dfd 100644
--- a/src/resolve/resolved-dns-rr.c
+++ b/src/resolve/src/resolved-dns-rr.c
diff --git a/src/resolve/resolved-dns-rr.h b/src/resolve/src/resolved-dns-rr.h
index 2e0dfbaba3..2e0dfbaba3 100644
--- a/src/resolve/resolved-dns-rr.h
+++ b/src/resolve/src/resolved-dns-rr.h
diff --git a/src/resolve/resolved-dns-scope.c b/src/resolve/src/resolved-dns-scope.c
index a406872a38..a406872a38 100644
--- a/src/resolve/resolved-dns-scope.c
+++ b/src/resolve/src/resolved-dns-scope.c
diff --git a/src/resolve/resolved-dns-scope.h b/src/resolve/src/resolved-dns-scope.h
index 291e5817d0..291e5817d0 100644
--- a/src/resolve/resolved-dns-scope.h
+++ b/src/resolve/src/resolved-dns-scope.h
diff --git a/src/resolve/resolved-dns-search-domain.c b/src/resolve/src/resolved-dns-search-domain.c
index 732471027b..732471027b 100644
--- a/src/resolve/resolved-dns-search-domain.c
+++ b/src/resolve/src/resolved-dns-search-domain.c
diff --git a/src/resolve/resolved-dns-search-domain.h b/src/resolve/src/resolved-dns-search-domain.h
index eaacef4edc..eaacef4edc 100644
--- a/src/resolve/resolved-dns-search-domain.h
+++ b/src/resolve/src/resolved-dns-search-domain.h
diff --git a/src/resolve/resolved-dns-server.c b/src/resolve/src/resolved-dns-server.c
index 27342a0e04..27342a0e04 100644
--- a/src/resolve/resolved-dns-server.c
+++ b/src/resolve/src/resolved-dns-server.c
diff --git a/src/resolve/resolved-dns-server.h b/src/resolve/src/resolved-dns-server.h
index 9f4a69c37a..9f4a69c37a 100644
--- a/src/resolve/resolved-dns-server.h
+++ b/src/resolve/src/resolved-dns-server.h
diff --git a/src/resolve/resolved-dns-stream.c b/src/resolve/src/resolved-dns-stream.c
index a1040aeff4..a1040aeff4 100644
--- a/src/resolve/resolved-dns-stream.c
+++ b/src/resolve/src/resolved-dns-stream.c
diff --git a/src/resolve/resolved-dns-stream.h b/src/resolve/src/resolved-dns-stream.h
index 5ccc842249..5ccc842249 100644
--- a/src/resolve/resolved-dns-stream.h
+++ b/src/resolve/src/resolved-dns-stream.h
diff --git a/src/resolve/resolved-dns-synthesize.c b/src/resolve/src/resolved-dns-synthesize.c
index f4a43dee8c..f4a43dee8c 100644
--- a/src/resolve/resolved-dns-synthesize.c
+++ b/src/resolve/src/resolved-dns-synthesize.c
diff --git a/src/resolve/resolved-dns-synthesize.h b/src/resolve/src/resolved-dns-synthesize.h
index 5d829bb2e7..5d829bb2e7 100644
--- a/src/resolve/resolved-dns-synthesize.h
+++ b/src/resolve/src/resolved-dns-synthesize.h
diff --git a/src/resolve/resolved-dns-transaction.c b/src/resolve/src/resolved-dns-transaction.c
index d48fdd1281..d48fdd1281 100644
--- a/src/resolve/resolved-dns-transaction.c
+++ b/src/resolve/src/resolved-dns-transaction.c
diff --git a/src/resolve/resolved-dns-transaction.h b/src/resolve/src/resolved-dns-transaction.h
index 4617194711..4617194711 100644
--- a/src/resolve/resolved-dns-transaction.h
+++ b/src/resolve/src/resolved-dns-transaction.h
diff --git a/src/resolve/resolved-dns-trust-anchor.c b/src/resolve/src/resolved-dns-trust-anchor.c
index a75337eb6a..a75337eb6a 100644
--- a/src/resolve/resolved-dns-trust-anchor.c
+++ b/src/resolve/src/resolved-dns-trust-anchor.c
diff --git a/src/resolve/resolved-dns-trust-anchor.h b/src/resolve/src/resolved-dns-trust-anchor.h
index 635c75fde5..635c75fde5 100644
--- a/src/resolve/resolved-dns-trust-anchor.h
+++ b/src/resolve/src/resolved-dns-trust-anchor.h
diff --git a/src/resolve/resolved-dns-zone.c b/src/resolve/src/resolved-dns-zone.c
index f52383cfd1..f52383cfd1 100644
--- a/src/resolve/resolved-dns-zone.c
+++ b/src/resolve/src/resolved-dns-zone.c
diff --git a/src/resolve/resolved-dns-zone.h b/src/resolve/src/resolved-dns-zone.h
index 408833c359..408833c359 100644
--- a/src/resolve/resolved-dns-zone.h
+++ b/src/resolve/src/resolved-dns-zone.h
diff --git a/src/resolve/resolved-etc-hosts.c b/src/resolve/src/resolved-etc-hosts.c
index ee82c96822..ee82c96822 100644
--- a/src/resolve/resolved-etc-hosts.c
+++ b/src/resolve/src/resolved-etc-hosts.c
diff --git a/src/resolve/resolved-etc-hosts.h b/src/resolve/src/resolved-etc-hosts.h
index 9d5a175f18..9d5a175f18 100644
--- a/src/resolve/resolved-etc-hosts.h
+++ b/src/resolve/src/resolved-etc-hosts.h
diff --git a/src/resolve/resolved-gperf.gperf b/src/resolve/src/resolved-gperf.gperf
index 82f26215df..82f26215df 100644
--- a/src/resolve/resolved-gperf.gperf
+++ b/src/resolve/src/resolved-gperf.gperf
diff --git a/src/resolve/resolved-link-bus.c b/src/resolve/src/resolved-link-bus.c
index df7516f4f4..df7516f4f4 100644
--- a/src/resolve/resolved-link-bus.c
+++ b/src/resolve/src/resolved-link-bus.c
diff --git a/src/resolve/resolved-link-bus.h b/src/resolve/src/resolved-link-bus.h
index 31e6cd2b45..5a8ee08ec7 100644
--- a/src/resolve/resolved-link-bus.h
+++ b/src/resolve/src/resolved-link-bus.h
@@ -19,7 +19,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#include "sd-bus.h"
+#include <systemd/sd-bus.h>
#include "resolved-link.h"
diff --git a/src/resolve/resolved-link.c b/src/resolve/src/resolved-link.c
index c5863b3aa2..65df95bb1f 100644
--- a/src/resolve/resolved-link.c
+++ b/src/resolve/src/resolved-link.c
@@ -19,7 +19,7 @@
#include <net/if.h>
-#include "sd-network.h"
+#include <systemd/sd-network.h>
#include "alloc-util.h"
#include "missing.h"
diff --git a/src/resolve/resolved-link.h b/src/resolve/src/resolved-link.h
index f534c12824..f534c12824 100644
--- a/src/resolve/resolved-link.h
+++ b/src/resolve/src/resolved-link.h
diff --git a/src/resolve/resolved-llmnr.c b/src/resolve/src/resolved-llmnr.c
index ef12abfbb5..ef12abfbb5 100644
--- a/src/resolve/resolved-llmnr.c
+++ b/src/resolve/src/resolved-llmnr.c
diff --git a/src/resolve/resolved-llmnr.h b/src/resolve/src/resolved-llmnr.h
index 8133582fa7..8133582fa7 100644
--- a/src/resolve/resolved-llmnr.h
+++ b/src/resolve/src/resolved-llmnr.h
diff --git a/src/resolve/resolved-manager.c b/src/resolve/src/resolved-manager.c
index e82c6ec563..e82c6ec563 100644
--- a/src/resolve/resolved-manager.c
+++ b/src/resolve/src/resolved-manager.c
diff --git a/src/resolve/resolved-manager.h b/src/resolve/src/resolved-manager.h
index e82a824f29..8bef2d2b28 100644
--- a/src/resolve/resolved-manager.h
+++ b/src/resolve/src/resolved-manager.h
@@ -19,9 +19,9 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#include "sd-event.h"
-#include "sd-netlink.h"
-#include "sd-network.h"
+#include <systemd/sd-event.h>
+#include <systemd/sd-netlink.h>
+#include <systemd/sd-network.h>
#include "hashmap.h"
#include "list.h"
diff --git a/src/resolve/resolved-mdns.c b/src/resolve/src/resolved-mdns.c
index bc8b8b809b..bc8b8b809b 100644
--- a/src/resolve/resolved-mdns.c
+++ b/src/resolve/src/resolved-mdns.c
diff --git a/src/resolve/resolved-mdns.h b/src/resolve/src/resolved-mdns.h
index 5d274648f4..5d274648f4 100644
--- a/src/resolve/resolved-mdns.h
+++ b/src/resolve/src/resolved-mdns.h
diff --git a/src/resolve/resolved-resolv-conf.c b/src/resolve/src/resolved-resolv-conf.c
index 065427b690..065427b690 100644
--- a/src/resolve/resolved-resolv-conf.c
+++ b/src/resolve/src/resolved-resolv-conf.c
diff --git a/src/resolve/resolved-resolv-conf.h b/src/resolve/src/resolved-resolv-conf.h
index 75fa080e4c..75fa080e4c 100644
--- a/src/resolve/resolved-resolv-conf.h
+++ b/src/resolve/src/resolved-resolv-conf.h
diff --git a/src/resolve/resolved.c b/src/resolve/src/resolved.c
index c7e2ab14d6..07e6bfb54a 100644
--- a/src/resolve/resolved.c
+++ b/src/resolve/src/resolved.c
@@ -17,8 +17,8 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#include "sd-daemon.h"
-#include "sd-event.h"
+#include <systemd/sd-daemon.h>
+#include <systemd/sd-event.h>
#include "capability-util.h"
#include "mkdir.h"
diff --git a/src/resolve/resolved.conf.in b/src/resolve/src/resolved.conf.in
index efc9c6733a..efc9c6733a 100644
--- a/src/resolve/resolved.conf.in
+++ b/src/resolve/src/resolved.conf.in
diff --git a/src/resolve/test-dnssec-complex.c b/src/resolve/src/test-dnssec-complex.c
index 58c089eb40..568400ac77 100644
--- a/src/resolve/test-dnssec-complex.c
+++ b/src/resolve/src/test-dnssec-complex.c
@@ -19,7 +19,7 @@
#include <netinet/ip.h>
-#include "sd-bus.h"
+#include <systemd/sd-bus.h>
#include "af-list.h"
#include "alloc-util.h"
diff --git a/src/resolve/test-dnssec.c b/src/resolve/src/test-dnssec.c
index a093d86a91..a093d86a91 100644
--- a/src/resolve/test-dnssec.c
+++ b/src/resolve/src/test-dnssec.c
diff --git a/src/resolve/test-resolve-tables.c b/src/resolve/src/test-resolve-tables.c
index 63660afc87..63660afc87 100644
--- a/src/resolve/test-resolve-tables.c
+++ b/src/resolve/src/test-resolve-tables.c