Commit 739f2119 authored by Petr Špaček's avatar Petr Špaček

Deckard: add per test option do-not-query-localhost

The option allows or disallows queries for localhost NS addresses.
If not specified, queries for localhost addresses are forbidden.
parent bb59067a
......@@ -16,6 +16,10 @@ Configuration part is a list of "key : value" pairs, one pair per line.
Configuration have no explicit start, it's assumed it starts immediately at
scenario file begin.
- **do-not-query-localhost:** : on
value "on" means that queries cannot be sent to 127.0.0.1/8 or ::1/128 addresses.
- **query-minimization** : on
value "on" means query minimization algorithm will be used; any other value
......
......@@ -108,6 +108,7 @@ def setup_env(scenario, child_env, config, args):
if "SOCKET_WRAPPER_PCAP_FILE" in child_env:
del child_env["SOCKET_WRAPPER_PCAP_FILE"]
qmin = args.qmin
do_not_query_localhost = True
trust_anchor_list = []
stub_addr = ""
features = {}
......@@ -116,6 +117,8 @@ def setup_env(scenario, child_env, config, args):
selfaddr = testserver.get_local_addr_str(socket.AF_INET, DEFAULT_IFACE)
for k, v in config:
# Enable selectively for some tests
if k == 'do-not-query-localhost':
do_not_query_localhost = str2bool(v)
if k == 'query-minimization':
qmin = str2bool(v)
elif k == 'trust-anchor':
......@@ -184,6 +187,7 @@ def setup_env(scenario, child_env, config, args):
searchpath=os.path.dirname(os.path.abspath(__file__)))
j2template_env = jinja2.Environment(loader=j2template_loader)
j2template_ctx = {
"DO_NOT_QUERY_LOCALHOST": str(do_not_query_localhost).lower(),
"ROOT_ADDR": selfaddr,
"SELF_ADDR": childaddr,
"QMIN": str(qmin).lower(),
......
......@@ -7,6 +7,11 @@ option('NO_MINIMIZE', true)
{% else %}
option('NO_MINIMIZE', false)
{% endif %}
{% if DO_NOT_QUERY_LOCALHOST == "false" %}
option('ALLOW_LOCAL', true)
{% else %}
option('ALLOW_LOCAL', false)
{% endif %}
-- Run tests in permissive mode
option('PERMISSIVE', true)
-- Always retry failing resolver
......
......@@ -410,7 +410,11 @@ server:
# if yes, the above default do-not-query-address entries are present.
# if no, localhost can be queried (for testing and debugging).
{% if DO_NOT_QUERY_LOCALHOST == "false" %}
do-not-query-localhost: no
{% else %}
do-not-query-localhost: yes
{% endif %}
# if yes, perform prefetching of almost expired message cache entries.
prefetch: no
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment