]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Apply the semantic patch to remove isc_stdtime_get()
authorOndřej Surý <ondrej@isc.org>
Thu, 30 Mar 2023 19:13:41 +0000 (21:13 +0200)
committerOndřej Surý <ondrej@isc.org>
Fri, 31 Mar 2023 11:32:56 +0000 (13:32 +0200)
This is a simple replacement using the semantic patch from the previous
commit and as added bonus, one removal of previously undetected unused
variable in named/server.c.

39 files changed:
bin/dnssec/dnssec-cds.c
bin/dnssec/dnssec-importkey.c
bin/dnssec/dnssec-keyfromlabel.c
bin/dnssec/dnssec-keygen.c
bin/dnssec/dnssec-revoke.c
bin/dnssec/dnssec-settime.c
bin/dnssec/dnssec-signzone.c
bin/dnssec/dnssec-verify.c
bin/dnssec/dnssectool.c
bin/named/controlconf.c
bin/named/server.c
bin/named/statschannel.c
bin/named/tsigconf.c
bin/rndc/rndc.c
lib/dns/adb.c
lib/dns/dnssec.c
lib/dns/master.c
lib/dns/masterdump.c
lib/dns/nta.c
lib/dns/rbtdb.c
lib/dns/rdata/generic/keydata_65533.c
lib/dns/resolver.c
lib/dns/rootns.c
lib/dns/rrl.c
lib/dns/time.c
lib/dns/tkey.c
lib/dns/tsig.c
lib/dns/update.c
lib/dns/validator.c
lib/dns/view.c
lib/dns/zone.c
lib/isc/netmgr/tcp.c
lib/ns/client.c
lib/ns/query.c
tests/dns/dnstap_test.c
tests/dns/keytable_test.c
tests/dns/sigs_test.c
tests/dns/tsig_test.c
tests/dns/update_test.c

index d6726e8ddbe893b42ef6b90799541b7522ce2831..21ecec919ad1a09ee283f161167818c39bd67bde 100644 (file)
@@ -345,8 +345,7 @@ load_parent_set(const char *path) {
        }
        notbefore = isc_time_seconds(&modtime);
        if (startstr != NULL) {
-               isc_stdtime_t now;
-               isc_stdtime_get(&now);
+               isc_stdtime_t now = isc_stdtime_now();
                notbefore = strtotime(startstr, now, notbefore, NULL);
        }
        verbose_time(1, "child records must not be signed before", notbefore);
index 8e8d481d5e62b3fd819445b0448866127afe2f2f..df01289e193e066aa92775c3c545524cf79ae9f8 100644 (file)
@@ -302,10 +302,9 @@ main(int argc, char **argv) {
        isc_log_t *log = NULL;
        dns_rdataset_t rdataset;
        dns_rdata_t rdata;
-       isc_stdtime_t now;
+       isc_stdtime_t now = isc_stdtime_now();
 
        dns_rdata_init(&rdata);
-       isc_stdtime_get(&now);
 
        if (argc == 1) {
                usage();
index 54a93a5a935e897301d0859e2bd5bfaf953113c7..9837b545235ea44c44f0631c3170e551ced2855e 100644 (file)
@@ -135,7 +135,6 @@ main(int argc, char **argv) {
        dns_ttl_t ttl = 0;
        isc_stdtime_t publish = 0, activate = 0, revoke = 0;
        isc_stdtime_t inactive = 0, deltime = 0;
-       isc_stdtime_t now;
        int prepub = -1;
        bool setpub = false, setact = false;
        bool setrev = false, setinact = false;
@@ -151,6 +150,7 @@ main(int argc, char **argv) {
        isc_stdtime_t syncadd = 0, syncdel = 0;
        bool unsetsyncadd = false, setsyncadd = false;
        bool unsetsyncdel = false, setsyncdel = false;
+       isc_stdtime_t now = isc_stdtime_now();
 
        if (argc == 1) {
                usage();
@@ -160,8 +160,6 @@ main(int argc, char **argv) {
 
        isc_commandline_errprint = false;
 
-       isc_stdtime_get(&now);
-
 #define CMDLINE_FLAGS "3A:a:Cc:D:E:Ff:GhI:i:kK:L:l:n:P:p:R:S:t:v:Vy"
        while ((ch = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) {
                switch (ch) {
index 55a28b7f7f45ba6e29633efda56f5517381a9867..35246e5f052436dc1079891528ae6641f2e67d58 100644 (file)
@@ -839,6 +839,7 @@ main(int argc, char **argv) {
                .prepub = -1,
                .protocol = -1,
                .size = -1,
+               .now = isc_stdtime_now(),
        };
 
        if (argc == 1) {
@@ -876,7 +877,6 @@ main(int argc, char **argv) {
        isc_commandline_reset = true;
 
        isc_mem_create(&mctx);
-       isc_stdtime_get(&ctx.now);
 
        while ((ch = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) {
                switch (ch) {
index b5797240a7a5ebeede957d6211225ba1576905f7..ada83fd96a53a8b85ef55bdce29fe8046351ebae 100644 (file)
@@ -190,7 +190,7 @@ main(int argc, char **argv) {
 
        flags = dst_key_flags(key);
        if ((flags & DNS_KEYFLAG_REVOKE) == 0) {
-               isc_stdtime_t now;
+               isc_stdtime_t now = isc_stdtime_now();
 
                if ((flags & DNS_KEYFLAG_KSK) == 0) {
                        fprintf(stderr,
@@ -200,7 +200,6 @@ main(int argc, char **argv) {
                                program);
                }
 
-               isc_stdtime_get(&now);
                dst_key_settime(key, DST_TIME_REVOKE, now);
 
                dst_key_setflags(key, flags | DNS_KEYFLAG_REVOKE);
index 816e85178dd8481f38a65bf15c87b0dd6696d2bc..fcd8c0cb53e90e5e2e91fb3985e6bb6d8037a8d3 100644 (file)
@@ -202,7 +202,6 @@ main(int argc, char **argv) {
        int prepub = -1;
        int options;
        dns_ttl_t ttl = 0;
-       isc_stdtime_t now;
        isc_stdtime_t dstime = 0, dnskeytime = 0;
        isc_stdtime_t krrsigtime = 0, zrrsigtime = 0;
        isc_stdtime_t pub = 0, act = 0, rev = 0, inact = 0, del = 0;
@@ -238,6 +237,7 @@ main(int argc, char **argv) {
        bool unsetdsadd = false, setdsadd = false;
        bool unsetdsdel = false, setdsdel = false;
        bool printdsadd = false, printdsdel = false;
+       isc_stdtime_t now = isc_stdtime_now();
 
        options = DST_TYPE_PUBLIC | DST_TYPE_PRIVATE | DST_TYPE_STATE;
 
@@ -251,8 +251,6 @@ main(int argc, char **argv) {
 
        isc_commandline_errprint = false;
 
-       isc_stdtime_get(&now);
-
 #define CMDLINE_FLAGS "A:D:d:E:fg:hI:i:K:k:L:P:p:R:r:S:suv:Vz:"
        while ((ch = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) {
                switch (ch) {
index 1a5b3b40fea03d222443554afb8403d8a2874127..d0f9add4b78a550fd37c9e1c238155dd62829d9f 100644 (file)
@@ -3680,7 +3680,7 @@ main(int argc, char *argv[]) {
                }
        }
 
-       isc_stdtime_get(&now);
+       now = isc_stdtime_now();
 
        if (startstr != NULL) {
                starttime = strtotime(startstr, now, now, NULL);
index 539b1552753d67ae29c42edba97f2b1a8b5272e8..e6b8972b0241295122de28798ba43a83143a13ab 100644 (file)
@@ -281,7 +281,7 @@ main(int argc, char *argv[]) {
                      isc_result_totext(result));
        }
 
-       isc_stdtime_get(&now);
+       now = isc_stdtime_now();
 
        rdclass = strtoclass(classname);
 
index d43e7d9fde32abb3d08d747d240086b3356183fd..502548444cbc95aa5ce205126168356c10bae1c3 100644 (file)
@@ -474,8 +474,7 @@ set_keyversion(dst_key_t *key) {
         * set the creation date
         */
        if (major < 1 || (major == 1 && minor <= 2)) {
-               isc_stdtime_t now;
-               isc_stdtime_get(&now);
+               isc_stdtime_t now = isc_stdtime_now();
                dst_key_settime(key, DST_TIME_CREATED, now);
        }
 }
@@ -490,7 +489,7 @@ key_collision(dst_key_t *dstkey, dns_name_t *name, const char *dir,
        uint16_t id, oldid;
        uint32_t rid, roldid;
        dns_secalg_t alg;
-       isc_stdtime_t now;
+       isc_stdtime_t now = isc_stdtime_now();
 
        if (exact != NULL) {
                *exact = false;
@@ -501,7 +500,6 @@ key_collision(dst_key_t *dstkey, dns_name_t *name, const char *dir,
        alg = dst_key_alg(dstkey);
 
        ISC_LIST_INIT(matchkeys);
-       isc_stdtime_get(&now);
        result = dns_dnssec_findmatchingkeys(name, dir, now, mctx, &matchkeys);
        if (result == ISC_R_NOTFOUND) {
                return (false);
index 8e1ecd08d40b8e366d718605631f6868c0dfc467..56084de881de9b7432f1b52318698f5b6d05cab6 100644 (file)
@@ -447,7 +447,7 @@ control_recvmessage(isc_nmhandle_t *handle, isc_result_t result, void *arg) {
                goto cleanup;
        }
 
-       isc_stdtime_get(&conn->now);
+       conn->now = isc_stdtime_now();
 
        /*
         * Limit exposure to replay attacks.
index 6a2ae1aa8dc0b4f1915cb5c0cac9ed28a4549801..a041e53e26b940a4fda35c38f621119f365dcc9f 100644 (file)
@@ -7456,7 +7456,7 @@ generate_session_key(const char *filename, const char *keynamestr,
        char key_txtsecret[256];
        char key_rawsecret[64];
        isc_region_t key_rawregion;
-       isc_stdtime_t now;
+       isc_stdtime_t now = isc_stdtime_now();
        dns_tsigkey_t *tsigkey = NULL;
        FILE *fp = NULL;
 
@@ -7484,7 +7484,6 @@ generate_session_key(const char *filename, const char *keynamestr,
        CHECK(isc_base64_totext(&key_rawregion, -1, "", &key_txtbuffer));
 
        /* Store the key in tsigkey. */
-       isc_stdtime_get(&now);
        CHECK(dns_tsigkey_createfromkey(dst_key_name(key), algname, key, false,
                                        false, NULL, now, now, mctx, NULL,
                                        &tsigkey));
@@ -15140,11 +15139,9 @@ named_server_zonestatus(named_server_t *server, isc_lex_t *lex,
 
                result = dns_db_getsigningtime(db, &next, name);
                if (result == ISC_R_SUCCESS) {
-                       isc_stdtime_t timenow;
                        char namebuf[DNS_NAME_FORMATSIZE];
                        char typebuf[DNS_RDATATYPE_FORMATSIZE];
 
-                       isc_stdtime_get(&timenow);
                        dns_name_format(name, namebuf, sizeof(namebuf));
                        dns_rdatatype_format(next.covers, typebuf,
                                             sizeof(typebuf));
@@ -15444,7 +15441,7 @@ named_server_nta(named_server_t *server, isc_lex_t *lex, bool readonly,
                CHECK(DNS_R_SYNTAX);
        }
 
-       isc_stdtime_get(&now);
+       now = isc_stdtime_now();
 
        isc_loopmgr_pause(named_g_loopmgr);
        for (view = ISC_LIST_HEAD(server->viewlist); view != NULL;
@@ -15704,11 +15701,9 @@ mkey_dumpzone(dns_view_t *view, isc_buffer_t **text) {
        dns_db_t *db = NULL;
        dns_dbversion_t *ver = NULL;
        dns_rriterator_t rrit;
-       isc_stdtime_t now;
+       isc_stdtime_t now = isc_stdtime_now();
        dns_name_t *prevname = NULL;
 
-       isc_stdtime_get(&now);
-
        CHECK(dns_zone_getdb(view->managed_keys, &db));
        dns_db_currentversion(db, &ver);
        dns_rriterator_init(&rrit, db, ver, 0);
index 180f75581c36936e175906db883dbe419709afde..7b8eaa4d25e0485e5af33517750019a0357333cc 100644 (file)
@@ -3826,7 +3826,6 @@ named_statschannels_shutdown(named_server_t *server) {
 
 isc_result_t
 named_stats_dump(named_server_t *server, FILE *fp) {
-       isc_stdtime_t now;
        isc_result_t result;
        dns_view_t *view;
        dns_zone_t *zone, *next;
@@ -3837,6 +3836,7 @@ named_stats_dump(named_server_t *server, FILE *fp) {
        uint64_t zonestat_values[dns_zonestatscounter_max];
        uint64_t sockstat_values[isc_sockstatscounter_max];
        uint64_t gluecachestats_values[dns_gluecachestatscounter_max];
+       isc_stdtime_t now = isc_stdtime_now();
 
        isc_once_do(&once, init_desc);
 
@@ -3844,7 +3844,6 @@ named_stats_dump(named_server_t *server, FILE *fp) {
        dumparg.type = isc_statsformat_file;
        dumparg.arg = fp;
 
-       isc_stdtime_get(&now);
        fprintf(fp, "+++ Statistics Dump +++ (%lu)\n", (unsigned long)now);
 
        fprintf(fp, "++ Incoming Requests ++\n");
index d20ab721031f3cbcb06832fcadbd4f4191bfd9dc..3333283bc7c038df9aad50d655e122678ab440fe 100644 (file)
@@ -104,7 +104,7 @@ add_initial_keys(const cfg_obj_t *list, dns_tsig_keyring_t *ring,
                }
                secretlen = isc_buffer_usedlength(&secretbuf);
 
-               isc_stdtime_get(&now);
+               now = isc_stdtime_now();
                ret = dns_tsigkey_create(&keyname, alg, secret, secretlen,
                                         false, false, NULL, now, now, mctx,
                                         ring, &tsigkey);
index c6bf8c9f62edfe9b10379022e85db48985666a19..088cfd1a17e02bf0ea341b55be5b0dcacfde90f3 100644 (file)
@@ -397,7 +397,7 @@ rndc_recvnonce(isc_nmhandle_t *handle, isc_result_t result, void *arg) {
        isccc_region_t source;
        uint32_t nonce;
        isccc_sexpr_t *request = NULL;
-       isccc_time_t now;
+       isccc_time_t now = isc_stdtime_now();
        isc_region_t r;
        isccc_sexpr_t *data = NULL;
        isc_buffer_t b;
@@ -439,8 +439,6 @@ rndc_recvnonce(isc_nmhandle_t *handle, isc_result_t result, void *arg) {
                nonce = 0;
        }
 
-       isc_stdtime_get(&now);
-
        DO("create message", isccc_cc_createmessage(1, NULL, NULL, ++serial,
                                                    now, now + 60, &request));
        data = isccc_alist_lookup(request, "_data");
@@ -496,7 +494,7 @@ rndc_connected(isc_nmhandle_t *handle, isc_result_t result, void *arg) {
        char socktext[ISC_SOCKADDR_FORMATSIZE];
        isccc_sexpr_t *request = NULL;
        isccc_sexpr_t *data = NULL;
-       isccc_time_t now;
+       isccc_time_t now = isc_stdtime_now();
        isc_region_t r;
        isc_buffer_t b;
        isc_nmhandle_t *connhandle = NULL;
@@ -521,7 +519,6 @@ rndc_connected(isc_nmhandle_t *handle, isc_result_t result, void *arg) {
 
        isc_nmhandle_attach(handle, &connhandle);
 
-       isc_stdtime_get(&now);
        DO("create message", isccc_cc_createmessage(1, NULL, NULL, ++serial,
                                                    now, now + 60, &request));
        data = isccc_alist_lookup(request, "_data");
index 568c96763c98ee306a2ab7ab428056de4a81cb32..071774f4cca56aa66069ca1632a9ff34a8df47d4 100644 (file)
@@ -2087,7 +2087,7 @@ dns_adb_createfind(dns_adb_t *adb, isc_loop_t *loop, isc_job_cb cb, void *cbarg,
        }
 
        if (now == 0) {
-               isc_stdtime_get(&now);
+               now = isc_stdtime_now();
        }
 
        /*
@@ -2456,7 +2456,7 @@ dns_adb_cancelfind(dns_adbfind_t *find) {
 
 void
 dns_adb_dump(dns_adb_t *adb, FILE *f) {
-       isc_stdtime_t now;
+       isc_stdtime_t now = isc_stdtime_now();
 
        REQUIRE(DNS_ADB_VALID(adb));
        REQUIRE(f != NULL);
@@ -2465,7 +2465,6 @@ dns_adb_dump(dns_adb_t *adb, FILE *f) {
                return;
        }
 
-       isc_stdtime_get(&now);
        cleanup_names(adb, now);
        cleanup_entries(adb, now);
        dump_adb(adb, f, false, now);
@@ -2956,7 +2955,7 @@ fetch_callback(void *arg) {
                goto out;
        }
 
-       isc_stdtime_get(&now);
+       now = isc_stdtime_now();
 
        /*
         * If we got a negative cache response, remember it.
@@ -3197,7 +3196,7 @@ dns_adb_adjustsrtt(dns_adb_t *adb, dns_adbaddrinfo_t *addr, unsigned int rtt,
        LOCK(&entry->lock);
 
        if (entry->expires == 0 || factor == DNS_ADB_RTTADJAGE) {
-               isc_stdtime_get(&now);
+               now = isc_stdtime_now();
        }
        adjustsrtt(addr, rtt, factor, now);
 
@@ -3258,7 +3257,7 @@ dns_adb_changeflags(dns_adb_t *adb, dns_adbaddrinfo_t *addr, unsigned int bits,
 
        entry->flags = (entry->flags & ~mask) | (bits & mask);
        if (entry->expires == 0) {
-               isc_stdtime_get(&now);
+               now = isc_stdtime_now();
                entry->expires = now + ADB_ENTRY_WINDOW;
        }
 
@@ -3555,7 +3554,7 @@ dns_adb_freeaddrinfo(dns_adb_t *adb, dns_adbaddrinfo_t **addrp) {
        REQUIRE(DNS_ADBENTRY_VALID(entry));
 
        if (entry->expires == 0) {
-               isc_stdtime_get(&now);
+               now = isc_stdtime_now();
                entry->expires = now + ADB_ENTRY_WINDOW;
        }
 
index 57453fa6cf49b26a81e8006db0d9f018c9980e69..034d697eec3cf46ad3072f88e03a4a7fb1ae0a32 100644 (file)
@@ -408,7 +408,7 @@ dns_dnssec_verify(const dns_name_t *name, dns_rdataset_t *set, dst_key_t *key,
        }
 
        if (!ignoretime) {
-               isc_stdtime_get(&now);
+               now = isc_stdtime_now();
 
                /*
                 * Is SIG temporally valid?
@@ -971,7 +971,7 @@ dns_dnssec_signmessage(dns_message_t *msg, dst_key_t *key) {
        if (msg->fuzzing) {
                now = msg->fuzztime;
        } else {
-               isc_stdtime_get(&now);
+               now = isc_stdtime_now();
        }
        sig.timesigned = now - DNS_TSIG_FUDGE;
        sig.timeexpire = now + DNS_TSIG_FUDGE;
@@ -1119,7 +1119,7 @@ dns_dnssec_verifymessage(isc_buffer_t *source, dns_message_t *msg,
        if (msg->fuzzing) {
                now = msg->fuzztime;
        } else {
-               isc_stdtime_get(&now);
+               now = isc_stdtime_now();
        }
 
        if (isc_serial_lt((uint32_t)now, sig.timesigned)) {
@@ -1907,7 +1907,7 @@ publish_key(dns_diff_t *diff, dns_dnsseckey_t *key, const dns_name_t *origin,
                       "(%u).",
                       keystr, ttl);
 
-               isc_stdtime_get(&now);
+               now = isc_stdtime_now();
                dst_key_settime(key->key, DST_TIME_ACTIVATE, now + ttl);
        }
 
index 0429ce36f4bd88e708d387fe0c2dbe95a6fcc30b..1d6aa5078ef7a76a87057ac9ef0967d9793ebfdb 100644 (file)
@@ -554,7 +554,7 @@ loadctx_create(dns_masterformat_t format, isc_mem_t *mctx, unsigned int options,
                isc_lex_setcomments(lctx->lex, ISC_LEXCOMMENT_DNSMASTERFILE);
        }
 
-       isc_stdtime_get(&lctx->now);
+       lctx->now = isc_stdtime_now();
 
        lctx->top = dns_fixedname_initname(&lctx->fixed_top);
        dns_name_toregion(top, &r);
@@ -1227,9 +1227,9 @@ load_text(dns_loadctx_t *lctx) {
                        } else if (strcasecmp(DNS_AS_STR(token), "$DATE") == 0)
                        {
                                int64_t dump_time64;
-                               isc_stdtime_t dump_time, current_time;
+                               isc_stdtime_t dump_time;
+                               isc_stdtime_t current_time = isc_stdtime_now();
                                GETTOKEN(lctx->lex, 0, &token, false);
-                               isc_stdtime_get(&current_time);
                                result = dns_time64_fromtext(DNS_AS_STR(token),
                                                             &dump_time64);
                                if (MANYERRS(lctx, result)) {
index 728b1d3dde5c0c58fc9eb7ebe4dcd824ac3a02c3..b80cd640eb0eabd2b0763625f8bc50adfa62540a 100644 (file)
@@ -1545,7 +1545,7 @@ dumpctx_create(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version,
                goto cleanup;
        }
 
-       isc_stdtime_get(&dctx->now);
+       dctx->now = isc_stdtime_now();
        dns_db_attach(db, &dctx->db);
 
        dctx->do_date = dns_db_iscache(dctx->db);
@@ -1913,7 +1913,7 @@ dns_master_dumpnodetostream(isc_mem_t *mctx, dns_db_t *db,
        isc_result_t result;
        isc_buffer_t buffer;
        char *bufmem;
-       isc_stdtime_t now;
+       isc_stdtime_t now = isc_stdtime_now();
        dns_totext_ctx_t ctx;
        dns_rdatasetiter_t *rdsiter = NULL;
        unsigned int options = DNS_DB_STALEOK;
@@ -1928,8 +1928,6 @@ dns_master_dumpnodetostream(isc_mem_t *mctx, dns_db_t *db,
                return (ISC_R_UNEXPECTED);
        }
 
-       isc_stdtime_get(&now);
-
        bufmem = isc_mem_get(mctx, initial_buffer_length);
 
        isc_buffer_init(&buffer, bufmem, initial_buffer_length);
index 0b44f6433950c3b5cbfde21cbad9ce262bd39ccf..cee1ea171419723b9354756ea5ca72fc7a0627d0 100644 (file)
@@ -161,7 +161,7 @@ fetch_done(void *arg) {
        isc_result_t eresult = resp->result;
        dns_ntatable_t *ntatable = nta->ntatable;
        dns_view_t *view = ntatable->view;
-       isc_stdtime_t now;
+       isc_stdtime_t now = isc_stdtime_now();
 
        if (dns_rdataset_isassociated(&nta->rdataset)) {
                dns_rdataset_disassociate(&nta->rdataset);
@@ -182,7 +182,6 @@ fetch_done(void *arg) {
        }
 
        isc_mem_putanddetach(&resp->mctx, resp, sizeof(*resp));
-       isc_stdtime_get(&now);
 
        switch (eresult) {
        case ISC_R_SUCCESS:
@@ -478,12 +477,10 @@ dns_ntatable_totext(dns_ntatable_t *ntatable, const char *view,
        dns_rbtnode_t *node;
        dns_rbtnodechain_t chain;
        bool first = true;
-       isc_stdtime_t now;
+       isc_stdtime_t now = isc_stdtime_now();
 
        REQUIRE(VALID_NTATABLE(ntatable));
 
-       isc_stdtime_get(&now);
-
        RWLOCK(&ntatable->rwlock, isc_rwlocktype_read);
        dns_rbtnodechain_init(&chain);
        result = dns_rbtnodechain_first(&chain, ntatable->table, NULL, NULL);
@@ -557,13 +554,11 @@ dns_ntatable_save(dns_ntatable_t *ntatable, FILE *fp) {
        isc_result_t result;
        dns_rbtnode_t *node;
        dns_rbtnodechain_t chain;
-       isc_stdtime_t now;
+       isc_stdtime_t now = isc_stdtime_now();
        bool written = false;
 
        REQUIRE(VALID_NTATABLE(ntatable));
 
-       isc_stdtime_get(&now);
-
        RWLOCK(&ntatable->rwlock, isc_rwlocktype_read);
        dns_rbtnodechain_init(&chain);
        result = dns_rbtnodechain_first(&chain, ntatable->table, NULL, NULL);
index 8ed1bff3a8c352e5a73efa5e314d48897b10b3a7..cec5536fec7079f42d0452e9f751b713920489bd 100644 (file)
@@ -5016,7 +5016,7 @@ cache_find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version,
        REQUIRE(version == NULL);
 
        if (now == 0) {
-               isc_stdtime_get(&now);
+               now = isc_stdtime_now();
        }
 
        search.rbtversion = NULL;
@@ -5417,7 +5417,7 @@ cache_findzonecut(dns_db_t *db, const dns_name_t *name, unsigned int options,
        REQUIRE(VALID_RBTDB(search.rbtdb));
 
        if (now == 0) {
-               isc_stdtime_get(&now);
+               now = isc_stdtime_now();
        }
 
        search.rbtversion = NULL;
@@ -5667,7 +5667,7 @@ expirenode(dns_db_t *db, dns_dbnode_t *node, isc_stdtime_t now) {
         */
 
        if (now == 0) {
-               isc_stdtime_get(&now);
+               now = isc_stdtime_now();
        }
 
        if (isc_mem_isovermem(rbtdb->common.mctx)) {
@@ -5950,7 +5950,7 @@ cache_findrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
        result = ISC_R_SUCCESS;
 
        if (now == 0) {
-               isc_stdtime_get(&now);
+               now = isc_stdtime_now();
        }
 
        lock = &rbtdb->node_locks[rbtnode->locknum].lock;
@@ -6058,7 +6058,7 @@ allrdatasets(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
                }
        } else {
                if (now == 0) {
-                       isc_stdtime_get(&now);
+                       now = isc_stdtime_now();
                }
                rbtversion = NULL;
        }
@@ -6923,7 +6923,7 @@ addrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
 
        if (rbtversion == NULL) {
                if (now == 0) {
-                       isc_stdtime_get(&now);
+                       now = isc_stdtime_now();
                }
        } else {
                now = 0;
@@ -7623,11 +7623,7 @@ beginload(dns_db_t *db, dns_rdatacallbacks_t *callbacks) {
        loadctx = isc_mem_get(rbtdb->common.mctx, sizeof(*loadctx));
 
        loadctx->rbtdb = rbtdb;
-       if (IS_CACHE(rbtdb)) {
-               isc_stdtime_get(&loadctx->now);
-       } else {
-               loadctx->now = 0;
-       }
+       loadctx->now = IS_CACHE(rbtdb) ? isc_stdtime_now() : 0;
 
        RBTDB_LOCK(&rbtdb->lock, isc_rwlocktype_write);
 
index 9e00a77ab74d2de8870c1110a063dc989b04b720..b6b21e7c959354b91ccd6f5cfa79ae51cb20a4ba 100644 (file)
@@ -207,9 +207,7 @@ totext_keydata(ARGS_TOTEXT) {
                RETERR(str_totext(buf, target));
 
                if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0) {
-                       isc_stdtime_t now;
-
-                       isc_stdtime_get(&now);
+                       isc_stdtime_t now = isc_stdtime_now();
 
                        RETERR(str_totext(tctx->linebreak, target));
                        RETERR(str_totext("; next refresh: ", target));
index e40c2b33c5a358921f01b104d5d82aa0505b43c3..ce08b76c1269f7b5a73be7ceea2438bbdd997b84 100644 (file)
@@ -1093,7 +1093,7 @@ fctx_cancelquery(resquery_t **queryp, isc_time_t *finish, bool no_response,
        fetchctx_t *fctx = NULL;
        dns_adbfind_t *find = NULL;
        dns_adbaddrinfo_t *addrinfo;
-       isc_stdtime_t now;
+       isc_stdtime_t now = isc_stdtime_now();
 
        REQUIRE(queryp != NULL);
 
@@ -1217,7 +1217,6 @@ fctx_cancelquery(resquery_t **queryp, isc_time_t *finish, bool no_response,
        /*
         * Age RTTs of servers not tried.
         */
-       isc_stdtime_get(&now);
        if (finish != NULL || age_untried) {
                for (addrinfo = ISC_LIST_HEAD(fctx->forwaddrs);
                     addrinfo != NULL;
@@ -1374,7 +1373,7 @@ fcount_logspill(fetchctx_t *fctx, fctxcount_t *counter, bool final) {
        }
 
        /* Do not log the cumulative message if the previous log is recent. */
-       isc_stdtime_get(&now);
+       now = isc_stdtime_now();
        if (!final && counter->logged > now - 60) {
                return;
        }
@@ -3556,7 +3555,7 @@ normal_nses:
                return (DNS_R_SERVFAIL);
        }
 
-       isc_stdtime_get(&now);
+       now = isc_stdtime_now();
 
        INSIST(ISC_LIST_EMPTY(fctx->finds));
        INSIST(ISC_LIST_EMPTY(fctx->altfinds));
@@ -5178,7 +5177,7 @@ validated(void *arg) {
                goto cleanup_fetchctx;
        }
 
-       isc_stdtime_get(&now);
+       now = isc_stdtime_now();
 
        /*
         * If chaining, we need to make sure that the right result code
index d776a78c866fb27168993789288b810b1de95de9..3e96694e561cfea9be025a84a23e1b6040d6f18c 100644 (file)
@@ -154,13 +154,11 @@ check_hints(dns_db_t *db) {
        dns_rdataset_t rootns;
        dns_dbiterator_t *dbiter = NULL;
        dns_dbnode_t *node = NULL;
-       isc_stdtime_t now;
+       isc_stdtime_t now = isc_stdtime_now();
        dns_fixedname_t fixname;
        dns_name_t *name;
        dns_rdatasetiter_t *rdsiter = NULL;
 
-       isc_stdtime_get(&now);
-
        name = dns_fixedname_initname(&fixname);
 
        dns_rdataset_init(&rootns);
@@ -460,7 +458,7 @@ dns_root_checkhints(dns_view_t *view, dns_db_t *hints, dns_db_t *db) {
        dns_rdata_ns_t ns;
        dns_rdataset_t hintns, rootns;
        const char *viewname = "", *sep = "";
-       isc_stdtime_t now;
+       isc_stdtime_t now = isc_stdtime_now();
        dns_name_t *name;
        dns_fixedname_t fixed;
 
@@ -468,8 +466,6 @@ dns_root_checkhints(dns_view_t *view, dns_db_t *hints, dns_db_t *db) {
        REQUIRE(db != NULL);
        REQUIRE(view != NULL);
 
-       isc_stdtime_get(&now);
-
        if (strcmp(view->name, "_bind") != 0 &&
            strcmp(view->name, "_default") != 0)
        {
index f0ed8f112bbf5afc41915fa903df04ae2e8ffcdf..f48258ef93919cb10083de2851b1768e07f7de9d 100644 (file)
@@ -1342,7 +1342,7 @@ dns_rrl_init(dns_rrl_t **rrlp, dns_view_t *view, int min_entries) {
        rrl = isc_mem_getx(view->mctx, sizeof(*rrl), ISC_MEM_ZERO);
        isc_mem_attach(view->mctx, &rrl->mctx);
        isc_mutex_init(&rrl->lock);
-       isc_stdtime_get(&rrl->ts_bases[0]);
+       rrl->ts_bases[0] = isc_stdtime_now();
 
        view->rrl = rrl;
 
index 1bf4a452fc5b247f10a55fe9ab7091c9789df916..cffcb05eb6c862d834a114078aae78cd6681f9f8 100644 (file)
@@ -101,7 +101,7 @@ dns_time64_totext(int64_t t, isc_buffer_t *target) {
 
 int64_t
 dns_time64_from32(uint32_t value) {
-       isc_stdtime_t now;
+       isc_stdtime_t now = isc_stdtime_now();
        int64_t start;
        int64_t t;
 
@@ -111,7 +111,7 @@ dns_time64_from32(uint32_t value) {
         * is defined, but even the current code is good until the year
         * 2106.
         */
-       isc_stdtime_get(&now);
+
        start = (int64_t)now;
        if (isc_serial_gt(value, now)) {
                t = start + (value - now);
index 45ac21c00301ec9f7e424a383cf8ad7f60ad2374..c7262c16881c71de4566e7b1245560b039575572 100644 (file)
@@ -180,7 +180,7 @@ process_gsstkey(dns_message_t *msg, dns_name_t *name, dns_rdata_tkey_t *tkeyin,
        dns_tsigkey_t *tsigkey = NULL;
        dns_fixedname_t fixed;
        dns_name_t *principal;
-       isc_stdtime_t now;
+       isc_stdtime_t now = isc_stdtime_now();
        isc_region_t intoken;
        isc_buffer_t *outtoken = NULL;
        dns_gss_ctx_id_t gss_ctx = NULL;
@@ -243,8 +243,6 @@ process_gsstkey(dns_message_t *msg, dns_name_t *name, dns_rdata_tkey_t *tkeyin,
         * XXXDCL Section 4.1.3: Limit GSS_S_CONTINUE_NEEDED to 10 times.
         */
 
-       isc_stdtime_get(&now);
-
        if (dns_name_countlabels(principal) == 0U) {
                if (tsigkey != NULL) {
                        dns_tsigkey_detach(&tsigkey);
@@ -685,7 +683,7 @@ dns_tkey_buildgssquery(dns_message_t *msg, const dns_name_t *name,
                       isc_mem_t *mctx, char **err_message) {
        dns_rdata_tkey_t tkey;
        isc_result_t result;
-       isc_stdtime_t now;
+       isc_stdtime_t now = isc_stdtime_now();
        isc_buffer_t token;
        unsigned char array[TEMP_BUFFER_SZ];
 
@@ -716,7 +714,6 @@ dns_tkey_buildgssquery(dns_message_t *msg, const dns_name_t *name,
                dns_name_clone(DNS_TSIG_GSSAPI_NAME, &tkey.algorithm);
        }
 
-       isc_stdtime_get(&now);
        tkey.inception = now;
        tkey.expire = now + lifetime;
        tkey.mode = DNS_TKEYMODE_GSSAPI;
index 8eef675b826817868edf947575e44ed53f487f33..f4278de865f3663c581bf6d993bd1ba59df35034 100644 (file)
@@ -389,14 +389,13 @@ cleanup_ring(dns_tsig_keyring_t *ring) {
        dns_name_t foundname;
        dns_fixedname_t fixedorigin;
        dns_name_t *origin;
-       isc_stdtime_t now;
+       isc_stdtime_t now = isc_stdtime_now();
        dns_rbtnode_t *node;
        dns_tsigkey_t *tkey;
 
        /*
         * Start up a new iterator each time.
         */
-       isc_stdtime_get(&now);
        dns_name_init(&foundname, NULL);
        origin = dns_fixedname_initname(&fixedorigin);
 
@@ -601,7 +600,7 @@ dns_tsigkeyring_dumpanddetach(dns_tsig_keyring_t **ringp, FILE *fp) {
        dns_name_t foundname;
        dns_fixedname_t fixedorigin;
        dns_name_t *origin;
-       isc_stdtime_t now;
+       isc_stdtime_t now = isc_stdtime_now();
        dns_rbtnode_t *node;
        dns_tsigkey_t *tkey;
        dns_tsig_keyring_t *ring;
@@ -615,7 +614,6 @@ dns_tsigkeyring_dumpanddetach(dns_tsig_keyring_t **ringp, FILE *fp) {
                return (DNS_R_CONTINUE);
        }
 
-       isc_stdtime_get(&now);
        dns_name_init(&foundname, NULL);
        origin = dns_fixedname_initname(&fixedorigin);
        dns_rbtnodechain_init(&chain);
@@ -805,7 +803,7 @@ dns_tsig_sign(dns_message_t *msg) {
        if (msg->fuzzing) {
                now = msg->fuzztime;
        } else {
-               isc_stdtime_get(&now);
+               now = isc_stdtime_now();
        }
 
        tsig.timesigned = now + msg->timeadjust;
@@ -1159,7 +1157,7 @@ dns_tsig_verify(isc_buffer_t *source, dns_message_t *msg,
        if (msg->fuzzing) {
                now = msg->fuzztime;
        } else {
-               isc_stdtime_get(&now);
+               now = isc_stdtime_now();
        }
 
        /*
@@ -1659,7 +1657,7 @@ tsig_verify_tcp(isc_buffer_t *source, dns_message_t *msg) {
                if (msg->fuzzing) {
                        now = msg->fuzztime;
                } else {
-                       isc_stdtime_get(&now);
+                       now = isc_stdtime_now();
                }
 
                if (now + msg->timeadjust > tsig.timesigned + tsig.fudge) {
@@ -1738,7 +1736,7 @@ isc_result_t
 dns_tsigkey_find(dns_tsigkey_t **tsigkey, const dns_name_t *name,
                 const dns_name_t *algorithm, dns_tsig_keyring_t *ring) {
        dns_tsigkey_t *key;
-       isc_stdtime_t now;
+       isc_stdtime_t now = isc_stdtime_now();
        isc_result_t result;
 
        REQUIRE(tsigkey != NULL);
@@ -1750,7 +1748,6 @@ dns_tsigkey_find(dns_tsigkey_t **tsigkey, const dns_name_t *name,
        cleanup_ring(ring);
        RWUNLOCK(&ring->lock, isc_rwlocktype_write);
 
-       isc_stdtime_get(&now);
        RWLOCK(&ring->lock, isc_rwlocktype_read);
        key = NULL;
        result = dns_rbt_findname(ring->keys, name, 0, NULL, (void *)&key);
@@ -1880,10 +1877,9 @@ dns_tsigkeyring_detach(dns_tsig_keyring_t **ringp) {
 
 void
 dns_keyring_restore(dns_tsig_keyring_t *ring, FILE *fp) {
-       isc_stdtime_t now;
+       isc_stdtime_t now = isc_stdtime_now();
        isc_result_t result;
 
-       isc_stdtime_get(&now);
        do {
                result = restore_key(ring, now, fp);
                if (result == ISC_R_NOMORE) {
index d3899e8e511b74a591de3e93ca32320dcae10721..c547c041a85ac2e8f18dafd74bc9a38eb18a428a 100644 (file)
@@ -1059,12 +1059,11 @@ find_zone_keys(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *ver,
               isc_mem_t *mctx, unsigned int maxkeys, dst_key_t **keys,
               unsigned int *nkeys) {
        isc_result_t result;
-       isc_stdtime_t now;
+       isc_stdtime_t now = isc_stdtime_now();
        dns_dbnode_t *node = NULL;
        const char *directory = dns_zone_getkeydirectory(zone);
 
        CHECK(dns_db_findnode(db, dns_db_origin(db), false, &node));
-       isc_stdtime_get(&now);
 
        dns_zone_lock_keyfiles(zone);
        result = dns_dnssec_findzonekeys(db, ver, node, dns_db_origin(db),
@@ -1561,7 +1560,7 @@ dns_update_signaturesinc(dns_update_log_t *log, dns_zone_t *zone, dns_db_t *db,
                        goto failure;
                }
 
-               isc_stdtime_get(&now);
+               now = isc_stdtime_now();
                state->inception = now - 3600; /* Allow for some clock skew. */
                state->expire = now +
                                dns__jitter_expire(zone, sigvalidityinterval);
@@ -2221,10 +2220,10 @@ dns__update_soaserial(uint32_t serial, dns_updatemethod_t method) {
        case dns_updatemethod_none:
                return (serial);
        case dns_updatemethod_unixtime:
-               isc_stdtime_get(&now);
+               now = isc_stdtime_now();
                return (now);
        case dns_updatemethod_date:
-               isc_stdtime_get(&now);
+               now = isc_stdtime_now();
                return (epoch_to_yyyymmdd((time_t)now) * 100);
        case dns_updatemethod_increment:
                /* RFC1982 */
index 08a5395ef2fd3c5155b1619f66c3139b7d596443..4b180d1e97aff1f3fa8efc34e1d8ec0e555ef094 100644 (file)
@@ -3019,7 +3019,7 @@ dns_validator_create(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
        dns_rdataset_init(&val->fsigrdataset);
        dns_fixedname_init(&val->wild);
        dns_fixedname_init(&val->closest);
-       isc_stdtime_get(&val->start);
+       val->start = isc_stdtime_now();
        val->magic = VALIDATOR_MAGIC;
 
        if ((options & DNS_VALIDATOR_DEFER) == 0) {
index 686075b30956fb235b2049099c2971d8934578c3..fdfc295239fd2b6b5ca08e59500be057abfa0bf6 100644 (file)
@@ -2017,7 +2017,7 @@ dns_view_loadnta(dns_view_t *view) {
        dns_ntatable_t *ntatable = NULL;
        isc_lex_t *lex = NULL;
        isc_token_t token;
-       isc_stdtime_t now;
+       isc_stdtime_t now = isc_stdtime_now();
 
        REQUIRE(DNS_VIEW_VALID(view));
 
@@ -2028,7 +2028,6 @@ dns_view_loadnta(dns_view_t *view) {
        isc_lex_create(view->mctx, 1025, &lex);
        CHECK(isc_lex_openfile(lex, view->nta_file));
        CHECK(dns_view_getntatable(view, &ntatable));
-       isc_stdtime_get(&now);
 
        for (;;) {
                int options = (ISC_LEXOPT_EOL | ISC_LEXOPT_EOF);
index 7444fb29e3e81166731e9fcaa7dd303f102a1e24..36446abd15948c107a8ba275745174736e485477 100644 (file)
@@ -4003,12 +4003,11 @@ create_keydata(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *ver,
        dns_rdata_keydata_t kd;
        unsigned char rrdata[4096];
        isc_buffer_t rrdatabuf;
-       isc_stdtime_t now;
+       isc_stdtime_t now = isc_stdtime_now();
 
        REQUIRE(keynode != NULL);
 
        ENTER;
-       isc_stdtime_get(&now);
 
        /*
         * If the keynode has no trust anchor set, we shouldn't be here.
@@ -4169,11 +4168,9 @@ load_secroots(dns_zone_t *zone, dns_name_t *name, dns_rdataset_t *rdataset) {
        dns_rdata_keydata_t keydata;
        dns_rdata_dnskey_t dnskey;
        int trusted = 0, revoked = 0, pending = 0;
-       isc_stdtime_t now;
+       isc_stdtime_t now = isc_stdtime_now();
        dns_keytable_t *sr = NULL;
 
-       isc_stdtime_get(&now);
-
        result = dns_view_getsecroots(zone->view, &sr);
        if (result == ISC_R_SUCCESS) {
                dns_keytable_delete(sr, name, sfd_del, zone->view);
@@ -4513,13 +4510,11 @@ sync_keyzone(dns_zone_t *zone, dns_db_t *db) {
                dns_rdataset_t *rdataset = NULL;
                dns_rdata_t rdata = DNS_RDATA_INIT;
                dns_rdata_keydata_t keydata;
-               isc_stdtime_t now;
+               isc_stdtime_t now = isc_stdtime_now();
                bool load = true;
                dns_name_t *rrname = NULL;
                uint32_t ttl;
 
-               isc_stdtime_get(&now);
-
                dns_rriterator_current(&rrit, &rrname, &ttl, &rdataset, NULL);
                if (!dns_rdataset_isassociated(rdataset)) {
                        dns_rriterator_destroy(&rrit);
@@ -5158,11 +5153,10 @@ zone_postload(dns_zone_t *zone, dns_db_t *db, isc_time_t loadtime,
 
                        result = dns_db_getsigningtime(db, &next, name);
                        if (result == ISC_R_SUCCESS) {
-                               isc_stdtime_t timenow;
+                               isc_stdtime_t timenow = isc_stdtime_now();
                                char namebuf[DNS_NAME_FORMATSIZE];
                                char typebuf[DNS_RDATATYPE_FORMATSIZE];
 
-                               isc_stdtime_get(&timenow);
                                dns_name_format(name, namebuf, sizeof(namebuf));
                                dns_rdatatype_format(next.covers, typebuf,
                                                     sizeof(typebuf));
@@ -6832,7 +6826,7 @@ zone_resigninc(dns_zone_t *zone) {
                goto failure;
        }
 
-       isc_stdtime_get(&now);
+       now = isc_stdtime_now();
 
        result = dns__zone_findkeys(zone, db, version, now, zone->mctx,
                                    DNS_MAXZONEKEYS, zone_keys, &nkeys);
@@ -8048,7 +8042,7 @@ zone_nsec3chain(dns_zone_t *zone) {
                goto failure;
        }
 
-       isc_stdtime_get(&now);
+       now = isc_stdtime_now();
 
        result = dns__zone_findkeys(zone, db, version, now, zone->mctx,
                                    DNS_MAXZONEKEYS, zone_keys, &nkeys);
@@ -9136,7 +9130,7 @@ zone_sign(dns_zone_t *zone) {
                goto cleanup;
        }
 
-       isc_stdtime_get(&now);
+       now = isc_stdtime_now();
 
        result = dns__zone_findkeys(zone, db, version, now, zone->mctx,
                                    DNS_MAXZONEKEYS, zone_keys, &nkeys);
@@ -9792,9 +9786,7 @@ refresh_time(dns_keyfetch_t *kfetch, bool retry) {
        dns_rdataset_t *rdset;
        dns_rdata_t sigrr = DNS_RDATA_INIT;
        dns_rdata_sig_t sig;
-       isc_stdtime_t now;
-
-       isc_stdtime_get(&now);
+       isc_stdtime_t now = isc_stdtime_now();
 
        if (dns_rdataset_isassociated(&kfetch->dnskeysigset)) {
                rdset = &kfetch->dnskeysigset;
@@ -9864,10 +9856,9 @@ minimal_update(dns_keyfetch_t *kfetch, dns_dbversion_t *ver, dns_diff_t *diff) {
        dns_rdata_keydata_t keydata;
        dns_name_t *name;
        dns_zone_t *zone = kfetch->zone;
-       isc_stdtime_t now;
+       isc_stdtime_t now = isc_stdtime_now();
 
        name = dns_fixedname_name(&kfetch->name);
-       isc_stdtime_get(&now);
 
        for (result = dns_rdataset_first(&kfetch->keydataset);
             result == ISC_R_SUCCESS;
@@ -10041,7 +10032,7 @@ keyfetch_done(void *arg) {
                goto cleanup;
        }
 
-       isc_stdtime_get(&now);
+       now = isc_stdtime_now();
        dns_name_format(keyname, namebuf, sizeof(namebuf));
 
        result = dns_view_getsecroots(zone->view, &secroots);
@@ -10742,7 +10733,7 @@ zone_refreshkeys(dns_zone_t *zone) {
        dns_diff_t diff;
        dns_rdata_t rdata = DNS_RDATA_INIT;
        dns_rdata_keydata_t kd;
-       isc_stdtime_t now;
+       isc_stdtime_t now = isc_stdtime_now();
        bool commit = false;
        bool fetching = false;
        bool timerset = false;
@@ -10750,8 +10741,6 @@ zone_refreshkeys(dns_zone_t *zone) {
        ENTER;
        REQUIRE(zone->db != NULL);
 
-       isc_stdtime_get(&now);
-
        LOCK_ZONE(zone);
        if (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_EXITING)) {
                isc_time_settoepoch(&zone->refreshkeytime);
index 7163595399c150d104cf84953c8701e1bf80968e..b5c0facdc2cbccf8ffb7a4fce07eba73f6f71099 100644 (file)
@@ -42,9 +42,8 @@ static atomic_uint_fast32_t last_tcpquota_log = 0;
 
 static bool
 can_log_tcp_quota(void) {
-       isc_stdtime_t now, last;
-
-       isc_stdtime_get(&now);
+       isc_stdtime_t last;
+       isc_stdtime_t now = isc_stdtime_now();
        last = atomic_exchange_relaxed(&last_tcpquota_log, now);
        if (now != last) {
                return (true);
index c016c8986cfd0dc3375259d1549883d4d474acdb..5414fa49d0afbbcc662aabab1b3df1990c4c5f2b 100644 (file)
@@ -997,11 +997,10 @@ ns_client_addopt(ns_client_t *client, dns_message_t *message,
 no_nsid:
        if ((client->attributes & NS_CLIENTATTR_WANTCOOKIE) != 0) {
                isc_buffer_t buf;
-               isc_stdtime_t now;
+               isc_stdtime_t now = isc_stdtime_now();
                uint32_t nonce;
 
                isc_buffer_init(&buf, cookie, sizeof(cookie));
-               isc_stdtime_get(&now);
 
                isc_random_buf(&nonce, sizeof(nonce));
 
@@ -1292,7 +1291,7 @@ process_cookie(ns_client_t *client, isc_buffer_t *buf, size_t optlen) {
         * Allow for a 5 minute clock skew between servers sharing a secret.
         * Only accept COOKIE if we have talked to the client in the last hour.
         */
-       isc_stdtime_get(&now);
+       now = isc_stdtime_now();
        if (isc_serial_gt(when, (now + 300)) || /* In the future. */
            isc_serial_lt(when, (now - 3600)))
        { /* In the past. */
index 4ce1c4d7abfc6e39f9c6bde030ef9ab7c78435f4..d82a96995b3a151da55c1192c4f5ab8ecc46b545 100644 (file)
@@ -2286,7 +2286,7 @@ mark_secure(ns_client_t *client, dns_db_t *db, dns_name_t *name,
                return;
        }
 
-       isc_stdtime_get(&now);
+       now = isc_stdtime_now();
        dns_rdataset_trimttl(rdataset, sigrdataset, rrsig, now,
                             client->view->acceptexpired);
 
@@ -2583,7 +2583,7 @@ stale_refresh_aftermath(ns_client_t *client, isc_result_t result) {
                 * database, starting the stale-refresh-time window for it.
                 * This is a condensed form of query_lookup().
                 */
-               isc_stdtime_get(&client->now);
+               client->now = isc_stdtime_now();
                client->query.attributes &= ~NS_QUERYATTR_RECURSIONOK;
                qctx_init(client, NULL, 0, &qctx);
 
@@ -6280,7 +6280,7 @@ fetch_callback(void *arg) {
                /*
                 * Update client->now.
                 */
-               isc_stdtime_get(&client->now);
+               client->now = isc_stdtime_now();
        } else {
                /*
                 * This is a fetch completion event for a canceled fetch.
@@ -6412,9 +6412,7 @@ recparam_update(ns_query_recparam_t *param, dns_rdatatype_t qtype,
 static void
 recursionquota_log(ns_client_t *client, atomic_uint_fast32_t *last_log_time,
                   const char *format, isc_quota_t *quota) {
-       isc_stdtime_t now;
-
-       isc_stdtime_get(&now);
+       isc_stdtime_t now = isc_stdtime_now();
        if (now == atomic_load_relaxed(last_log_time)) {
                return;
        }
@@ -6757,7 +6755,7 @@ query_hookresume(void *arg) {
                INSIST(rev->ctx == client->query.hookactx);
                client->query.hookactx = NULL;
                canceled = false;
-               isc_stdtime_get(&client->now);
+               client->now = isc_stdtime_now();
        } else {
                canceled = true;
        }
index 6aa054e0695a2c9bfd64bad02c587ef4a25fbc99..ead4a83ef73217491230f9d9446b2e207daa7d4a 100644 (file)
@@ -141,7 +141,8 @@ ISC_RUN_TEST_IMPL(dns_dt_send) {
        isc_sockaddr_t qaddr;
        isc_sockaddr_t raddr;
        struct in_addr in;
-       isc_stdtime_t now;
+       isc_stdtime_t now = isc_stdtime_now();
+
        isc_time_t p, f;
        struct fstrm_iothr_options *fopt;
 
@@ -182,7 +183,6 @@ ISC_RUN_TEST_IMPL(dns_dt_send) {
        in.s_addr = inet_addr("10.53.0.2");
        isc_sockaddr_fromin(&raddr, &in, 2112);
 
-       isc_stdtime_get(&now);
        isc_time_set(&p, now - 3600, 0); /* past */
        isc_time_set(&f, now + 3600, 0); /* future */
 
index 9a86b85065006a82664b777d7e32f18b3fdda0e4..ac8ae02868958cdf660a5fe84bf0f1970e5a6919 100644 (file)
@@ -170,7 +170,7 @@ create_tables(void) {
        dns_rdata_ds_t ds;
        dns_fixedname_t fn;
        dns_name_t *keyname = dns_fixedname_name(&fn);
-       isc_stdtime_t now;
+       isc_stdtime_t now = isc_stdtime_now();
 
        assert_int_equal(dns_test_makeview("view", false, &view),
                         ISC_R_SUCCESS);
@@ -199,7 +199,6 @@ create_tables(void) {
                ISC_R_SUCCESS);
 
        /* Add a negative trust anchor, duration 1 hour */
-       isc_stdtime_get(&now);
        assert_int_equal(dns_ntatable_add(ntatable,
                                          str2name("insecure.example"), false,
                                          now, 3600),
@@ -604,7 +603,7 @@ ISC_LOOP_TEST_IMPL(nta) {
        unsigned char digest[ISC_MAX_MD_SIZE];
        dns_rdata_ds_t ds;
        dns_view_t *myview = NULL;
-       isc_stdtime_t now;
+       isc_stdtime_t now = isc_stdtime_now();
 
        result = dns_test_makeview("view", false, &myview);
        assert_int_equal(result, ISC_R_SUCCESS);
@@ -625,7 +624,6 @@ ISC_LOOP_TEST_IMPL(nta) {
                                  NULL),
        assert_int_equal(result, ISC_R_SUCCESS);
 
-       isc_stdtime_get(&now);
        result = dns_ntatable_add(ntatable, str2name("insecure.example"), false,
                                  now, 1);
        assert_int_equal(result, ISC_R_SUCCESS);
index dbb14ac86ee1845509db76aa8ac8798318c69543..1dfdd83e348a3e3e38e7324a4da17ee0ca05379b 100644 (file)
@@ -294,7 +294,7 @@ ISC_RUN_TEST_IMPL(updatesigs_next) {
        dns_db_t *db = NULL;
        isc_result_t result;
        unsigned int nkeys;
-       isc_stdtime_t now;
+       isc_stdtime_t now = isc_stdtime_now();
        size_t i;
 
        UNUSED(state);
@@ -313,7 +313,6 @@ ISC_RUN_TEST_IMPL(updatesigs_next) {
        result = dns_zone_setkeydirectory(zone, TESTS_DIR "/testkeys");
        assert_int_equal(result, ISC_R_SUCCESS);
 
-       isc_stdtime_get(&now);
        result = dns__zone_findkeys(zone, db, NULL, now, mctx, DNS_MAXZONEKEYS,
                                    zone_keys, &nkeys);
        assert_int_equal(result, ISC_R_SUCCESS);
index 02b5926f0cc28633d42e03cba3db82f90b57836b..e18fc69dd6fe32dacf3c050fad8178005e227b1f 100644 (file)
@@ -104,7 +104,6 @@ add_tsig(dst_context_t *tsigctx, dns_tsigkey_t *key, isc_buffer_t *target) {
        isc_buffer_t sigbuf;
        isc_region_t r;
        isc_result_t result = ISC_R_SUCCESS;
-       isc_stdtime_t now;
        unsigned char tsigbuf[1024];
        unsigned int count;
        unsigned int sigsize = 0;
@@ -119,8 +118,7 @@ add_tsig(dst_context_t *tsigctx, dns_tsigkey_t *key, isc_buffer_t *target) {
        dns_name_init(&tsig.algorithm, NULL);
        dns_name_clone(key->algorithm, &tsig.algorithm);
 
-       isc_stdtime_get(&now);
-       tsig.timesigned = now;
+       tsig.timesigned = isc_stdtime_now();
        tsig.fudge = DNS_TSIG_FUDGE;
        tsig.originalid = 50;
        tsig.error = dns_rcode_noerror;
index afeaa5ce830cda597efc9612cbd4aaed7ece44d0..5ec4002db5de293820197c310efc57effe7f2b95 100644 (file)
@@ -67,9 +67,9 @@ set_mystdtime(int year, int month, int day) {
        mystdtime = timegm(&tm);
 }
 
-void
-isc_stdtime_get(isc_stdtime_t *now) {
-       *now = mystdtime;
+isc_stdtime_t
+isc_stdtime_now(void) {
+       return (mystdtime);
 }
 
 /* simple increment by 1 */