summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2018-05-21 11:47:17 +0200
committerChristian Poessinger <christian@poessinger.com>2018-05-21 11:47:17 +0200
commit682f8ffdd7cd71b77277719b114d4ca813175da4 (patch)
tree2cc8c1ddc58d8fa521efe768b3100aa1489b6a96 /src
parent8c459924e2e9532ef0ec869615162fc6cd0e3a5f (diff)
downloadvyos-1x-682f8ffdd7cd71b77277719b114d4ca813175da4.tar.gz
vyos-1x-682f8ffdd7cd71b77277719b114d4ca813175da4.zip
T588: Configurable Negative TTL caching in forwarder
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/dns_forwarding.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/conf_mode/dns_forwarding.py b/src/conf_mode/dns_forwarding.py
index a04726da0..f5ad2e482 100755
--- a/src/conf_mode/dns_forwarding.py
+++ b/src/conf_mode/dns_forwarding.py
@@ -43,6 +43,9 @@ non-local-bind=yes
# cache-size
max-cache-entries={{ cache_size }}
+# negative TTL for NXDOMAIN
+max-negative-ttl={{ negative_ttl }}
+
# ignore-hosts-file
export-etc-hosts={{ export_hosts_file }}
@@ -65,11 +68,12 @@ forward-zones-recurse=.={{ name_servers | join(';') }}
"""
default_config_data = {
- 'cache_size' : 10000,
+ 'cache_size': 10000,
'export_hosts_file': 'yes',
'listen_on': [],
'interfaces': [],
'name_servers': [],
+ 'negative_ttl': 3600,
'domains': []
}
@@ -100,6 +104,10 @@ def get_config():
cache_size = conf.return_value('cache-size')
dns['cache_size'] = cache_size
+ if conf.exists('negative-ttl'):
+ negative_ttl = conf.return_value('negative-ttl')
+ dns['negative_ttl'] = negative_ttl
+
if conf.exists('domain'):
for node in conf.list_nodes('domain'):
server = conf.return_values("domain {0} server".format(node))