Commit 2b8bed66 authored by Evan Hunt's avatar Evan Hunt

[master] multiple-dlz/dlz-nxdomain

3432.	[func]		Multiple DLZ databases can now be configured.
			DLZ databases are searched in the order configured,
			unless set to "search no", in which case a
			zone can be configured to be retrieved from a
			particular DLZ database by using a "dlz <name>"
			option in the zone statement.  DLZ databases can
			support type "master" and "redirect" zones.
			[RT #27597]
parent de5890da
3432. [func] Multiple DLZ databases can now be configured.
DLZ databases are searched in the order configured,
unless set to "search no", in which case a
zone can be configured to be retrieved from a
particular DLZ database by using a "dlz <name>"
option in the zone statement. DLZ databases can
support type "master" and "redirect" zones.
[RT #27597]
3431. [bug] ddns-confgen: Some valid key algorithms were
not accepted. [RT #31927]
......
......@@ -827,6 +827,7 @@ query_getzonedb(ns_client_t *client, dns_name_t *name, dns_rdatatype_t qtype,
result = dns_zt_find(client->view->zonetable, name, ztoptions, NULL,
&zone);
if (result == DNS_R_PARTIALMATCH)
partial = ISC_TRUE;
if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH)
......@@ -1057,11 +1058,14 @@ query_getdb(ns_client_t *client, dns_name_t *name, dns_rdatatype_t qtype,
/* See how many labels are in the zone's name. */
if (result == ISC_R_SUCCESS && zone != NULL)
zonelabels = dns_name_countlabels(dns_zone_getorigin(zone));
/*
* If # zone labels < # name labels, try to find an even better match
* Only try if a DLZ driver is loaded for this view
* Only try if DLZ drivers are loaded for this view
*/
if (zonelabels < namelabels && client->view->dlzdatabase != NULL) {
if (zonelabels < namelabels &&
!ISC_LIST_EMPTY(client->view->dlz_searched))
{
tresult = dns_dlzfindzone(client->view, name,
zonelabels, &tdbp);
/* If we successful, we found a better match. */
......
......@@ -1465,7 +1465,7 @@ cache_sharable(dns_view_t *originview, dns_view_t *view,
* Callback from DLZ configure when the driver sets up a writeable zone
*/
static isc_result_t
dlzconfigure_callback(dns_view_t *view, dns_zone_t *zone) {
dlzconfigure_callback(dns_view_t *view, dns_dlzdb_t *dlzdb, dns_zone_t *zone) {
dns_name_t *origin = dns_zone_getorigin(zone);
dns_rdataclass_t zclass = view->rdclass;
isc_result_t result;
......@@ -1475,8 +1475,7 @@ dlzconfigure_callback(dns_view_t *view, dns_zone_t *zone) {
return (result);
dns_zone_setstats(zone, ns_g_server->zonestats);
return (ns_zone_configure_writeable_dlz(view->dlzdatabase,
zone, zclass, origin));
return (ns_zone_configure_writeable_dlz(dlzdb, zone, zclass, origin));
}
static isc_result_t
......@@ -1701,6 +1700,7 @@ configure_view(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig,
const cfg_obj_t *forwarders;
const cfg_obj_t *alternates;
const cfg_obj_t *zonelist;
const cfg_obj_t *dlzlist;
const cfg_obj_t *dlz;
unsigned int dlzargc;
char **dlzargv;
......@@ -1892,18 +1892,27 @@ configure_view(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig,
/*
* Create Dynamically Loadable Zone driver.
*/
dlz = NULL;
dlzlist = NULL;
if (voptions != NULL)
(void)cfg_map_get(voptions, "dlz", &dlz);
(void)cfg_map_get(voptions, "dlz", &dlzlist);
else
(void)cfg_map_get(config, "dlz", &dlz);
(void)cfg_map_get(config, "dlz", &dlzlist);
obj = NULL;
if (dlz != NULL) {
(void)cfg_map_get(cfg_tuple_get(dlz, "options"),
"database", &obj);
for (element = cfg_list_first(dlzlist);
element != NULL;
element = cfg_list_next(element))
{
obj = NULL;
const cfg_obj_t *dlzopts;
dlz = cfg_listelt_value(element);
dlzopts = cfg_tuple_get(dlz, "options");
(void)cfg_map_get(dlzopts, "database", &obj);
if (obj != NULL) {
dns_dlzdb_t *dlzdb = NULL;
const cfg_obj_t *name, *search = NULL;
char *s = isc_mem_strdup(mctx, cfg_obj_asstring(obj));
if (s == NULL) {
result = ISC_R_NOMEMORY;
goto cleanup;
......@@ -1915,22 +1924,36 @@ configure_view(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig,
goto cleanup;
}
obj = cfg_tuple_get(dlz, "name");
result = dns_dlzcreate(mctx, cfg_obj_asstring(obj),
name = cfg_tuple_get(dlz, "name");
result = dns_dlzcreate(mctx, cfg_obj_asstring(name),
dlzargv[0], dlzargc, dlzargv,
&view->dlzdatabase);
&dlzdb);
isc_mem_free(mctx, s);
isc_mem_put(mctx, dlzargv, dlzargc * sizeof(*dlzargv));
if (result != ISC_R_SUCCESS)
goto cleanup;
/*
* If the dlz backend supports configuration,
* then call its configure method now.
* If the DLZ backend supports configuration,
* and is searchable, then call its configure
* method now. If not searchable, we'll take
* care of it when we process the zone statement.
*/
result = dns_dlzconfigure(view, dlzconfigure_callback);
if (result != ISC_R_SUCCESS)
goto cleanup;
(void)cfg_map_get(dlzopts, "search", &search);
if (search == NULL || cfg_obj_asboolean(search)) {
dlzdb->search = ISC_TRUE;
result = dns_dlzconfigure(view, dlzdb,
dlzconfigure_callback);
if (result != ISC_R_SUCCESS)
goto cleanup;
ISC_LIST_APPEND(view->dlz_searched,
dlzdb, link);
} else {
dlzdb->search = ISC_FALSE;
ISC_LIST_APPEND(view->dlz_unsearched,
dlzdb, link);
}
}
}
......
......@@ -451,7 +451,9 @@ dlopen_dlz_closeversion(const char *zone, isc_boolean_t commit,
* Called on startup to configure any writeable zones
*/
static isc_result_t
dlopen_dlz_configure(dns_view_t *view, void *driverarg, void *dbdata) {
dlopen_dlz_configure(dns_view_t *view, dns_dlzdb_t *dlzdb,
void *driverarg, void *dbdata)
{
dlopen_data_t *cd = (dlopen_data_t *) dbdata;
isc_result_t result;
......@@ -462,7 +464,7 @@ dlopen_dlz_configure(dns_view_t *view, void *driverarg, void *dbdata) {
MAYBE_LOCK(cd);
cd->in_configure = ISC_TRUE;
result = cd->dlz_configure(view, cd->dbdata);
result = cd->dlz_configure(view, dlzdb, cd->dbdata);
cd->in_configure = ISC_FALSE;
MAYBE_UNLOCK(cd);
......
......@@ -807,7 +807,8 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype) {
* Normal zone table does not have a match.
* Try the DLZ database
*/
if (client->view->dlzdatabase != NULL) {
// Temporary: only searching the first DLZ database
if (! ISC_LIST_EMPTY(client->view->dlz_searched)) {
result = dns_dlzallowzonexfr(client->view,
question_name,
&client->peeraddr,
......
......@@ -803,10 +803,11 @@ ns_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
isc_sockaddr_t *addrs;
dns_name_t **keynames;
isc_uint32_t count;
char *cpval;
unsigned int dbargc;
char **dbargv;
static char default_dbtype[] = "rbt";
static char dlz_dbtype[] = "dlz";
char *cpval = default_dbtype;
isc_mem_t *mctx = dns_zone_getmctx(zone);
dns_dialuptype_t dialup = dns_dialuptype_no;
dns_zonetype_t ztype;
......@@ -876,12 +877,28 @@ ns_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
result = cfg_map_get(zoptions, "database", &obj);
if (result == ISC_R_SUCCESS)
cpval = isc_mem_strdup(mctx, cfg_obj_asstring(obj));
else
cpval = default_dbtype;
if (cpval == NULL)
return(ISC_R_NOMEMORY);
obj = NULL;
result = cfg_map_get(zoptions, "dlz", &obj);
if (result == ISC_R_SUCCESS) {
const char *dlzname = cfg_obj_asstring(obj);
size_t len;
if (cpval != default_dbtype) {
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
NS_LOGMODULE_SERVER, ISC_LOG_ERROR,
"zone '%s': both 'database' and 'dlz' "
"specified", zname);
return (ISC_R_FAILURE);
}
len = strlen(dlzname) + 5;
cpval = isc_mem_allocate(mctx, len);
snprintf(cpval, len, "dlz %s", dlzname);
}
result = strtoargv(mctx, cpval, &dbargc, &dbargv);
if (result != ISC_R_SUCCESS && cpval != default_dbtype) {
isc_mem_free(mctx, cpval);
......@@ -895,7 +912,7 @@ ns_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
*/
result = dns_zone_setdbtype(zone, dbargc, (const char * const *)dbargv);
isc_mem_put(mctx, dbargv, dbargc * sizeof(*dbargv));
if (cpval != default_dbtype)
if (cpval != default_dbtype && cpval != dlz_dbtype)
isc_mem_free(mctx, cpval);
if (result != ISC_R_SUCCESS)
return (result);
......
dlz one {
database "one";
};
dlz two {
database "two";
search no;
};
zone master {
type master;
database "none";
dlz two;
};
......@@ -101,6 +101,10 @@ n=`$CHECKCONF bad-dnssec.conf 2>&1 | grep "dnssec-loadkeys-interval.*requires in
[ $n -eq 1 ] || ret=1
n=`$CHECKCONF bad-dnssec.conf 2>&1 | grep "update-check-ksk.*requires inline" | wc -l`
[ $n -eq 1 ] || ret=1
echo "I: checking named-checkconf DLZ warnings"
ret=0
$CHECKCONF dlz-bad.conf 2>&1 | grep "'dlz' and 'database'" > /dev/null || ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
......
......@@ -57,9 +57,9 @@ ARPANAME=$TOP/bin/tools/arpaname
# v6synth
SUBDIRS="acl allow_query addzone autosign builtin cacheclean checkconf
@CHECKDS@ checknames checkzone database dlv dlvauto dlz dlzexternal
dname dns64 dnssec dsdigest ecdsa forward glue gost ixfr inline
limits logfileconfig lwresd masterfile masterformat metadata notify
nsupdate pending pkcs11 redirect resolver rndc rpz rrsetorder
dlzredir dname dns64 dnssec dsdigest ecdsa forward glue gost ixfr
inline limits logfileconfig lwresd masterfile masterformat metadata
notify nsupdate pending pkcs11 redirect resolver rndc rpz rrsetorder
rsabigexponent sortlist smartsign staticstub statistics stub
tkey tsig tsiggss unknown upforwd verify views xfer xferquota
zonechecks"
......
......@@ -29,6 +29,6 @@ options {
recursion no;
};
dlz "file system zone" {
dlz fszone {
database "filesystem dns-root/ dns.d xfr.d 0 =";
};
......@@ -7,3 +7,4 @@ rm -f ns1/update.txt
rm -f */named.memstats
rm -f ns1/ddns.key
rm -f random.data
rm -f dig.out*
......@@ -234,6 +234,7 @@ dlz_create(const char *dlzname, unsigned int argc, char *argv[],
const char *helper_name;
va_list ap;
char soa_data[200];
const char *extra;
isc_result_t result;
int n;
......@@ -264,20 +265,25 @@ dlz_create(const char *dlzname, unsigned int argc, char *argv[],
return (ISC_R_NOMEMORY);
}
n = snprintf(soa_data, sizeof(soa_data),
"%s hostmaster.%s 123 900 600 86400 3600",
state->zone_name, state->zone_name);
if (strcmp(state->zone_name, ".") == 0)
extra = ".root";
else
extra = ".";
n = sprintf(soa_data, "%s hostmaster%s%s 123 900 600 86400 3600",
state->zone_name, extra, state->zone_name);
if (n < 0)
CHECK(ISC_R_FAILURE);
if ((unsigned)n >= sizeof(soa_data))
CHECK(ISC_R_NOSPACE);
CHECK(add_name(state, &state->current[0], state->zone_name,
"soa", 3600, soa_data));
CHECK(add_name(state, &state->current[0], state->zone_name,
"ns", 3600, state->zone_name));
CHECK(add_name(state, &state->current[0], state->zone_name,
"a", 1800, "10.53.0.1"));
add_name(state, &state->current[0], state->zone_name,
"soa", 3600, soa_data);
add_name(state, &state->current[0], state->zone_name,
"ns", 3600, state->zone_name);
add_name(state, &state->current[0], state->zone_name,
"a", 1800, "10.53.0.1");
if (state->log != NULL)
state->log(ISC_LOG_INFO, "dlz_example: started for zone %s",
......@@ -504,11 +510,10 @@ dlz_closeversion(const char *zone, isc_boolean_t commit,
* Configure a writeable zone
*/
isc_result_t
dlz_configure(dns_view_t *view, void *dbdata) {
dlz_configure(dns_view_t *view, dns_dlzdb_t *dlzdb, void *dbdata) {
struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
isc_result_t result;
if (state->log != NULL)
state->log(ISC_LOG_INFO, "dlz_example: starting configure");
......@@ -519,7 +524,7 @@ dlz_configure(dns_view_t *view, void *dbdata) {
return (ISC_R_FAILURE);
}
result = state->writeable_zone(view, state->zone_name);
result = state->writeable_zone(view, dlzdb, state->zone_name);
if (result != ISC_R_SUCCESS) {
if (state->log != NULL)
state->log(ISC_LOG_ERROR, "dlz_example: failed to "
......
......@@ -42,6 +42,25 @@ controls {
inet 10.53.0.1 port 9953 allow { any; } keys { rndc_key; };
};
dlz "example zone" {
dlz "example one" {
database "dlopen ../driver.@SO@ example.nil";
};
dlz "example two" {
database "dlopen ../driver.@SO@ alternate.nil";
};
dlz "unsearched1" {
database "dlopen ../driver.@SO@ other.nil";
search no;
};
dlz "unsearched2" {
database "dlopen ../driver.@SO@ zone.nil";
search no;
};
zone zone.nil {
type master;
dlz unsearched2;
};
......@@ -60,6 +60,7 @@ addr=`eval echo $out | cut -f1 -d'#'`
[ "$ret" -eq 0 ] || echo "I:failed"
status=`expr $status + $ret`
ret=0
echo "I:testing DLZ driver is cleaned up on reload"
$RNDC -c ../common/rndc.conf -s 10.53.0.1 -p 9953 reload 2>&1 | sed 's/^/I:ns1 /'
for i in 0 1 2 3 4 5 6 7 8 9; do
......@@ -70,4 +71,34 @@ done
[ "$ret" -eq 0 ] || echo "I:failed"
status=`expr $status + $ret`
ret=0
echo "I:testing multiple DLZ drivers"
test_update testdc1.alternate.nil. A "86400 A 10.53.0.10" "10.53.0.10" || ret=1
status=`expr $status + $ret`
ret=0
echo "I:testing AXFR from DLZ drivers"
$DIG $DIGOPTS +noall +answer axfr example.nil > dig.out.ns1.1
n=`cat dig.out.ns1.1 | wc -l`
[ "$n" -eq 4 ] || ret=1
$DIG $DIGOPTS +noall +answer axfr alternate.nil > dig.out.ns1.2
n=`cat dig.out.ns1.2 | wc -l`
[ "$n" -eq 5 ] || ret=1
[ "$ret" -eq 0 ] || echo "I:failed"
status=`expr $status + $ret`
ret=0
echo "I:testing unsearched/unregistered DLZ zone is not found"
$DIG $DIGOPTS +noall +answer ns other.nil > dig.out.ns1.3
grep "3600.IN.NS.other.nil." dig.out.ns1.3 > /dev/null && ret=1
[ "$ret" -eq 0 ] || echo "I:failed"
status=`expr $status + $ret`
ret=0
echo "I:testing unsearched/registered DLZ zone is found"
$DIG $DIGOPTS +noall +answer ns zone.nil > dig.out.ns1.4
grep "3600.IN.NS.zone.nil." dig.out.ns1.4 > /dev/null || ret=1
[ "$ret" -eq 0 ] || echo "I:failed"
status=`expr $status + $ret`
exit $status
#!/bin/sh
#
# Copyright (C) 2010 Internet Systems Consortium, Inc. ("ISC")
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: clean.sh,v 1.2 2010/08/16 04:46:15 marka Exp $
rm -f dig.out.*
rm -f */named.memstats
rm -f */named.run
Copyright (C) 2010 Internet Systems Consortium, Inc. ("ISC")
See COPYRIGHT in the source root or http://isc.org/copyright.html for terms.
$Id: NS=10=example.com.=,v 1.1 2010/08/16 04:46:15 marka Exp $
The contents of this file is not read by the filesystem driver.
This is the file for "NS 10 example.com.".
Copyright (C) 2010 Internet Systems Consortium, Inc. ("ISC")
See COPYRIGHT in the source root or http://isc.org/copyright.html for terms.
$Id: NS=10=example.com.=,v 1.1 2010/08/16 04:46:15 marka Exp $
The contents of this file is not read by the filesystem driver.
This is the file for "NS 10 example.com.".
Copyright (C) 2010 Internet Systems Consortium, Inc. ("ISC")
See COPYRIGHT in the source root or http://isc.org/copyright.html for terms.
$Id: SOA=10=ns.example.com.=root.example.com.=2010062900=0=0=0=10=,v 1.1 2010/08/16 04:46:15 marka Exp $
The contents of this file is not read by the filesystem driver.
This is the file for "SOA 10 ns.example.com. root.example.com. 2010062900 0 0 0 10".
/*
* Copyright (C) 2010 Internet Systems Consortium, Inc. ("ISC")
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: named.conf,v 1.2 2010/08/16 04:46:15 marka Exp $ */
controls { /* empty */ };
options {
query-source address 10.53.0.1;
notify-source 10.53.0.1;
transfer-source 10.53.0.1;
port 5300;
pid-file "named.pid";
listen-on { 10.53.0.1; };
listen-on-v6 { none; };
recursion no;
};
dlz fszone {
database "filesystem dns-root/ dns.d xfr.d 0 =";
search no;
};
zone "." {
type redirect;
dlz fszone;
};
zone "." {
type master;
file "root.db";
};
; Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC")
; Copyright (C) 2000, 2001 Internet Software Consortium.
;
; Permission to use, copy, modify, and/or distribute this software for any
; purpose with or without fee is hereby granted, provided that the above
; copyright notice and this permission notice appear in all copies.
;
; THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
; REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
; AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
; INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
; LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
; OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
; PERFORMANCE OF THIS SOFTWARE.
; $Id: root.db,v 1.9 2007-06-19 23:47:03 tbox Exp $
$TTL 300
. IN SOA gson.nominum.com. a.root.servers.nil. (
2000042100 ; serial
600 ; refresh
600 ; retry
1200 ; expire
600 ; minimum
)
. NS a.root-servers.nil.
a.root-servers.nil. A 10.53.0.1
example. NS ns1.example.
ns1.example. A 10.53.0.1
exists. A 10.10.10.10
#!/bin/sh
#
# Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC")
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: prereq.sh.in,v 1.2 2011/04/19 22:30:52 each Exp $
TOP=${SYSTEMTESTTOP:=.}/../../../..
if [ "@DLZ_SYSTEM_TEST@" != "filesystem" ]; then
echo "I:DLZ filesystem driver not supported"
exit 255
fi
exit 0
#!/bin/sh
#
# Copyright (C) 2010, 2011 Internet Systems Consortium, Inc. ("ISC")
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: tests.sh,v 1.4 2011/04/19 23:47:52 tbox Exp $
SYSTEMTESTTOP=..
. $SYSTEMTESTTOP/conf.sh
status=0
n=0
rm -f dig.out.*
DIGOPTS="+tcp +noadd +nosea +nostat +nocmd +dnssec -p 5300"
echo "I:checking query for existing name ($n)"
ret=0
$DIG $DIGOPTS @10.53.0.1 exists a > dig.out.ns1.test$n || ret=1
grep "status: NOERROR" dig.out.ns1.test$n > /dev/null || ret=1
grep "exists.*A.*10.10.10.10" dig.out.ns1.test$n > /dev/null || ret=1
grep "flags:[^;]* aa[ ;]" dig.out.ns1.test$n > /dev/null || ret=1
n=`expr $n + 1`
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I:checking query for nonexistent name ($n)"
ret=0
$DIG $DIGOPTS @10.53.0.1 unexists a > dig.out.ns1.test$n || ret=1
grep "status: NOERROR" dig.out.ns1.test$n > /dev/null || ret=1
grep "unexists.*A.*100.100.100.2" dig.out.ns1.test$n > /dev/null || ret=1
grep "flags:[^;]* aa[ ;]" dig.out.ns1.test$n > /dev/null || ret=1
n=`expr $n + 1`