Fix typo & ttl issue.
This commit is contained in:
@@ -95,7 +95,7 @@ int dns_conf_dualstack_ip_selection_threshold = 15;
|
|||||||
|
|
||||||
/* TTL */
|
/* TTL */
|
||||||
int dns_conf_rr_ttl;
|
int dns_conf_rr_ttl;
|
||||||
int dns_conf_rr_ttl_rely_max = 60;
|
int dns_conf_rr_ttl_reply_max;
|
||||||
int dns_conf_rr_ttl_min = 600;
|
int dns_conf_rr_ttl_min = 600;
|
||||||
int dns_conf_rr_ttl_max;
|
int dns_conf_rr_ttl_max;
|
||||||
int dns_conf_force_AAAA_SOA;
|
int dns_conf_force_AAAA_SOA;
|
||||||
@@ -1488,7 +1488,7 @@ static struct config_item _config_item[] = {
|
|||||||
CONF_INT("rr-ttl", &dns_conf_rr_ttl, 0, CONF_INT_MAX),
|
CONF_INT("rr-ttl", &dns_conf_rr_ttl, 0, CONF_INT_MAX),
|
||||||
CONF_INT("rr-ttl-min", &dns_conf_rr_ttl_min, 0, CONF_INT_MAX),
|
CONF_INT("rr-ttl-min", &dns_conf_rr_ttl_min, 0, CONF_INT_MAX),
|
||||||
CONF_INT("rr-ttl-max", &dns_conf_rr_ttl_max, 0, CONF_INT_MAX),
|
CONF_INT("rr-ttl-max", &dns_conf_rr_ttl_max, 0, CONF_INT_MAX),
|
||||||
CONF_INT("rr-ttl-reply-max", &dns_conf_rr_ttl_rely_max, 0, CONF_INT_MAX),
|
CONF_INT("rr-ttl-reply-max", &dns_conf_rr_ttl_reply_max, 0, CONF_INT_MAX),
|
||||||
CONF_YESNO("force-AAAA-SOA", &dns_conf_force_AAAA_SOA),
|
CONF_YESNO("force-AAAA-SOA", &dns_conf_force_AAAA_SOA),
|
||||||
CONF_CUSTOM("force-qtype-SOA", _config_qtype_soa, NULL),
|
CONF_CUSTOM("force-qtype-SOA", _config_qtype_soa, NULL),
|
||||||
CONF_CUSTOM("blacklist-ip", _config_blacklist_ip, NULL),
|
CONF_CUSTOM("blacklist-ip", _config_blacklist_ip, NULL),
|
||||||
|
|||||||
@@ -255,7 +255,7 @@ extern int dns_conf_dualstack_ip_selection;
|
|||||||
extern int dns_conf_dualstack_ip_selection_threshold;
|
extern int dns_conf_dualstack_ip_selection_threshold;
|
||||||
|
|
||||||
extern int dns_conf_rr_ttl;
|
extern int dns_conf_rr_ttl;
|
||||||
extern int dns_conf_rr_ttl_rely_max;
|
extern int dns_conf_rr_ttl_reply_max;
|
||||||
extern int dns_conf_rr_ttl_min;
|
extern int dns_conf_rr_ttl_min;
|
||||||
extern int dns_conf_rr_ttl_max;
|
extern int dns_conf_rr_ttl_max;
|
||||||
extern int dns_conf_force_AAAA_SOA;
|
extern int dns_conf_force_AAAA_SOA;
|
||||||
|
|||||||
@@ -1086,6 +1086,7 @@ static int _dns_request_post(struct dns_server_post_context *context)
|
|||||||
if (context->reply_ttl > 0) {
|
if (context->reply_ttl > 0) {
|
||||||
struct dns_update_param param;
|
struct dns_update_param param;
|
||||||
param.id = request->id;
|
param.id = request->id;
|
||||||
|
param.cname_ttl = context->reply_ttl;
|
||||||
param.ip_ttl = context->reply_ttl;
|
param.ip_ttl = context->reply_ttl;
|
||||||
if (dns_packet_update(context->inpacket, context->inpacket_len, ¶m) != 0) {
|
if (dns_packet_update(context->inpacket, context->inpacket_len, ¶m) != 0) {
|
||||||
tlog(TLOG_ERROR, "update packet info failed.");
|
tlog(TLOG_ERROR, "update packet info failed.");
|
||||||
@@ -1311,13 +1312,10 @@ static int _dns_server_request_complete(struct dns_request *request)
|
|||||||
out:
|
out:
|
||||||
_dns_server_dualstack_selection_cache_A(request);
|
_dns_server_dualstack_selection_cache_A(request);
|
||||||
|
|
||||||
if (dns_conf_rr_ttl_rely_max > 0) {
|
if (dns_conf_rr_ttl_reply_max > 0) {
|
||||||
if (ttl > dns_conf_rr_ttl_rely_max) {
|
if (ttl > dns_conf_rr_ttl_reply_max) {
|
||||||
ttl = dns_conf_rr_ttl_rely_max;
|
ttl = dns_conf_rr_ttl_reply_max;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
/* no need upate ttl */
|
|
||||||
ttl = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct dns_server_post_context context;
|
struct dns_server_post_context context;
|
||||||
@@ -2362,7 +2360,7 @@ static int dns_server_resolve_callback(char *domain, dns_result_type rtype, unsi
|
|||||||
context.do_audit = 1;
|
context.do_audit = 1;
|
||||||
context.do_reply = 1;
|
context.do_reply = 1;
|
||||||
context.do_ipset = 1;
|
context.do_ipset = 1;
|
||||||
context.reply_ttl = dns_conf_rr_ttl_rely_max;
|
context.reply_ttl = dns_conf_rr_ttl_reply_max;
|
||||||
return _dns_server_reply_passthrouth(&context);
|
return _dns_server_reply_passthrouth(&context);
|
||||||
}
|
}
|
||||||
_dns_server_process_answer(request, domain, packet, result_flag);
|
_dns_server_process_answer(request, domain, packet, result_flag);
|
||||||
@@ -2754,8 +2752,8 @@ static int _dns_server_get_expired_ttl_reply(struct dns_cache *dns_cache)
|
|||||||
{
|
{
|
||||||
int ttl = dns_cache_get_ttl(dns_cache);
|
int ttl = dns_cache_get_ttl(dns_cache);
|
||||||
if (ttl > 0) {
|
if (ttl > 0) {
|
||||||
if (dns_conf_rr_ttl_rely_max > 0 && ttl > dns_conf_rr_ttl_rely_max) {
|
if (dns_conf_rr_ttl_reply_max > 0 && ttl > dns_conf_rr_ttl_reply_max) {
|
||||||
ttl = dns_conf_rr_ttl_rely_max;
|
ttl = dns_conf_rr_ttl_reply_max;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ttl;
|
return ttl;
|
||||||
|
|||||||
Reference in New Issue
Block a user