extern unsigned int dns_zone_mkey_day;
extern unsigned int dns_zone_mkey_month;
+extern unsigned int dns_adb_entrywindow;
+extern unsigned int dns_adb_cachemin;
+
static bool want_stats = false;
static char absolute_conffile[PATH_MAX];
static char saved_command_line[4096] = { 0 };
transferstuck = true;
} else if (!strncmp(option, "tat=", 4)) {
named_g_tat_interval = atoi(option + 4);
+ } else if (!strncmp(option, "adbentrywindow=", 15)) {
+ dns_adb_entrywindow = atoi(option + 15);
+ } else if (!strncmp(option, "adbcachemin=", 12)) {
+ dns_adb_cachemin = atoi(option + 12);
} else {
fprintf(stderr, "unknown -T flag '%s'\n", option);
}
/*!
* For type 3 negative cache entries, we will remember that the address is
* broken for this long. XXXMLG This is also used for actual addresses, too.
- * The intent is to keep us from constantly asking about A/AAAA records
- * if the zone has extremely low TTLs.
*/
-#define ADB_CACHE_MINIMUM 10 /*%< seconds */
#define ADB_CACHE_MAXIMUM 86400 /*%< seconds (86400 = 24 hours) */
-#define ADB_ENTRY_WINDOW 60 /*%< seconds */
#define ADB_HASH_SIZE (1 << 12)
ISC_REFCOUNT_DECL(dns_adbentry);
#endif
+/*
+ * ADB settings that can be tweaked with named -T option
+ */
+unsigned int dns_adb_entrywindow = 60;
+unsigned int dns_adb_cachemin = 10;
+
/*
* Internal functions (and prototypes).
*/
* Due to the ttlclamp(), the TTL is never 0 unless the trust is ultimate,
* in which case we need to set the expiration to have immediate effect.
*/
-#define ADJUSTED_EXPIRE(expire, now, ttl) \
- ((ttl != 0) \
- ? ISC_MIN(expire, ISC_MAX(now + ADB_ENTRY_WINDOW, now + ttl)) \
- : INT_MAX)
+#define ADJUSTED_EXPIRE(expire, now, ttl) \
+ ((ttl != 0) ? ISC_MIN(expire, \
+ ISC_MAX(now + dns_adb_entrywindow, now + ttl)) \
+ : INT_MAX)
/*
* Error states.
static dns_ttl_t
ttlclamp(dns_ttl_t ttl) {
- if (ttl < ADB_CACHE_MINIMUM) {
- ttl = ADB_CACHE_MINIMUM;
+ if (ttl < dns_adb_cachemin) {
+ /*
+ * Avoid to constantly ask about A/AAAA records if the zone has
+ * extremely low TTLs.
+ */
+ ttl = dns_adb_cachemin;
}
if (ttl > ADB_CACHE_MAXIMUM) {
ttl = ADB_CACHE_MAXIMUM;
case dns_trust_additional:
case dns_trust_pending_answer:
case dns_trust_pending_additional:
- rdataset->ttl = ADB_CACHE_MINIMUM;
+ /*
+ * Avoid to constantly ask about A/AAAA records if the zone has
+ * extremely low TTLs.
+ */
+ rdataset->ttl = dns_adb_cachemin;
break;
case dns_trust_ultimate:
rdataset->ttl = 0;
.quota = adb->quota,
.references = ISC_REFCOUNT_INITIALIZER(1),
.adb = dns_adb_ref(adb),
- .expires = now + ADB_ENTRY_WINDOW,
+ .expires = now + dns_adb_entrywindow,
.loop = isc_loop_ref(isc_loop()),
.magic = DNS_ADBENTRY_MAGIC,
};