]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
move dns64 fields from client->query to client
authorEvan Hunt <each@isc.org>
Thu, 1 Nov 2018 15:28:18 +0000 (08:28 -0700)
committerEvan Hunt <each@isc.org>
Fri, 30 Aug 2019 22:11:38 +0000 (15:11 -0700)
- this is temporary: the fields will be moved into the dns64 module later.

lib/ns/client.c
lib/ns/include/ns/client.h
lib/ns/include/ns/query.h
lib/ns/query.c

index 4cad159a483af130be8bd7716c0748467d29c1db..31a98a0adb13dc55a6b6951e317013a7ad7b4f4f 100644 (file)
@@ -3209,6 +3209,13 @@ client_create(ns_clientmgr_t *manager, ns_client_t **clientp) {
        client->keytag_len = 0;
        client->rcode_override = -1;    /* not set */
 
+       /* XXX temporary */
+       client->dns64_aaaa = NULL;
+       client->dns64_sigaaaa = NULL;
+       client->dns64_aaaaok = NULL;
+       client->dns64_aaaaoklen = 0;
+       client->dns64_ttl = UINT32_MAX;
+
        /*
         * We call the init routines for the various kinds of client here,
         * after we have created an otherwise valid client, because some
index 02531f21180092d98bf2e9cbd89d9d093f38ea38..a98a9af1e0d5baa99638dd4b8d14bd2038088dcc 100644 (file)
@@ -185,6 +185,12 @@ struct ns_client {
         * bits will be used as the rcode in the response message.
         */
        int32_t                 rcode_override;
+
+       dns_rdataset_t *        dns64_aaaa;
+       dns_rdataset_t *        dns64_sigaaaa;
+       bool *                  dns64_aaaaok;
+       unsigned int            dns64_aaaaoklen;
+       unsigned int            dns64_ttl;
 };
 
 typedef ISC_QUEUE(ns_client_t) client_queue_t;
index 5e38d48fb21c86d41f22937c43404aec0c3ed207..61dc7ef6c54c65bc424af9815b1bb113f64b91be 100644 (file)
@@ -70,12 +70,6 @@ struct ns_query {
        isc_bufferlist_t                namebufs;
        ISC_LIST(ns_dbversion_t)        activeversions;
        ISC_LIST(ns_dbversion_t)        freeversions;
-       dns_rdataset_t *                dns64_aaaa;
-       dns_rdataset_t *                dns64_sigaaaa;
-       bool *                          dns64_aaaaok;
-       unsigned int                    dns64_aaaaoklen;
-       unsigned int                    dns64_options;
-       unsigned int                    dns64_ttl;
 
        struct {
                dns_db_t *              db;
index dba52bb6ab37c3e0408d45179fd0757886588889..0ab56e304500e4009012de4408cc9d955f94731a 100644 (file)
@@ -670,16 +670,19 @@ query_reset(ns_client_t *client, bool everything) {
        if (client->query.authzone != NULL)
                dns_zone_detach(&client->query.authzone);
 
-       if (client->query.dns64_aaaa != NULL)
-               ns_client_putrdataset(client, &client->query.dns64_aaaa);
-       if (client->query.dns64_sigaaaa != NULL)
-               ns_client_putrdataset(client, &client->query.dns64_sigaaaa);
-       if (client->query.dns64_aaaaok != NULL) {
-               isc_mem_put(client->mctx, client->query.dns64_aaaaok,
-                           client->query.dns64_aaaaoklen *
-                           sizeof(bool));
-               client->query.dns64_aaaaok =  NULL;
-               client->query.dns64_aaaaoklen =  0;
+       /* XXX temporary */
+       if (client->dns64_aaaa != NULL) {
+               ns_client_putrdataset(client, &client->dns64_aaaa);
+       }
+       if (client->dns64_sigaaaa != NULL) {
+               ns_client_putrdataset(client, &client->dns64_sigaaaa);
+       }
+
+       if (client->dns64_aaaaok != NULL) {
+               isc_mem_put(client->mctx, client->dns64_aaaaok,
+                           client->dns64_aaaaoklen * sizeof(bool));
+               client->dns64_aaaaok =  NULL;
+               client->dns64_aaaaoklen =  0;
        }
 
        ns_client_putrdataset(client, &client->query.redirect.rdataset);
@@ -733,12 +736,13 @@ query_reset(ns_client_t *client, bool everything) {
        client->query.gluedb = NULL;
        client->query.authdbset = false;
        client->query.isreferral = false;
-       client->query.dns64_options = 0;
-       client->query.dns64_ttl = UINT32_MAX;
        recparam_update(&client->query.recparam, 0, NULL, NULL);
        client->query.root_key_sentinel_keyid = 0;
        client->query.root_key_sentinel_is_ta = false;
        client->query.root_key_sentinel_not_ta = false;
+
+       /* XXX temporary */
+       client->dns64_ttl = UINT32_MAX;
 }
 
 static void
@@ -778,10 +782,6 @@ ns_query_init(ns_client_t *client) {
        client->query.authzone = NULL;
        client->query.authdbset = false;
        client->query.isreferral = false;
-       client->query.dns64_aaaa = NULL;
-       client->query.dns64_sigaaaa = NULL;
-       client->query.dns64_aaaaok = NULL;
-       client->query.dns64_aaaaoklen = 0;
        client->query.redirect.db = NULL;
        client->query.redirect.node = NULL;
        client->query.redirect.zone = NULL;
@@ -805,6 +805,12 @@ ns_query_init(ns_client_t *client) {
                isc_mutex_destroy(&client->query.fetchlock);
        }
 
+       /* XXX: temporary */
+       client->dns64_aaaa = NULL;
+       client->dns64_sigaaaa = NULL;
+       client->dns64_aaaaok = NULL;
+       client->dns64_aaaaoklen = 0;
+
        return (result);
 }
 
@@ -4650,10 +4656,10 @@ dns64_aaaaok(ns_client_t *client, dns_rdataset_t *rdataset,
        unsigned int i, count;
        bool *aaaaok;
 
-       INSIST(client->query.dns64_aaaaok == NULL);
-       INSIST(client->query.dns64_aaaaoklen == 0);
-       INSIST(client->query.dns64_aaaa == NULL);
-       INSIST(client->query.dns64_sigaaaa == NULL);
+       INSIST(client->dns64_aaaaok == NULL);
+       INSIST(client->dns64_aaaaoklen == 0);
+       INSIST(client->dns64_aaaa == NULL);
+       INSIST(client->dns64_sigaaaa == NULL);
 
        if (dns64 == NULL)
                return (true);
@@ -4674,8 +4680,8 @@ dns64_aaaaok(ns_client_t *client, dns_rdataset_t *rdataset,
        {
                for (i = 0; i < count; i++) {
                        if (aaaaok != NULL && !aaaaok[i]) {
-                               SAVE(client->query.dns64_aaaaok, aaaaok);
-                               client->query.dns64_aaaaoklen = count;
+                               SAVE(client->dns64_aaaaok, aaaaok);
+                               client->dns64_aaaaoklen = count;
                                break;
                        }
                }
@@ -7224,7 +7230,7 @@ query_addanswer(query_ctx_t *qctx) {
                        qctx->result = result;
                        return (ns_query_done(qctx));
                }
-       } else if (qctx->client->query.dns64_aaaaok != NULL) {
+       } else if (qctx->client->dns64_aaaaok != NULL) {
                query_filter64(qctx);
                ns_client_putrdataset(qctx->client, &qctx->rdataset);
        } else {
@@ -7258,7 +7264,7 @@ query_respond(query_ctx_t *qctx) {
         * Check to see if the AAAA RRset has non-excluded addresses
         * in it.  If not look for a A RRset.
         */
-       INSIST(qctx->client->query.dns64_aaaaok == NULL);
+       INSIST(qctx->client->dns64_aaaaok == NULL);
 
        if (qctx->qtype == dns_rdatatype_aaaa && !qctx->dns64_exclude &&
            !ISC_LIST_EMPTY(qctx->view->dns64) &&
@@ -7268,9 +7274,9 @@ query_respond(query_ctx_t *qctx) {
                /*
                 * Look to see if there are A records for this name.
                 */
-               qctx->client->query.dns64_ttl = qctx->rdataset->ttl;
-               SAVE(qctx->client->query.dns64_aaaa, qctx->rdataset);
-               SAVE(qctx->client->query.dns64_sigaaaa, qctx->sigrdataset);
+               qctx->client->dns64_ttl = qctx->rdataset->ttl;
+               SAVE(qctx->client->dns64_aaaa, qctx->rdataset);
+               SAVE(qctx->client->dns64_sigaaaa, qctx->sigrdataset);
                ns_client_releasename(qctx->client, &qctx->fname);
                dns_db_detachnode(qctx->db, &qctx->node);
                qctx->type = qctx->qtype = dns_rdatatype_a;
@@ -7442,9 +7448,9 @@ query_dns64(query_ctx_t *qctx) {
        dns_rdatalist_init(dns64_rdatalist);
        dns64_rdatalist->rdclass = dns_rdataclass_in;
        dns64_rdatalist->type = dns_rdatatype_aaaa;
-       if (client->query.dns64_ttl != UINT32_MAX)
+       if (client->dns64_ttl != UINT32_MAX)
                dns64_rdatalist->ttl = ISC_MIN(qctx->rdataset->ttl,
-                                              client->query.dns64_ttl);
+                                              client->dns64_ttl);
        else
                dns64_rdatalist->ttl = ISC_MIN(qctx->rdataset->ttl, 600);
 
@@ -7555,8 +7561,8 @@ query_filter64(query_ctx_t *qctx) {
 
        CTRACE(ISC_LOG_DEBUG(3), "query_filter64");
 
-       INSIST(client->query.dns64_aaaaok != NULL);
-       INSIST(client->query.dns64_aaaaoklen ==
+       INSIST(client->dns64_aaaaok != NULL);
+       INSIST(client->dns64_aaaaoklen ==
               dns_rdataset_count(qctx->rdataset));
 
        name = qctx->fname;
@@ -7616,7 +7622,7 @@ query_filter64(query_ctx_t *qctx) {
             result == ISC_R_SUCCESS;
             result = dns_rdataset_next(qctx->rdataset))
        {
-               if (!client->query.dns64_aaaaok[i++])
+               if (!client->dns64_aaaaok[i++])
                        continue;
                dns_rdataset_current(qctx->rdataset, &rdata);
                INSIST(rdata.length == 16);
@@ -8219,8 +8225,8 @@ query_nodata(query_ctx_t *qctx, isc_result_t res) {
                        ns_client_putrdataset(qctx->client, &qctx->rdataset);
                if (qctx->sigrdataset != NULL)
                        ns_client_putrdataset(qctx->client, &qctx->sigrdataset);
-               RESTORE(qctx->rdataset, qctx->client->query.dns64_aaaa);
-               RESTORE(qctx->sigrdataset, qctx->client->query.dns64_sigaaaa);
+               RESTORE(qctx->rdataset, qctx->client->dns64_aaaa);
+               RESTORE(qctx->sigrdataset, qctx->client->dns64_sigaaaa);
                if (qctx->fname == NULL) {
                        qctx->dbuf = ns_client_getnamebuf(qctx->client);
                        if (qctx->dbuf == NULL) {
@@ -8268,15 +8274,14 @@ query_nodata(query_ctx_t *qctx, isc_result_t res) {
                         * cache ttl in the answer.
                         */
                        if (qctx->rdataset->ttl != 0) {
-                               qctx->client->query.dns64_ttl =
-                                       qctx->rdataset->ttl;
+                               qctx->client->dns64_ttl = qctx->rdataset->ttl;
                                break;
                        }
                        if (dns_rdataset_first(qctx->rdataset) == ISC_R_SUCCESS)
-                               qctx->client->query.dns64_ttl = 0;
+                               qctx->client->dns64_ttl = 0;
                        break;
                case DNS_R_NXRRSET:
-                       qctx->client->query.dns64_ttl =
+                       qctx->client->dns64_ttl =
                                dns64_ttl(qctx->db, qctx->version);
                        break;
                default:
@@ -8284,8 +8289,8 @@ query_nodata(query_ctx_t *qctx, isc_result_t res) {
                        ISC_UNREACHABLE();
                }
 
-               SAVE(qctx->client->query.dns64_aaaa, qctx->rdataset);
-               SAVE(qctx->client->query.dns64_sigaaaa, qctx->sigrdataset);
+               SAVE(qctx->client->dns64_aaaa, qctx->rdataset);
+               SAVE(qctx->client->dns64_sigaaaa, qctx->sigrdataset);
                ns_client_releasename(qctx->client, &qctx->fname);
                dns_db_detachnode(qctx->db, &qctx->node);
                qctx->type = qctx->qtype = dns_rdatatype_a;