stub-prime option.

git-svn-id: file:///svn/unbound/trunk@1319 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2008-10-22 12:01:40 +00:00
parent 18b09fe9c1
commit 83a017d3d1
10 changed files with 1122 additions and 1074 deletions

View file

@ -2,6 +2,8 @@
- CFLAGS are picked up by configure from the environment.
- iana portlist updated.
- updated ldns to use 1.4.0-pre20081022 so it picks up CFLAGS too.
- new stub-prime: yesno option. Default is off, so it does not prime.
can be turned on to get same behaviour as previous unbound release.
21 October 2008: Wouter
- fix update-anchors.sh, so it does not report different RR order

View file

@ -402,10 +402,12 @@ remote-control:
# Stub zones.
# Create entries like below, to make all queries for 'example.com' and
# 'example.org' go to the given list of nameservers. list zero or more
# nameservers by hostname or by ipaddress.
# nameservers by hostname or by ipaddress. If you set stub-prime to yes,
# the list is treated as priming hints (default is no).
# stub-zone:
# name: "example.com"
# stub-addr: 192.0.2.68
# stub-prime: "no"
# stub-zone:
# name: "example.org"
# stub-host: ns.example.com.

View file

@ -756,12 +756,6 @@ bit on replies for the private zone (authoritative servers do not set the
AD bit). This setup makes unbound capable of answering queries for the
private zone, and can even set the AD bit ('authentic'), but the AA
('authoritative') bit is not set on these replies.
.P
To make a stub setup work, the stub server must serve an NS record set with
an up to date list of servers that serve the zone.
If the NS record set does not list any useful servers for the zone,
then resolution fails. When running the authority server on a specific
port number (using the '@' notation) the NS record set does not matter.
.TP
.B name: \fI<domain name>
Name of the stub zone.
@ -772,6 +766,12 @@ Name of stub zone nameserver. Is itself resolved before it is used.
.B stub\-addr: \fI<IP address>
IP address of stub zone nameserver. Can be IP 4 or IP 6.
To use a nondefault port for DNS communication append '@' with the port number.
.TP
.B stub\-prime: \fI<yes or no>
This option is by default off. If enabled it performs NS set priming,
which is similar to root hints, where it starts using the list of nameservers
currently published by the zone. Thus, if the hint list is slightly outdated,
the resolver picks up a correct list online.
.SS "Forward Zone Options"
.LP
There may be multiple

View file

@ -212,15 +212,13 @@ read_stubs_host(struct iter_hints* hints, struct config_stub* s,
/** set stub server addresses */
static int
read_stubs_addr(struct iter_hints* hints, struct config_stub* s,
struct delegpt* dp, int* noprime)
struct delegpt* dp)
{
struct config_strlist* p;
struct sockaddr_storage addr;
socklen_t addrlen;
for(p = s->addrs; p; p = p->next) {
log_assert(p->str);
if(strchr(p->str, '@'))
*noprime = 1;
if(!extstrtoaddr(p->str, &addr, &addrlen)) {
log_err("cannot parse stub %s ip address: '%s'",
s->name, p->str);
@ -239,19 +237,17 @@ static int
read_stubs(struct iter_hints* hints, struct config_file* cfg)
{
struct config_stub* s;
int noprime;
for(s = cfg->stubs; s; s = s->next) {
struct delegpt* dp = delegpt_create(hints->region);
if(!dp) {
log_err("out of memory");
return 0;
}
noprime = 0;
if(!read_stubs_name(hints, s, dp) ||
!read_stubs_host(hints, s, dp) ||
!read_stubs_addr(hints, s, dp, &noprime))
!read_stubs_addr(hints, s, dp))
return 0;
if(!hints_insert(hints, LDNS_RR_CLASS_IN, dp, noprime))
if(!hints_insert(hints, LDNS_RR_CLASS_IN, dp, !s->isprime))
return 0;
delegpt_log(VERB_QUERY, dp);
}

View file

@ -251,6 +251,8 @@ struct config_stub {
struct config_strlist* hosts;
/** list of stub nameserver addresses (IP address) */
struct config_strlist* addrs;
/** if stub-prime is set */
int isprime;
};
/**

File diff suppressed because it is too large Load diff

View file

@ -156,6 +156,7 @@ stub-zone{COLON} { YDOUT; return VAR_STUB_ZONE;}
name{COLON} { YDOUT; return VAR_NAME;}
stub-addr{COLON} { YDOUT; return VAR_STUB_ADDR;}
stub-host{COLON} { YDOUT; return VAR_STUB_HOST;}
stub-prime{COLON} { YDOUT; return VAR_STUB_PRIME;}
forward-zone{COLON} { YDOUT; return VAR_FORWARD_ZONE;}
forward-addr{COLON} { YDOUT; return VAR_FORWARD_ADDR;}
forward-host{COLON} { YDOUT; return VAR_FORWARD_HOST;}

File diff suppressed because it is too large Load diff

View file

@ -134,7 +134,8 @@
VAR_CONTROL_CERT_FILE = 350,
VAR_EXTENDED_STATISTICS = 351,
VAR_LOCAL_DATA_PTR = 352,
VAR_JOSTLE_TIMEOUT = 353
VAR_JOSTLE_TIMEOUT = 353,
VAR_STUB_PRIME = 354
};
#endif
/* Tokens. */
@ -234,6 +235,7 @@
#define VAR_EXTENDED_STATISTICS 351
#define VAR_LOCAL_DATA_PTR 352
#define VAR_JOSTLE_TIMEOUT 353
#define VAR_STUB_PRIME 354
@ -245,7 +247,7 @@ typedef union YYSTYPE
char* str;
}
/* Line 1489 of yacc.c. */
#line 249 "util/configparser.h"
#line 251 "util/configparser.h"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1

View file

@ -96,6 +96,7 @@ extern struct config_parser_state* cfg_parser;
%token VAR_CONTROL_INTERFACE VAR_CONTROL_PORT VAR_SERVER_KEY_FILE
%token VAR_SERVER_CERT_FILE VAR_CONTROL_KEY_FILE VAR_CONTROL_CERT_FILE
%token VAR_EXTENDED_STATISTICS VAR_LOCAL_DATA_PTR VAR_JOSTLE_TIMEOUT
%token VAR_STUB_PRIME
%%
toplevelvars: /* empty */ | toplevelvars toplevelvar ;
@ -157,7 +158,7 @@ stubstart: VAR_STUB_ZONE
;
contents_stub: contents_stub content_stub
| ;
content_stub: stub_name | stub_host | stub_addr
content_stub: stub_name | stub_host | stub_addr | stub_prime
;
forwardstart: VAR_FORWARD_ZONE
{
@ -877,6 +878,16 @@ stub_addr: VAR_STUB_ADDR STRING
yyerror("out of memory");
}
;
stub_prime: VAR_STUB_PRIME STRING
{
OUTYY(("P(stub-prime:%s)\n", $2));
if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
yyerror("expected yes or no.");
else cfg_parser->cfg->stubs->isprime =
(strcmp($2, "yes")==0);
free($2);
}
;
forward_name: VAR_NAME STRING
{
OUTYY(("P(name:%s)\n", $2));