resolved-dns-rr.c revision 58db254ade4fb2ef77de68f28c4f13814819f6a1
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen This file is part of systemd.
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen Copyright 2014 Lennart Poettering
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen systemd is free software; you can redistribute it and/or modify it
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen under the terms of the GNU Lesser General Public License as published by
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen the Free Software Foundation; either version 2.1 of the License, or
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen (at your option) any later version.
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen systemd is distributed in the hope that it will be useful, but
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen WITHOUT ANY WARRANTY; without even the implied warranty of
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen Lesser General Public License for more details.
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen You should have received a copy of the GNU Lesser General Public License
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen along with systemd; If not, see <http://www.gnu.org/licenses/>.
091a364c802e34a58f3260c9cb5db9b75c62215cTom GundersenDnsResourceKey* dns_resource_key_new(uint16_t class, uint16_t type, const char *name) {
39d8db043b599a7382f94bfc904d5e108af438bdLennart Poettering k = malloc0(sizeof(DnsResourceKey) + l + 1);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering strcpy((char*) k + sizeof(DnsResourceKey), name);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart PoetteringDnsResourceKey* dns_resource_key_new_cname(const DnsResourceKey *key) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering return dns_resource_key_new(key->class, DNS_TYPE_CNAME, DNS_RESOURCE_KEY_NAME(key));
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart PoetteringDnsResourceKey* dns_resource_key_new_redirect(const DnsResourceKey *key, const DnsResourceRecord *cname) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering assert(IN_SET(cname->key->type, DNS_TYPE_CNAME, DNS_TYPE_DNAME));
a2a416f768e2aa7db5b975cd50eb19237cac9cceLennart Poettering return dns_resource_key_new(key->class, key->type, cname->cname.name);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering r = dns_name_change_suffix(DNS_RESOURCE_KEY_NAME(key), DNS_RESOURCE_KEY_NAME(cname->key), cname->dname.name, &destination);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering return dns_resource_key_ref((DnsResourceKey*) key);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering k = dns_resource_key_new_consume(key->class, key->type, destination);
a2a416f768e2aa7db5b975cd50eb19237cac9cceLennart PoetteringDnsResourceKey* dns_resource_key_new_consume(uint16_t class, uint16_t type, char *name) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart PoetteringDnsResourceKey* dns_resource_key_ref(DnsResourceKey *k) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart PoetteringDnsResourceKey* dns_resource_key_unref(DnsResourceKey *k) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringint dns_resource_key_equal(const DnsResourceKey *a, const DnsResourceKey *b) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering r = dns_name_equal(DNS_RESOURCE_KEY_NAME(a), DNS_RESOURCE_KEY_NAME(b));
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringint dns_resource_key_match_rr(const DnsResourceKey *key, const DnsResourceRecord *rr) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering if (rr->key->class != key->class && key->class != DNS_CLASS_ANY)
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering if (rr->key->type != key->type && key->type != DNS_TYPE_ANY)
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering return dns_name_equal(DNS_RESOURCE_KEY_NAME(rr->key), DNS_RESOURCE_KEY_NAME(key));
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringint dns_resource_key_match_cname(const DnsResourceKey *key, const DnsResourceRecord *rr) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering if (rr->key->class != key->class && key->class != DNS_CLASS_ANY)
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering return dns_name_equal(DNS_RESOURCE_KEY_NAME(key), DNS_RESOURCE_KEY_NAME(rr->key));
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering else if (rr->key->type == DNS_TYPE_DNAME)
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering return dns_name_endswith(DNS_RESOURCE_KEY_NAME(key), DNS_RESOURCE_KEY_NAME(rr->key));
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringstatic void dns_resource_key_hash_func(const void *i, struct siphash *state) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering dns_name_hash_func(DNS_RESOURCE_KEY_NAME(k), state);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering siphash24_compress(&k->class, sizeof(k->class), state);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering siphash24_compress(&k->type, sizeof(k->type), state);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringstatic int dns_resource_key_compare_func(const void *a, const void *b) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering const DnsResourceKey *x = a, *y = b;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering ret = dns_name_compare_func(DNS_RESOURCE_KEY_NAME(x), DNS_RESOURCE_KEY_NAME(y));
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringconst struct hash_ops dns_resource_key_hash_ops = {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringint dns_resource_key_to_string(const DnsResourceKey *key, char **ret) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering char cbuf[strlen("CLASS") + DECIMAL_STR_MAX(uint16_t)], tbuf[strlen("TYPE") + DECIMAL_STR_MAX(uint16_t)];
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering const char *c, *t;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering if (asprintf(&s, "%s %s %-5s", DNS_RESOURCE_KEY_NAME(key), c, t) < 0)
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart PoetteringDnsResourceRecord* dns_resource_record_new(DnsResourceKey *key) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart PoetteringDnsResourceRecord* dns_resource_record_new_full(uint16_t class, uint16_t type, const char *name) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering _cleanup_(dns_resource_key_unrefp) DnsResourceKey *key = NULL;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering key = dns_resource_key_new(class, type, name);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart PoetteringDnsResourceRecord* dns_resource_record_ref(DnsResourceRecord *rr) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart PoetteringDnsResourceRecord* dns_resource_record_unref(DnsResourceRecord *rr) {
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poetteringint dns_resource_record_new_reverse(DnsResourceRecord **ret, int family, const union in_addr_union *address, const char *hostname) {
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering _cleanup_(dns_resource_key_unrefp) DnsResourceKey *key = NULL;
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering _cleanup_(dns_resource_record_unrefp) DnsResourceRecord *rr = NULL;
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering r = dns_name_reverse(family, address, &ptr);
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering key = dns_resource_key_new_consume(DNS_CLASS_IN, DNS_TYPE_PTR, ptr);
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poetteringint dns_resource_record_new_address(DnsResourceRecord **ret, int family, const union in_addr_union *address, const char *name) {
edc501d4674dadc304d45a7e1c5b69e207eb8cd4Lennart Poettering rr = dns_resource_record_new_full(DNS_CLASS_IN, DNS_TYPE_A, name);
edc501d4674dadc304d45a7e1c5b69e207eb8cd4Lennart Poettering rr = dns_resource_record_new_full(DNS_CLASS_IN, DNS_TYPE_AAAA, name);
edc501d4674dadc304d45a7e1c5b69e207eb8cd4Lennart Poetteringint dns_resource_record_equal(const DnsResourceRecord *a, const DnsResourceRecord *b) {
edc501d4674dadc304d45a7e1c5b69e207eb8cd4Lennart Poettering r = dns_resource_key_equal(a->key, b->key);
edc501d4674dadc304d45a7e1c5b69e207eb8cd4Lennart Poettering switch (a->unparseable ? _DNS_TYPE_INVALID : a->key->type) {
90ab504273a7f186ebb76e6acfb778b4e0d7c91bLennart Poettering r = dns_name_equal(a->srv.name, b->srv.name);
90ab504273a7f186ebb76e6acfb778b4e0d7c91bLennart Poettering return a->srv.priority == b->srv.priority &&
edc501d4674dadc304d45a7e1c5b69e207eb8cd4Lennart Poettering return dns_name_equal(a->ptr.name, b->ptr.name);
c4147df156835513c43260a14fc9f7af177f737fLennart Poettering return strcaseeq(a->hinfo.cpu, b->hinfo.cpu) &&
90ab504273a7f186ebb76e6acfb778b4e0d7c91bLennart Poettering case DNS_TYPE_SPF: /* exactly the same as TXT */
edc501d4674dadc304d45a7e1c5b69e207eb8cd4Lennart Poettering return dns_txt_item_equal(a->txt.items, b->txt.items);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering return memcmp(&a->a.in_addr, &b->a.in_addr, sizeof(struct in_addr)) == 0;
c92e531c82a9815ec349aa1bf31236b86b2d5311Lennart Poettering return memcmp(&a->aaaa.in6_addr, &b->aaaa.in6_addr, sizeof(struct in6_addr)) == 0;
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen r = dns_name_equal(a->soa.mname, b->soa.mname);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering r = dns_name_equal(a->soa.rname, b->soa.rname);
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen return dns_name_equal(a->mx.exchange, b->mx.exchange);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering a->ds.digest_type == b->ds.digest_type &&
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering a->ds.digest_size == b->ds.digest_size &&
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering memcmp(a->ds.digest, b->ds.digest, a->ds.digest_size) == 0;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering return a->sshfp.algorithm == b->sshfp.algorithm &&
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering a->sshfp.fingerprint_size == b->sshfp.fingerprint_size &&
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering memcmp(a->sshfp.fingerprint, b->sshfp.fingerprint, a->sshfp.fingerprint_size) == 0;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering return a->dnskey.zone_key_flag == b->dnskey.zone_key_flag &&
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen memcmp(a->dnskey.key, b->dnskey.key, a->dnskey.key_size) == 0;
edc501d4674dadc304d45a7e1c5b69e207eb8cd4Lennart Poettering /* do the fast comparisons first */
edc501d4674dadc304d45a7e1c5b69e207eb8cd4Lennart Poettering if (a->rrsig.type_covered != b->rrsig.type_covered ||
edc501d4674dadc304d45a7e1c5b69e207eb8cd4Lennart Poettering a->rrsig.algorithm != b->rrsig.algorithm ||
edc501d4674dadc304d45a7e1c5b69e207eb8cd4Lennart Poettering a->rrsig.original_ttl != b->rrsig.original_ttl ||
edc501d4674dadc304d45a7e1c5b69e207eb8cd4Lennart Poettering a->rrsig.expiration != b->rrsig.expiration ||
edc501d4674dadc304d45a7e1c5b69e207eb8cd4Lennart Poettering a->rrsig.inception != b->rrsig.inception ||
edc501d4674dadc304d45a7e1c5b69e207eb8cd4Lennart Poettering a->rrsig.signature_size != b->rrsig.signature_size ||
edc501d4674dadc304d45a7e1c5b69e207eb8cd4Lennart Poettering memcmp(a->rrsig.signature, b->rrsig.signature, a->rrsig.signature_size) != 0)
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering return dns_name_equal(a->rrsig.signer, b->rrsig.signer);
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen return dns_name_equal(a->nsec.next_domain_name, b->nsec.next_domain_name) &&
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering bitmap_equal(a->nsec.types, b->nsec.types);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering return a->nsec3.algorithm == b->nsec3.algorithm &&
f0e1546763304aedc90e91d70dab9eeb7c966cf8Lennart Poettering a->nsec3.iterations == b->nsec3.iterations &&
f0e1546763304aedc90e91d70dab9eeb7c966cf8Lennart Poettering a->nsec3.salt_size == b->nsec3.salt_size &&
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering memcmp(a->nsec3.salt, b->nsec3.salt, a->nsec3.salt_size) == 0 &&
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering memcmp(a->nsec3.next_hashed_name, b->nsec3.next_hashed_name, a->nsec3.next_hashed_name_size) == 0 &&
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering bitmap_equal(a->nsec3.types, b->nsec3.types);
f0e1546763304aedc90e91d70dab9eeb7c966cf8Lennart Poettering memcmp(a->generic.data, b->generic.data, a->generic.size) == 0;
096b6773886bd7a0c8c97aa684b0b67dfae58355Lennart Poetteringstatic char* format_location(uint32_t latitude, uint32_t longitude, uint32_t altitude,
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen uint8_t size, uint8_t horiz_pre, uint8_t vert_pre) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering char NS = latitude >= 1U<<31 ? 'N' : 'S';
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering char EW = longitude >= 1U<<31 ? 'E' : 'W';
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering int lat = latitude >= 1U<<31 ? (int) (latitude - (1U<<31)) : (int) ((1U<<31) - latitude);
edc501d4674dadc304d45a7e1c5b69e207eb8cd4Lennart Poettering int lon = longitude >= 1U<<31 ? (int) (longitude - (1U<<31)) : (int) ((1U<<31) - longitude);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering double alt = altitude >= 10000000u ? altitude - 10000000u : -(double)(10000000u - altitude);
902bb5d8abb2a7d258741828d212ca549ab16950Lennart Poettering double siz = (size >> 4) * exp10((double) (size & 0xF));
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering double hor = (horiz_pre >> 4) * exp10((double) (horiz_pre & 0xF));
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering double ver = (vert_pre >> 4) * exp10((double) (vert_pre & 0xF));
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering if (asprintf(&s, "%d %d %.3f %c %d %d %.3f %c %.2fm %.2fm %.2fm %.2fm",
5cb36f41f01cf4b1f4395abfffd1b33116591e58Lennart Poetteringstatic int format_timestamp_dns(char *buf, size_t l, time_t sec) {
5cb36f41f01cf4b1f4395abfffd1b33116591e58Lennart Poettering if (strftime(buf, l, "%Y%m%d%H%M%S", &tm) <= 0)
5cb36f41f01cf4b1f4395abfffd1b33116591e58Lennart Poetteringstatic char *format_types(Bitmap *types) {
5cb36f41f01cf4b1f4395abfffd1b33116591e58Lennart Poettering r = strv_extend(&strv, dns_type_to_string(type));
5cb36f41f01cf4b1f4395abfffd1b33116591e58Lennart Poetteringstatic char *format_txt(DnsTxtItem *first) {
5cb36f41f01cf4b1f4395abfffd1b33116591e58Lennart Poettering p = s = new(char, c);
5cb36f41f01cf4b1f4395abfffd1b33116591e58Lennart Poettering for (j = 0; j < i->length; j++) {
5cb36f41f01cf4b1f4395abfffd1b33116591e58Lennart Poettering if (i->data[j] < ' ' || i->data[j] == '"' || i->data[j] >= 127) {
5cb36f41f01cf4b1f4395abfffd1b33116591e58Lennart Poettering *(p++) = '\\';
5cb36f41f01cf4b1f4395abfffd1b33116591e58Lennart Poettering *(p++) = i->data[j];
5cb36f41f01cf4b1f4395abfffd1b33116591e58Lennart Poetteringint dns_resource_record_to_string(const DnsResourceRecord *rr, char **ret) {
5cb36f41f01cf4b1f4395abfffd1b33116591e58Lennart Poettering _cleanup_free_ char *k = NULL, *t = NULL;
5cb36f41f01cf4b1f4395abfffd1b33116591e58Lennart Poettering r = dns_resource_key_to_string(rr->key, &k);
5cb36f41f01cf4b1f4395abfffd1b33116591e58Lennart Poettering switch (rr->unparseable ? _DNS_TYPE_INVALID : rr->key->type) {
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen s = strjoin(k, " ", rr->hinfo.cpu, " ", rr->hinfo.os, NULL);
bda2c408f8a739c19161818bcc842107f60652a2Tom Gundersen case DNS_TYPE_SPF: /* exactly the same as TXT */
bda2c408f8a739c19161818bcc842107f60652a2Tom Gundersen r = in_addr_to_string(AF_INET, (const union in_addr_union*) &rr->a.in_addr, &x);
4713135eae4f7b6b670a98476fe413edfa1d9f41Zbigniew Jędrzejewski-Szmek r = in_addr_to_string(AF_INET6, (const union in_addr_union*) &rr->aaaa.in6_addr, &t);
4713135eae4f7b6b670a98476fe413edfa1d9f41Zbigniew Jędrzejewski-Szmek r = asprintf(&s, "%s %s %s %u %u %u %u %u",
bda2c408f8a739c19161818bcc842107f60652a2Tom Gundersen t = hexmem(rr->ds.digest, rr->ds.digest_size);
87f5a19343acf8ba697acc5a62bdb1a2b8c9eda3Lennart Poettering t = hexmem(rr->sshfp.fingerprint, rr->sshfp.fingerprint_size);
bda2c408f8a739c19161818bcc842107f60652a2Tom Gundersen const char *alg;
bda2c408f8a739c19161818bcc842107f60652a2Tom Gundersen alg = dnssec_algorithm_to_string(rr->dnskey.algorithm);
bda2c408f8a739c19161818bcc842107f60652a2Tom Gundersen t = base64mem(rr->dnskey.key, rr->dnskey.key_size);
87f5a19343acf8ba697acc5a62bdb1a2b8c9eda3Lennart Poettering alg ? 0 : 1, alg ? 0u : (unsigned) rr->dnskey.algorithm,
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen char expiration[strlen("YYYYMMDDHHmmSS") + 1], inception[strlen("YYYYMMDDHHmmSS") + 1];
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering type = dns_type_to_string(rr->rrsig.type_covered);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering alg = dnssec_algorithm_to_string(rr->rrsig.algorithm);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering t = base64mem(rr->rrsig.signature, rr->rrsig.signature_size);
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen r = format_timestamp_dns(expiration, sizeof(expiration), rr->rrsig.expiration);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering r = format_timestamp_dns(inception, sizeof(inception), rr->rrsig.inception);
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen /* TYPE?? follows
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering * http://tools.ietf.org/html/rfc3597#section-5 */
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering r = asprintf(&s, "%s %s%.*u %.*s%.*u %u %u %s %s %u %s %s",
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering type ? 0 : 1, type ? 0u : (unsigned) rr->rrsig.type_covered,
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering alg ? 0 : 1, alg ? 0u : (unsigned) rr->rrsig.algorithm,
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering _cleanup_free_ char *salt = NULL, *hash = NULL;
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering salt = hexmem(rr->nsec3.salt, rr->nsec3.salt_size);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering hash = base32hexmem(rr->nsec3.next_hashed_name, rr->nsec3.next_hashed_name_size, false);
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering r = asprintf(&s, "%s %"PRIu8" %"PRIu8" %"PRIu16" %s %s %s",
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering t = hexmem(rr->generic.data, rr->generic.size);
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering r = asprintf(&s, "%s \\# %zu %s", k, rr->generic.size, t);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poetteringconst char *dns_class_to_string(uint16_t class) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringint dns_class_from_string(const char *s, uint16_t *class) {
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart PoetteringDnsTxtItem *dns_txt_item_free_all(DnsTxtItem *i) {
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poetteringbool dns_txt_item_equal(DnsTxtItem *a, DnsTxtItem *b) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering if (memcmp(a->data, b->data, a->length) != 0)