summaryrefslogtreecommitdiff
path: root/src/resolve/resolved-dns-zone.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-08-17 23:54:08 +0200
committerLennart Poettering <lennart@poettering.net>2015-08-21 12:41:08 +0200
commit78c6a153c47f8d597c827bdcaf8c4e42ac87f738 (patch)
treec0b378f70987c6de3cbbcc02fd6cc2c6549d2a3a /src/resolve/resolved-dns-zone.c
parent8013e860b6344cb109e68208a3a91b0fc3cb9ed1 (diff)
resolved: rework synthesizing logic
With this change we'll now also generate synthesized RRs for the local LLMNR hostname (first label of system hostname), the local mDNS hostname (first label of system hostname suffixed with .local), the "gateway" hostname and all the reverse PTRs. This hence takes over part of what nss-myhostname already implemented. Local hostnames resolve to the set of local IP addresses. Since the addresses are possibly on different interfaces it is necessary to change the internal DnsAnswer object to track per-RR interface indexes, and to change the bus API to always return the interface per-address rather than per-reply. This change also patches the existing clients for resolved accordingly (nss-resolve + systemd-resolve-host). This also changes the routing logic for queries slightly: we now ensure that the local hostname is never resolved via LLMNR, thus making it trustable on the local system.
Diffstat (limited to 'src/resolve/resolved-dns-zone.c')
-rw-r--r--src/resolve/resolved-dns-zone.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/resolve/resolved-dns-zone.c b/src/resolve/resolved-dns-zone.c
index 32d771a954..99d96c3f40 100644
--- a/src/resolve/resolved-dns-zone.c
+++ b/src/resolve/resolved-dns-zone.c
@@ -422,7 +422,7 @@ int dns_zone_lookup(DnsZone *z, DnsQuestion *q, DnsAnswer **ret_answer, DnsAnswe
if (k < 0)
return k;
if (k > 0) {
- r = dns_answer_add(answer, j->rr);
+ r = dns_answer_add(answer, j->rr, 0);
if (r < 0)
return r;
@@ -448,7 +448,7 @@ int dns_zone_lookup(DnsZone *z, DnsQuestion *q, DnsAnswer **ret_answer, DnsAnswe
if (j->state != DNS_ZONE_ITEM_PROBING)
tentative = false;
- r = dns_answer_add(answer, j->rr);
+ r = dns_answer_add(answer, j->rr, 0);
if (r < 0)
return r;
}
@@ -505,7 +505,7 @@ void dns_zone_item_conflict(DnsZoneItem *i) {
i->state = DNS_ZONE_ITEM_WITHDRAWN;
/* Maybe change the hostname */
- if (dns_name_equal(i->scope->manager->hostname, DNS_RESOURCE_KEY_NAME(i->rr->key)) > 0)
+ if (manager_is_own_hostname(i->scope->manager, DNS_RESOURCE_KEY_NAME(i->rr->key)) > 0)
manager_next_hostname(i->scope->manager);
}