From 4008b4f70d16d90cdc0c5877e9c3c42ccdc5be48 Mon Sep 17 00:00:00 2001 From: florian Date: Sat, 25 Jun 2022 10:20:29 +0000 Subject: [PATCH] Remove a bunch of unused DNS_RDATASETATTR_ #defines and mop up. OK sthen, beck --- usr.bin/dig/lib/dns/include/dns/rdataset.h | 77 +------- usr.bin/dig/lib/dns/masterdump.c | 1 - usr.bin/dig/lib/dns/message.c | 13 +- usr.bin/dig/lib/dns/rdatalist.c | 194 +-------------------- usr.bin/dig/lib/dns/rdatalist_p.h | 16 +- usr.bin/dig/lib/dns/rdataset.c | 11 -- 6 files changed, 6 insertions(+), 306 deletions(-) diff --git a/usr.bin/dig/lib/dns/include/dns/rdataset.h b/usr.bin/dig/lib/dns/include/dns/rdataset.h index 27f75e470b9..e1da816f9e4 100644 --- a/usr.bin/dig/lib/dns/include/dns/rdataset.h +++ b/usr.bin/dig/lib/dns/include/dns/rdataset.h @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rdataset.h,v 1.11 2022/06/25 09:40:20 florian Exp $ */ +/* $Id: rdataset.h,v 1.12 2022/06/25 10:20:30 florian Exp $ */ #ifndef DNS_RDATASET_H #define DNS_RDATASET_H 1 @@ -67,46 +67,6 @@ typedef struct dns_rdatasetmethods { void (*clone)(dns_rdataset_t *source, dns_rdataset_t *target); unsigned int (*count)(dns_rdataset_t *rdataset); - isc_result_t (*addnoqname)(dns_rdataset_t *rdataset, - dns_name_t *name); - isc_result_t (*getnoqname)(dns_rdataset_t *rdataset, - dns_name_t *name, - dns_rdataset_t *neg, - dns_rdataset_t *negsig); - isc_result_t (*addclosest)(dns_rdataset_t *rdataset, - dns_name_t *name); - isc_result_t (*getclosest)(dns_rdataset_t *rdataset, - dns_name_t *name, - dns_rdataset_t *neg, - dns_rdataset_t *negsig); - isc_result_t (*getadditional)(dns_rdataset_t *rdataset, - dns_rdatasetadditional_t type, - dns_rdatatype_t qtype, - dns_acache_t *acache, - dns_zone_t **zonep, - dns_db_t **dbp, - dns_dbversion_t **versionp, - dns_dbnode_t **nodep, - dns_name_t *fname, - dns_message_t *msg, - time_t now); - isc_result_t (*setadditional)(dns_rdataset_t *rdataset, - dns_rdatasetadditional_t type, - dns_rdatatype_t qtype, - dns_acache_t *acache, - dns_zone_t *zone, - dns_db_t *db, - dns_dbversion_t *version, - dns_dbnode_t *node, - dns_name_t *fname); - isc_result_t (*putadditional)(dns_acache_t *acache, - dns_rdataset_t *rdataset, - dns_rdatasetadditional_t type, - dns_rdatatype_t qtype); - void (*settrust)(dns_rdataset_t *rdataset, - dns_trust_t trust); - void (*expire)(dns_rdataset_t *rdataset); - void (*clearprefetch)(dns_rdataset_t *rdataset); } dns_rdatasetmethods_t; /*% @@ -139,11 +99,6 @@ struct dns_rdataset { * increment the counter. */ uint32_t count; - /* - * This RRSIG RRset should be re-generated around this time. - * Only valid if DNS_RDATASETATTR_RESIGN is set in attributes. - */ - time_t resign; /*@{*/ /*% * These are for use by the rdataset implementation, and MUST NOT @@ -163,40 +118,10 @@ struct dns_rdataset { /*! * \def DNS_RDATASETATTR_RENDERED * Used by message.c to indicate that the rdataset was rendered. - * - * \def DNS_RDATASETATTR_TTLADJUSTED - * Used by message.c to indicate that the rdataset's rdata had differing - * TTL values, and the rdataset->ttl holds the smallest. - * - * \def DNS_RDATASETATTR_LOADORDER - * Output the RRset in load order. */ #define DNS_RDATASETATTR_QUESTION 0x00000001 #define DNS_RDATASETATTR_RENDERED 0x00000002 /*%< Used by message.c */ -#define DNS_RDATASETATTR_ANSWERED 0x00000004 /*%< Used by server. */ -#define DNS_RDATASETATTR_CACHE 0x00000008 /*%< Used by resolver. */ -#define DNS_RDATASETATTR_ANSWER 0x00000010 /*%< Used by resolver. */ -#define DNS_RDATASETATTR_ANSWERSIG 0x00000020 /*%< Used by resolver. */ -#define DNS_RDATASETATTR_EXTERNAL 0x00000040 /*%< Used by resolver. */ -#define DNS_RDATASETATTR_NCACHE 0x00000080 /*%< Used by resolver. */ -#define DNS_RDATASETATTR_CHAINING 0x00000100 /*%< Used by resolver. */ -#define DNS_RDATASETATTR_TTLADJUSTED 0x00000200 /*%< Used by message.c */ -#define DNS_RDATASETATTR_CHASE 0x00001000 /*%< Used by resolver. */ -#define DNS_RDATASETATTR_NXDOMAIN 0x00002000 -#define DNS_RDATASETATTR_NOQNAME 0x00004000 -#define DNS_RDATASETATTR_CHECKNAMES 0x00008000 /*%< Used by resolver. */ -#define DNS_RDATASETATTR_LOADORDER 0x00020000 -#define DNS_RDATASETATTR_RESIGN 0x00040000 -#define DNS_RDATASETATTR_CLOSEST 0x00080000 -#define DNS_RDATASETATTR_OPTOUT 0x00100000 /*%< OPTOUT proof */ -#define DNS_RDATASETATTR_PREFETCH 0x00400000 - -/*% - * _OMITDNSSEC: - * Omit DNSSEC records when rendering ncache records. - */ -#define DNS_RDATASETTOWIRE_OMITDNSSEC 0x0001 void dns_rdataset_init(dns_rdataset_t *rdataset); diff --git a/usr.bin/dig/lib/dns/masterdump.c b/usr.bin/dig/lib/dns/masterdump.c index 272315fcfbc..35f68497167 100644 --- a/usr.bin/dig/lib/dns/masterdump.c +++ b/usr.bin/dig/lib/dns/masterdump.c @@ -249,7 +249,6 @@ rdataset_totext(dns_rdataset_t *rdataset, dns_rdatatype_t type; unsigned int type_start; - rdataset->attributes |= DNS_RDATASETATTR_LOADORDER; result = dns_rdataset_first(rdataset); current_ttl = ctx->current_ttl; diff --git a/usr.bin/dig/lib/dns/message.c b/usr.bin/dig/lib/dns/message.c index 24b30691972..64053ead3e7 100644 --- a/usr.bin/dig/lib/dns/message.c +++ b/usr.bin/dig/lib/dns/message.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: message.c,v 1.19 2022/06/25 09:40:20 florian Exp $ */ +/* $Id: message.c,v 1.20 2022/06/25 10:20:29 florian Exp $ */ /*! \file */ @@ -59,8 +59,6 @@ #define VALID_PSEUDOSECTION(s) (((s) >= DNS_PSEUDOSECTION_ANY) \ && ((s) < DNS_PSEUDOSECTION_MAX)) -#define OPTOUT(x) (((x)->attributes & DNS_RDATASETATTR_OPTOUT) != 0) - /*% * This is the size of each individual scratchpad buffer, and the numbers * of various block allocations used within the server. @@ -1298,11 +1296,8 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, * currently treat them the as if they were authoritative and * minimize them. */ - if (ttl != rdataset->ttl) { - rdataset->attributes |= DNS_RDATASETATTR_TTLADJUSTED; - if (ttl < rdataset->ttl) - rdataset->ttl = ttl; - } + if (ttl < rdataset->ttl) + rdataset->ttl = ttl; /* Append this rdata to the rdataset. */ dns_rdatalist_fromrdataset(rdataset, &rdatalist); @@ -1683,8 +1678,6 @@ dns_message_rendersection(dns_message_t *msg, dns_section_t sectionid) (sectionid == DNS_SECTION_ANSWER || sectionid == DNS_SECTION_AUTHORITY)) msg->flags &= ~DNS_MESSAGEFLAG_AD; - if (OPTOUT(rdataset)) - msg->flags &= ~DNS_MESSAGEFLAG_AD; rdataset->attributes |= DNS_RDATASETATTR_RENDERED; diff --git a/usr.bin/dig/lib/dns/rdatalist.c b/usr.bin/dig/lib/dns/rdatalist.c index 1c37ca65f39..2f8a9a27e17 100644 --- a/usr.bin/dig/lib/dns/rdatalist.c +++ b/usr.bin/dig/lib/dns/rdatalist.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rdatalist.c,v 1.2 2020/02/18 18:11:27 florian Exp $ */ +/* $Id: rdatalist.c,v 1.3 2022/06/25 10:20:29 florian Exp $ */ /*! \file */ @@ -36,16 +36,6 @@ static dns_rdatasetmethods_t methods = { isc__rdatalist_current, isc__rdatalist_clone, isc__rdatalist_count, - isc__rdatalist_addnoqname, - isc__rdatalist_getnoqname, - isc__rdatalist_addclosest, - isc__rdatalist_getclosest, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL }; void @@ -181,185 +171,3 @@ isc__rdatalist_count(dns_rdataset_t *rdataset) { return (count); } - -isc_result_t -isc__rdatalist_addnoqname(dns_rdataset_t *rdataset, dns_name_t *name) { - dns_rdataset_t *neg = NULL; - dns_rdataset_t *negsig = NULL; - dns_rdataset_t *rdset; - dns_ttl_t ttl; - - REQUIRE(rdataset != NULL); - - for (rdset = ISC_LIST_HEAD(name->list); - rdset != NULL; - rdset = ISC_LIST_NEXT(rdset, link)) - { - if (rdset->rdclass != rdataset->rdclass) - continue; - if (rdset->type == dns_rdatatype_nsec || - rdset->type == dns_rdatatype_nsec3) - neg = rdset; - } - if (neg == NULL) - return (ISC_R_NOTFOUND); - - for (rdset = ISC_LIST_HEAD(name->list); - rdset != NULL; - rdset = ISC_LIST_NEXT(rdset, link)) - { - if (rdset->type == dns_rdatatype_rrsig && - rdset->covers == neg->type) - negsig = rdset; - } - - if (negsig == NULL) - return (ISC_R_NOTFOUND); - /* - * Minimise ttl. - */ - ttl = rdataset->ttl; - if (neg->ttl < ttl) - ttl = neg->ttl; - if (negsig->ttl < ttl) - ttl = negsig->ttl; - rdataset->ttl = neg->ttl = negsig->ttl = ttl; - rdataset->attributes |= DNS_RDATASETATTR_NOQNAME; - rdataset->private6 = name; - return (ISC_R_SUCCESS); -} - -isc_result_t -isc__rdatalist_getnoqname(dns_rdataset_t *rdataset, dns_name_t *name, - dns_rdataset_t *neg, dns_rdataset_t *negsig) -{ - dns_rdataclass_t rdclass = rdataset->rdclass; - dns_rdataset_t *tneg = NULL; - dns_rdataset_t *tnegsig = NULL; - dns_name_t *noqname = rdataset->private6; - - REQUIRE(rdataset != NULL); - REQUIRE((rdataset->attributes & DNS_RDATASETATTR_NOQNAME) != 0); - - (void)dns_name_dynamic(noqname); /* Sanity Check. */ - - for (rdataset = ISC_LIST_HEAD(noqname->list); - rdataset != NULL; - rdataset = ISC_LIST_NEXT(rdataset, link)) - { - if (rdataset->rdclass != rdclass) - continue; - if (rdataset->type == dns_rdatatype_nsec || - rdataset->type == dns_rdatatype_nsec3) - tneg = rdataset; - } - if (tneg == NULL) - return (ISC_R_NOTFOUND); - - for (rdataset = ISC_LIST_HEAD(noqname->list); - rdataset != NULL; - rdataset = ISC_LIST_NEXT(rdataset, link)) - { - if (rdataset->type == dns_rdatatype_rrsig && - rdataset->covers == tneg->type) - tnegsig = rdataset; - } - if (tnegsig == NULL) - return (ISC_R_NOTFOUND); - - dns_name_clone(noqname, name); - dns_rdataset_clone(tneg, neg); - dns_rdataset_clone(tnegsig, negsig); - return (ISC_R_SUCCESS); -} - -isc_result_t -isc__rdatalist_addclosest(dns_rdataset_t *rdataset, dns_name_t *name) { - dns_rdataset_t *neg = NULL; - dns_rdataset_t *negsig = NULL; - dns_rdataset_t *rdset; - dns_ttl_t ttl; - - REQUIRE(rdataset != NULL); - - for (rdset = ISC_LIST_HEAD(name->list); - rdset != NULL; - rdset = ISC_LIST_NEXT(rdset, link)) - { - if (rdset->rdclass != rdataset->rdclass) - continue; - if (rdset->type == dns_rdatatype_nsec || - rdset->type == dns_rdatatype_nsec3) - neg = rdset; - } - if (neg == NULL) - return (ISC_R_NOTFOUND); - - for (rdset = ISC_LIST_HEAD(name->list); - rdset != NULL; - rdset = ISC_LIST_NEXT(rdset, link)) - { - if (rdset->type == dns_rdatatype_rrsig && - rdset->covers == neg->type) - negsig = rdset; - } - - if (negsig == NULL) - return (ISC_R_NOTFOUND); - /* - * Minimise ttl. - */ - ttl = rdataset->ttl; - if (neg->ttl < ttl) - ttl = neg->ttl; - if (negsig->ttl < ttl) - ttl = negsig->ttl; - rdataset->ttl = neg->ttl = negsig->ttl = ttl; - rdataset->attributes |= DNS_RDATASETATTR_CLOSEST; - rdataset->private7 = name; - return (ISC_R_SUCCESS); -} - -isc_result_t -isc__rdatalist_getclosest(dns_rdataset_t *rdataset, dns_name_t *name, - dns_rdataset_t *neg, dns_rdataset_t *negsig) -{ - dns_rdataclass_t rdclass = rdataset->rdclass; - dns_rdataset_t *tneg = NULL; - dns_rdataset_t *tnegsig = NULL; - dns_name_t *closest = rdataset->private7; - - REQUIRE(rdataset != NULL); - REQUIRE((rdataset->attributes & DNS_RDATASETATTR_CLOSEST) != 0); - - (void)dns_name_dynamic(closest); /* Sanity Check. */ - - for (rdataset = ISC_LIST_HEAD(closest->list); - rdataset != NULL; - rdataset = ISC_LIST_NEXT(rdataset, link)) - { - if (rdataset->rdclass != rdclass) - continue; - if (rdataset->type == dns_rdatatype_nsec || - rdataset->type == dns_rdatatype_nsec3) - tneg = rdataset; - } - if (tneg == NULL) - return (ISC_R_NOTFOUND); - - for (rdataset = ISC_LIST_HEAD(closest->list); - rdataset != NULL; - rdataset = ISC_LIST_NEXT(rdataset, link)) - { - if (rdataset->type == dns_rdatatype_rrsig && - rdataset->covers == tneg->type) - tnegsig = rdataset; - } - if (tnegsig == NULL) - return (ISC_R_NOTFOUND); - - dns_name_clone(closest, name); - dns_rdataset_clone(tneg, neg); - dns_rdataset_clone(tnegsig, negsig); - return (ISC_R_SUCCESS); -} diff --git a/usr.bin/dig/lib/dns/rdatalist_p.h b/usr.bin/dig/lib/dns/rdatalist_p.h index 9eb58c66854..0c69515181c 100644 --- a/usr.bin/dig/lib/dns/rdatalist_p.h +++ b/usr.bin/dig/lib/dns/rdatalist_p.h @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rdatalist_p.h,v 1.2 2020/02/13 13:53:00 jsg Exp $ */ +/* $Id: rdatalist_p.h,v 1.3 2022/06/25 10:20:29 florian Exp $ */ #ifndef DNS_RDATALIST_P_H #define DNS_RDATALIST_P_H @@ -42,18 +42,4 @@ isc__rdatalist_clone(dns_rdataset_t *source, dns_rdataset_t *target); unsigned int isc__rdatalist_count(dns_rdataset_t *rdataset); -isc_result_t -isc__rdatalist_addnoqname(dns_rdataset_t *rdataset, dns_name_t *name); - -isc_result_t -isc__rdatalist_getnoqname(dns_rdataset_t *rdataset, dns_name_t *name, - dns_rdataset_t *neg, dns_rdataset_t *negsig); - -isc_result_t -isc__rdatalist_addclosest(dns_rdataset_t *rdataset, dns_name_t *name); - -isc_result_t -isc__rdatalist_getclosest(dns_rdataset_t *rdataset, dns_name_t *name, - dns_rdataset_t *neg, dns_rdataset_t *negsig); - #endif /* DNS_RDATALIST_P_H */ diff --git a/usr.bin/dig/lib/dns/rdataset.c b/usr.bin/dig/lib/dns/rdataset.c index fbc59352fa8..7e9aa5ed8d5 100644 --- a/usr.bin/dig/lib/dns/rdataset.c +++ b/usr.bin/dig/lib/dns/rdataset.c @@ -52,7 +52,6 @@ dns_rdataset_init(dns_rdataset_t *rdataset) { rdataset->private5 = NULL; rdataset->private6 = NULL; rdataset->private7 = NULL; - rdataset->resign = 0; } void @@ -140,16 +139,6 @@ static dns_rdatasetmethods_t question_methods = { question_current, question_clone, question_count, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL }; void -- 2.20.1