Skip to content
Snippets Groups Projects
Commit 809bb50a authored by Daniel Salzman's avatar Daniel Salzman
Browse files

dnsproxy: add timeout configuration parameter

parent 4b6b51eb
No related branches found
No related tags found
No related merge requests found
......@@ -1147,6 +1147,7 @@ server for resolution.
mod\-dnsproxy:
\- id: STR
remote: remote_id
timeout: INT
catch\-nxdomain: BOOL
.ft P
.fi
......@@ -1161,6 +1162,11 @@ A \fI\%reference\fP to a remote server where the queries are
forwarded to.
.sp
\fIRequired\fP
.SS timeout
.sp
A remote response timeout in milliseconds.
.sp
\fIDefault:\fP 500
.SS catch\-nxdomain
.sp
If enabled, all unsatisfied queries (also applies to local zone lookups)
......
......@@ -1372,6 +1372,7 @@ server for resolution.
mod-dnsproxy:
- id: STR
remote: remote_id
timeout: INT
catch-nxdomain: BOOL
.. _mod-dnsproxy_id:
......@@ -1391,6 +1392,15 @@ forwarded to.
*Required*
.. _mod-dnsproxy_timeout:
timeout
-------
A remote response timeout in milliseconds.
*Default:* 500
.. _mod-dnsproxy_catch-nxdomain:
catch-nxdomain
......
/* Copyright (C) 2014 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
/* Copyright (C) 2016 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -24,11 +24,13 @@
/* Module configuration scheme. */
#define MOD_REMOTE "\x06""remote"
#define MOD_TIMEOUT "\x07""timeout"
#define MOD_CATCH_NXDOMAIN "\x0E""catch-nxdomain"
const yp_item_t scheme_mod_dnsproxy[] = {
{ C_ID, YP_TSTR, YP_VNONE },
{ MOD_REMOTE, YP_TREF, YP_VREF = { C_RMT }, YP_FNONE, { check_ref } },
{ MOD_TIMEOUT, YP_TINT, YP_VINT = { 0, INT32_MAX, 500 } },
{ MOD_CATCH_NXDOMAIN, YP_TBOOL, YP_VNONE },
{ C_COMMENT, YP_TSTR, YP_VNONE },
{ NULL }
......@@ -49,6 +51,7 @@ int check_mod_dnsproxy(conf_check_t *args)
struct dnsproxy {
conf_remote_t remote;
bool catch_nxdomain;
int timeout;
};
static int dnsproxy_fwd(int state, knot_pkt_t *pkt, struct query_data *qdata, void *ctx)
......@@ -88,8 +91,7 @@ static int dnsproxy_fwd(int state, knot_pkt_t *pkt, struct query_data *qdata, vo
}
/* Forward request. */
int timeout = 1000 * conf()->cache.srv_tcp_reply_timeout;
ret = knot_requestor_exec(&re, req, timeout);
ret = knot_requestor_exec(&re, req, proxy->timeout);
knot_request_free(req, re.mm);
knot_requestor_clear(&re);
......@@ -119,6 +121,9 @@ int dnsproxy_load(struct query_plan *plan, struct query_module *self,
conf_val_t val = conf_mod_get(self->config, MOD_REMOTE, self->id);
proxy->remote = conf_remote(self->config, &val, 0);
val = conf_mod_get(self->config, MOD_TIMEOUT, self->id);
proxy->timeout = conf_int(&val);
val = conf_mod_get(self->config, MOD_CATCH_NXDOMAIN, self->id);
proxy->catch_nxdomain = conf_bool(&val);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment