}
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);
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();
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;
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();
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) {
.prepub = -1,
.protocol = -1,
.size = -1,
+ .now = isc_stdtime_now(),
};
if (argc == 1) {
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) {
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,
program);
}
- isc_stdtime_get(&now);
dst_key_settime(key, DST_TIME_REVOKE, now);
dst_key_setflags(key, flags | DNS_KEYFLAG_REVOKE);
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;
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;
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) {
}
}
- isc_stdtime_get(&now);
+ now = isc_stdtime_now();
if (startstr != NULL) {
starttime = strtotime(startstr, now, now, NULL);
isc_result_totext(result));
}
- isc_stdtime_get(&now);
+ now = isc_stdtime_now();
rdclass = strtoclass(classname);
* 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);
}
}
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;
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);
goto cleanup;
}
- isc_stdtime_get(&conn->now);
+ conn->now = isc_stdtime_now();
/*
* Limit exposure to replay attacks.
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;
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));
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));
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;
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);
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;
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);
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");
}
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);
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;
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");
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;
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");
}
if (now == 0) {
- isc_stdtime_get(&now);
+ now = isc_stdtime_now();
}
/*
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);
return;
}
- isc_stdtime_get(&now);
cleanup_names(adb, now);
cleanup_entries(adb, now);
dump_adb(adb, f, false, now);
goto out;
}
- isc_stdtime_get(&now);
+ now = isc_stdtime_now();
/*
* If we got a negative cache response, remember it.
LOCK(&entry->lock);
if (entry->expires == 0 || factor == DNS_ADB_RTTADJAGE) {
- isc_stdtime_get(&now);
+ now = isc_stdtime_now();
}
adjustsrtt(addr, rtt, factor, now);
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;
}
REQUIRE(DNS_ADBENTRY_VALID(entry));
if (entry->expires == 0) {
- isc_stdtime_get(&now);
+ now = isc_stdtime_now();
entry->expires = now + ADB_ENTRY_WINDOW;
}
}
if (!ignoretime) {
- isc_stdtime_get(&now);
+ now = isc_stdtime_now();
/*
* Is SIG temporally valid?
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;
if (msg->fuzzing) {
now = msg->fuzztime;
} else {
- isc_stdtime_get(&now);
+ now = isc_stdtime_now();
}
if (isc_serial_lt((uint32_t)now, sig.timesigned)) {
"(%u).",
keystr, ttl);
- isc_stdtime_get(&now);
+ now = isc_stdtime_now();
dst_key_settime(key->key, DST_TIME_ACTIVATE, now + ttl);
}
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);
} 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)) {
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);
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;
return (ISC_R_UNEXPECTED);
}
- isc_stdtime_get(&now);
-
bufmem = isc_mem_get(mctx, initial_buffer_length);
isc_buffer_init(&buffer, bufmem, initial_buffer_length);
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);
}
isc_mem_putanddetach(&resp->mctx, resp, sizeof(*resp));
- isc_stdtime_get(&now);
switch (eresult) {
case ISC_R_SUCCESS:
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);
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);
REQUIRE(version == NULL);
if (now == 0) {
- isc_stdtime_get(&now);
+ now = isc_stdtime_now();
}
search.rbtversion = NULL;
REQUIRE(VALID_RBTDB(search.rbtdb));
if (now == 0) {
- isc_stdtime_get(&now);
+ now = isc_stdtime_now();
}
search.rbtversion = NULL;
*/
if (now == 0) {
- isc_stdtime_get(&now);
+ now = isc_stdtime_now();
}
if (isc_mem_isovermem(rbtdb->common.mctx)) {
result = ISC_R_SUCCESS;
if (now == 0) {
- isc_stdtime_get(&now);
+ now = isc_stdtime_now();
}
lock = &rbtdb->node_locks[rbtnode->locknum].lock;
}
} else {
if (now == 0) {
- isc_stdtime_get(&now);
+ now = isc_stdtime_now();
}
rbtversion = NULL;
}
if (rbtversion == NULL) {
if (now == 0) {
- isc_stdtime_get(&now);
+ now = isc_stdtime_now();
}
} else {
now = 0;
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);
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));
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);
/*
* Age RTTs of servers not tried.
*/
- isc_stdtime_get(&now);
if (finish != NULL || age_untried) {
for (addrinfo = ISC_LIST_HEAD(fctx->forwaddrs);
addrinfo != NULL;
}
/* 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;
}
return (DNS_R_SERVFAIL);
}
- isc_stdtime_get(&now);
+ now = isc_stdtime_now();
INSIST(ISC_LIST_EMPTY(fctx->finds));
INSIST(ISC_LIST_EMPTY(fctx->altfinds));
goto cleanup_fetchctx;
}
- isc_stdtime_get(&now);
+ now = isc_stdtime_now();
/*
* If chaining, we need to make sure that the right result code
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);
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;
REQUIRE(db != NULL);
REQUIRE(view != NULL);
- isc_stdtime_get(&now);
-
if (strcmp(view->name, "_bind") != 0 &&
strcmp(view->name, "_default") != 0)
{
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;
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;
* 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);
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;
* 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);
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];
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;
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);
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;
return (DNS_R_CONTINUE);
}
- isc_stdtime_get(&now);
dns_name_init(&foundname, NULL);
origin = dns_fixedname_initname(&fixedorigin);
dns_rbtnodechain_init(&chain);
if (msg->fuzzing) {
now = msg->fuzztime;
} else {
- isc_stdtime_get(&now);
+ now = isc_stdtime_now();
}
tsig.timesigned = now + msg->timeadjust;
if (msg->fuzzing) {
now = msg->fuzztime;
} else {
- isc_stdtime_get(&now);
+ now = isc_stdtime_now();
}
/*
if (msg->fuzzing) {
now = msg->fuzztime;
} else {
- isc_stdtime_get(&now);
+ now = isc_stdtime_now();
}
if (now + msg->timeadjust > tsig.timesigned + tsig.fudge) {
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);
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);
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) {
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),
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);
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 */
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) {
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));
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);
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.
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);
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);
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));
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);
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);
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);
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;
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;
goto cleanup;
}
- isc_stdtime_get(&now);
+ now = isc_stdtime_now();
dns_name_format(keyname, namebuf, sizeof(namebuf));
result = dns_view_getsecroots(zone->view, &secroots);
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;
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);
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);
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));
* 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. */
return;
}
- isc_stdtime_get(&now);
+ now = isc_stdtime_now();
dns_rdataset_trimttl(rdataset, sigrdataset, rrsig, now,
client->view->acceptexpired);
* 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);
/*
* Update client->now.
*/
- isc_stdtime_get(&client->now);
+ client->now = isc_stdtime_now();
} else {
/*
* This is a fetch completion event for a canceled fetch.
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;
}
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;
}
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;
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 */
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);
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),
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);
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);
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);
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);
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;
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;
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 */