mirror of
https://github.com/NLnetLabs/unbound.git
synced 2026-02-01 03:09:28 -05:00
- Patch for stub-no-cache and forward-no-cache options that disable
caching for the contents of that stub or forward, for when you want immediate changes visible, from Bjoern A. Zeeb. git-svn-id: file:///svn/unbound/trunk@4846 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
a07337fd6d
commit
256ab3d935
11 changed files with 3115 additions and 2990 deletions
|
|
@ -2,6 +2,9 @@
|
|||
- unbound-checkconf checks if modules exist and prints if they are
|
||||
not compiled in the name of the wrong module.
|
||||
- document --enable-subnet in doc/README.
|
||||
- Patch for stub-no-cache and forward-no-cache options that disable
|
||||
caching for the contents of that stub or forward, for when you
|
||||
want immediate changes visible, from Bjoern A. Zeeb.
|
||||
|
||||
7 August 2018: Ralph
|
||||
- Make capsforid fallback QNAME minimisation aware.
|
||||
|
|
|
|||
|
|
@ -85,6 +85,8 @@ struct delegpt {
|
|||
uint8_t ssl_upstream;
|
||||
/** delegpt from authoritative zone that is locally hosted */
|
||||
uint8_t auth_dp;
|
||||
/*** no cache */
|
||||
int no_cache;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -272,6 +272,8 @@ read_forwards(struct iter_forwards* fwd, struct config_file* cfg)
|
|||
* last resort will ask for parent-side NS record and thus
|
||||
* fallback to the internet name servers on a failure */
|
||||
dp->has_parent_side_NS = (uint8_t)!s->isfirst;
|
||||
/* Do not cache if set. */
|
||||
dp->no_cache = s->no_cache;
|
||||
/* use SSL for queries to this forwarder */
|
||||
dp->ssl_upstream = (uint8_t)s->ssl_upstream;
|
||||
verbose(VERB_QUERY, "Forward zone server list:");
|
||||
|
|
|
|||
|
|
@ -283,6 +283,8 @@ read_stubs(struct iter_hints* hints, struct config_file* cfg)
|
|||
* last resort will ask for parent-side NS record and thus
|
||||
* fallback to the internet name servers on a failure */
|
||||
dp->has_parent_side_NS = (uint8_t)!s->isfirst;
|
||||
/* Do not cache if set. */
|
||||
dp->no_cache = s->no_cache;
|
||||
/* ssl_upstream */
|
||||
dp->ssl_upstream = (uint8_t)s->ssl_upstream;
|
||||
delegpt_log(VERB_QUERY, dp);
|
||||
|
|
|
|||
|
|
@ -1126,6 +1126,36 @@ forward_request(struct module_qstate* qstate, struct iter_qstate* iq)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
iter_stub_fwd_no_cache(struct module_qstate *qstate, struct iter_qstate *iq)
|
||||
{
|
||||
struct iter_hints_stub *stub;
|
||||
struct delegpt *dp;
|
||||
|
||||
/* Check for stub. */
|
||||
stub = hints_lookup_stub(qstate->env->hints, iq->qchase.qname,
|
||||
iq->qchase.qclass, iq->dp);
|
||||
if (stub != NULL && stub->dp != NULL) {
|
||||
verbose(VERB_ALGO, "%s: stub for '%s'/'%s' no_cache %d", __func__,
|
||||
iq->qchase.qname, stub->dp->name, stub->dp->no_cache);
|
||||
return (stub->dp->no_cache);
|
||||
}
|
||||
|
||||
/* Check for forward. */
|
||||
dp = forwards_lookup(qstate->env->fwds, iq->qchase.qname, iq->qchase.qclass);
|
||||
if (dp) {
|
||||
verbose(VERB_ALGO, "%s: fwd for '%s'/'%s' no_cache %d", __func__,
|
||||
iq->qchase.qname, dp->name, dp->no_cache);
|
||||
return (dp->no_cache);
|
||||
}
|
||||
|
||||
#if 0
|
||||
verbose(VERB_ALGO, "%s: no stub or fwd for '%s' found no_cache 0",
|
||||
__func__, iq->qchase.qname);
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the initial part of the request handling. This state roughly
|
||||
* corresponds to resolver algorithms steps 1 (find answer in cache) and 2
|
||||
|
|
@ -1197,7 +1227,13 @@ processInitRequest(struct module_qstate* qstate, struct iter_qstate* iq,
|
|||
/* This either results in a query restart (CNAME cache response), a
|
||||
* terminating response (ANSWER), or a cache miss (null). */
|
||||
|
||||
if(qstate->blacklist) {
|
||||
if (iter_stub_fwd_no_cache(qstate, iq)) {
|
||||
/* Asked to not query cache. */
|
||||
verbose(VERB_ALGO, "no-cache set, going to the network");
|
||||
qstate->no_cache_lookup = 1;
|
||||
qstate->no_cache_store = 1;
|
||||
msg = NULL;
|
||||
} else if(qstate->blacklist) {
|
||||
/* if cache, or anything else, was blacklisted then
|
||||
* getting older results from cache is a bad idea, no cache */
|
||||
verbose(VERB_ALGO, "cache blacklisted, going to the network");
|
||||
|
|
|
|||
|
|
@ -572,6 +572,8 @@ struct config_stub {
|
|||
int isfirst;
|
||||
/** use SSL for queries to this stub */
|
||||
int ssl_upstream;
|
||||
/*** no cache */
|
||||
int no_cache;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
3778
util/configlexer.c
3778
util/configlexer.c
File diff suppressed because it is too large
Load diff
|
|
@ -302,12 +302,14 @@ stub-addr{COLON} { YDVAR(1, VAR_STUB_ADDR) }
|
|||
stub-host{COLON} { YDVAR(1, VAR_STUB_HOST) }
|
||||
stub-prime{COLON} { YDVAR(1, VAR_STUB_PRIME) }
|
||||
stub-first{COLON} { YDVAR(1, VAR_STUB_FIRST) }
|
||||
stub-no-cache{COLON} { YDVAR(1, VAR_STUB_NO_CACHE) }
|
||||
stub-ssl-upstream{COLON} { YDVAR(1, VAR_STUB_SSL_UPSTREAM) }
|
||||
stub-tls-upstream{COLON} { YDVAR(1, VAR_STUB_SSL_UPSTREAM) }
|
||||
forward-zone{COLON} { YDVAR(0, VAR_FORWARD_ZONE) }
|
||||
forward-addr{COLON} { YDVAR(1, VAR_FORWARD_ADDR) }
|
||||
forward-host{COLON} { YDVAR(1, VAR_FORWARD_HOST) }
|
||||
forward-first{COLON} { YDVAR(1, VAR_FORWARD_FIRST) }
|
||||
forward-no-cache{COLON} { YDVAR(1, VAR_FORWARD_NO_CACHE) }
|
||||
forward-ssl-upstream{COLON} { YDVAR(1, VAR_FORWARD_SSL_UPSTREAM) }
|
||||
forward-tls-upstream{COLON} { YDVAR(1, VAR_FORWARD_SSL_UPSTREAM) }
|
||||
auth-zone{COLON} { YDVAR(0, VAR_AUTH_ZONE) }
|
||||
|
|
|
|||
2245
util/configparser.c
2245
util/configparser.c
File diff suppressed because it is too large
Load diff
|
|
@ -289,7 +289,9 @@ extern int yydebug;
|
|||
VAR_LOW_RTT_PERMIL = 499,
|
||||
VAR_ALLOW_NOTIFY = 500,
|
||||
VAR_TLS_WIN_CERT = 501,
|
||||
VAR_TCP_CONNECTION_LIMIT = 502
|
||||
VAR_TCP_CONNECTION_LIMIT = 502,
|
||||
VAR_FORWARD_NO_CACHE = 503,
|
||||
VAR_STUB_NO_CACHE = 504
|
||||
};
|
||||
#endif
|
||||
/* Tokens. */
|
||||
|
|
@ -538,6 +540,8 @@ extern int yydebug;
|
|||
#define VAR_ALLOW_NOTIFY 500
|
||||
#define VAR_TLS_WIN_CERT 501
|
||||
#define VAR_TCP_CONNECTION_LIMIT 502
|
||||
#define VAR_FORWARD_NO_CACHE 503
|
||||
#define VAR_STUB_NO_CACHE 504
|
||||
|
||||
/* Value type. */
|
||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||
|
|
@ -548,7 +552,7 @@ union YYSTYPE
|
|||
|
||||
char* str;
|
||||
|
||||
#line 552 "util/configparser.h" /* yacc.c:1909 */
|
||||
#line 556 "util/configparser.h" /* yacc.c:1909 */
|
||||
};
|
||||
|
||||
typedef union YYSTYPE YYSTYPE;
|
||||
|
|
|
|||
|
|
@ -159,6 +159,7 @@ extern struct config_parser_state* cfg_parser;
|
|||
%token VAR_AUTH_ZONE VAR_ZONEFILE VAR_MASTER VAR_URL VAR_FOR_DOWNSTREAM
|
||||
%token VAR_FALLBACK_ENABLED VAR_TLS_ADDITIONAL_PORT VAR_LOW_RTT VAR_LOW_RTT_PERMIL
|
||||
%token VAR_ALLOW_NOTIFY VAR_TLS_WIN_CERT VAR_TCP_CONNECTION_LIMIT
|
||||
%token VAR_FORWARD_NO_CACHE VAR_STUB_NO_CACHE
|
||||
|
||||
%%
|
||||
toplevelvars: /* empty */ | toplevelvars toplevelvar ;
|
||||
|
|
@ -269,7 +270,7 @@ stubstart: VAR_STUB_ZONE
|
|||
contents_stub: contents_stub content_stub
|
||||
| ;
|
||||
content_stub: stub_name | stub_host | stub_addr | stub_prime | stub_first |
|
||||
stub_ssl_upstream
|
||||
stub_no_cache | stub_ssl_upstream
|
||||
;
|
||||
forwardstart: VAR_FORWARD_ZONE
|
||||
{
|
||||
|
|
@ -286,7 +287,7 @@ forwardstart: VAR_FORWARD_ZONE
|
|||
contents_forward: contents_forward content_forward
|
||||
| ;
|
||||
content_forward: forward_name | forward_host | forward_addr | forward_first |
|
||||
forward_ssl_upstream
|
||||
forward_no_cache | forward_ssl_upstream
|
||||
;
|
||||
viewstart: VAR_VIEW
|
||||
{
|
||||
|
|
@ -2077,6 +2078,15 @@ stub_first: VAR_STUB_FIRST STRING_ARG
|
|||
free($2);
|
||||
}
|
||||
;
|
||||
stub_no_cache: VAR_STUB_NO_CACHE STRING_ARG
|
||||
{
|
||||
OUTYY(("P(stub-no-cache:%s)\n", $2));
|
||||
if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
|
||||
yyerror("expected yes or no.");
|
||||
else cfg_parser->cfg->stubs->no_cache=(strcmp($2, "yes")==0);
|
||||
free($2);
|
||||
}
|
||||
;
|
||||
stub_ssl_upstream: VAR_STUB_SSL_UPSTREAM STRING_ARG
|
||||
{
|
||||
OUTYY(("P(stub-ssl-upstream:%s)\n", $2));
|
||||
|
|
@ -2130,6 +2140,15 @@ forward_first: VAR_FORWARD_FIRST STRING_ARG
|
|||
free($2);
|
||||
}
|
||||
;
|
||||
forward_no_cache: VAR_FORWARD_NO_CACHE STRING_ARG
|
||||
{
|
||||
OUTYY(("P(forward-no-cache:%s)\n", $2));
|
||||
if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
|
||||
yyerror("expected yes or no.");
|
||||
else cfg_parser->cfg->forwards->no_cache=(strcmp($2, "yes")==0);
|
||||
free($2);
|
||||
}
|
||||
;
|
||||
forward_ssl_upstream: VAR_FORWARD_SSL_UPSTREAM STRING_ARG
|
||||
{
|
||||
OUTYY(("P(forward-ssl-upstream:%s)\n", $2));
|
||||
|
|
|
|||
Loading…
Reference in a new issue