mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 14:07:59 +00:00
Merge branch 'ondrej/add-isc_stdtime_now' into 'main'
Provide isc_stdtime_now(void) that returns value See merge request isc-projects/bind9!7757
This commit is contained in:
commit
1ca0fb0e02
3
CHANGES
3
CHANGES
@ -1,3 +1,6 @@
|
||||
6135. [cleanup] Change isc_stdtime_get(&t) to t = isc_stdtime_now().
|
||||
[GL !7757]
|
||||
|
||||
6134. [bug] Fix a crash when dig or host receive a signal.
|
||||
[GL #3970]
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
|
@ -281,7 +281,7 @@ main(int argc, char *argv[]) {
|
||||
isc_result_totext(result));
|
||||
}
|
||||
|
||||
isc_stdtime_get(&now);
|
||||
now = isc_stdtime_now();
|
||||
|
||||
rdclass = strtoclass(classname);
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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.
|
||||
|
@ -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);
|
||||
|
@ -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");
|
||||
|
@ -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);
|
||||
|
@ -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");
|
||||
|
6
cocci/isc_stdtime_now.spatch
Normal file
6
cocci/isc_stdtime_now.spatch
Normal file
@ -0,0 +1,6 @@
|
||||
@@
|
||||
expression t;
|
||||
@@
|
||||
|
||||
- isc_stdtime_get(&t);
|
||||
+ t = isc_stdtime_now();
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -369,10 +369,6 @@ dns_adb_createfind(dns_adb_t *adb, isc_loop_t *loop, isc_job_cb cb, void *cbarg,
|
||||
*\li #ISC_R_NOMEMORY insufficient resources
|
||||
*\li #DNS_R_ALIAS 'name' is an alias for another name.
|
||||
*
|
||||
* Calls, and returns error codes from:
|
||||
*
|
||||
*\li isc_stdtime_get()
|
||||
*
|
||||
* Notes:
|
||||
*
|
||||
*\li No internal reference to "name" exists after this function
|
||||
|
@ -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(¤t_time);
|
||||
result = dns_time64_fromtext(DNS_AS_STR(token),
|
||||
&dump_time64);
|
||||
if (MANYERRS(lctx, result)) {
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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));
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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;
|
||||
|
||||
|
@ -101,17 +101,17 @@ 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;
|
||||
|
||||
/*
|
||||
* Adjust the time to the closest epoch. This should be changed
|
||||
* to use a 64-bit counterpart to isc_stdtime_get() if one ever
|
||||
* to use a 64-bit counterpart to isc_stdtime_now() if one ever
|
||||
* 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);
|
||||
|
@ -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;
|
||||
|
@ -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) {
|
||||
|
@ -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 */
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <isc/lang.h>
|
||||
#include <isc/time.h>
|
||||
|
||||
/*%
|
||||
* It's public information that 'isc_stdtime_t' is an unsigned integral type.
|
||||
@ -28,15 +29,11 @@
|
||||
typedef uint32_t isc_stdtime_t;
|
||||
|
||||
ISC_LANG_BEGINDECLS
|
||||
/* */
|
||||
void
|
||||
isc_stdtime_get(isc_stdtime_t *t);
|
||||
|
||||
isc_stdtime_t
|
||||
isc_stdtime_now(void);
|
||||
/*%<
|
||||
* Set 't' to the number of seconds since 00:00:00 UTC, January 1, 1970.
|
||||
*
|
||||
* Requires:
|
||||
*
|
||||
*\li 't' is a valid pointer.
|
||||
* Return the number of seconds since 00:00:00 UTC, January 1, 1970.
|
||||
*/
|
||||
|
||||
void
|
||||
@ -53,9 +50,4 @@ isc_stdtime_tostring(isc_stdtime_t t, char *out, size_t outlen);
|
||||
* 'outlen' is at least 26.
|
||||
*/
|
||||
|
||||
#define isc_stdtime_convert32(t, t32p) (*(t32p) = t)
|
||||
/*
|
||||
* Convert the standard time to its 32-bit version.
|
||||
*/
|
||||
|
||||
ISC_LANG_ENDDECLS
|
||||
|
@ -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);
|
||||
|
@ -33,19 +33,16 @@
|
||||
#define CLOCKSOURCE CLOCK_REALTIME
|
||||
#endif /* if defined(CLOCK_REALTIME_COARSE) */
|
||||
|
||||
void
|
||||
isc_stdtime_get(isc_stdtime_t *t) {
|
||||
REQUIRE(t != NULL);
|
||||
|
||||
isc_stdtime_t
|
||||
isc_stdtime_now(void) {
|
||||
struct timespec ts;
|
||||
|
||||
if (clock_gettime(CLOCKSOURCE, &ts) == -1) {
|
||||
FATAL_SYSERROR(errno, "clock_gettime()");
|
||||
}
|
||||
INSIST(ts.tv_sec > 0 && ts.tv_nsec >= 0 && ts.tv_nsec < NS_PER_SEC);
|
||||
|
||||
REQUIRE(ts.tv_sec > 0 && ts.tv_nsec >= 0 && ts.tv_nsec < NS_PER_SEC);
|
||||
|
||||
*t = (isc_stdtime_t)ts.tv_sec;
|
||||
return ((isc_stdtime_t)ts.tv_sec);
|
||||
}
|
||||
|
||||
void
|
||||
@ -55,8 +52,6 @@ isc_stdtime_tostring(isc_stdtime_t t, char *out, size_t outlen) {
|
||||
REQUIRE(out != NULL);
|
||||
REQUIRE(outlen >= 26);
|
||||
|
||||
UNUSED(outlen);
|
||||
|
||||
/* time_t and isc_stdtime_t might be different sizes */
|
||||
when = t;
|
||||
INSIST((ctime_r(&when, out) != NULL));
|
||||
|
@ -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. */
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 */
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -32,7 +32,7 @@
|
||||
#define KEEP_BEFORE
|
||||
|
||||
/*
|
||||
* Fix the linking order problem for overridden isc_stdtime_get() by making
|
||||
* Fix the linking order problem for overridden isc_stdtime_now() by making
|
||||
* everything local. This also allows static functions from update.c to be
|
||||
* tested.
|
||||
*/
|
||||
@ -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 */
|
||||
|
Loading…
x
Reference in New Issue
Block a user