diff options
author | Daniel Mack <github@zonque.org> | 2015-12-10 20:48:42 +0100 |
---|---|---|
committer | Daniel Mack <github@zonque.org> | 2015-12-10 20:48:42 +0100 |
commit | c57d67f718077aadee4e2d0940fb87f513b98671 (patch) | |
tree | 394c75707a9672611da33e5e78131efcf569d6c9 /src/resolve/resolved-dns-answer.c | |
parent | 7b56301a88a0e78e791727bba098a79fc55879a7 (diff) | |
parent | a257f9d4a53e98da6306b674d2cbb63b42d67d20 (diff) |
Merge pull request #2096 from teg/resolved-cache
Misc resolved cache fixes
Diffstat (limited to 'src/resolve/resolved-dns-answer.c')
-rw-r--r-- | src/resolve/resolved-dns-answer.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/resolve/resolved-dns-answer.c b/src/resolve/resolved-dns-answer.c index de8c4d9dd3..55e6ffbad7 100644 --- a/src/resolve/resolved-dns-answer.c +++ b/src/resolve/resolved-dns-answer.c @@ -249,6 +249,29 @@ int dns_answer_find_soa(DnsAnswer *a, const DnsResourceKey *key, DnsResourceReco return 0; } +int dns_answer_find_cname_or_dname(DnsAnswer *a, const DnsResourceKey *key, DnsResourceRecord **ret) { + DnsResourceRecord *rr; + + assert(key); + + if (!a) + return 0; + + /* For a {C,D}NAME record we can never find a matching {C,D}NAME record */ + if (key->type == DNS_TYPE_CNAME || key->type == DNS_TYPE_DNAME) + return 0; + + DNS_ANSWER_FOREACH(rr, a) { + if (dns_resource_key_match_cname_or_dname(key, rr->key, NULL)) { + if (ret) + *ret = rr; + return 1; + } + } + + return 0; +} + int dns_answer_merge(DnsAnswer *a, DnsAnswer *b, DnsAnswer **ret) { _cleanup_(dns_answer_unrefp) DnsAnswer *k = NULL; int r; |