[systemd-commits] 2 commits - TODO src/resolve
Lennart Poettering
lennart at kemper.freedesktop.org
Wed Jul 30 10:35:02 PDT 2014
TODO | 1 +
src/resolve/resolved-dns-answer.c | 6 ++++--
src/resolve/resolved-dns-answer.h | 2 +-
src/resolve/resolved-dns-zone.c | 4 ++--
src/resolve/resolved-dns-zone.h | 3 +++
src/resolve/resolved-link.c | 3 ---
6 files changed, 11 insertions(+), 8 deletions(-)
New commits:
commit 699bd879efdf17c663b66fac8ca4f9cd4a946260
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed Jul 30 19:34:55 2014 +0200
update TODO
diff --git a/TODO b/TODO
index 6350711..258ea57 100644
--- a/TODO
+++ b/TODO
@@ -40,6 +40,7 @@ Features:
- collect multiple responses
- jitter interval support
- add SOA record to empty responses
+ - watch udev initialization state
- mDNS/DNS-SD
- DNS-SD service registration from socket units
- port sd-resolve to direct bus calls
commit 57f5ad3149b604d07816da61e6aa7dcf1cc56b64
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed Jul 30 19:34:50 2014 +0200
resolved: properly set TTL in SOA records
diff --git a/src/resolve/resolved-dns-answer.c b/src/resolve/resolved-dns-answer.c
index b6883a3..7c4ab18 100644
--- a/src/resolve/resolved-dns-answer.c
+++ b/src/resolve/resolved-dns-answer.c
@@ -97,13 +97,15 @@ int dns_answer_add(DnsAnswer *a, DnsResourceRecord *rr) {
return 1;
}
-int dns_answer_add_soa(DnsAnswer *a, const char *name) {
+int dns_answer_add_soa(DnsAnswer *a, const char *name, uint32_t ttl) {
_cleanup_(dns_resource_record_unrefp) DnsResourceRecord *soa = NULL;
soa = dns_resource_record_new_full(DNS_CLASS_IN, DNS_TYPE_SOA, name);
if (!soa)
return -ENOMEM;
+ soa->ttl = ttl;
+
soa->soa.mname = strdup(name);
if (!soa->soa.mname)
return -ENOMEM;
@@ -116,7 +118,7 @@ int dns_answer_add_soa(DnsAnswer *a, const char *name) {
soa->soa.refresh = 1;
soa->soa.retry = 1;
soa->soa.expire = 1;
- soa->soa.minimum = 1;
+ soa->soa.minimum = ttl;
return dns_answer_add(a, soa);
}
diff --git a/src/resolve/resolved-dns-answer.h b/src/resolve/resolved-dns-answer.h
index 917bfce..af3e462 100644
--- a/src/resolve/resolved-dns-answer.h
+++ b/src/resolve/resolved-dns-answer.h
@@ -38,7 +38,7 @@ DnsAnswer *dns_answer_ref(DnsAnswer *a);
DnsAnswer *dns_answer_unref(DnsAnswer *a);
int dns_answer_add(DnsAnswer *a, DnsResourceRecord *rr);
-int dns_answer_add_soa(DnsAnswer *a, const char *name);
+int dns_answer_add_soa(DnsAnswer *a, const char *name, uint32_t ttl);
int dns_answer_contains(DnsAnswer *a, DnsResourceKey *key);
int dns_answer_find_soa(DnsAnswer *a, DnsResourceKey *key, DnsResourceRecord **ret);
diff --git a/src/resolve/resolved-dns-zone.c b/src/resolve/resolved-dns-zone.c
index b51f503..99ea420 100644
--- a/src/resolve/resolved-dns-zone.c
+++ b/src/resolve/resolved-dns-zone.c
@@ -275,7 +275,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_soa(soa, DNS_RESOURCE_KEY_NAME(q->keys[i]));
+ r = dns_answer_add_soa(soa, DNS_RESOURCE_KEY_NAME(q->keys[i]), LLMNR_DEFAULT_TTL);
else
r = dns_answer_add(answer, j->rr);
if (r < 0)
@@ -292,7 +292,7 @@ int dns_zone_lookup(DnsZone *z, DnsQuestion *q, DnsAnswer **ret_answer, DnsAnswe
}
} else {
if (hashmap_get(z->by_name, DNS_RESOURCE_KEY_NAME(q->keys[i]))) {
- r = dns_answer_add_soa(soa, DNS_RESOURCE_KEY_NAME(q->keys[i]));
+ r = dns_answer_add_soa(soa, DNS_RESOURCE_KEY_NAME(q->keys[i]), LLMNR_DEFAULT_TTL);
if (r < 0)
return r;
}
diff --git a/src/resolve/resolved-dns-zone.h b/src/resolve/resolved-dns-zone.h
index 5e7a1f7..b2af028 100644
--- a/src/resolve/resolved-dns-zone.h
+++ b/src/resolve/resolved-dns-zone.h
@@ -38,3 +38,6 @@ int dns_zone_put(DnsZone *z, DnsResourceRecord *rr);
void dns_zone_remove_rr(DnsZone *z, DnsResourceRecord *rr);
int dns_zone_lookup(DnsZone *z, DnsQuestion *q, DnsAnswer **answer, DnsAnswer **soa);
+
+/* RFC 4795 Section 2.8. suggests a TTL of 30s by default */
+#define LLMNR_DEFAULT_TTL (30)
diff --git a/src/resolve/resolved-link.c b/src/resolve/resolved-link.c
index cd6e4ba..a4c23ba 100644
--- a/src/resolve/resolved-link.c
+++ b/src/resolve/resolved-link.c
@@ -25,9 +25,6 @@
#include "strv.h"
#include "resolved-link.h"
-/* RFC 4795 Section 2.8. suggests a TTL of 30s by default */
-#define LLMNR_DEFAULT_TTL (30)
-
static void link_address_add_rrs(LinkAddress *a);
int link_new(Manager *m, Link **ret, int ifindex) {
More information about the systemd-commits
mailing list