mirror of
https://github.com/NLnetLabs/unbound.git
synced 2026-02-01 11:19:27 -05:00
- tests for localdata multiple RR, and implicit zones.
- can specify TXT records for local data. git-svn-id: file:///svn/unbound/trunk@780 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
a1cbd214a5
commit
aa0c26ddec
8 changed files with 792 additions and 659 deletions
|
|
@ -1,3 +1,11 @@
|
|||
28 November 2007: Wouter
|
||||
- Changeup plan for 0.8 - no complication needed, a simple solution
|
||||
has been chosen for authoritative features.
|
||||
- you can use single quotes in the config file, so it is possible
|
||||
to specify TXT records in local data.
|
||||
- fixup small memory problem in implicit transparent zone creation.
|
||||
- test for implicit zone creation and multiple RR RRsets local data.
|
||||
|
||||
27 November 2007: Wouter
|
||||
- per suggestion in rfc2308, replaced default max-ttl value with 1 day.
|
||||
- set size of msgparse lookup table to 32, from 1024, so that its size
|
||||
|
|
|
|||
|
|
@ -275,6 +275,7 @@ server:
|
|||
# You can add locally served data with
|
||||
# local-zone: "local." static
|
||||
# local-data: "mycomputer.local. IN A 192.0.2.51"
|
||||
# local-data: 'mytext.local TXT "content of text record"'
|
||||
#
|
||||
# You can override certain queries with
|
||||
# local-data: "adserver.example.com A 127.0.0.1"
|
||||
|
|
|
|||
12
doc/plan
12
doc/plan
|
|
@ -203,14 +203,18 @@ X make overload mode work; phase 0 all ok, phase 1 some threads close ports,
|
|||
can be used to block AS112 traffic, option to unblock a zone.
|
||||
* after checking acl, do iter: static, blacklist, forwards, recurse.
|
||||
* Forward-local-zone to NSD.
|
||||
- include in package, autoforkexec on localhost to do so.
|
||||
- in package, autoforkexec on localhost to do so.
|
||||
- not included. Not necessary for localhost and AS112 service.
|
||||
* forward local zone to remote server.
|
||||
- not included. Not necessary for localhost and AS112 service.
|
||||
* stub zones - send queries for a zone to configged nameserver.
|
||||
- Can be used for complicated setups. So, run auth server on a
|
||||
different port or pc, and stub it on the resolver. Resolver is
|
||||
not auth for zones, but resolution works. This enforces the split
|
||||
of recursive and auth servers.
|
||||
* test local zones
|
||||
* for speed
|
||||
* for correctness on corner cases
|
||||
* for validation
|
||||
* in case you get data on localzone in an answer (from rootserver).
|
||||
|
||||
*** Library use
|
||||
* Create library that can do:
|
||||
|
|
@ -240,8 +244,6 @@ X make overload mode work; phase 0 all ok, phase 1 some threads close ports,
|
|||
*** Features features
|
||||
* aggressive negative caching for NSEC, NSEC3.
|
||||
* multiple queries per question, server exploration, server selection.
|
||||
* option to use real entropy for randomness (mix it in once in a while).
|
||||
* check query, enforce qdsection, checking for forgery-resilience.
|
||||
* NSID support.
|
||||
* support TSIG on queries, for validating resolver deployment.
|
||||
* Nicer statistics
|
||||
|
|
|
|||
|
|
@ -415,6 +415,8 @@ The query has to match exactly unless you configure the local-zone as
|
|||
redirect. If not matched exactly, the local-zone type determines
|
||||
further processing. If local-data is configured that is not a subdomain of
|
||||
a local-zone, a transparent local-zone is configured.
|
||||
For record types such as TXT, use single quotes, as in
|
||||
local-data: 'example. TXT "text"'.
|
||||
.El
|
||||
.Ss Stub Zone Options
|
||||
There may be multiple
|
||||
|
|
|
|||
|
|
@ -710,15 +710,16 @@ lz_setup_implicit(struct local_zones* zones, struct config_file* cfg)
|
|||
have_name = 1;
|
||||
} else {
|
||||
int m;
|
||||
free(rr_name);
|
||||
if(rr_class != dclass) {
|
||||
/* process other classes later */
|
||||
free(rr_name);
|
||||
have_other_classes = 1;
|
||||
continue;
|
||||
}
|
||||
/* find smallest shared topdomain */
|
||||
(void)dname_lab_cmp(nm, nmlabs,
|
||||
rr_name, labs, &m);
|
||||
free(rr_name);
|
||||
if(m < match)
|
||||
match = m;
|
||||
}
|
||||
|
|
@ -735,6 +736,8 @@ lz_setup_implicit(struct local_zones* zones, struct config_file* cfg)
|
|||
log_err("out of memory");
|
||||
return 0;
|
||||
}
|
||||
log_nametypeclass(VERB_ALGO, "implicit transparent local-zone",
|
||||
n2, 0, dclass);
|
||||
if(!lz_enter_zone_dname(zones, n2, nmlen, match,
|
||||
local_zone_transparent, dclass)) {
|
||||
return 0;
|
||||
|
|
|
|||
47
testdata/localdata.rpl
vendored
47
testdata/localdata.rpl
vendored
|
|
@ -7,12 +7,18 @@ server:
|
|||
|
||||
; implicit transparent zone should not block id.server
|
||||
local-data: "mydata.server. CH A 10.11.12.13"
|
||||
local-data: "myd2.server. CH A 10.11.12.14"
|
||||
local-data: 'myd3.server. CH TXT "a text record"'
|
||||
; together implicit CH top domain .server is created transparent.
|
||||
|
||||
; static zone
|
||||
local-zone: "local" static
|
||||
local-data: "local SOA nobody nobody 1 2 3 4 5"
|
||||
local-data: "serv.local. A 20.30.40.50"
|
||||
; multiple RRs in this RRset.
|
||||
local-data: "bla.bla.local. A 20.30.40.51"
|
||||
local-data: "bla.bla.local. A 20.30.40.52"
|
||||
local-data: "bla.bla.local. A 20.30.40.53"
|
||||
|
||||
; static zone (no soa)
|
||||
local-zone: "noso.local" static
|
||||
|
|
@ -24,6 +30,13 @@ server:
|
|||
; refuse zone (error)
|
||||
local-zone: "refuse.top." refuse
|
||||
|
||||
; create implicit data in the IN domain as well
|
||||
local-data: "a.a.implicit. A 20.30.41.50"
|
||||
local-data: "b.a.implicit. A 20.30.42.50"
|
||||
local-data: "b.b.implicit. A 20.30.43.50"
|
||||
local-data: "b.c.implicit. A 20.30.45.50"
|
||||
local-data: "c.c.implicit. A 20.30.44.50"
|
||||
|
||||
CONFIG_END
|
||||
SCENARIO_BEGIN Test local data queries
|
||||
|
||||
|
|
@ -169,6 +182,40 @@ SECTION QUESTION
|
|||
doing.noso.local. IN MX
|
||||
ENTRY_END
|
||||
|
||||
; positive multiple RR
|
||||
STEP 19 QUERY
|
||||
ENTRY_BEGIN
|
||||
SECTION QUESTION
|
||||
bla.bla.local. IN A
|
||||
ENTRY_END
|
||||
STEP 20 CHECK_ANSWER
|
||||
ENTRY_BEGIN
|
||||
MATCH all
|
||||
REPLY QR RA AA
|
||||
SECTION QUESTION
|
||||
bla.bla.local. IN A
|
||||
SECTION ANSWER
|
||||
bla.bla.local. IN A 20.30.40.51
|
||||
bla.bla.local. IN A 20.30.40.52
|
||||
bla.bla.local. IN A 20.30.40.53
|
||||
ENTRY_END
|
||||
|
||||
; second implicit transparent zone.
|
||||
STEP 21 QUERY
|
||||
ENTRY_BEGIN
|
||||
SECTION QUESTION
|
||||
b.b.implicit. IN A
|
||||
ENTRY_END
|
||||
STEP 22 CHECK_ANSWER
|
||||
ENTRY_BEGIN
|
||||
MATCH all
|
||||
REPLY QR RA AA
|
||||
SECTION QUESTION
|
||||
b.b.implicit. IN A
|
||||
SECTION ANSWER
|
||||
b.b.implicit. 3600 IN A 20.30.43.50
|
||||
ENTRY_END
|
||||
|
||||
; localhost A default
|
||||
STEP 30 QUERY
|
||||
ENTRY_BEGIN
|
||||
|
|
|
|||
1347
util/configlexer.c
1347
util/configlexer.c
File diff suppressed because it is too large
Load diff
|
|
@ -87,13 +87,14 @@ static void config_end_include(void)
|
|||
|
||||
SPACE [ \t]
|
||||
LETTER [a-zA-Z]
|
||||
UNQUOTEDLETTER [^\"\n\r \t\\]|\\.
|
||||
UNQUOTEDLETTER [^\'\"\n\r \t\\]|\\.
|
||||
NEWLINE [\r\n]
|
||||
COMMENT \#
|
||||
COLON \:
|
||||
ANY [^\"\n\r\\]|\\.
|
||||
DQANY [^\"\n\r\\]|\\.
|
||||
SQANY [^\'\n\r\\]|\\.
|
||||
|
||||
%x quotedstring include include_quoted
|
||||
%x quotedstring singlequotedstr include include_quoted
|
||||
|
||||
%%
|
||||
{SPACE}* { LEXOUT(("SP ")); /* ignore */ }
|
||||
|
|
@ -171,7 +172,7 @@ local-data{COLON} { YDOUT; return VAR_LOCAL_DATA;}
|
|||
yyerror("EOF inside quoted string");
|
||||
BEGIN(INITIAL);
|
||||
}
|
||||
<quotedstring>{ANY}* { LEXOUT(("STR(%s) ", yytext)); yymore(); }
|
||||
<quotedstring>{DQANY}* { LEXOUT(("STR(%s) ", yytext)); yymore(); }
|
||||
<quotedstring>\n { cfg_parser->line++; yymore(); }
|
||||
<quotedstring>\" {
|
||||
LEXOUT(("QE "));
|
||||
|
|
@ -183,6 +184,24 @@ local-data{COLON} { YDOUT; return VAR_LOCAL_DATA;}
|
|||
return STRING;
|
||||
}
|
||||
|
||||
/* Single Quoted strings. Strip leading and ending quotes */
|
||||
\' { BEGIN(singlequotedstr); LEXOUT(("SQS ")); }
|
||||
<singlequotedstr><<EOF>> {
|
||||
yyerror("EOF inside quoted string");
|
||||
BEGIN(INITIAL);
|
||||
}
|
||||
<singlequotedstr>{SQANY}* { LEXOUT(("STR(%s) ", yytext)); yymore(); }
|
||||
<singlequotedstr>\n { cfg_parser->line++; yymore(); }
|
||||
<singlequotedstr>\' {
|
||||
LEXOUT(("SQE "));
|
||||
BEGIN(INITIAL);
|
||||
yytext[yyleng - 1] = '\0';
|
||||
yylval.str = strdup(yytext);
|
||||
if(!yylval.str)
|
||||
yyerror("out of memory");
|
||||
return STRING;
|
||||
}
|
||||
|
||||
/* include: directive */
|
||||
include{COLON} { LEXOUT(("v(%s) ", yytext)); BEGIN(include); }
|
||||
<include><<EOF>> {
|
||||
|
|
@ -201,7 +220,7 @@ include{COLON} { LEXOUT(("v(%s) ", yytext)); BEGIN(include); }
|
|||
yyerror("EOF inside quoted string");
|
||||
BEGIN(INITIAL);
|
||||
}
|
||||
<include_quoted>{ANY}* { LEXOUT(("ISTR(%s) ", yytext)); yymore(); }
|
||||
<include_quoted>{DQANY}* { LEXOUT(("ISTR(%s) ", yytext)); yymore(); }
|
||||
<include_quoted>{NEWLINE} { cfg_parser->line++; yymore(); }
|
||||
<include_quoted>\" {
|
||||
LEXOUT(("IQE "));
|
||||
|
|
|
|||
Loading…
Reference in a new issue