]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Some general cleanup (#42827)
authorMukund Sivaraman <muks@isc.org>
Wed, 13 Jul 2016 08:45:22 +0000 (14:15 +0530)
committerMukund Sivaraman <muks@isc.org>
Wed, 13 Jul 2016 08:45:22 +0000 (14:15 +0530)
lib/dns/include/dns/message.h
lib/dns/rbtdb.c
lib/dns/rdata.c

index ec6779ce0ce48f2cfb6ca38f13983aa999804b3c..ebaa4d6d775d52f703ca5923cdbcf21301545321 100644 (file)
@@ -27,7 +27,7 @@
  *
  * How this beast works:
  *
- * When a dns message is received in a buffer, dns_message_fromwire() is called
+ * When a dns message is received in a buffer, dns_message_parse() is called
  * on the memory region.  Various items are checked including the format
  * of the message (if counts are right, if counts consume the entire sections,
  * and if sections consume the entire message) and known pseudo-RRs in the
index aa15c884200d3f9c169a6a2c8cc8d497dbef2f34..7a900202609b5d1523056ad13b731eea27f9a36d 100644 (file)
@@ -1659,7 +1659,7 @@ free_rdataset(dns_rbtdb_t *rbtdb, isc_mem_t *mctx, rdatasetheader_t *rdataset) {
        free_acachearray(mctx, rdataset, rdataset->additional_auth);
        free_acachearray(mctx, rdataset, rdataset->additional_glue);
 
-       if ((rdataset->attributes & RDATASET_ATTR_NONEXISTENT) != 0)
+       if (NONEXISTENT(rdataset))
                size = sizeof(*rdataset);
        else
                size = dns_rdataslab_size((unsigned char *)rdataset,
@@ -6067,30 +6067,34 @@ add32(dns_rbtdb_t *rbtdb, dns_rbtnode_t *rbtnode, rbtdb_version_t *rbtversion,
                        /*
                         * We're adding a negative cache entry.
                         */
-                       for (topheader = rbtnode->data;
-                            topheader != NULL;
-                            topheader = topheader->next) {
+                       if (covers == dns_rdatatype_any) {
                                /*
                                 * If we're adding an negative cache entry
                                 * which covers all types (NXDOMAIN,
-                                * NODATA(QTYPE=ANY)).
+                                * NODATA(QTYPE=ANY)),
                                 *
                                 * We make all other data stale so that the
                                 * only rdataset that can be found at this
                                 * node is the negative cache entry.
-                                *
-                                * Otherwise look for any RRSIGs of the
-                                * given type so they can be marked stale
-                                * later.
                                 */
-                               if (covers == dns_rdatatype_any) {
+                               for (topheader = rbtnode->data;
+                                    topheader != NULL;
+                                    topheader = topheader->next)
+                               {
                                        set_ttl(rbtdb, topheader, 0);
                                        mark_stale_header(rbtdb, topheader);
-                               } else if (topheader->type == sigtype)
-                                       sigheader = topheader;
-                       }
-                       if (covers == dns_rdatatype_any)
+                               }
                                goto find_header;
+                       }
+                       /*
+                        * Otherwise look for any RRSIGs of the given
+                        * type so they can be marked stale later.
+                        */
+                       for (topheader = rbtnode->data;
+                            topheader != NULL;
+                            topheader = topheader->next)
+                               if (topheader->type == sigtype)
+                                       sigheader = topheader;
                        negtype = RBTDB_RDATATYPE_VALUE(covers, 0);
                } else {
                        /*
@@ -8903,8 +8907,7 @@ rdatasetiter_next(dns_rdatasetiter_t *iterator) {
                                         * ANY and RRSIG queries for 0 TTL
                                         * rdatasets to work.
                                         */
-                                       if ((header->attributes &
-                                            RDATASET_ATTR_NONEXISTENT) != 0 ||
+                                       if (NONEXISTENT(header) ||
                                            (now != 0 && now > header->rdh_ttl))
                                                header = NULL;
                                        break;
index ade9f5682377ace98b64fddb43185fadefbc9560..83dc7f8281d0298c6a945743527a2604411fd8a7 100644 (file)
@@ -2246,7 +2246,7 @@ fromtext_error(void (*callback)(dns_rdatacallbacks_t *, const char *, ...),
 
 dns_rdatatype_t
 dns_rdata_covers(dns_rdata_t *rdata) {
-       if (rdata->type == 46)
+       if (rdata->type == dns_rdatatype_rrsig)
                return (covers_rrsig(rdata));
        return (covers_sig(rdata));
 }