summaryrefslogtreecommitdiff
path: root/src/resolve
diff options
context:
space:
mode:
Diffstat (limited to 'src/resolve')
-rw-r--r--src/resolve/resolved-bus.c27
-rw-r--r--src/resolve/resolved-dns-answer.c2
-rw-r--r--src/resolve/resolved-dns-cache.c7
-rw-r--r--src/resolve/resolved-dns-cache.h1
-rw-r--r--src/resolve/resolved-dns-domain.h1
-rw-r--r--src/resolve/resolved-dns-packet.h1
-rw-r--r--src/resolve/resolved-dns-query.c6
-rw-r--r--src/resolve/resolved-dns-query.h8
-rw-r--r--src/resolve/resolved-dns-rr.h2
-rw-r--r--src/resolve/resolved-dns-scope.c10
-rw-r--r--src/resolve/resolved-dns-scope.h3
-rw-r--r--src/resolve/resolved-dns-server.c15
-rw-r--r--src/resolve/resolved-dns-server.h1
-rw-r--r--src/resolve/resolved-dns-stream.h1
-rw-r--r--src/resolve/resolved-dns-transaction.c3
-rw-r--r--src/resolve/resolved-dns-transaction.h2
-rw-r--r--src/resolve/resolved-link.c6
-rw-r--r--src/resolve/resolved-link.h2
-rw-r--r--src/resolve/resolved-manager.c50
-rw-r--r--src/resolve/resolved-manager.h4
-rw-r--r--src/resolve/resolved.c2
-rw-r--r--src/resolve/resolved.conf.in5
-rw-r--r--src/resolve/test-dns-domain.c3
23 files changed, 67 insertions, 95 deletions
diff --git a/src/resolve/resolved-bus.c b/src/resolve/resolved-bus.c
index 03c84786db..171141e3a4 100644
--- a/src/resolve/resolved-bus.c
+++ b/src/resolve/resolved-bus.c
@@ -183,7 +183,7 @@ static void bus_method_resolve_hostname_complete(DnsQuery *q) {
}
}
- if (added <= 0) {
+ if (added == 0) {
if (!cname) {
r = sd_bus_reply_method_errorf(q->request, BUS_ERROR_NO_SUCH_RR, "'%s' does not have any RR of requested type", q->request_hostname);
goto finish;
@@ -220,6 +220,8 @@ static void bus_method_resolve_hostname_complete(DnsQuery *q) {
added++;
}
+ // what about the cache?
+
/* If we didn't find anything, then let's restart the
* query, this time with the cname */
if (added <= 0) {
@@ -273,7 +275,7 @@ static int check_ifindex_flags(int ifindex, uint64_t *flags, sd_bus_error *error
return 0;
}
-static int bus_method_resolve_hostname(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
+static int bus_method_resolve_hostname(sd_bus_message *message, void *userdata, sd_bus_error *error) {
_cleanup_(dns_question_unrefp) DnsQuestion *question = NULL;
Manager *m = userdata;
const char *hostname;
@@ -282,7 +284,6 @@ static int bus_method_resolve_hostname(sd_bus *bus, sd_bus_message *message, voi
DnsQuery *q;
int r;
- assert(bus);
assert(message);
assert(m);
@@ -338,7 +339,7 @@ static int bus_method_resolve_hostname(sd_bus *bus, sd_bus_message *message, voi
q->request_hostname = hostname;
q->complete = bus_method_resolve_hostname_complete;
- r = dns_query_bus_track(q, bus, message);
+ r = dns_query_bus_track(q, message);
if (r < 0)
return r;
@@ -398,7 +399,7 @@ static void bus_method_resolve_address_complete(DnsQuery *q) {
}
}
- if (added <= 0) {
+ if (added == 0) {
_cleanup_free_ char *ip = NULL;
in_addr_to_string(q->request_family, &q->request_address, &ip);
@@ -426,7 +427,7 @@ finish:
dns_query_free(q);
}
-static int bus_method_resolve_address(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
+static int bus_method_resolve_address(sd_bus_message *message, void *userdata, sd_bus_error *error) {
_cleanup_(dns_resource_key_unrefp) DnsResourceKey *key = NULL;
_cleanup_(dns_question_unrefp) DnsQuestion *question = NULL;
_cleanup_free_ char *reverse = NULL;
@@ -438,7 +439,6 @@ static int bus_method_resolve_address(sd_bus *bus, sd_bus_message *message, void
size_t sz;
int r;
- assert(bus);
assert(message);
assert(m);
@@ -491,7 +491,7 @@ static int bus_method_resolve_address(sd_bus *bus, sd_bus_message *message, void
memcpy(&q->request_address, d, sz);
q->complete = bus_method_resolve_address_complete;
- r = dns_query_bus_track(q, bus, message);
+ r = dns_query_bus_track(q, message);
if (r < 0)
return r;
@@ -598,7 +598,7 @@ finish:
dns_query_free(q);
}
-static int bus_method_resolve_record(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
+static int bus_method_resolve_record(sd_bus_message *message, void *userdata, sd_bus_error *error) {
_cleanup_(dns_resource_key_unrefp) DnsResourceKey *key = NULL;
_cleanup_(dns_question_unrefp) DnsQuestion *question = NULL;
Manager *m = userdata;
@@ -608,7 +608,6 @@ static int bus_method_resolve_record(sd_bus *bus, sd_bus_message *message, void
uint64_t flags;
DnsQuery *q;
- assert(bus);
assert(message);
assert(m);
@@ -644,7 +643,7 @@ static int bus_method_resolve_record(sd_bus *bus, sd_bus_message *message, void
q->request_hostname = name;
q->complete = bus_method_resolve_record_complete;
- r = dns_query_bus_track(q, bus, message);
+ r = dns_query_bus_track(q, message);
if (r < 0)
return r;
@@ -681,12 +680,12 @@ static int on_bus_retry(sd_event_source *s, usec_t usec, void *userdata) {
return 0;
}
-static int match_prepare_for_sleep(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *ret_error) {
+static int match_prepare_for_sleep(sd_bus_message *message, void *userdata, sd_bus_error *ret_error) {
Manager *m = userdata;
int b, r;
- assert(bus);
- assert(bus);
+ assert(message);
+ assert(m);
r = sd_bus_message_read(message, "b", &b);
if (r < 0) {
diff --git a/src/resolve/resolved-dns-answer.c b/src/resolve/resolved-dns-answer.c
index 7c4ab18b58..e08eb667cc 100644
--- a/src/resolve/resolved-dns-answer.c
+++ b/src/resolve/resolved-dns-answer.c
@@ -25,8 +25,6 @@
DnsAnswer *dns_answer_new(unsigned n) {
DnsAnswer *a;
- assert(n > 0);
-
a = malloc0(offsetof(DnsAnswer, rrs) + sizeof(DnsResourceRecord*) * n);
if (!a)
return NULL;
diff --git a/src/resolve/resolved-dns-cache.c b/src/resolve/resolved-dns-cache.c
index 33ca4d1a45..be52891681 100644
--- a/src/resolve/resolved-dns-cache.c
+++ b/src/resolve/resolved-dns-cache.c
@@ -91,11 +91,8 @@ void dns_cache_flush(DnsCache *c) {
assert(hashmap_size(c->by_key) == 0);
assert(prioq_size(c->by_expiry) == 0);
- hashmap_free(c->by_key);
- c->by_key = NULL;
-
- prioq_free(c->by_expiry);
- c->by_expiry = NULL;
+ c->by_key = hashmap_free(c->by_key);
+ c->by_expiry = prioq_free(c->by_expiry);
}
static void dns_cache_remove(DnsCache *c, DnsResourceKey *key) {
diff --git a/src/resolve/resolved-dns-cache.h b/src/resolve/resolved-dns-cache.h
index e92280c319..8a9b3d459d 100644
--- a/src/resolve/resolved-dns-cache.h
+++ b/src/resolve/resolved-dns-cache.h
@@ -21,7 +21,6 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#include <sys/types.h>
#include "hashmap.h"
#include "prioq.h"
diff --git a/src/resolve/resolved-dns-domain.h b/src/resolve/resolved-dns-domain.h
index 36f27ea031..516d244f7a 100644
--- a/src/resolve/resolved-dns-domain.h
+++ b/src/resolve/resolved-dns-domain.h
@@ -21,7 +21,6 @@
#pragma once
-#include <sys/types.h>
#include "hashmap.h"
#include "in-addr-util.h"
diff --git a/src/resolve/resolved-dns-packet.h b/src/resolve/resolved-dns-packet.h
index 561dd3adfa..c5867386c6 100644
--- a/src/resolve/resolved-dns-packet.h
+++ b/src/resolve/resolved-dns-packet.h
@@ -21,7 +21,6 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#include <inttypes.h>
#include "macro.h"
#include "sparse-endian.h"
diff --git a/src/resolve/resolved-dns-query.c b/src/resolve/resolved-dns-query.c
index f0483c9806..418d9721ef 100644
--- a/src/resolve/resolved-dns-query.c
+++ b/src/resolve/resolved-dns-query.c
@@ -19,10 +19,8 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#include "af-list.h"
#include "resolved-dns-query.h"
-#include "resolved-dns-domain.h"
/* How long to wait for the query in total */
#define QUERY_TIMEOUT_USEC (30 * USEC_PER_SEC)
@@ -469,14 +467,14 @@ static int on_bus_track(sd_bus_track *t, void *userdata) {
return 0;
}
-int dns_query_bus_track(DnsQuery *q, sd_bus *bus, sd_bus_message *m) {
+int dns_query_bus_track(DnsQuery *q, sd_bus_message *m) {
int r;
assert(q);
assert(m);
if (!q->bus_track) {
- r = sd_bus_track_new(bus, &q->bus_track, on_bus_track, q);
+ r = sd_bus_track_new(sd_bus_message_get_bus(m), &q->bus_track, on_bus_track, q);
if (r < 0)
return r;
}
diff --git a/src/resolve/resolved-dns-query.h b/src/resolve/resolved-dns-query.h
index 13b3ee4f81..5a319f0a62 100644
--- a/src/resolve/resolved-dns-query.h
+++ b/src/resolve/resolved-dns-query.h
@@ -21,21 +21,15 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#include <inttypes.h>
#include "sd-bus.h"
-#include "util.h"
#include "set.h"
typedef struct DnsQuery DnsQuery;
-#include "resolved-dns-scope.h"
-#include "resolved-dns-rr.h"
#include "resolved-dns-question.h"
#include "resolved-dns-answer.h"
#include "resolved-dns-stream.h"
-#include "resolved-dns-transaction.h"
-#include "resolved-manager.h"
struct DnsQuery {
Manager *manager;
@@ -81,6 +75,6 @@ void dns_query_ready(DnsQuery *q);
int dns_query_cname_redirect(DnsQuery *q, const char *name);
-int dns_query_bus_track(DnsQuery *q, sd_bus *bus, sd_bus_message *m);
+int dns_query_bus_track(DnsQuery *q, sd_bus_message *m);
DEFINE_TRIVIAL_CLEANUP_FUNC(DnsQuery*, dns_query_free);
diff --git a/src/resolve/resolved-dns-rr.h b/src/resolve/resolved-dns-rr.h
index 9d9a89d383..26796c842b 100644
--- a/src/resolve/resolved-dns-rr.h
+++ b/src/resolve/resolved-dns-rr.h
@@ -21,10 +21,8 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#include <inttypes.h>
#include <netinet/in.h>
-#include "util.h"
#include "hashmap.h"
#include "in-addr-util.h"
#include "dns-type.h"
diff --git a/src/resolve/resolved-dns-scope.c b/src/resolve/resolved-dns-scope.c
index abdb2e0732..7369cbf50f 100644
--- a/src/resolve/resolved-dns-scope.c
+++ b/src/resolve/resolved-dns-scope.c
@@ -25,6 +25,8 @@
#include "strv.h"
#include "socket-util.h"
#include "af-list.h"
+#include "random-util.h"
+#include "hostname-util.h"
#include "resolved-dns-domain.h"
#include "resolved-dns-scope.h"
@@ -144,7 +146,7 @@ int dns_scope_emit(DnsScope *s, DnsPacket *p) {
DnsServer *srv;
if (DNS_PACKET_QDCOUNT(p) > 1)
- return -ENOTSUP;
+ return -EOPNOTSUPP;
srv = dns_scope_get_dns_server(s);
if (!srv)
@@ -172,7 +174,7 @@ int dns_scope_emit(DnsScope *s, DnsPacket *p) {
} else if (s->protocol == DNS_PROTOCOL_LLMNR) {
if (DNS_PACKET_QDCOUNT(p) > 1)
- return -ENOTSUP;
+ return -EOPNOTSUPP;
if (!ratelimit_test(&s->ratelimit))
return -EBUSY;
@@ -387,7 +389,7 @@ int dns_scope_llmnr_membership(DnsScope *s, bool b) {
* one. This is necessary on some devices, such as
* veth. */
if (b)
- (void)setsockopt(fd, IPPROTO_IP, IP_DROP_MEMBERSHIP, &mreqn, sizeof(mreqn));
+ (void) setsockopt(fd, IPPROTO_IP, IP_DROP_MEMBERSHIP, &mreqn, sizeof(mreqn));
if (setsockopt(fd, IPPROTO_IP, b ? IP_ADD_MEMBERSHIP : IP_DROP_MEMBERSHIP, &mreqn, sizeof(mreqn)) < 0)
return -errno;
@@ -403,7 +405,7 @@ int dns_scope_llmnr_membership(DnsScope *s, bool b) {
return fd;
if (b)
- (void)setsockopt(fd, IPPROTO_IPV6, IPV6_DROP_MEMBERSHIP, &mreq, sizeof(mreq));
+ (void) setsockopt(fd, IPPROTO_IPV6, IPV6_DROP_MEMBERSHIP, &mreq, sizeof(mreq));
if (setsockopt(fd, IPPROTO_IPV6, b ? IPV6_ADD_MEMBERSHIP : IPV6_DROP_MEMBERSHIP, &mreq, sizeof(mreq)) < 0)
return -errno;
diff --git a/src/resolve/resolved-dns-scope.h b/src/resolve/resolved-dns-scope.h
index f05648e5a5..cfbde1343f 100644
--- a/src/resolve/resolved-dns-scope.h
+++ b/src/resolve/resolved-dns-scope.h
@@ -27,11 +27,8 @@ typedef struct DnsScope DnsScope;
#include "resolved-dns-server.h"
#include "resolved-dns-packet.h"
-#include "resolved-dns-query.h"
#include "resolved-dns-cache.h"
#include "resolved-dns-zone.h"
-#include "resolved-dns-stream.h"
-#include "resolved-manager.h"
#include "resolved-link.h"
typedef enum DnsScopeMatch {
diff --git a/src/resolve/resolved-dns-server.c b/src/resolve/resolved-dns-server.c
index caf06fe450..9a62a63258 100644
--- a/src/resolve/resolved-dns-server.c
+++ b/src/resolve/resolved-dns-server.c
@@ -78,23 +78,24 @@ DnsServer* dns_server_free(DnsServer *s) {
if (!s)
return NULL;
- if (s->manager) {
+ if (s->link) {
if (s->type == DNS_SERVER_LINK)
LIST_REMOVE(servers, s->link->dns_servers, s);
- else if (s->type == DNS_SERVER_SYSTEM)
+
+ if (s->link->current_dns_server == s)
+ link_set_dns_server(s->link, NULL);
+ }
+
+ if (s->manager) {
+ if (s->type == DNS_SERVER_SYSTEM)
LIST_REMOVE(servers, s->manager->dns_servers, s);
else if (s->type == DNS_SERVER_FALLBACK)
LIST_REMOVE(servers, s->manager->fallback_dns_servers, s);
- else
- assert_not_reached("Unknown server type");
if (s->manager->current_dns_server == s)
manager_set_dns_server(s->manager, NULL);
}
- if (s->link && s->link->current_dns_server == s)
- link_set_dns_server(s->link, NULL);
-
free(s);
return NULL;
diff --git a/src/resolve/resolved-dns-server.h b/src/resolve/resolved-dns-server.h
index a438a27763..70ff35b08f 100644
--- a/src/resolve/resolved-dns-server.h
+++ b/src/resolve/resolved-dns-server.h
@@ -32,7 +32,6 @@ typedef enum DnsServerType {
DNS_SERVER_LINK,
} DnsServerType;
-#include "resolved-manager.h"
#include "resolved-link.h"
struct DnsServer {
diff --git a/src/resolve/resolved-dns-stream.h b/src/resolve/resolved-dns-stream.h
index 46eae31c60..fb81e9f1ac 100644
--- a/src/resolve/resolved-dns-stream.h
+++ b/src/resolve/resolved-dns-stream.h
@@ -27,7 +27,6 @@ typedef struct DnsStream DnsStream;
#include "resolved-dns-packet.h"
#include "resolved-dns-transaction.h"
-#include "resolved-manager.h"
struct DnsStream {
Manager *manager;
diff --git a/src/resolve/resolved-dns-transaction.c b/src/resolve/resolved-dns-transaction.c
index 74b0634142..214938986d 100644
--- a/src/resolve/resolved-dns-transaction.c
+++ b/src/resolve/resolved-dns-transaction.c
@@ -22,6 +22,7 @@
#include "af-list.h"
#include "resolved-dns-transaction.h"
+#include "random-util.h"
DnsTransaction* dns_transaction_free(DnsTransaction *t) {
DnsQuery *q;
@@ -252,7 +253,7 @@ static int dns_transaction_open_tcp(DnsTransaction *t) {
fd = dns_scope_tcp_socket(t->scope, t->received->family, &t->received->sender, t->received->sender_port);
else {
union in_addr_union address;
- int family;
+ int family = AF_UNSPEC;
/* Otherwise, try to talk to the owner of a
* the IP address, in case this is a reverse
diff --git a/src/resolve/resolved-dns-transaction.h b/src/resolve/resolved-dns-transaction.h
index 182fb7714c..f6d539d315 100644
--- a/src/resolve/resolved-dns-transaction.h
+++ b/src/resolve/resolved-dns-transaction.h
@@ -40,11 +40,9 @@ enum DnsTransactionState {
};
#include "resolved-dns-scope.h"
-#include "resolved-dns-rr.h"
#include "resolved-dns-packet.h"
#include "resolved-dns-question.h"
#include "resolved-dns-answer.h"
-#include "resolved-dns-stream.h"
struct DnsTransaction {
DnsScope *scope;
diff --git a/src/resolve/resolved-link.c b/src/resolve/resolved-link.c
index f94e4bb6f0..27d9129e00 100644
--- a/src/resolve/resolved-link.c
+++ b/src/resolve/resolved-link.c
@@ -68,13 +68,13 @@ Link *link_free(Link *l) {
if (l->manager)
hashmap_remove(l->manager->links, INT_TO_PTR(l->ifindex));
+ while (l->dns_servers)
+ dns_server_free(l->dns_servers);
+
dns_scope_free(l->unicast_scope);
dns_scope_free(l->llmnr_ipv4_scope);
dns_scope_free(l->llmnr_ipv6_scope);
- while (l->dns_servers)
- dns_server_free(l->dns_servers);
-
free(l);
return NULL;
}
diff --git a/src/resolve/resolved-link.h b/src/resolve/resolved-link.h
index 4f0702e872..eee1846108 100644
--- a/src/resolve/resolved-link.h
+++ b/src/resolve/resolved-link.h
@@ -29,8 +29,6 @@
typedef struct Link Link;
typedef struct LinkAddress LinkAddress;
-#include "resolved-dns-server.h"
-#include "resolved-dns-scope.h"
#include "resolved-dns-rr.h"
#include "resolved-manager.h"
diff --git a/src/resolve/resolved-manager.c b/src/resolve/resolved-manager.c
index b5ad701611..52695376f0 100644
--- a/src/resolve/resolved-manager.c
+++ b/src/resolve/resolved-manager.c
@@ -19,22 +19,20 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#include <arpa/inet.h>
#include <resolv.h>
-#include <net/if.h>
#include <sys/ioctl.h>
#include <poll.h>
#include <netinet/in.h>
#include "rtnl-util.h"
-#include "event-util.h"
-#include "network-util.h"
#include "network-internal.h"
-#include "conf-parser.h"
#include "socket-util.h"
#include "af-list.h"
#include "utf8.h"
#include "fileio-label.h"
+#include "ordered-set.h"
+#include "random-util.h"
+#include "hostname-util.h"
#include "resolved-dns-domain.h"
#include "resolved-conf.h"
@@ -536,11 +534,11 @@ Manager *manager_free(Manager *m) {
while (m->dns_queries)
dns_query_free(m->dns_queries);
- dns_scope_free(m->unicast_scope);
-
manager_flush_dns_servers(m, DNS_SERVER_SYSTEM);
manager_flush_dns_servers(m, DNS_SERVER_FALLBACK);
+ dns_scope_free(m->unicast_scope);
+
hashmap_free(m->links);
hashmap_free(m->dns_transactions);
@@ -707,8 +705,11 @@ static void write_resolv_conf_server(DnsServer *s, FILE *f, unsigned *count) {
(*count) ++;
}
-static void write_resolv_conf_search(const char *domain, FILE *f,
- unsigned *count, unsigned *length) {
+static void write_resolv_conf_search(
+ const char *domain, FILE *f,
+ unsigned *count,
+ unsigned *length) {
+
assert(domain);
assert(f);
assert(length);
@@ -729,7 +730,7 @@ static void write_resolv_conf_search(const char *domain, FILE *f,
(*count) ++;
}
-static int write_resolv_conf_contents(FILE *f, Set *dns, Set *domains) {
+static int write_resolv_conf_contents(FILE *f, OrderedSet *dns, OrderedSet *domains) {
Iterator i;
fputs("# This file is managed by systemd-resolved(8). Do not edit.\n#\n"
@@ -738,22 +739,22 @@ static int write_resolv_conf_contents(FILE *f, Set *dns, Set *domains) {
"# resolv.conf(5) in a different way, replace the symlink by a\n"
"# static file or a different symlink.\n\n", f);
- if (set_isempty(dns))
+ if (ordered_set_isempty(dns))
fputs("# No DNS servers known.\n", f);
else {
DnsServer *s;
unsigned count = 0;
- SET_FOREACH(s, dns, i)
+ ORDERED_SET_FOREACH(s, dns, i)
write_resolv_conf_server(s, f, &count);
}
- if (!set_isempty(domains)) {
+ if (!ordered_set_isempty(domains)) {
unsigned length = 0, count = 0;
char *domain;
fputs("search", f);
- SET_FOREACH(domain, domains, i)
+ ORDERED_SET_FOREACH(domain, domains, i)
write_resolv_conf_search(domain, f, &count, &length);
fputs("\n", f);
}
@@ -761,12 +762,11 @@ static int write_resolv_conf_contents(FILE *f, Set *dns, Set *domains) {
return fflush_and_check(f);
}
-
int manager_write_resolv_conf(Manager *m) {
static const char path[] = "/run/systemd/resolve/resolv.conf";
_cleanup_free_ char *temp_path = NULL;
_cleanup_fclose_ FILE *f = NULL;
- _cleanup_set_free_ Set *dns = NULL, *domains = NULL;
+ _cleanup_ordered_set_free_ OrderedSet *dns = NULL, *domains = NULL;
DnsServer *s;
Iterator i;
Link *l;
@@ -778,17 +778,17 @@ int manager_write_resolv_conf(Manager *m) {
manager_read_resolv_conf(m);
/* Add the full list to a set, to filter out duplicates */
- dns = set_new(&dns_server_hash_ops);
+ dns = ordered_set_new(&dns_server_hash_ops);
if (!dns)
return -ENOMEM;
- domains = set_new(&dns_name_hash_ops);
+ domains = ordered_set_new(&dns_name_hash_ops);
if (!domains)
return -ENOMEM;
/* First add the system-wide servers */
LIST_FOREACH(servers, s, m->dns_servers) {
- r = set_put(dns, s);
+ r = ordered_set_put(dns, s);
if (r == -EEXIST)
continue;
if (r < 0)
@@ -800,7 +800,7 @@ int manager_write_resolv_conf(Manager *m) {
char **domain;
LIST_FOREACH(servers, s, l->dns_servers) {
- r = set_put(dns, s);
+ r = ordered_set_put(dns, s);
if (r == -EEXIST)
continue;
if (r < 0)
@@ -811,7 +811,7 @@ int manager_write_resolv_conf(Manager *m) {
continue;
STRV_FOREACH(domain, l->unicast_scope->domains) {
- r = set_put(domains, *domain);
+ r = ordered_set_put(domains, *domain);
if (r == -EEXIST)
continue;
if (r < 0)
@@ -820,9 +820,9 @@ int manager_write_resolv_conf(Manager *m) {
}
/* If we found nothing, add the fallback servers */
- if (set_isempty(dns)) {
+ if (ordered_set_isempty(dns)) {
LIST_FOREACH(servers, s, m->fallback_dns_servers) {
- r = set_put(dns, s);
+ r = ordered_set_put(dns, s);
if (r == -EEXIST)
continue;
if (r < 0)
@@ -848,8 +848,8 @@ int manager_write_resolv_conf(Manager *m) {
return 0;
fail:
- unlink(path);
- unlink(temp_path);
+ (void) unlink(path);
+ (void) unlink(temp_path);
return r;
}
diff --git a/src/resolve/resolved-manager.h b/src/resolve/resolved-manager.h
index 1151029d29..5a581cc13a 100644
--- a/src/resolve/resolved-manager.h
+++ b/src/resolve/resolved-manager.h
@@ -24,9 +24,7 @@
#include "sd-event.h"
#include "sd-network.h"
#include "sd-rtnl.h"
-#include "util.h"
#include "list.h"
-#include "in-addr-util.h"
#include "hashmap.h"
typedef struct Manager Manager;
@@ -41,8 +39,6 @@ enum Support {
};
#include "resolved-dns-query.h"
-#include "resolved-dns-server.h"
-#include "resolved-dns-scope.h"
#include "resolved-dns-stream.h"
#include "resolved-link.h"
diff --git a/src/resolve/resolved.c b/src/resolve/resolved.c
index ce15a8011d..e283d8a749 100644
--- a/src/resolve/resolved.c
+++ b/src/resolve/resolved.c
@@ -22,9 +22,9 @@
#include "sd-event.h"
#include "sd-daemon.h"
#include "mkdir.h"
-#include "label.h"
#include "capability.h"
#include "selinux-util.h"
+#include "signal-util.h"
#include "resolved-manager.h"
#include "resolved-conf.h"
diff --git a/src/resolve/resolved.conf.in b/src/resolve/resolved.conf.in
index e5a19ee474..3eb19e42b7 100644
--- a/src/resolve/resolved.conf.in
+++ b/src/resolve/resolved.conf.in
@@ -5,8 +5,9 @@
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
-# You can override the directives in this file by creating files in
-# /etc/systemd/resolved.conf.d/*.conf.
+# Entries in this file show the compile time defaults.
+# You can change settings by editing this file.
+# Defaults can be restored by simply deleting this file.
#
# See resolved.conf(5) for details
diff --git a/src/resolve/test-dns-domain.c b/src/resolve/test-dns-domain.c
index ebc8d98fce..c3208abc78 100644
--- a/src/resolve/test-dns-domain.c
+++ b/src/resolve/test-dns-domain.c
@@ -19,7 +19,6 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#include "log.h"
#include "macro.h"
#include "resolved-dns-domain.h"
@@ -162,7 +161,7 @@ static void test_dns_name_single_label(void) {
static void test_dns_name_reverse_one(const char *address, const char *name) {
_cleanup_free_ char *p = NULL;
- union in_addr_union a, b;
+ union in_addr_union a, b = {};
int familya, familyb;
assert_se(in_addr_from_string_auto(address, &familya, &a) >= 0);