diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-08-05 01:38:13 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-08-05 01:52:24 +0200 |
commit | cd1b20f90abb1e49d60d8c3f4a7665ca93bea436 (patch) | |
tree | f41c3133497dfa08f7f9b38895fcbd100b11099d /src/resolve | |
parent | 24fb7c1fa633e90e4297e0715546c0bc47118ba9 (diff) | |
download | systemd-cd1b20f90abb1e49d60d8c3f4a7665ca93bea436.tar.gz |
resolved: if there's already an RR established that has the same name of an RR to be established, skip probing the name
After all, what has been probed once, doesn't need to be probed again.
Diffstat (limited to 'src/resolve')
-rw-r--r-- | src/resolve/resolved-dns-zone.c | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/src/resolve/resolved-dns-zone.c b/src/resolve/resolved-dns-zone.c index b577fd6cc6..d4e0552887 100644 --- a/src/resolve/resolved-dns-zone.c +++ b/src/resolve/resolved-dns-zone.c @@ -260,14 +260,34 @@ int dns_zone_put(DnsZone *z, DnsScope *s, DnsResourceRecord *rr, bool probe) { return r; if (probe) { - r = dns_zone_item_probe_start(i); - if (r < 0) { - dns_zone_item_remove_and_free(z, i); - i = NULL; - return r; + DnsZoneItem *first, *j; + bool established = false; + + /* Check if there's already an RR with the same name + * established. If so, it has been probed already, and + * we don't ned to probe again. */ + + LIST_FIND_HEAD(by_name, i, first); + LIST_FOREACH(by_name, j, first) { + if (i == j) + continue; + + if (j->state == DNS_ZONE_ITEM_ESTABLISHED) + established = true; } - i->state = DNS_ZONE_ITEM_PROBING; + if (established) + i->state = DNS_ZONE_ITEM_ESTABLISHED; + else { + r = dns_zone_item_probe_start(i); + if (r < 0) { + dns_zone_item_remove_and_free(z, i); + i = NULL; + return r; + } + + i->state = DNS_ZONE_ITEM_PROBING; + } } else i->state = DNS_ZONE_ITEM_ESTABLISHED; |