diff options
author | Lennart Poettering <lennart@poettering.net> | 2020-10-28 20:50:44 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2021-02-09 17:52:36 +0100 |
commit | 7d44b1986bc51a026ff96e1f8c038a4b39786328 (patch) | |
tree | 8c7942acfd31dc961366e8298b03c0ba9ee01359 /src | |
parent | resolved: add logic for patching TTLs of full packets (diff) | |
download | systemd-7d44b1986bc51a026ff96e1f8c038a4b39786328.tar.xz systemd-7d44b1986bc51a026ff96e1f8c038a4b39786328.zip |
resolved: add dns_answer_contains() helper
Diffstat (limited to 'src')
-rw-r--r-- | src/resolve/resolved-dns-answer.c | 10 | ||||
-rw-r--r-- | src/resolve/resolved-dns-answer.h | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/resolve/resolved-dns-answer.c b/src/resolve/resolved-dns-answer.c index a2878ec2bb..52ba05644f 100644 --- a/src/resolve/resolved-dns-answer.c +++ b/src/resolve/resolved-dns-answer.c @@ -284,6 +284,16 @@ int dns_answer_contains_zone_nsec3(DnsAnswer *answer, const char *zone) { return false; } +int dns_answer_contains(DnsAnswer *answer, DnsResourceRecord *rr) { + DnsResourceRecord *i; + + DNS_ANSWER_FOREACH(i, answer) + if (dns_resource_record_equal(i, rr)) + return true; + + return false; +} + int dns_answer_find_soa(DnsAnswer *a, const DnsResourceKey *key, DnsResourceRecord **ret, DnsAnswerFlags *flags) { DnsResourceRecord *rr, *soa = NULL; DnsAnswerFlags rr_flags, soa_flags = 0; diff --git a/src/resolve/resolved-dns-answer.h b/src/resolve/resolved-dns-answer.h index d73525cedd..88043081c2 100644 --- a/src/resolve/resolved-dns-answer.h +++ b/src/resolve/resolved-dns-answer.h @@ -47,6 +47,7 @@ int dns_answer_add_soa(DnsAnswer *a, const char *name, uint32_t ttl, int ifindex int dns_answer_match_key(DnsAnswer *a, const DnsResourceKey *key, DnsAnswerFlags *combined_flags); int dns_answer_contains_nsec_or_nsec3(DnsAnswer *a); int dns_answer_contains_zone_nsec3(DnsAnswer *answer, const char *zone); +int dns_answer_contains(DnsAnswer *answer, DnsResourceRecord *rr); int dns_answer_find_soa(DnsAnswer *a, const DnsResourceKey *key, DnsResourceRecord **ret, DnsAnswerFlags *flags); int dns_answer_find_cname_or_dname(DnsAnswer *a, const DnsResourceKey *key, DnsResourceRecord **ret, DnsAnswerFlags *flags); |