Commit Diff
Diff:
ae63ff0da1133007649bb52cf5e0d6020c43db72
e550ac3607b5b44775b0dd60e718f59f44342c33
Commit:
e550ac3607b5b44775b0dd60e718f59f44342c33
Tree:
c58aed868dba30ee5812a7e8aca03144259194b6
Author:
pjp <pjp@delphinusdns.org>
Committer:
pjp <pjp@delphinusdns.org>
Date:
Thu May 7 12:17:35 2020 UTC
Message:
conform to RFC 2181 section 5.2. Basically each RRset has the same TTL.. A very tedious commit, change the ttl on a per RR level to a per RRset level. An RRSET is all A's, or all AAAA's in a domain name like the apex. This caused some confusion with RRSIG records and I had to resort to reading RFC 4034 again. With the help of Habbie in #dns I was able to overcome my confusion. To quote RFC 4034 section 3: The TTL value of an RRSIG RR MUST match the TTL value of the RRset it covers. This is an exception to the [RFC 2181] rules for TTL values of individual RRs within an RRset; individual RRSIG RRs with the same owner name will have different TTL values if the RRsets they cover have different TTL values. Tested on OpenBSD/amd64
blob - 03c4994f1bb1a5aacc6a43ae94fbb39f27de3f86
blob + 7ebc8a7fa37972731a10180cad6d2a35350fa803
--- additional.c
+++ additional.c
@@ -27,7 +27,7 @@
*/
/*
- * $Id: additional.c,v 1.34 2020/04/01 11:42:01 pjp Exp $
+ * $Id: additional.c,v 1.35 2020/05/07 12:17:35 pjp Exp $
*/
#include <sys/types.h>
@@ -145,7 +145,7 @@ additional_a(char *name, int namelen, struct rbtree *r
answer->type = htons(DNS_TYPE_A);
answer->class = htons(DNS_CLASS_IN);
- answer->ttl = htonl(((struct a *)rrp->rdata)->ttl);
+ answer->ttl = htonl(rrset->ttl);
answer->rdlength = htons(sizeof(in_addr_t));
@@ -214,7 +214,7 @@ additional_aaaa(char *name, int namelen, struct rbtree
answer->type = htons(DNS_TYPE_AAAA);
answer->class = htons(DNS_CLASS_IN);
- answer->ttl = htonl(((struct aaaa *)rrp->rdata)->ttl);
+ answer->ttl = htonl(rrset->ttl);
answer->rdlength = htons(sizeof(struct in6_addr));
@@ -285,7 +285,7 @@ additional_mx(char *name, int namelen, struct rbtree *
answer->type = htons(DNS_TYPE_MX);
answer->class = htons(DNS_CLASS_IN);
- answer->ttl = htonl(((struct smx *)rrp->rdata)->ttl);
+ answer->ttl = htonl(rrset->ttl);
answer->mx_priority = htons(((struct smx *)rrp->rdata)->preference);
offset += sizeof(struct answer);
@@ -371,7 +371,7 @@ additional_ptr(char *name, int namelen, struct rbtree
answer->type = htons(DNS_TYPE_PTR);
answer->class = htons(DNS_CLASS_IN);
- answer->ttl = htonl(((struct ptr *)rrp->rdata)->ttl);
+ answer->ttl = htonl(rrset->ttl);
offset += sizeof(struct answer);
@@ -806,7 +806,7 @@ additional_nsec(char *name, int namelen, int inttype,
answer = (struct answer *)&reply[offset];
answer->type = htons(DNS_TYPE_NSEC);
answer->class = htons(DNS_CLASS_IN);
- answer->ttl = htonl(((struct nsec *)rrp->rdata)->ttl);
+ answer->ttl = htonl(rrset->ttl);
answer->rdlength = htons(((struct nsec *)rrp->rdata)->ndn_len +
((struct nsec *)rrp->rdata)->bitmap_len);
@@ -891,7 +891,7 @@ additional_nsec3(char *name, int namelen, int inttype,
answer = (struct answer *)&reply[offset];
answer->type = htons(DNS_TYPE_NSEC3);
answer->class = htons(DNS_CLASS_IN);
- answer->ttl = htonl(((struct nsec3 *)rrp->rdata)->ttl);
+ answer->ttl = htonl(rrset->ttl);
answer->rdlength = htons(6 + ((struct nsec3 *)rrp->rdata)->saltlen +
((struct nsec3 *)rrp->rdata)->nextlen +
((struct nsec3 *)rrp->rdata)->bitmap_len);
@@ -994,7 +994,7 @@ additional_ds(char *name, int namelen, struct rbtree *
answer->type = htons(DNS_TYPE_DS);
answer->class = htons(DNS_CLASS_IN);
- answer->ttl = htonl(((struct ds *)rrp->rdata)->ttl);
+ answer->ttl = htonl(rrset->ttl);
answer->key_tag = htons(((struct ds *)rrp->rdata)->key_tag);
answer->algorithm = ((struct ds *)rrp->rdata)->algorithm;
answer->digest_type = ((struct ds *)rrp->rdata)->digest_type;
blob - 0e4534296b180299ff02a33cff5c9d5162e471f7
blob + ffaddb25c1f1c2667f0579ddac6cb1e1b78fd1a6
--- axfr.c
+++ axfr.c
@@ -27,7 +27,7 @@
*/
/*
- * $Id: axfr.c,v 1.41 2020/03/10 07:42:53 pjp Exp $
+ * $Id: axfr.c,v 1.42 2020/05/07 12:17:35 pjp Exp $
*/
#include <sys/types.h>
@@ -1300,7 +1300,7 @@ build_soa(ddDB *db, char *reply, int offset, struct rb
answer->name[1] = 0x0c;
answer->type = htons(DNS_TYPE_SOA);
answer->class = htons(DNS_CLASS_IN);
- answer->ttl = htonl(((struct soa *)rrp->rdata)->ttl);
+ answer->ttl = htonl(rrset->ttl);
offset += 12; /* up to rdata length */
blob - 76f0e30ff8b430af732df6ab830d84a9a369aa97
blob + 32f0ab7541edb97514c1c1d06c4d19d4c20af5d5
--- db.c
+++ db.c
@@ -27,7 +27,7 @@
*/
/*
- * $Id: db.c,v 1.17 2020/01/14 12:42:04 pjp Exp $
+ * $Id: db.c,v 1.18 2020/05/07 12:17:35 pjp Exp $
*/
#include <sys/types.h>
@@ -62,7 +62,7 @@
#include "ddd-dns.h"
#include "ddd-db.h"
-struct rbtree * create_rr(ddDB *db, char *name, int len, int type, void *rdata);
+struct rbtree * create_rr(ddDB *db, char *name, int len, int type, void *rdata, uint32_t ttl);
struct rbtree * find_rrset(ddDB *db, char *name, int len);
struct rrset * find_rr(struct rbtree *rbt, u_int16_t rrtype);
int add_rr(struct rbtree *rbt, char *name, int len, u_int16_t rrtype, void *rdata);
@@ -178,7 +178,7 @@ dddbclose(ddDB *db)
}
struct rbtree *
-create_rr(ddDB *db, char *name, int len, int type, void *rdata)
+create_rr(ddDB *db, char *name, int len, int type, void *rdata, uint32_t ttl)
{
struct rbtree *rbt = NULL;
struct rrset *rrset = NULL;
@@ -214,6 +214,11 @@ create_rr(ddDB *db, char *name, int len, int type, voi
}
rrset->rrtype = type;
+ if (type != DNS_TYPE_RRSIG)
+ rrset->ttl = ttl;
+ else
+ rrset->ttl = 0; /* fill in later */
+
TAILQ_INIT(&rrset->rr_head);
TAILQ_INSERT_TAIL(&rbt->rrset_head, rrset, entries);
@@ -243,10 +248,14 @@ create_rr(ddDB *db, char *name, int len, int type, voi
return NULL;
}
- myrr->ttl = 86400;
myrr->rdata = rdata;
myrr->changed = time(NULL);
+ if (type == DNS_TYPE_RRSIG) {
+ struct rrsig *rrsig = (struct rrsig *)rdata;
+ rrsig->ttl = ttl;
+ }
+
TAILQ_INSERT_TAIL(&rrset->rr_head, myrr, entries);
return (rbt);
@@ -302,6 +311,7 @@ add_rr(struct rbtree *rbt, char *name, int len, u_int1
}
rp->rrtype = rrtype;
+ rp->ttl = 86400;
TAILQ_INIT(&rp->rr_head);
TAILQ_INSERT_TAIL(&rbt->rrset_head, rp, entries);
@@ -313,7 +323,6 @@ add_rr(struct rbtree *rbt, char *name, int len, u_int1
return -1;
}
- rt->ttl = 86400;
rt->changed = time(NULL);
rt->rdata = rdata;
@@ -348,9 +357,9 @@ display_rr(struct rrset *rrset)
TAILQ_FOREACH_SAFE(rrp, &rrset->rr_head, entries, rrp0) {
#if __linux__
- printf("%ld:%u:%s\n", rrp->changed, rrp->ttl, (char *)rrp->rdata);
+ printf("%ld:%u:%s\n", rrp->changed, rrset->ttl, (char *)rrp->rdata);
#else
- printf("%lld:%u:%s\n", rrp->changed, rrp->ttl, (char *)rrp->rdata);
+ printf("%lld:%u:%s\n", rrp->changed, rrset->ttl, (char *)rrp->rdata);
#endif
}
blob - 59d3c5876c90560aef4730478360cf8024ea04c8
blob + d1c0f4bde2e8b14c97b28d47d9757d8eb9767632
--- ddd-db.h
+++ ddd-db.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005-2019 Peter J. Philipp
+ * Copyright (c) 2005-2020 Peter J. Philipp
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -27,7 +27,7 @@
*/
/*
- * $Id: ddd-db.h,v 1.31 2019/12/11 16:55:01 pjp Exp $
+ * $Id: ddd-db.h,v 1.32 2020/05/07 12:17:35 pjp Exp $
*/
#ifndef _DB_H
@@ -85,7 +85,6 @@ struct dnskey {
u_int8_t algorithm; /* would be 5, RFC 3110 */
char public_key[4096];
u_int16_t publickey_len;
- u_int32_t ttl;
} __attribute__((packed));
struct rrsig {
@@ -100,7 +99,7 @@ struct rrsig {
u_int8_t signame_len;
char signature[4096];
u_int16_t signature_len;
- u_int32_t ttl;
+ uint32_t ttl; /* RFC 4034 section 3, the TTL value of ... */
int used; /* if this RRSIG is used at all */
} __attribute__((packed));
@@ -118,7 +117,6 @@ struct nsec {
u_int8_t ndn_len; /* next domain name length */
char bitmap[8192];
u_int16_t bitmap_len;
- u_int32_t ttl;
} __attribute__((packed));
struct nsec3 {
@@ -131,7 +129,6 @@ struct nsec3 {
u_int8_t nextlen; /* next domain name length */
char bitmap[8192];
u_int16_t bitmap_len;
- u_int32_t ttl;
} __attribute__((packed));
struct nsec3param {
@@ -140,7 +137,6 @@ struct nsec3param {
u_int16_t iterations;
u_int8_t saltlen;
char salt[256];
- u_int32_t ttl;
} __attribute__((packed));
struct ds {
@@ -149,7 +145,6 @@ struct ds {
u_int8_t digest_type;
char digest[4096];
u_int16_t digestlen;
- u_int32_t ttl;
} __attribute__((packed));
@@ -163,14 +158,12 @@ struct soa {
u_int32_t retry;
u_int32_t expire;
u_int32_t minttl;
- u_int32_t ttl;
} __attribute__((packed));
struct smx {
u_int16_t preference; /* MX preference */
char exchange[DNS_MAXNAME]; /* name of exchange server */
int exchangelen; /* length of exchange server name */
- u_int32_t ttl;
} __attribute__((packed));
struct ns {
@@ -179,7 +172,6 @@ struct ns {
int ns_type; /* set if it's a delegation */
#define NS_TYPE_DELEGATE 0x1
#define NS_TYPE_HINT 0x2
- u_int32_t ttl;
} __attribute__((packed));
@@ -189,7 +181,6 @@ struct srv {
u_int16_t port; /* 16 bit port */
char target[DNS_MAXNAME]; /* SRV target name */
int targetlen; /* SRV target name length */
- u_int32_t ttl;
} __attribute__((packed));
struct sshfp {
@@ -197,7 +188,6 @@ struct sshfp {
u_int8_t fptype; /* SSHFP fingerprint type */
char fingerprint[DNS_MAXNAME]; /* fingerprint */
int fplen; /* fingerprint length */
- u_int32_t ttl;
} __attribute__((packed));
struct tlsa {
@@ -206,7 +196,6 @@ struct tlsa {
u_int8_t matchtype; /* TLSA matching type */
char data[DNS_MAXNAME]; /* TLSA data */
int datalen; /* data length */
- u_int32_t ttl;
} __attribute__((packed));
struct naptr {
@@ -220,35 +209,29 @@ struct naptr {
int regexplen; /* regexp len */
char replacement[DNS_MAXNAME]; /* replacement this is a domain */
int replacementlen;
- u_int32_t ttl;
} __attribute__((packed));
struct cname {
char cname[DNS_MAXNAME]; /* CNAME RR */
int cnamelen; /* len of CNAME */
- u_int32_t ttl;
} __attribute__((packed));
struct ptr {
char ptr[DNS_MAXNAME]; /* PTR RR */
int ptrlen; /* len of PTR */
- u_int32_t ttl;
} __attribute__((packed));
struct txt {
char txt[1024]; /* TXT string */
int txtlen; /* len of TXT */
- u_int32_t ttl;
} __attribute__((packed));
struct a {
in_addr_t a; /* IP addresses */
- u_int32_t ttl;
} __attribute__((packed));
struct aaaa {
struct in6_addr aaaa; /* IPv6 addresses */
- u_int32_t ttl;
} __attribute__((packed));
@@ -313,13 +296,13 @@ typedef struct __dddb {
struct rr {
void *rdata;
- u_int32_t ttl;
time_t changed;
TAILQ_ENTRY(rr) entries;
};
struct rrset {
u_int16_t rrtype;
+ u_int32_t ttl;
TAILQ_ENTRY(rrset) entries;
TAILQ_HEAD(rrh, rr) rr_head;
};
blob - 616468833dbd94eef03e30150e7b94cb707b71c2
blob + 0243c9398aeb62fc689854c18e639ba6f4e47906
--- dddctl.c
+++ dddctl.c
@@ -27,7 +27,7 @@
*/
/*
- * $Id: dddctl.c,v 1.104 2020/04/10 17:08:14 pjp Exp $
+ * $Id: dddctl.c,v 1.105 2020/05/07 12:17:35 pjp Exp $
*/
#include <sys/types.h>
@@ -748,7 +748,7 @@ print_rbt_bind(FILE *of, struct rbtree *rbt)
}
fprintf(of, "%s %d IN SOA %s %s (\n\t\t\t\t%u\t; Serial\n\t\t\t\t%d\t; Refresh\n\t\t\t\t%d\t; Retry\n\t\t\t\t%d\t; Expire\n\t\t\t\t%d )\t; Minimum TTL\n\n",
convert_name(rbt->zone, rbt->zonelen),
- ((struct soa *)rrp->rdata)->ttl,
+ rrset->ttl,
convert_name(((struct soa *)rrp->rdata)->nsserver, ((struct soa *)rrp->rdata)->nsserver_len),
convert_name(((struct soa *)rrp->rdata)->responsible_person, ((struct soa *)rrp->rdata)->rp_len),
((struct soa *)rrp->rdata)->serial,
@@ -765,7 +765,7 @@ print_rbt_bind(FILE *of, struct rbtree *rbt)
TAILQ_FOREACH(rrp2, &rrset->rr_head, entries) {
fprintf(of, "%s %d IN NS %s\n",
convert_name(rbt->zone, rbt->zonelen),
- ((struct ns *)rrp2->rdata)->ttl,
+ rrset->ttl,
convert_name(((struct ns *)rrp2->rdata)->nsserver, ((struct ns *)rrp2->rdata)->nslen));
}
}
@@ -777,7 +777,7 @@ print_rbt_bind(FILE *of, struct rbtree *rbt)
TAILQ_FOREACH(rrp2, &rrset->rr_head, entries) {
fprintf(of, "%s %d IN MX %d %s\n",
convert_name(rbt->zone, rbt->zonelen),
- ((struct smx *)rrp2->rdata)->ttl,
+ rrset->ttl,
((struct smx *)rrp2->rdata)->preference,
convert_name(((struct smx *)rrp2->rdata)->exchange, ((struct smx *)rrp2->rdata)->exchangelen));
}
@@ -790,7 +790,7 @@ print_rbt_bind(FILE *of, struct rbtree *rbt)
TAILQ_FOREACH(rrp2, &rrset->rr_head, entries) {
fprintf(of, "%s %d IN DS %d %d %d (%s)\n",
convert_name(rbt->zone, rbt->zonelen),
- ((struct ds *)rrp2->rdata)->ttl,
+ rrset->ttl,
((struct ds *)rrp2->rdata)->key_tag,
((struct ds *)rrp2->rdata)->algorithm,
((struct ds *)rrp2->rdata)->digest_type,
@@ -804,7 +804,7 @@ print_rbt_bind(FILE *of, struct rbtree *rbt)
}
fprintf(of, "%s %d IN CNAME %s\n",
convert_name(rbt->zone, rbt->zonelen),
- ((struct cname *)rrp->rdata)->ttl,
+ rrset->ttl,
convert_name(((struct cname *)rrp->rdata)->cname, ((struct cname *)rrp->rdata)->cnamelen));
}
if ((rrset = find_rr(rbt, DNS_TYPE_NAPTR)) != NULL) {
@@ -815,7 +815,7 @@ print_rbt_bind(FILE *of, struct rbtree *rbt)
TAILQ_FOREACH(rrp2, &rrset->rr_head, entries) {
fprintf(of, "%s %d IN NAPTR %d\t%d\t\"",
convert_name(rbt->zone, rbt->zonelen),
- ((struct naptr *)rrp2->rdata)->ttl,
+ rrset->ttl,
((struct naptr *)rrp2->rdata)->order,
((struct naptr *)rrp2->rdata)->preference);
@@ -841,7 +841,7 @@ print_rbt_bind(FILE *of, struct rbtree *rbt)
TAILQ_FOREACH(rrp2, &rrset->rr_head, entries) {
fprintf(of, "%s %d IN TXT \"",
convert_name(rbt->zone, rbt->zonelen),
- ((struct txt *)rrp->rdata)->ttl);
+ rrset->ttl);
for (i = 0; i < ((struct txt *)rrp2->rdata)->txtlen; i++) {
if (i % 256 == 0)
@@ -859,7 +859,7 @@ print_rbt_bind(FILE *of, struct rbtree *rbt)
}
fprintf(of, "%s %d IN PTR %s\n",
convert_name(rbt->zone, rbt->zonelen),
- ((struct ptr *)rrp->rdata)->ttl,
+ rrset->ttl,
convert_name(((struct ptr *)rrp->rdata)->ptr, ((struct ptr *)rrp->rdata)->ptrlen));
}
if ((rrset = find_rr(rbt, DNS_TYPE_SRV)) != NULL) {
@@ -870,7 +870,7 @@ print_rbt_bind(FILE *of, struct rbtree *rbt)
TAILQ_FOREACH(rrp2, &rrset->rr_head, entries) {
fprintf(of, "%s %d IN SRV %d %d %d %s\n",
convert_name(rbt->zone, rbt->zonelen),
- ((struct srv *)rrp2->rdata)->ttl,
+ rrset->ttl,
((struct srv *)rrp2->rdata)->priority,
((struct srv *)rrp2->rdata)->weight,
((struct srv *)rrp2->rdata)->port,
@@ -885,7 +885,7 @@ print_rbt_bind(FILE *of, struct rbtree *rbt)
TAILQ_FOREACH(rrp2, &rrset->rr_head, entries) {
fprintf(of, "%s %d IN TLSA %d %d %d (%s)\n",
convert_name(rbt->zone, rbt->zonelen),
- ((struct tlsa *)rrp2->rdata)->ttl,
+ rrset->ttl,
((struct tlsa *)rrp2->rdata)->usage,
((struct tlsa *)rrp2->rdata)->selector,
((struct tlsa *)rrp2->rdata)->matchtype,
@@ -900,7 +900,7 @@ print_rbt_bind(FILE *of, struct rbtree *rbt)
TAILQ_FOREACH(rrp2, &rrset->rr_head, entries) {
fprintf(of, "%s %d IN SSHFP %d %d (%s)\n",
convert_name(rbt->zone, rbt->zonelen),
- ((struct sshfp *)rrp2->rdata)->ttl,
+ rrset->ttl,
((struct sshfp *)rrp2->rdata)->algorithm,
((struct sshfp *)rrp2->rdata)->fptype,
bin2hex(((struct sshfp *)rrp2->rdata)->fingerprint, ((struct sshfp *)rrp2->rdata)->fplen));
@@ -915,7 +915,7 @@ print_rbt_bind(FILE *of, struct rbtree *rbt)
inet_ntop(AF_INET, &((struct a *)rrp2->rdata)->a, buf, sizeof(buf));
fprintf(of, "%s %d IN A %s\n",
convert_name(rbt->zone, rbt->zonelen),
- ((struct a *)rrp2->rdata)->ttl,
+ rrset->ttl,
buf);
}
}
@@ -928,7 +928,7 @@ print_rbt_bind(FILE *of, struct rbtree *rbt)
inet_ntop(AF_INET6, &((struct aaaa *)rrp2->rdata)->aaaa , buf, sizeof(buf));
fprintf(of, "%s %d IN AAAA %s\n",
convert_name(rbt->zone, rbt->zonelen),
- ((struct aaaa *)rrp2->rdata)->ttl,
+ rrset->ttl,
buf);
}
}
@@ -942,7 +942,7 @@ print_rbt_bind(FILE *of, struct rbtree *rbt)
buf[len] = '\0';
fprintf(of, "%s %d IN DNSKEY %d %d %d (%s)\n",
convert_name(rbt->zone, rbt->zonelen),
- ((struct dnskey *)rrp2->rdata)->ttl,
+ rrset->ttl,
((struct dnskey *)rrp2->rdata)->flags,
((struct dnskey *)rrp2->rdata)->protocol,
((struct dnskey *)rrp2->rdata)->algorithm,
@@ -970,7 +970,7 @@ print_rbt_bind(FILE *of, struct rbtree *rbt)
fprintf(of, "%s %d IN NSEC3 %d %d %d %s %s %s\n",
convert_name(rbt->zone, rbt->zonelen),
- ((struct nsec3 *)rrp->rdata)->ttl,
+ rrset->ttl,
((struct nsec3 *)rrp->rdata)->algorithm,
((struct nsec3 *)rrp->rdata)->flags,
((struct nsec3 *)rrp->rdata)->iterations,
@@ -990,7 +990,7 @@ print_rbt_bind(FILE *of, struct rbtree *rbt)
fprintf(of, "%s %d IN RRSIG (%s %d %d %d %llu %llu %d %s %s)\n",
convert_name(rbt->zone, rbt->zonelen),
- ((struct rrsig *)rrp2->rdata)->ttl,
+ rrset->ttl,
get_dns_type(((struct rrsig *)rrp2->rdata)->type_covered, 0),
((struct rrsig *)rrp2->rdata)->algorithm,
((struct rrsig *)rrp2->rdata)->labels,
blob - 53f3ac90a42558a461a974e1fa018bd3b2fd7cf5
blob + be32c5c34cdbc7e26bad3865e79b12bf7ee5d31f
--- parse.y
+++ parse.y
@@ -21,7 +21,7 @@
*/
/*
- * $Id: parse.y,v 1.96 2020/04/23 06:28:28 pjp Exp $
+ * $Id: parse.y,v 1.97 2020/05/07 12:17:35 pjp Exp $
*/
%{
@@ -98,7 +98,7 @@ extern int insert_tsig_key(char *, int, char *, int);
extern void slave_shutdown(void);
extern int mybase64_encode(u_char const *, size_t, char *, size_t);
extern int mybase64_decode(char const *, u_char *, size_t);
-extern struct rbtree * create_rr(ddDB *db, char *name, int len, int type, void *rdata);
+extern struct rbtree * create_rr(ddDB *, char *, int, int, void *, uint32_t);
extern struct rbtree * find_rrset(ddDB *db, char *name, int len);
extern struct rrset * find_rr(struct rbtree *rbt, u_int16_t rrtype);
extern int add_rr(struct rbtree *rbt, char *name, int len, u_int16_t rrtype, void *rdata);
@@ -2109,11 +2109,10 @@ fill_cname(char *name, char *type, int myttl, char *ho
cname->cnamelen = len;
memcpy((char *)cname->cname, myname, len);
- cname->ttl = myttl;
free(myname);
- rbt = create_rr(db, converted_name, converted_namelen, DNS_TYPE_CNAME, cname);
+ rbt = create_rr(db, converted_name, converted_namelen, DNS_TYPE_CNAME, cname, myttl);
if (rbt == NULL) {
dolog(LOG_ERR, "create_rr failed\n");
return -1;
@@ -2164,11 +2163,10 @@ fill_ptr(char *name, char *type, int myttl, char *host
ptr->ptrlen = len;
memcpy((char *)ptr->ptr, myname, len);
- ptr->ttl = myttl;
free(myname);
- rbt = create_rr(db, converted_name, converted_namelen, DNS_TYPE_PTR, ptr);
+ rbt = create_rr(db, converted_name, converted_namelen, DNS_TYPE_PTR, ptr, myttl);
if (rbt == NULL) {
dolog(LOG_ERR, "create_rr failed\n");
return -1;
@@ -2211,7 +2209,6 @@ fill_dnskey(char *name, char *type, u_int32_t myttl, u
dnskey->flags = flags;
dnskey->protocol = protocol;
dnskey->algorithm = algorithm;
- dnskey->ttl = myttl;
/* feed our base64 key to the public key */
ret = mybase64_decode(pubkey, dnskey->public_key, sizeof(dnskey->public_key));
@@ -2221,7 +2218,7 @@ fill_dnskey(char *name, char *type, u_int32_t myttl, u
dnskey->publickey_len = ret;
- rbt = create_rr(db, converted_name, converted_namelen, DNS_TYPE_DNSKEY, dnskey);
+ rbt = create_rr(db, converted_name, converted_namelen, DNS_TYPE_DNSKEY, dnskey, myttl);
if (rbt == NULL) {
dolog(LOG_ERR, "create_rr failed\n");
return -1;
@@ -2284,9 +2281,8 @@ fill_rrsig(char *name, char *type, u_int32_t myttl, ch
rrsig->type_covered = rr->type;
rrsig->algorithm = algorithm;
rrsig->labels = labels;
- rrsig->ttl = original_ttl;
-
rrsig->original_ttl = original_ttl;
+
snprintf(tmpbuf, sizeof(tmpbuf), "%llu", sig_expiration);
if (strptime(tmpbuf, "%Y%m%d%H%M%S", &tmbuf) == NULL) {
perror("sig_expiration");
@@ -2320,7 +2316,7 @@ fill_rrsig(char *name, char *type, u_int32_t myttl, ch
rrsig->signature_len = ret;
- rbt = create_rr(db, converted_name, converted_namelen, DNS_TYPE_RRSIG, rrsig);
+ rbt = create_rr(db, converted_name, converted_namelen, DNS_TYPE_RRSIG, rrsig, original_ttl);
if (rbt == NULL) {
dolog(LOG_ERR, "create_rr failed\n");
return -1;
@@ -2386,9 +2382,8 @@ fill_ds(char *name, char *type, u_int32_t myttl, u_int
ret = hex2bin(digest, strlen(digest), ds->digest);
ds->digestlen = ret;
- ds->ttl = myttl;
- rbt = create_rr(db, converted_name, converted_namelen, DNS_TYPE_DS, ds);
+ rbt = create_rr(db, converted_name, converted_namelen, DNS_TYPE_DS, ds, myttl);
if (rbt == NULL) {
dolog(LOG_ERR, "create_rr failed\n");
return -1;
@@ -2464,9 +2459,7 @@ fill_nsec3(char *name, char *type, u_int32_t myttl, u_
printf(";nsec3->bitmap == \"%s\", nsec3->bitmap_len == %d\n", bitmap, nsec3->bitmap_len);
#endif
- nsec3->ttl = myttl;
-
- rbt = create_rr(db, converted_name, converted_namelen, DNS_TYPE_NSEC3, nsec3);
+ rbt = create_rr(db, converted_name, converted_namelen, DNS_TYPE_NSEC3, nsec3, myttl);
if (rbt == NULL) {
dolog(LOG_ERR, "create_rr failed\n");
return -1;
@@ -2511,9 +2504,7 @@ fill_nsec3param(char *name, char *type, u_int32_t mytt
nsec3param->saltlen = (strlen(salt) / 2);
hex2bin(salt, strlen(salt), nsec3param->salt);
}
- nsec3param->ttl = myttl;
-
- rbt = create_rr(db, converted_name, converted_namelen, DNS_TYPE_NSEC3PARAM, nsec3param);
+ rbt = create_rr(db, converted_name, converted_namelen, DNS_TYPE_NSEC3PARAM, nsec3param, myttl);
if (rbt == NULL) {
dolog(LOG_ERR, "create_rr failed\n");
return -1;
@@ -2566,9 +2557,8 @@ fill_nsec(char *name, char *type, u_int32_t myttl, cha
nsec->ndn_len = converted_domainnamelen;
create_nsec_bitmap(bitmap, nsec->bitmap, (int *)&nsec->bitmap_len);
- nsec->ttl = myttl;
- rbt = create_rr(db, converted_name, converted_namelen, DNS_TYPE_NSEC, nsec);
+ rbt = create_rr(db, converted_name, converted_namelen, DNS_TYPE_NSEC, nsec, myttl);
if (rbt == NULL) {
dolog(LOG_ERR, "create_rr failed\n");
return -1;
@@ -2637,9 +2627,8 @@ fill_naptr(char *name, char *type, int myttl, int orde
memcpy(&naptr->replacement, naptrname, naptr_namelen);
naptr->replacementlen = naptr_namelen;
- naptr->ttl = myttl;
- rbt = create_rr(db, converted_name, converted_namelen, DNS_TYPE_NAPTR, naptr);
+ rbt = create_rr(db, converted_name, converted_namelen, DNS_TYPE_NAPTR, naptr, myttl);
if (rbt == NULL) {
dolog(LOG_ERR, "create_rr failed\n");
return -1;
@@ -2712,9 +2701,8 @@ fill_txt(char *name, char *type, int myttl, char *msg)
memcpy(&txt->txt, tmp, len);
txt->txtlen = len;
- txt->ttl = myttl;
- rbt = create_rr(db, converted_name, converted_namelen, DNS_TYPE_TXT, txt);
+ rbt = create_rr(db, converted_name, converted_namelen, DNS_TYPE_TXT, txt, myttl);
if (rbt == NULL) {
dolog(LOG_ERR, "create_rr failed\n");
return -1;
@@ -2782,9 +2770,8 @@ fill_tlsa(char *name, char *type, int myttl, uint8_t u
}
- tlsa->ttl = myttl;
- rbt = create_rr(db, converted_name, converted_namelen, DNS_TYPE_TLSA, tlsa);
+ rbt = create_rr(db, converted_name, converted_namelen, DNS_TYPE_TLSA, tlsa, myttl);
if (rbt == NULL) {
dolog(LOG_ERR, "create_rr failed\n");
return -1;
@@ -2842,9 +2829,8 @@ fill_sshfp(char *name, char *type, int myttl, int alg,
memset(sshfp->fingerprint, 0, sizeof(sshfp->fingerprint));
ret = hex2bin(fingerprint, strlen(fingerprint), sshfp->fingerprint);
- sshfp->ttl = myttl;
- rbt = create_rr(db, converted_name, converted_namelen, DNS_TYPE_SSHFP, sshfp);
+ rbt = create_rr(db, converted_name, converted_namelen, DNS_TYPE_SSHFP, sshfp, myttl);
if (rbt == NULL) {
dolog(LOG_ERR, "create_rr failed\n");
return -1;
@@ -2885,7 +2871,6 @@ fill_srv(char *name, char *type, int myttl, int priori
return -1;
}
- srv->ttl = myttl;
srv->priority = priority;
srv->weight = weight;
srv->port = port;
@@ -2904,9 +2889,8 @@ fill_srv(char *name, char *type, int myttl, int priori
srv->targetlen = 1;
free (srvname);
- srv->ttl = myttl;
- rbt = create_rr(db, converted_name, converted_namelen, DNS_TYPE_SRV, srv);
+ rbt = create_rr(db, converted_name, converted_namelen, DNS_TYPE_SRV, srv, myttl);
if (rbt == NULL) {
dolog(LOG_ERR, "create_rr failed\n");
return -1;
@@ -2946,7 +2930,6 @@ fill_mx(char *name, char *type, int myttl, int priorit
return -1;
}
mx->preference = priority;
- mx->ttl = myttl;
mxname = dns_label(mxhost, &len);
if (mxname == NULL) {
@@ -2959,7 +2942,7 @@ fill_mx(char *name, char *type, int myttl, int priorit
free (mxname);
- rbt = create_rr(db, converted_name, converted_namelen, DNS_TYPE_MX, mx);
+ rbt = create_rr(db, converted_name, converted_namelen, DNS_TYPE_MX, mx, myttl);
if (rbt == NULL) {
dolog(LOG_ERR, "create_rr failed\n");
return -1;
@@ -3004,9 +2987,8 @@ fill_a(char *name, char *type, int myttl, char *a)
dolog(LOG_INFO, "could not parse A record on line %d\n", file->lineno);
return (-1);
}
- sa->ttl = myttl;
- rbt = create_rr(db, converted_name, converted_namelen, DNS_TYPE_A, sa);
+ rbt = create_rr(db, converted_name, converted_namelen, DNS_TYPE_A, sa, myttl);
if (rbt == NULL) {
dolog(LOG_ERR, "create_rr failed\n");
return -1;
@@ -3053,10 +3035,8 @@ fill_aaaa(char *name, char *type, int myttl, char *aaa
dolog(LOG_INFO, "AAAA \"%s\" unparseable line %d\n", aaaa, file->lineno);
return -1;
}
-
- saaaa->ttl = myttl;
- rbt = create_rr(db, converted_name, converted_namelen, DNS_TYPE_AAAA, saaaa);
+ rbt = create_rr(db, converted_name, converted_namelen, DNS_TYPE_AAAA, saaaa, myttl);
if (rbt == NULL) {
dolog(LOG_ERR, "create_rr failed\n");
return -1;
@@ -3143,9 +3123,8 @@ fill_ns(char *name, char *type, int myttl, char *names
free(myname);
ns->ns_type = nstype;
- ns->ttl = myttl;
- rbt = create_rr(db, converted_name, converted_namelen, DNS_TYPE_NS, ns);
+ rbt = create_rr(db, converted_name, converted_namelen, DNS_TYPE_NS, ns, myttl);
if (rbt == NULL) {
dolog(LOG_ERR, "create_rr failed\n");
return -1;
@@ -3227,9 +3206,8 @@ fill_soa(char *name, char *type, int myttl, char *auth
soa->retry = retry;
soa->expire = expire;
soa->minttl = ttl;
- soa->ttl = myttl;
- rbt = create_rr(db, converted_name, converted_namelen, DNS_TYPE_SOA, soa);
+ rbt = create_rr(db, converted_name, converted_namelen, DNS_TYPE_SOA, soa, myttl);
if (rbt == NULL) {
dolog(LOG_ERR, "create_rr failed\n");
return -1;
blob - 4380e4b54906b68046091b5ba37d21b4933b1883
blob + c20ce23527a640ac13f7cb50c020b1fc9cc370bd
--- reply.c
+++ reply.c
@@ -27,7 +27,7 @@
*/
/*
- * $Id: reply.c,v 1.100 2020/04/23 06:28:28 pjp Exp $
+ * $Id: reply.c,v 1.101 2020/05/07 12:17:35 pjp Exp $
*/
#include <sys/types.h>
@@ -246,7 +246,7 @@ reply_a(struct sreply *sreply, ddDB *db)
answer->name[1] = 0x0c; /* 2 bytes */
answer->type = q->hdr->qtype; /* 4 bytes */
answer->class = q->hdr->qclass; /* 6 bytes */
- answer->ttl = htonl(((struct a *)rrp->rdata)->ttl); /* 10 b */
+ answer->ttl = htonl(rrset->ttl); /* 10 b */
answer->rdlength = htons(sizeof(in_addr_t)); /* 12 bytes */
@@ -461,7 +461,7 @@ reply_nsec3param(struct sreply *sreply, ddDB *db)
answer->name[1] = 0x0c; /* 2 bytes */
answer->type = q->hdr->qtype; /* 4 bytes */
answer->class = q->hdr->qclass; /* 6 bytes */
- answer->ttl = htonl(((struct nsec3param *)rrp->rdata)->ttl);
+ answer->ttl = htonl(rrset->ttl);
answer->rdlength = htons(((struct nsec3param *)rrp->rdata)->saltlen + 5); /* 5 = rest */
@@ -672,7 +672,7 @@ reply_nsec3(struct sreply *sreply, ddDB *db)
answer->name[1] = 0x0c; /* 2 bytes */
answer->type = q->hdr->qtype; /* 4 bytes */
answer->class = q->hdr->qclass; /* 6 bytes */
- answer->ttl = htonl(((struct nsec3 *)rrp->rdata)->ttl); /* 10 b */
+ answer->ttl = htonl(rrset->ttl); /* 10 b */
answer->rdlength = htons(nextlen + bitmaplen + saltlen + 6); /* 6 = rest */
@@ -880,7 +880,7 @@ reply_nsec(struct sreply *sreply, ddDB *db)
answer->name[1] = 0x0c; /* 2 bytes */
answer->type = q->hdr->qtype; /* 4 bytes */
answer->class = q->hdr->qclass; /* 6 bytes */
- answer->ttl = htonl(((struct nsec *)rrp->rdata)->ttl); /* 10 b */
+ answer->ttl = htonl(rrset->ttl); /* 10 b */
answer->rdlength = htons(ndnlen + bitmaplen);
@@ -1070,7 +1070,7 @@ reply_ds(struct sreply *sreply, ddDB *db)
answer->name[1] = 0x0c; /* 2 bytes */
answer->type = q->hdr->qtype; /* 4 bytes */
answer->class = q->hdr->qclass; /* 6 bytes */
- answer->ttl = htonl(((struct ds *)rrp->rdata)->ttl); /* 10 */
+ answer->ttl = htonl(rrset->ttl); /* 10 */
answer->rdlength = htons(((struct ds *)rrp->rdata)->digestlen + 4); /* 12 bytes */
@@ -1267,7 +1267,7 @@ reply_dnskey(struct sreply *sreply, ddDB *db)
answer->name[1] = 0x0c; /* 2 bytes */
answer->type = q->hdr->qtype; /* 4 bytes */
answer->class = q->hdr->qclass; /* 6 bytes */
- answer->ttl = htonl(((struct dnskey *)rrp->rdata)->ttl);
+ answer->ttl = htonl(rrset->ttl);
answer->rdlength = htons(((struct dnskey *)rrp->rdata)->publickey_len + 4); /* 12 bytes */
@@ -1569,7 +1569,7 @@ reply_aaaa(struct sreply *sreply, ddDB *db)
answer->name[1] = 0x0c;
answer->type = q->hdr->qtype;
answer->class = q->hdr->qclass;
- answer->ttl = htonl(((struct aaaa *)rrp->rdata)->ttl);
+ answer->ttl = htonl(rrset->ttl);
answer->rdlength = htons(sizeof(struct in6_addr));
@@ -1757,7 +1757,7 @@ reply_mx(struct sreply *sreply, ddDB *db)
answer->name[1] = 0x0c;
answer->type = q->hdr->qtype;
answer->class = q->hdr->qclass;
- answer->ttl = htonl(((struct smx *)rrp->rdata)->ttl);
+ answer->ttl = htonl(rrset->ttl);
answer->rdlength = htons(sizeof(u_int16_t) + ((struct smx *)rrp->rdata)->exchangelen);
@@ -2094,7 +2094,7 @@ reply_ns(struct sreply *sreply, ddDB *db)
answer = (struct answer *)(&reply[outlen] + rbt1->zonelen);
answer->type = htons(DNS_TYPE_NS);
answer->class = q->hdr->qclass;
- answer->ttl = htonl(((struct ns *)rrp->rdata)->ttl);
+ answer->ttl = htonl(rrset->ttl);
name = ((struct ns *)rrp->rdata)->nsserver;
namelen = ((struct ns *)rrp->rdata)->nslen;
@@ -2479,7 +2479,7 @@ reply_cname(struct sreply *sreply, ddDB *db)
answer->name[1] = 0x0c;
answer->type = htons(DNS_TYPE_CNAME);
answer->class = q->hdr->qclass;
- answer->ttl = htonl(((struct cname *)rrp->rdata)->ttl);
+ answer->ttl = htonl(rrset->ttl);
outlen += 12; /* up to rdata length */
@@ -2798,7 +2798,7 @@ reply_ptr(struct sreply *sreply, ddDB *db)
answer->name[1] = 0x0c;
answer->type = q->hdr->qtype;
answer->class = q->hdr->qclass;
- answer->ttl = htonl(((struct ptr *)rrp->rdata)->ttl);
+ answer->ttl = htonl(rrset->ttl);
outlen += 12; /* up to rdata length */
@@ -2988,7 +2988,7 @@ reply_soa(struct sreply *sreply, ddDB *db)
answer->name[1] = 0x0c;
answer->type = q->hdr->qtype;
answer->class = q->hdr->qclass;
- answer->ttl = htonl(((struct soa *)rrp->rdata)->ttl);
+ answer->ttl = htonl(rrset->ttl);
outlen += 12; /* up to rdata length */
@@ -3240,7 +3240,7 @@ reply_txt(struct sreply *sreply, ddDB *db)
answer->name[1] = 0x0c; /* 2 bytes */
answer->type = q->hdr->qtype; /* 4 bytes */
answer->class = q->hdr->qclass; /* 6 bytes */
- answer->ttl = htonl(((struct txt *)rrp->rdata)->ttl); /* 10 b */
+ answer->ttl = htonl(rrset->ttl); /* 10 b */
/* 12 bytes */
answer->rdlength = htons(((struct txt *)rrp->rdata)->txtlen);
@@ -3561,7 +3561,7 @@ reply_tlsa(struct sreply *sreply, ddDB *db)
answer->name[1] = 0x0c;
answer->type = q->hdr->qtype;
answer->class = q->hdr->qclass;
- answer->ttl = htonl(((struct tlsa *)rrp->rdata)->ttl);
+ answer->ttl = htonl(rrset->ttl);
switch (((struct tlsa *)rrp->rdata)->matchtype) {
case 1:
@@ -3748,7 +3748,7 @@ reply_sshfp(struct sreply *sreply, ddDB *db)
answer->name[1] = 0x0c;
answer->type = q->hdr->qtype;
answer->class = q->hdr->qclass;
- answer->ttl = htonl(((struct sshfp *)rrp->rdata)->ttl);
+ answer->ttl = htonl(rrset->ttl);
switch (((struct sshfp *)rrp->rdata)->fptype) {
case 1:
@@ -3938,7 +3938,7 @@ reply_naptr(struct sreply *sreply, ddDB *db)
answer->name[1] = 0x0c;
answer->type = q->hdr->qtype;
answer->class = q->hdr->qclass;
- answer->ttl = htonl(((struct naptr *)rrp->rdata)->ttl);
+ answer->ttl = htonl(rrset->ttl);
answer->naptr_order = htons(((struct naptr *)rrp->rdata)->order);
answer->naptr_preference = htons(((struct naptr *)rrp->rdata)->preference);
@@ -4157,7 +4157,7 @@ reply_srv(struct sreply *sreply, ddDB *db)
answer->name[1] = 0x0c;
answer->type = q->hdr->qtype;
answer->class = q->hdr->qclass;
- answer->ttl = htonl(((struct srv *)rrp->rdata)->ttl);
+ answer->ttl = htonl(rrset->ttl);
answer->rdlength = htons((3 * sizeof(u_int16_t)) + ((struct srv *)rrp->rdata)->targetlen);
@@ -4464,7 +4464,7 @@ reply_nxdomain(struct sreply *sreply, ddDB *db)
answer->type = htons(DNS_TYPE_SOA);
answer->class = q->hdr->qclass;
- answer->ttl = htonl(((struct soa *)rrp->rdata)->ttl);
+ answer->ttl = htonl(rrset->ttl);
outlen += 10; /* sizeof(struct answer) up to rdata length */
@@ -5178,7 +5178,7 @@ reply_noerror(struct sreply *sreply, ddDB *db)
answer->type = htons(DNS_TYPE_SOA);
answer->class = q->hdr->qclass;
- answer->ttl = htonl(((struct soa *)rrp->rdata)->ttl);
+ answer->ttl = htonl(rrset->ttl);
outlen += 10; /* up to rdata length */
@@ -5569,7 +5569,7 @@ create_anyreply(struct sreply *sreply, char *reply, in
answer->type = htons(DNS_TYPE_SOA);
answer->class = htons(DNS_CLASS_IN);
- answer->ttl = htonl(((struct soa *)rrp->rdata)->ttl);
+ answer->ttl = htonl(rrset->ttl);
offset += 10; /* up to rdata length */
@@ -5689,7 +5689,7 @@ create_anyreply(struct sreply *sreply, char *reply, in
answer->type = htons(DNS_TYPE_DNSKEY);
answer->class = htons(DNS_CLASS_IN);
- answer->ttl = htonl(((struct dnskey *)rrp->rdata)->ttl);
+ answer->ttl = htonl(rrset->ttl);
answer->rdlength = htons(namelen);
@@ -5745,7 +5745,7 @@ create_anyreply(struct sreply *sreply, char *reply, in
answer->type = htons(DNS_TYPE_DS);
answer->class = htons(DNS_CLASS_IN);
- answer->ttl = htonl(((struct ds *)rrp->rdata)->ttl);
+ answer->ttl = htonl(rrset->ttl);
answer->rdlength = htons(namelen);
@@ -5800,7 +5800,7 @@ create_anyreply(struct sreply *sreply, char *reply, in
answer->type = htons(DNS_TYPE_NSEC3);
answer->class = htons(DNS_CLASS_IN);
- answer->ttl = htonl(((struct nsec3 *)rrp->rdata)->ttl);
+ answer->ttl = htonl(rrset->ttl);
answer->rdlength = htons(namelen);
@@ -5877,7 +5877,7 @@ create_anyreply(struct sreply *sreply, char *reply, in
answer->type = htons(DNS_TYPE_NSEC3PARAM);
answer->class = htons(DNS_CLASS_IN);
- answer->ttl = htonl(((struct nsec3param *)rrp->rdata)->ttl);
+ answer->ttl = htonl(rrset->ttl);
answer->rdlength = htons(namelen);
@@ -5939,7 +5939,7 @@ create_anyreply(struct sreply *sreply, char *reply, in
answer->type = htons(DNS_TYPE_NSEC);
answer->class = htons(DNS_CLASS_IN);
- answer->ttl = htonl(((struct nsec *)rrp->rdata)->ttl);
+ answer->ttl = htonl(rrset->ttl);
answer->rdlength = htons(namelen);
@@ -5985,7 +5985,7 @@ create_anyreply(struct sreply *sreply, char *reply, in
answer->type = htons(DNS_TYPE_NS);
answer->class = htons(DNS_CLASS_IN);
- answer->ttl = htonl(((struct ns *)rrp->rdata)->ttl);
+ answer->ttl = htonl(rrset->ttl);
answer->rdlength = htons(namelen);
@@ -6041,7 +6041,7 @@ create_anyreply(struct sreply *sreply, char *reply, in
answer->type = htons(DNS_TYPE_PTR);
answer->class = htons(DNS_CLASS_IN);
- answer->ttl = htonl(((struct ptr *)rrp->rdata)->ttl);
+ answer->ttl = htonl(rrset->ttl);
offset += 10; /* up to rdata length */
@@ -6094,7 +6094,7 @@ create_anyreply(struct sreply *sreply, char *reply, in
answer->type = htons(DNS_TYPE_MX);
answer->class = htons(DNS_CLASS_IN);
- answer->ttl = htonl(((struct smx *)rrp->rdata)->ttl);
+ answer->ttl = htonl(rrset->ttl);
answer->rdlength = htons(sizeof(u_int16_t) + ((struct smx *)rrp->rdata)->exchangelen);
offset += 10; /* up to rdata length */
@@ -6145,7 +6145,7 @@ create_anyreply(struct sreply *sreply, char *reply, in
answer->type = htons(DNS_TYPE_TXT);
answer->class = htons(DNS_CLASS_IN);
- answer->ttl = htonl(((struct txt *)rrp->rdata)->ttl);
+ answer->ttl = htonl(rrset->ttl);
offset += 10; /* up to rdata length */
@@ -6190,7 +6190,7 @@ create_anyreply(struct sreply *sreply, char *reply, in
answer->type = htons(DNS_TYPE_TLSA);
answer->class = htons(DNS_CLASS_IN);
- answer->ttl = htonl(((struct tlsa *)rrp->rdata)->ttl);
+ answer->ttl = htonl(rrset->ttl);
typelen = ((struct tlsa *)rrp->rdata)->matchtype == 1 ? DNS_TLSA_SIZE_SHA256 : DNS_TLSA_SIZE_SHA512;
answer->rdlength = htons((3 * sizeof(u_int8_t)) + typelen);
@@ -6251,7 +6251,7 @@ create_anyreply(struct sreply *sreply, char *reply, in
answer->type = htons(DNS_TYPE_SSHFP);
answer->class = htons(DNS_CLASS_IN);
- answer->ttl = htonl(((struct sshfp *)rrp->rdata)->ttl);
+ answer->ttl = htonl(rrset->ttl);
answer->rdlength = htons((2 * sizeof(u_int8_t)) + ((struct sshfp *)rrp->rdata)->fplen);
offset += 10; /* up to rdata length */
@@ -6304,7 +6304,7 @@ create_anyreply(struct sreply *sreply, char *reply, in
answer->type = htons(DNS_TYPE_NAPTR);
answer->class = htons(DNS_CLASS_IN);
- answer->ttl = htonl(((struct naptr *)rrp->rdata)->ttl);
+ answer->ttl = htonl(rrset->ttl);
answer->rdlength = htons((2 * sizeof(u_int16_t)) + ((struct naptr *)rrp->rdata)->flagslen + 1 + ((struct naptr *)rrp->rdata)->serviceslen + 1 + ((struct naptr *)rrp->rdata)->regexplen + 1 + ((struct naptr *)rrp->rdata)->replacementlen);
offset += 10; /* up to rdata length */
@@ -6388,7 +6388,7 @@ create_anyreply(struct sreply *sreply, char *reply, in
answer->type = htons(DNS_TYPE_SRV);
answer->class = htons(DNS_CLASS_IN);
- answer->ttl = htonl(((struct srv *)rrp->rdata)->ttl);
+ answer->ttl = htonl(rrset->ttl);
answer->rdlength = htons((3 * sizeof(u_int16_t)) + ((struct srv *)rrp->rdata)->targetlen);
offset += 10; /* up to rdata length */
@@ -6447,7 +6447,7 @@ create_anyreply(struct sreply *sreply, char *reply, in
answer->type = htons(DNS_TYPE_CNAME);
answer->class = htons(DNS_CLASS_IN);
- answer->ttl = htonl(((struct cname *)rrp->rdata)->ttl);
+ answer->ttl = htonl(rrset->ttl);
offset += 10; /* up to rdata length */
@@ -6495,7 +6495,7 @@ create_anyreply(struct sreply *sreply, char *reply, in
answer->type = htons(DNS_TYPE_A);
answer->class = htons(DNS_CLASS_IN);
- answer->ttl = htonl(((struct a *)rrp->rdata)->ttl);
+ answer->ttl = htonl(rrset->ttl);
answer->rdlength = htons(sizeof(in_addr_t));
memcpy((char *)&answer->rdata, (char *)&((struct a *)rrp->rdata)->a,
@@ -6530,7 +6530,7 @@ create_anyreply(struct sreply *sreply, char *reply, in
answer->type = htons(DNS_TYPE_AAAA);
answer->class = htons(DNS_CLASS_IN);
- answer->ttl = htonl(((struct aaaa *)rrp->rdata)->ttl);
+ answer->ttl = htonl(rrset->ttl);
answer->rdlength = htons(sizeof(struct in6_addr));
offset += 10;
blob - 316031437c4e40385802891f306f48e15982bbce
blob + 26a75e5733e44fb8f2bd98710d7bea9e2469f4e6
--- sign.c
+++ sign.c
@@ -27,7 +27,7 @@
*/
/*
- * $Id: sign.c,v 1.2 2020/04/11 07:15:22 pjp Exp $
+ * $Id: sign.c,v 1.3 2020/05/07 12:17:36 pjp Exp $
*/
#include <sys/types.h>
@@ -1875,7 +1875,7 @@ sign_soa(ddDB *db, char *zonename, int expiry, struct
p++;
pack8(p, labels);
p++;
- pack32(p, htonl(((struct soa *)rrp->rdata)->ttl));
+ pack32(p, htonl(rrset->ttl));
p += 4;
snprintf(timebuf, sizeof(timebuf), "%lld", expiredon);
@@ -1903,7 +1903,7 @@ sign_soa(ddDB *db, char *zonename, int expiry, struct
p += 2;
pack16(p, htons(DNS_CLASS_IN));
p += 2;
- pack32(p, htonl(((struct soa *)rrp->rdata)->ttl));
+ pack32(p, htonl(rrset->ttl));
p += 4;
pack16(p, htons(((struct soa *)rrp->rdata)->nsserver_len + ((struct soa *)rrp->rdata)->rp_len + 4 + 4 + 4 + 4 + 4));
p += 2;
@@ -1936,7 +1936,7 @@ sign_soa(ddDB *db, char *zonename, int expiry, struct
len = mybase64_encode(signature, siglen, tmp, sizeof(tmp));
tmp[len] = '\0';
- if (fill_rrsig(rbt->humanname, "RRSIG", ((struct soa *)rrp->rdata)->ttl, "SOA", algorithm, labels, ((struct soa *)rrp->rdata)->ttl, expiredon, signedon, keyid, zonename, tmp) < 0) {
+ if (fill_rrsig(rbt->humanname, "RRSIG", rrset->ttl, "SOA", algorithm, labels, rrset->ttl, expiredon, signedon, keyid, zonename, tmp) < 0) {
dolog(LOG_INFO, "fill_rrsig\n");
return -1;
}
@@ -2077,7 +2077,7 @@ sign_txt(ddDB *db, char *zonename, int expiry, struct
p++;
pack8(p, labels);
p++;
- pack32(p, htonl(((struct txt *)rrp->rdata)->ttl));
+ pack32(p, htonl(rrset->ttl));
p += sizeof(u_int32_t);
snprintf(timebuf, sizeof(timebuf), "%lld", expiredon);
@@ -2105,7 +2105,7 @@ sign_txt(ddDB *db, char *zonename, int expiry, struct
pack16(q, htons(DNS_CLASS_IN));
q += 2;
/* the below uses rrp! because we can't have an rrsig differ */
- pack32(q, htonl(((struct txt *)rrp->rdata)->ttl));
+ pack32(q, htonl(rrset->ttl));
q += 4;
pack16(q, htons(((struct txt *)rrp2->rdata)->txtlen));
q += 2;
@@ -2162,7 +2162,7 @@ sign_txt(ddDB *db, char *zonename, int expiry, struct
len = mybase64_encode(signature, siglen, tmp, sizeof(tmp));
tmp[len] = '\0';
- if (fill_rrsig(rbt->humanname, "RRSIG", ((struct txt *)rrp->rdata)->ttl, "TXT", algorithm, labels, ((struct txt *)rrp->rdata)->ttl, expiredon, signedon, keyid, zonename, tmp) < 0) {
+ if (fill_rrsig(rbt->humanname, "RRSIG", rrset->ttl, "TXT", algorithm, labels, rrset->ttl, expiredon, signedon, keyid, zonename, tmp) < 0) {
dolog(LOG_INFO, "fill_rrsig\n");
return -1;
}
@@ -2300,7 +2300,7 @@ sign_aaaa(ddDB *db, char *zonename, int expiry, struct
p++;
pack8(p, labels);
p++;
- pack32(p, htonl(((struct aaaa *)rrp->rdata)->ttl));
+ pack32(p, htonl(rrset->ttl));
p += 4;
snprintf(timebuf, sizeof(timebuf), "%lld", expiredon);
@@ -2330,7 +2330,7 @@ sign_aaaa(ddDB *db, char *zonename, int expiry, struct
pack16(q, htons(DNS_CLASS_IN));
q += 2;
/* the below uses rrp! because we can't have an rrsig differ */
- pack32(q, htonl(((struct aaaa *)rrp->rdata)->ttl));
+ pack32(q, htonl(rrset->ttl));
q += 4;
pack16(q, htons(sizeof(struct in6_addr)));
q += 2;
@@ -2391,7 +2391,7 @@ sign_aaaa(ddDB *db, char *zonename, int expiry, struct
len = mybase64_encode(signature, siglen, tmp, sizeof(tmp));
tmp[len] = '\0';
- if (fill_rrsig(rbt->humanname, "RRSIG", ((struct aaaa *)rrp->rdata)->ttl, "AAAA", algorithm, labels, ((struct aaaa *)rrp->rdata)->ttl, expiredon, signedon, keyid, zonename, tmp) < 0) {
+ if (fill_rrsig(rbt->humanname, "RRSIG", rrset->ttl, "AAAA", algorithm, labels, rrset->ttl, expiredon, signedon, keyid, zonename, tmp) < 0) {
dolog(LOG_INFO, "fill_rrsig\n");
return -1;
}
@@ -2516,7 +2516,7 @@ sign_nsec3(ddDB *db, char *zonename, int expiry, struc
p++;
pack8(p, labels);
p++;
- pack32(p, htonl(((struct nsec3 *)rrp->rdata)->ttl));
+ pack32(p, htonl(rrset->ttl));
p += 4;
snprintf(timebuf, sizeof(timebuf), "%lld", expiredon);
@@ -2545,7 +2545,7 @@ sign_nsec3(ddDB *db, char *zonename, int expiry, struc
p += 2;
pack16(p, htons(DNS_CLASS_IN));
p += 2;
- pack32(p, htonl(((struct nsec3 *)rrp->rdata)->ttl));
+ pack32(p, htonl(rrset->ttl));
p += 4;
pack16(p, htons(1 + 1 + 2 + 1 + ((struct nsec3 *)rrp->rdata)->saltlen + 1 + ((struct nsec3 *)rrp->rdata)->nextlen + ((struct nsec3 *)rrp->rdata)->bitmap_len));
p += 2;
@@ -2587,7 +2587,7 @@ sign_nsec3(ddDB *db, char *zonename, int expiry, struc
len = mybase64_encode(signature, siglen, tmp, sizeof(tmp));
tmp[len] = '\0';
- if (fill_rrsig(rbt->humanname, "RRSIG", ((struct nsec3 *)rrp->rdata)->ttl, "NSEC3", algorithm, labels, ((struct nsec3 *)rrp->rdata)->ttl, expiredon, signedon, keyid, zonename, tmp) < 0) {
+ if (fill_rrsig(rbt->humanname, "RRSIG", rrset->ttl, "NSEC3", algorithm, labels, rrset->ttl, expiredon, signedon, keyid, zonename, tmp) < 0) {
dolog(LOG_INFO, "fill_rrsig\n");
return -1;
}
@@ -2712,7 +2712,7 @@ sign_nsec3param(ddDB *db, char *zonename, int expiry,
p++;
pack8(p, labels);
p++;
- pack32(p, htonl(((struct nsec3param *)rrp->rdata)->ttl));
+ pack32(p, htonl(rrset->ttl));
p += 4;
snprintf(timebuf, sizeof(timebuf), "%lld", expiredon);
@@ -2740,7 +2740,7 @@ sign_nsec3param(ddDB *db, char *zonename, int expiry,
p += 2;
pack16(p, htons(DNS_CLASS_IN));
p += 2;
- pack32(p, htonl(((struct nsec3param *)rrp->rdata)->ttl));
+ pack32(p, htonl(rrset->ttl));
p += 4;
pack16(p, htons(1 + 1 + 2 + 1 + ((struct nsec3param *)rrp->rdata)->saltlen));
p += 2;
@@ -2898,7 +2898,7 @@ sign_cname(ddDB *db, char *zonename, int expiry, struc
p++;
pack8(p, labels);
p++;
- pack32(p, htonl(((struct cname *)rrp->rdata)->ttl));
+ pack32(p, htonl(rrset->ttl));
p += 4;
snprintf(timebuf, sizeof(timebuf), "%lld", expiredon);
@@ -2926,7 +2926,7 @@ sign_cname(ddDB *db, char *zonename, int expiry, struc
p += 2;
pack16(p, htons(DNS_CLASS_IN));
p += 2;
- pack32(p, htonl(((struct cname *)rrp->rdata)->ttl));
+ pack32(p, htonl(rrset->ttl));
p += 4;
pack16(p, htons(((struct cname *)rrp->rdata)->cnamelen));
p += 2;
@@ -2946,7 +2946,7 @@ sign_cname(ddDB *db, char *zonename, int expiry, struc
len = mybase64_encode(signature, siglen, tmp, sizeof(tmp));
tmp[len] = '\0';
- if (fill_rrsig(rbt->humanname, "RRSIG", ((struct cname *)rrp->rdata)->ttl, "CNAME", algorithm, labels, ((struct cname *)rrp->rdata)->ttl, expiredon, signedon, keyid, zonename, tmp) < 0) {
+ if (fill_rrsig(rbt->humanname, "RRSIG", rrset->ttl, "CNAME", algorithm, labels, rrset->ttl, expiredon, signedon, keyid, zonename, tmp) < 0) {
dolog(LOG_INFO, "fill_rrsig\n");
return -1;
}
@@ -3071,7 +3071,7 @@ sign_ptr(ddDB *db, char *zonename, int expiry, struct
p++;
pack8(p, labels);
p++;
- pack32(p, htonl(((struct ptr *)rrp->rdata)->ttl));
+ pack32(p, htonl(rrset->ttl));
p += 4;
snprintf(timebuf, sizeof(timebuf), "%lld", expiredon);
@@ -3099,7 +3099,7 @@ sign_ptr(ddDB *db, char *zonename, int expiry, struct
p += 2;
pack16(p, htons(DNS_CLASS_IN));
p += 2;
- pack32(p, htonl(((struct ptr *)rrp->rdata)->ttl));
+ pack32(p, htonl(rrset->ttl));
p += 4;
pack16(p, htons(((struct ptr *)rrp->rdata)->ptrlen));
p += 2;
@@ -3119,7 +3119,7 @@ sign_ptr(ddDB *db, char *zonename, int expiry, struct
len = mybase64_encode(signature, siglen, tmp, sizeof(tmp));
tmp[len] = '\0';
- if (fill_rrsig(rbt->humanname, "RRSIG", ((struct ptr *)rrp->rdata)->ttl, "PTR", algorithm, labels, ((struct ptr *)rrp->rdata)->ttl, expiredon, signedon, keyid, zonename, tmp) < 0) {
+ if (fill_rrsig(rbt->humanname, "RRSIG", rrset->ttl, "PTR", algorithm, labels, rrset->ttl, expiredon, signedon, keyid, zonename, tmp) < 0) {
dolog(LOG_INFO, "fill_rrsig\n");
return -1;
}
@@ -3258,7 +3258,7 @@ sign_naptr(ddDB *db, char *zonename, int expiry, struc
p++;
pack8(p, labels);
p++;
- pack32(p, htonl(((struct naptr *)rrp->rdata)->ttl));
+ pack32(p, htonl(rrset->ttl));
p += 4;
snprintf(timebuf, sizeof(timebuf), "%lld", expiredon);
@@ -3288,7 +3288,7 @@ sign_naptr(ddDB *db, char *zonename, int expiry, struc
q += 2;
pack16(q, htons(DNS_CLASS_IN));
q += 2;
- pack32(q, htonl(((struct naptr *)rrp->rdata)->ttl));
+ pack32(q, htonl(rrset->ttl));
q += 4;
pack16(q, htons(2 + 2 + 1 + ((struct naptr *)rrp2->rdata)->flagslen + 1 + ((struct naptr *)rrp2->rdata)->serviceslen + 1 + ((struct naptr *)rrp2->rdata)->regexplen + ((struct naptr *)rrp2->rdata)->replacementlen));
q += 2;
@@ -3368,7 +3368,7 @@ sign_naptr(ddDB *db, char *zonename, int expiry, struc
len = mybase64_encode(signature, siglen, tmp, sizeof(tmp));
tmp[len] = '\0';
- if (fill_rrsig(rbt->humanname, "RRSIG", ((struct naptr *)rrp->rdata)->ttl, "NAPTR", algorithm, labels, ((struct naptr *)rrp->rdata)->ttl, expiredon, signedon, keyid, zonename, tmp) < 0) {
+ if (fill_rrsig(rbt->humanname, "RRSIG", rrset->ttl, "NAPTR", algorithm, labels, rrset->ttl, expiredon, signedon, keyid, zonename, tmp) < 0) {
dolog(LOG_INFO, "fill_rrsig\n");
return -1;
}
@@ -3508,7 +3508,7 @@ sign_srv(ddDB *db, char *zonename, int expiry, struct
p++;
pack8(p, labels);
p++;
- pack32(p, htonl(((struct srv *)rrp->rdata)->ttl));
+ pack32(p, htonl(rrset->ttl));
p += 4;
snprintf(timebuf, sizeof(timebuf), "%lld", expiredon);
@@ -3538,7 +3538,7 @@ sign_srv(ddDB *db, char *zonename, int expiry, struct
q += 2;
pack16(q, htons(DNS_CLASS_IN));
q += 2;
- pack32(q, htonl(((struct srv *)rrp->rdata)->ttl));
+ pack32(q, htonl(rrset->ttl));
q += 4;
pack16(q, htons(2 + 2 + 2 + ((struct srv *)rrp2->rdata)->targetlen));
q += 2;
@@ -3605,7 +3605,7 @@ sign_srv(ddDB *db, char *zonename, int expiry, struct
len = mybase64_encode(signature, siglen, tmp, sizeof(tmp));
tmp[len] = '\0';
- if (fill_rrsig(rbt->humanname, "RRSIG", ((struct srv *)rrp->rdata)->ttl, "SRV", algorithm, labels, ((struct srv *)rrp->rdata)->ttl, expiredon, signedon, keyid, zonename, tmp) < 0) {
+ if (fill_rrsig(rbt->humanname, "RRSIG", rrset->ttl, "SRV", algorithm, labels, rrset->ttl, expiredon, signedon, keyid, zonename, tmp) < 0) {
dolog(LOG_INFO, "fill_rrsig\n");
return -1;
}
@@ -3745,7 +3745,7 @@ sign_sshfp(ddDB *db, char *zonename, int expiry, struc
p++;
pack8(p, labels);
p++;
- pack32(p, htonl(((struct sshfp *)rrp->rdata)->ttl));
+ pack32(p, htonl(rrset->ttl));
p += 4;
snprintf(timebuf, sizeof(timebuf), "%lld", expiredon);
@@ -3775,7 +3775,7 @@ sign_sshfp(ddDB *db, char *zonename, int expiry, struc
q += 2;
pack16(q, htons(DNS_CLASS_IN));
q += 2;
- pack32(q, htonl(((struct sshfp *)rrp->rdata)->ttl));
+ pack32(q, htonl(rrset->ttl));
q += 4;
pack16(q, htons(1 + 1 + ((struct sshfp *)rrp2->rdata)->fplen));
q += 2;
@@ -3840,7 +3840,7 @@ sign_sshfp(ddDB *db, char *zonename, int expiry, struc
len = mybase64_encode(signature, siglen, tmp, sizeof(tmp));
tmp[len] = '\0';
- if (fill_rrsig(rbt->humanname, "RRSIG", ((struct sshfp *)rrp->rdata)->ttl, "SSHFP", algorithm, labels, ((struct sshfp *)rrp->rdata)->ttl, expiredon, signedon, keyid, zonename, tmp) < 0) {
+ if (fill_rrsig(rbt->humanname, "RRSIG", rrset->ttl, "SSHFP", algorithm, labels, rrset->ttl, expiredon, signedon, keyid, zonename, tmp) < 0) {
dolog(LOG_INFO, "fill_rrsig\n");
return -1;
}
@@ -3980,7 +3980,7 @@ sign_tlsa(ddDB *db, char *zonename, int expiry, struct
p++;
pack8(p, labels);
p++;
- pack32(p, htonl(((struct tlsa *)rrp->rdata)->ttl));
+ pack32(p, htonl(rrset->ttl));
p += 4;
snprintf(timebuf, sizeof(timebuf), "%lld", expiredon);
@@ -4011,7 +4011,7 @@ sign_tlsa(ddDB *db, char *zonename, int expiry, struct
q += 2;
pack16(q, htons(DNS_CLASS_IN));
q += 2;
- pack32(q, htonl(((struct tlsa *)rrp->rdata)->ttl));
+ pack32(q, htonl(rrset->ttl));
q += 4;
pack16(q, htons(1 + 1 + 1 + ((struct tlsa *)rrp2->rdata)->datalen));
q += 2;
@@ -4078,7 +4078,7 @@ sign_tlsa(ddDB *db, char *zonename, int expiry, struct
len = mybase64_encode(signature, siglen, tmp, sizeof(tmp));
tmp[len] = '\0';
- if (fill_rrsig(rbt->humanname, "RRSIG", ((struct tlsa *)rrp->rdata)->ttl, "TLSA", algorithm, labels, ((struct tlsa *)rrp->rdata)->ttl, expiredon, signedon, keyid, zonename, tmp) < 0) {
+ if (fill_rrsig(rbt->humanname, "RRSIG", rrset->ttl, "TLSA", algorithm, labels, rrset->ttl, expiredon, signedon, keyid, zonename, tmp) < 0) {
dolog(LOG_INFO, "fill_rrsig\n");
return -1;
}
@@ -4217,7 +4217,7 @@ sign_ds(ddDB *db, char *zonename, int expiry, struct r
p++;
pack8(p, labels);
p++;
- pack32(p, htonl(((struct ds *)rrp->rdata)->ttl));
+ pack32(p, htonl(rrset->ttl));
p += 4;
snprintf(timebuf, sizeof(timebuf), "%lld", expiredon);
@@ -4247,7 +4247,7 @@ sign_ds(ddDB *db, char *zonename, int expiry, struct r
q += 2;
pack16(q, htons(DNS_CLASS_IN));
q += 2;
- pack32(q, htonl(((struct ds *)rrp->rdata)->ttl));
+ pack32(q, htonl(rrset->ttl));
q += 4;
pack16(q, htons(2 + 1 + 1 + ((struct ds *)rrp2->rdata)->digestlen));
q += 2;
@@ -4312,7 +4312,7 @@ sign_ds(ddDB *db, char *zonename, int expiry, struct r
len = mybase64_encode(signature, siglen, tmp, sizeof(tmp));
tmp[len] = '\0';
- if (fill_rrsig(rbt->humanname, "RRSIG", ((struct ds *)rrp->rdata)->ttl, "DS", algorithm, labels, ((struct ds *)rrp->rdata)->ttl, expiredon, signedon, keyid, zonename, tmp) < 0) {
+ if (fill_rrsig(rbt->humanname, "RRSIG", rrset->ttl, "DS", algorithm, labels, rrset->ttl, expiredon, signedon, keyid, zonename, tmp) < 0) {
dolog(LOG_INFO, "fill_rrsig\n");
return -1;
}
@@ -4452,7 +4452,7 @@ sign_ns(ddDB *db, char *zonename, int expiry, struct r
p++;
pack8(p, labels);
p++;
- pack32(p, htonl(((struct ns *)rrp->rdata)->ttl));
+ pack32(p, htonl(rrset->ttl));
p += 4;
snprintf(timebuf, sizeof(timebuf), "%lld", expiredon);
@@ -4482,7 +4482,7 @@ sign_ns(ddDB *db, char *zonename, int expiry, struct r
q += 2;
pack16(q, htons(DNS_CLASS_IN));
q += 2;
- pack32(q, htonl(((struct ns *)rrp->rdata)->ttl));
+ pack32(q, htonl(rrset->ttl));
q += 4;
pack16(q, htons(((struct ns *)rrp2->rdata)->nslen));
q += 2;
@@ -4541,7 +4541,7 @@ sign_ns(ddDB *db, char *zonename, int expiry, struct r
len = mybase64_encode(signature, siglen, tmp, sizeof(tmp));
tmp[len] = '\0';
- if (fill_rrsig(rbt->humanname, "RRSIG", ((struct ns *)rrp->rdata)->ttl, "NS", algorithm, labels, ((struct ns *)rrp->rdata)->ttl, expiredon, signedon, keyid, zonename, tmp) < 0) {
+ if (fill_rrsig(rbt->humanname, "RRSIG", rrset->ttl, "NS", algorithm, labels, rrset->ttl, expiredon, signedon, keyid, zonename, tmp) < 0) {
dolog(LOG_INFO, "fill_rrsig\n");
return -1;
}
@@ -4680,7 +4680,7 @@ sign_mx(ddDB *db, char *zonename, int expiry, struct r
p++;
pack8(p, labels);
p++;
- pack32(p, htonl(((struct smx *)rrp->rdata)->ttl));
+ pack32(p, htonl(rrset->ttl));
p += 4;
snprintf(timebuf, sizeof(timebuf), "%lld", expiredon);
@@ -4710,7 +4710,7 @@ sign_mx(ddDB *db, char *zonename, int expiry, struct r
q += 2;
pack16(q, htons(DNS_CLASS_IN));
q += 2;
- pack32(q, htonl(((struct smx *)rrp->rdata)->ttl));
+ pack32(q, htonl(rrset->ttl));
q += 4;
pack16(q, htons(2 + ((struct smx *)rrp2->rdata)->exchangelen));
q += 2;
@@ -4771,7 +4771,7 @@ sign_mx(ddDB *db, char *zonename, int expiry, struct r
len = mybase64_encode(signature, siglen, tmp, sizeof(tmp));
tmp[len] = '\0';
- if (fill_rrsig(rbt->humanname, "RRSIG", ((struct smx *)rrp->rdata)->ttl, "MX", algorithm, labels, ((struct smx *)rrp->rdata)->ttl, expiredon, signedon, keyid, zonename, tmp) < 0) {
+ if (fill_rrsig(rbt->humanname, "RRSIG", rrset->ttl, "MX", algorithm, labels, rrset->ttl, expiredon, signedon, keyid, zonename, tmp) < 0) {
dolog(LOG_INFO, "fill_rrsig\n");
return -1;
}
@@ -4911,7 +4911,7 @@ sign_a(ddDB *db, char *zonename, int expiry, struct rb
p++;
pack8(p, labels);
p++;
- pack32(p, htonl(((struct a *)rrp->rdata)->ttl));
+ pack32(p, htonl(rrset->ttl));
p += 4;
snprintf(timebuf, sizeof(timebuf), "%lld", expiredon);
@@ -4941,7 +4941,7 @@ sign_a(ddDB *db, char *zonename, int expiry, struct rb
q += 2;
pack16(q, htons(DNS_CLASS_IN));
q += 2;
- pack32(q, htonl(((struct a *)rrp->rdata)->ttl));
+ pack32(q, htonl(rrset->ttl));
q += 4;
pack16(q, htons(sizeof(in_addr_t)));
q += 2;
@@ -5000,7 +5000,7 @@ sign_a(ddDB *db, char *zonename, int expiry, struct rb
len = mybase64_encode(signature, siglen, tmp, sizeof(tmp));
tmp[len] = '\0';
- if (fill_rrsig(rbt->humanname, "RRSIG", ((struct a *)rrp->rdata)->ttl, "A", algorithm, labels, ((struct a *)rrp->rdata)->ttl, expiredon, signedon, keyid, zonename, tmp) < 0) {
+ if (fill_rrsig(rbt->humanname, "RRSIG", rrset->ttl, "A", algorithm, labels, rrset->ttl, expiredon, signedon, keyid, zonename, tmp) < 0) {
dolog(LOG_INFO, "fill_rrsig\n");
return -1;
}
@@ -5318,7 +5318,7 @@ sign_dnskey(ddDB *db, char *zonename, int expiry, stru
p++;
pack8(p, labels);
p++;
- pack32(p, htonl(((struct dnskey *)rrp->rdata)->ttl));
+ pack32(p, htonl(rrset->ttl));
p += 4;
snprintf(timebuf, sizeof(timebuf), "%lld", expiredon);
@@ -5347,7 +5347,7 @@ sign_dnskey(ddDB *db, char *zonename, int expiry, stru
q += 2;
pack16(q, htons(DNS_CLASS_IN));
q += 2;
- pack32(q, htonl(((struct dnskey *)rrp->rdata)->ttl));
+ pack32(q, htonl(rrset->ttl));
q += 4;
pack16(q, htons(2 + 1 + 1 + ((struct dnskey *)rrp2->rdata)->publickey_len));
q += 2;
@@ -5498,7 +5498,7 @@ sign_dnskey(ddDB *db, char *zonename, int expiry, stru
p++;
pack8(p, labels);
p++;
- pack32(p, htonl(((struct dnskey *)rrp->rdata)->ttl));
+ pack32(p, htonl(rrset->ttl));
p += 4;
snprintf(timebuf, sizeof(timebuf), "%lld", expiredon);
@@ -5535,7 +5535,7 @@ sign_dnskey(ddDB *db, char *zonename, int expiry, stru
q += 2;
pack16(q, htons(DNS_CLASS_IN));
q += 2;
- pack32(q, htonl(((struct dnskey *)rrp->rdata)->ttl));
+ pack32(q, htonl(rrset->ttl));
q += 4;
pack16(q, htons(2 + 1 + 1 + ((struct dnskey *)rrp2->rdata)->publickey_len));
q += 2;
@@ -6005,7 +6005,7 @@ construct_nsec3(ddDB *db, char *zone, int iterations,
return -1;
/* RFC 5155 page 3 */
- ttl = ((struct soa *)rrp->rdata)->ttl;
+ ttl = rrset->ttl;
rrset = find_rr(rbt, DNS_TYPE_NSEC3PARAM);
@@ -6231,7 +6231,7 @@ print_rbt(FILE *of, struct rbtree *rbt)
}
fprintf(of, " %s,soa,%d,%s,%s,%u,%d,%d,%d,%d\n",
convert_name(rbt->zone, rbt->zonelen),
- ((struct soa *)rrp->rdata)->ttl,
+ rrset->ttl,
convert_name(((struct soa *)rrp->rdata)->nsserver, ((struct soa *)rrp->rdata)->nsserver_len),
convert_name(((struct soa *)rrp->rdata)->responsible_person, ((struct soa *)rrp->rdata)->rp_len),
((struct soa *)rrp->rdata)->serial,
@@ -6248,7 +6248,7 @@ print_rbt(FILE *of, struct rbtree *rbt)
TAILQ_FOREACH(rrp2, &rrset->rr_head, entries) {
fprintf(of, " %s,ns,%d,%s\n",
convert_name(rbt->zone, rbt->zonelen),
- ((struct ns *)rrp->rdata)->ttl,
+ rrset->ttl,
convert_name(((struct ns *)rrp2->rdata)->nsserver, ((struct ns *)rrp2->rdata)->nslen));
}
}
@@ -6260,7 +6260,7 @@ print_rbt(FILE *of, struct rbtree *rbt)
TAILQ_FOREACH(rrp2, &rrset->rr_head, entries) {
fprintf(of, " %s,mx,%d,%d,%s\n",
convert_name(rbt->zone, rbt->zonelen),
- ((struct smx *)rrp->rdata)->ttl,
+ rrset->ttl,
((struct smx *)rrp2->rdata)->preference,
convert_name(((struct smx *)rrp2->rdata)->exchange, ((struct smx *)rrp2->rdata)->exchangelen));
}
@@ -6273,7 +6273,7 @@ print_rbt(FILE *of, struct rbtree *rbt)
TAILQ_FOREACH(rrp2, &rrset->rr_head, entries) {
fprintf(of, " %s,ds,%d,%d,%d,%d,\"%s\"\n",
convert_name(rbt->zone, rbt->zonelen),
- ((struct ds *)rrp->rdata)->ttl,
+ rrset->ttl,
((struct ds *)rrp2->rdata)->key_tag,
((struct ds *)rrp2->rdata)->algorithm,
((struct ds *)rrp2->rdata)->digest_type,
@@ -6287,7 +6287,7 @@ print_rbt(FILE *of, struct rbtree *rbt)
}
fprintf(of, " %s,cname,%d,%s\n",
convert_name(rbt->zone, rbt->zonelen),
- ((struct cname *)rrp->rdata)->ttl,
+ rrset->ttl,
convert_name(((struct cname *)rrp->rdata)->cname, ((struct cname *)rrp->rdata)->cnamelen));
}
if ((rrset = find_rr(rbt, DNS_TYPE_NAPTR)) != NULL) {
@@ -6298,7 +6298,7 @@ print_rbt(FILE *of, struct rbtree *rbt)
TAILQ_FOREACH(rrp2, &rrset->rr_head, entries) {
fprintf(of, " %s,naptr,%d,%d,%d,\"",
convert_name(rbt->zone, rbt->zonelen),
- ((struct naptr *)rrp->rdata)->ttl,
+ rrset->ttl,
((struct naptr *)rrp2->rdata)->order,
((struct naptr *)rrp2->rdata)->preference);
@@ -6324,7 +6324,7 @@ print_rbt(FILE *of, struct rbtree *rbt)
TAILQ_FOREACH(rrp2, &rrset->rr_head, entries) {
fprintf(of, " %s,txt,%d,\"",
convert_name(rbt->zone, rbt->zonelen),
- ((struct txt *)rrp->rdata)->ttl);
+ rrset->ttl);
for (i = 0; i < ((struct txt *)rrp2->rdata)->txtlen; i++) {
if (i % 256 == 0)
@@ -6342,7 +6342,7 @@ print_rbt(FILE *of, struct rbtree *rbt)
}
fprintf(of, " %s,ptr,%d,%s\n",
convert_name(rbt->zone, rbt->zonelen),
- ((struct ptr *)rrp->rdata)->ttl,
+ rrset->ttl,
convert_name(((struct ptr *)rrp->rdata)->ptr, ((struct ptr *)rrp->rdata)->ptrlen));
}
if ((rrset = find_rr(rbt, DNS_TYPE_SRV)) != NULL) {
@@ -6353,7 +6353,7 @@ print_rbt(FILE *of, struct rbtree *rbt)
TAILQ_FOREACH(rrp2, &rrset->rr_head, entries) {
fprintf(of, " %s,srv,%d,%d,%d,%d,%s\n",
convert_name(rbt->zone, rbt->zonelen),
- ((struct srv *)rrp->rdata)->ttl,
+ rrset->ttl,
((struct srv *)rrp2->rdata)->priority,
((struct srv *)rrp2->rdata)->weight,
((struct srv *)rrp2->rdata)->port,
@@ -6368,7 +6368,7 @@ print_rbt(FILE *of, struct rbtree *rbt)
TAILQ_FOREACH(rrp2, &rrset->rr_head, entries) {
fprintf(of, " %s,tlsa,%d,%d,%d,%d,\"%s\"\n",
convert_name(rbt->zone, rbt->zonelen),
- ((struct tlsa *)rrp->rdata)->ttl,
+ rrset->ttl,
((struct tlsa *)rrp2->rdata)->usage,
((struct tlsa *)rrp2->rdata)->selector,
((struct tlsa *)rrp2->rdata)->matchtype,
@@ -6383,7 +6383,7 @@ print_rbt(FILE *of, struct rbtree *rbt)
TAILQ_FOREACH(rrp2, &rrset->rr_head, entries) {
fprintf(of, " %s,sshfp,%d,%d,%d,\"%s\"\n",
convert_name(rbt->zone, rbt->zonelen),
- ((struct sshfp *)rrp->rdata)->ttl,
+ rrset->ttl,
((struct sshfp *)rrp2->rdata)->algorithm,
((struct sshfp *)rrp2->rdata)->fptype,
bin2hex(((struct sshfp *)rrp2->rdata)->fingerprint, ((struct sshfp *)rrp2->rdata)->fplen));
@@ -6398,7 +6398,7 @@ print_rbt(FILE *of, struct rbtree *rbt)
inet_ntop(AF_INET, &((struct a *)rrp2->rdata)->a, buf, sizeof(buf));
fprintf(of, " %s,a,%d,%s\n",
convert_name(rbt->zone, rbt->zonelen),
- ((struct a *)rrp->rdata)->ttl,
+ rrset->ttl,
buf);
}
}
@@ -6411,7 +6411,7 @@ print_rbt(FILE *of, struct rbtree *rbt)
inet_ntop(AF_INET6, &((struct aaaa *)rrp2->rdata)->aaaa, buf, sizeof(buf));
fprintf(of, " %s,aaaa,%d,%s\n",
convert_name(rbt->zone, rbt->zonelen),
- ((struct aaaa *)rrp->rdata)->ttl,
+ rrset->ttl,
buf);
}
}
@@ -6425,7 +6425,7 @@ print_rbt(FILE *of, struct rbtree *rbt)
buf[len] = '\0';
fprintf(of, " %s,dnskey,%d,%d,%d,%d,\"%s\"\n",
convert_name(rbt->zone, rbt->zonelen),
- ((struct dnskey *)rrp->rdata)->ttl,
+ rrset->ttl,
((struct dnskey *)rrp2->rdata)->flags,
((struct dnskey *)rrp2->rdata)->protocol,
((struct dnskey *)rrp2->rdata)->algorithm,
@@ -6453,7 +6453,7 @@ print_rbt(FILE *of, struct rbtree *rbt)
fprintf(of, " %s,nsec3,%d,%d,%d,%d,\"%s\",\"%s\",\"%s\"\n",
convert_name(rbt->zone, rbt->zonelen),
- ((struct nsec3 *)rrp->rdata)->ttl,
+ rrset->ttl,
((struct nsec3 *)rrp->rdata)->algorithm,
((struct nsec3 *)rrp->rdata)->flags,
((struct nsec3 *)rrp->rdata)->iterations,
@@ -6468,17 +6468,12 @@ print_rbt(FILE *of, struct rbtree *rbt)
return -1;
}
TAILQ_FOREACH(rrp2, &rrset->rr_head, entries) {
-#if 0
- if (((struct rrsig *)rrp2->rdata)->type_covered != DNS_TYPE_DNSKEY)
- continue;
-#endif
-
len = mybase64_encode(((struct rrsig *)rrp2->rdata)->signature, ((struct rrsig *)rrp2->rdata)->signature_len, buf, sizeof(buf));
buf[len] = '\0';
fprintf(of, " %s,rrsig,%d,%s,%d,%d,%d,%llu,%llu,%d,%s,\"%s\"\n",
convert_name(rbt->zone, rbt->zonelen),
- ((struct rrsig *)rrp2->rdata)->ttl,
+ ((struct rrsig *)rrp2->rdata)->ttl,
get_dns_type(((struct rrsig *)rrp2->rdata)->type_covered, 0),
((struct rrsig *)rrp2->rdata)->algorithm,
repomaster@centroid.eu