From: wessels <> Date: Fri, 12 Apr 1996 10:34:15 +0000 (+0000) Subject: add dns_positive_ttl config option X-Git-Tag: SQUID_3_0_PRE1~6204 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2639dac62bf22d1eaefc1d12f9c0e2e540c1d395;p=thirdparty%2Fsquid.git add dns_positive_ttl config option --- diff --git a/src/cache_cf.cc b/src/cache_cf.cc index e7de019f84..363946ac12 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -1,4 +1,4 @@ -/* $Id: cache_cf.cc,v 1.37 1996/04/12 00:11:02 wessels Exp $ */ +/* $Id: cache_cf.cc,v 1.38 1996/04/12 04:34:15 wessels Exp $ */ /* DEBUG: Section 3 cache_cf: Configuration file parsing */ @@ -22,6 +22,7 @@ static struct { } Wais; int negativeTtl; int negativeDnsTtl; + int positiveDnsTtl; int readTimeout; int lifetimeDefault; int connectTimeout; @@ -101,6 +102,7 @@ static struct { #define DefaultNegativeTtl (5 * 60) /* 5 min */ #define DefaultNegativeDnsTtl (2 * 60) /* 2 min */ +#define DefaultPositiveDnsTtl (360 * 60) /* 6 hours */ #define DefaultReadTimeout (15 * 60) /* 15 min */ #define DefaultLifetimeDefault (200 * 60) /* 3+ hours */ #define DefaultConnectTimeout (2 * 60) /* 2 min */ @@ -173,6 +175,7 @@ int httpd_accel_mode = 0; /* for fast access */ int emulate_httpd_log = DefaultCommonLogFormat; /* for fast access */ time_t neighbor_timeout = DefaultNeighborTimeout; /* for fast access */ int single_parent_bypass = 0; +int DnsPositiveTtl = DefaultPositiveDnsTtl; char w_space[] = " \t\n"; char config_input_line[BUFSIZ]; @@ -618,6 +621,14 @@ static void parseNegativeDnsLine() Config.negativeDnsTtl = i * 60; } +static void parsePositiveDnsLine() +{ + char *token; + int i; + GetInteger(i); + Config.positiveDnsTtl = i * 60; +} + static void parseReadTimeoutLine() { char *token; @@ -1296,6 +1307,10 @@ int parseConfigFile(file_name) else if (!strcmp(token, "negative_dns_ttl")) parseNegativeDnsLine(); + /* Parse a positive_dns_ttl line */ + else if (!strcmp(token, "positive_dns_ttl")) + parsePositiveDnsLine(); + /* Parse a read_timeout line */ else if (!strcmp(token, "read_timeout")) parseReadTimeoutLine(); @@ -1769,6 +1784,8 @@ static void configSetFactoryDefaults() Config.Wais.relayPort = DefaultWaisRelayPort; Config.negativeTtl = DefaultNegativeTtl; + Config.negativeDnsTtl = DefaultNegativeDnsTtl; + Config.positiveDnsTtl = DefaultPositiveDnsTtl; Config.readTimeout = DefaultReadTimeout; Config.lifetimeDefault = DefaultLifetimeDefault; Config.maxRequestSize = DefaultMaxRequestSize; @@ -1818,6 +1835,7 @@ static void configDoConfigure() emulate_httpd_log = Config.commonLogFormat; neighbor_timeout = (time_t) Config.neighborTimeout; single_parent_bypass = Config.singleParentBypass; + DnsPositiveTtl = Config.positiveDnsTtl; #if !ALLOW_HOT_CACHE if (!httpd_accel_mode || Config.Accel.withProxy) { diff --git a/src/ipcache.cc b/src/ipcache.cc index 545e39a380..f2d73dc5d2 100644 --- a/src/ipcache.cc +++ b/src/ipcache.cc @@ -1,4 +1,4 @@ -/* $Id: ipcache.cc,v 1.21 1996/04/11 22:52:29 wessels Exp $ */ +/* $Id: ipcache.cc,v 1.22 1996/04/12 04:34:17 wessels Exp $ */ /* * DEBUG: Section 14 ipcache: IP Cache @@ -11,7 +11,6 @@ char ipcache_status_char _PARAMS((ipcache_entry *)); int ipcache_hash_entry_count(); -#define IP_POS_TTL 86400 /* one day */ #define MAX_IP 1024 /* Maximum cached IP */ #define IP_LOW_WATER 70 #define IP_HIGH_WATER 90 @@ -448,7 +447,7 @@ void ipcache_add(name, e, data, cached) e->entry.h_name = xstrdup(data->h_name); e->lastref = e->timestamp = cached_curtime; e->status = CACHED; - e->ttl = IP_POS_TTL; + e->ttl = DnsPositiveTtl; } else { e->lastref = e->timestamp = cached_curtime; e->status = NEGATIVE_CACHED; @@ -511,7 +510,7 @@ void ipcache_update_content(name, e, data, cached) e->entry.h_name = xstrdup(data->h_name); e->lastref = e->timestamp = cached_curtime; e->status = CACHED; - e->ttl = IP_POS_TTL; + e->ttl = DnsPositiveTtl; } else { e->lastref = e->timestamp = cached_curtime; e->status = NEGATIVE_CACHED; @@ -770,7 +769,7 @@ int ipcache_parsebuffer(buf, offset, data) debug(14, 4, "ipcache_parsebuffer: DNS record already resolved.\n"); } else { e->lastref = e->timestamp = cached_curtime; - e->ttl = IP_POS_TTL; + e->ttl = DnsPositiveTtl; e->status = CACHED; line_cur = line_head->next;