resolved-dns-rr.c revision 6f717d0817573a76c3e586eae02793d8b23a0581
d4205751d4643c272059a3728045929dd0e5e800Lennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
d4205751d4643c272059a3728045929dd0e5e800Lennart Poettering This file is part of systemd.
d4205751d4643c272059a3728045929dd0e5e800Lennart Poettering Copyright 2014 Lennart Poettering
d4205751d4643c272059a3728045929dd0e5e800Lennart Poettering systemd is free software; you can redistribute it and/or modify it
d4205751d4643c272059a3728045929dd0e5e800Lennart Poettering under the terms of the GNU Lesser General Public License as published by
d4205751d4643c272059a3728045929dd0e5e800Lennart Poettering the Free Software Foundation; either version 2.1 of the License, or
d4205751d4643c272059a3728045929dd0e5e800Lennart Poettering (at your option) any later version.
d4205751d4643c272059a3728045929dd0e5e800Lennart Poettering systemd is distributed in the hope that it will be useful, but
d4205751d4643c272059a3728045929dd0e5e800Lennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
d4205751d4643c272059a3728045929dd0e5e800Lennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
d4205751d4643c272059a3728045929dd0e5e800Lennart Poettering Lesser General Public License for more details.
d4205751d4643c272059a3728045929dd0e5e800Lennart Poettering You should have received a copy of the GNU Lesser General Public License
d4205751d4643c272059a3728045929dd0e5e800Lennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
844ec79b3c2f246114ea316ebe1f36044bdb688eZbigniew Jędrzejewski-Szmek#include "resolved-dns-packet.h"
844ec79b3c2f246114ea316ebe1f36044bdb688eZbigniew Jędrzejewski-SzmekDnsResourceKey* dns_resource_key_new(uint16_t class, uint16_t type, const char *name) {
return NULL;
DnsResourceKey* dns_resource_key_new_redirect(const DnsResourceKey *key, const DnsResourceRecord *cname) {
DnsResourceKey *k;
r = dns_name_change_suffix(DNS_RESOURCE_KEY_NAME(key), DNS_RESOURCE_KEY_NAME(cname->key), cname->dname.name, &destination);
return NULL;
return NULL;
char *joined;
if (!new_key) {
return -ENOMEM;
DnsResourceKey *k;
return NULL;
return NULL;
k->n_ref++;
return NULL;
free(k);
k->n_ref--;
return NULL;
int dns_resource_key_match_rr(const DnsResourceKey *key, DnsResourceRecord *rr, const char *search_domain) {
if (search_domain) {
int dns_resource_key_match_cname_or_dname(const DnsResourceKey *key, const DnsResourceKey *cname, const char *search_domain) {
if (search_domain) {
const DnsResourceKey *k = i;
assert(k);
static int dns_resource_key_compare_func(const void *a, const void *b) {
const DnsResourceKey *x = a, *y = b;
int ret;
if (ret != 0)
return ret;
char cbuf[strlen("CLASS") + DECIMAL_STR_MAX(uint16_t)], tbuf[strlen("TYPE") + DECIMAL_STR_MAX(uint16_t)];
c = cbuf;
t = tbuf;
return -ENOMEM;
*ret = s;
if (!rr)
return NULL;
return rr;
if (!key)
return NULL;
if (!rr)
return NULL;
return rr;
if (!rr)
return NULL;
return NULL;
case DNS_TYPE_SRV:
case DNS_TYPE_PTR:
case DNS_TYPE_NS:
case DNS_TYPE_CNAME:
case DNS_TYPE_DNAME:
case DNS_TYPE_HINFO:
case DNS_TYPE_TXT:
case DNS_TYPE_SPF:
case DNS_TYPE_SOA:
case DNS_TYPE_MX:
case DNS_TYPE_DS:
case DNS_TYPE_SSHFP:
case DNS_TYPE_DNSKEY:
case DNS_TYPE_RRSIG:
case DNS_TYPE_NSEC:
case DNS_TYPE_NSEC3:
case DNS_TYPE_LOC:
case DNS_TYPE_A:
case DNS_TYPE_AAAA:
return NULL;
int dns_resource_record_new_reverse(DnsResourceRecord **ret, int family, const union in_addr_union *address, const char *hostname) {
if (!key)
return -ENOMEM;
if (!rr)
return -ENOMEM;
return -ENOMEM;
int dns_resource_record_new_address(DnsResourceRecord **ret, int family, const union in_addr_union *address, const char *name) {
if (!rr)
return -ENOMEM;
if (!rr)
return -ENOMEM;
return -EAFNOSUPPORT;
assert(a);
assert(b);
case DNS_TYPE_SRV:
case DNS_TYPE_PTR:
case DNS_TYPE_NS:
case DNS_TYPE_CNAME:
case DNS_TYPE_DNAME:
case DNS_TYPE_HINFO:
case DNS_TYPE_TXT:
case DNS_TYPE_A:
case DNS_TYPE_AAAA:
case DNS_TYPE_SOA:
case DNS_TYPE_MX:
case DNS_TYPE_LOC:
case DNS_TYPE_DS:
case DNS_TYPE_SSHFP:
case DNS_TYPE_DNSKEY:
case DNS_TYPE_RRSIG:
case DNS_TYPE_NSEC:
case DNS_TYPE_NSEC3:
memcmp(a->nsec3.next_hashed_name, b->nsec3.next_hashed_name, a->nsec3.next_hashed_name_size) == 0 &&
NS,
EW,
return NULL;
return -EINVAL;
return -EINVAL;
Iterator i;
unsigned type;
return NULL;
return NULL;
return NULL;
if (!str)
return NULL;
DnsTxtItem *i;
p = s = new(char, c);
return NULL;
size_t j;
if (i != first)
for (j = 0; j < i->length; j++) {
*(p++) = i->data[j];
return NULL;
case DNS_TYPE_SRV:
return NULL;
case DNS_TYPE_PTR:
case DNS_TYPE_NS:
case DNS_TYPE_CNAME:
case DNS_TYPE_DNAME:
return NULL;
case DNS_TYPE_HINFO:
return NULL;
case DNS_TYPE_TXT:
return NULL;
return NULL;
case DNS_TYPE_A: {
return NULL;
return NULL;
case DNS_TYPE_AAAA:
return NULL;
return NULL;
case DNS_TYPE_SOA:
return NULL;
case DNS_TYPE_MX:
return NULL;
case DNS_TYPE_LOC:
return NULL;
return NULL;
case DNS_TYPE_DS:
return NULL;
return NULL;
case DNS_TYPE_SSHFP:
return NULL;
return NULL;
case DNS_TYPE_DNSKEY: {
const char *alg;
return NULL;
return NULL;
case DNS_TYPE_RRSIG: {
return NULL;
return NULL;
return NULL;
* http://tools.ietf.org/html/rfc3597#section-5 */
return NULL;
case DNS_TYPE_NSEC:
return NULL;
return NULL;
case DNS_TYPE_NSEC3: {
if (!salt)
return NULL;
if (!hash)
return NULL;
return NULL;
hash,
return NULL;
return NULL;
return NULL;
.on_stack = true,
.refuse_compression = true,
DnsTxtItem *n;
return NULL;
n = i->items_next;
free(i);
return dns_txt_item_free_all(n);
/* Mnemonics as listed on https://www.iana.org/assignments/dns-sec-alg-numbers/dns-sec-alg-numbers.xhtml */
/* Names as listed on https://www.iana.org/assignments/ds-rr-types/ds-rr-types.xhtml */