summaryrefslogtreecommitdiff
path: root/src/resolve/resolved-dns-query.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-11-25 20:47:27 +0100
committerLennart Poettering <lennart@poettering.net>2015-11-25 21:59:16 +0100
commit801ad6a6a9cd8fbd58b9f9c27f20dbb3c87d47dd (patch)
treedb95ac0b7a04e4c0a0135d64c3077391eaea7356 /src/resolve/resolved-dns-query.h
parent7f220d94a938a99c77400fa0ca30485e269bae7c (diff)
resolved: fully support DNS search domains
This adds support for searching single-label hostnames in a set of configured search domains. A new object DnsQueryCandidate is added that links queries to scopes. It keeps track of the search domain last used for a query on a specific link. Whenever a host name was unsuccessfuly resolved on a scope all its transactions are flushed out and replaced by a new set, with the next search domain appended. This also adds a new flag SD_RESOLVED_NO_SEARCH to disable search domain behaviour. The "systemd-resolve-host" tool is updated to make this configurable via --search=. Fixes #1697
Diffstat (limited to 'src/resolve/resolved-dns-query.h')
-rw-r--r--src/resolve/resolved-dns-query.h23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/resolve/resolved-dns-query.h b/src/resolve/resolved-dns-query.h
index 256dddc00b..fb16747c55 100644
--- a/src/resolve/resolved-dns-query.h
+++ b/src/resolve/resolved-dns-query.h
@@ -26,11 +26,26 @@
#include "set.h"
+typedef struct DnsQueryCandidate DnsQueryCandidate;
typedef struct DnsQuery DnsQuery;
#include "resolved-dns-answer.h"
#include "resolved-dns-question.h"
#include "resolved-dns-stream.h"
+#include "resolved-dns-search-domain.h"
+
+struct DnsQueryCandidate {
+ DnsQuery *query;
+ DnsScope *scope;
+
+ DnsSearchDomain *search_domain;
+
+ int error_code;
+ Set *transactions;
+
+ LIST_FIELDS(DnsQueryCandidate, candidates_by_query);
+ LIST_FIELDS(DnsQueryCandidate, candidates_by_scope);
+};
struct DnsQuery {
Manager *manager;
@@ -45,13 +60,13 @@ struct DnsQuery {
int auxiliary_result;
DnsQuestion *question;
-
uint64_t flags;
int ifindex;
DnsTransactionState state;
unsigned n_cname_redirects;
+ LIST_HEAD(DnsQueryCandidate, candidates);
sd_event_source *timeout_event_source;
/* Discovered data */
@@ -59,6 +74,7 @@ struct DnsQuery {
int answer_family;
DnsProtocol answer_protocol;
int answer_rcode;
+ DnsSearchDomain *answer_search_domain;
/* Bus client information */
sd_bus_message *request;
@@ -71,14 +87,15 @@ struct DnsQuery {
void (*complete)(DnsQuery* q);
unsigned block_ready;
- Set *transactions;
-
sd_bus_track *bus_track;
LIST_FIELDS(DnsQuery, queries);
LIST_FIELDS(DnsQuery, auxiliary_queries);
};
+DnsQueryCandidate* dns_query_candidate_free(DnsQueryCandidate *c);
+void dns_query_candidate_ready(DnsQueryCandidate *c);
+
int dns_query_new(Manager *m, DnsQuery **q, DnsQuestion *question, int family, uint64_t flags);
DnsQuery *dns_query_free(DnsQuery *q);