diff --git a/bin/named/include/named/query.h b/bin/named/include/named/query.h index 001d5d9e9f..ada1fbd78a 100644 --- a/bin/named/include/named/query.h +++ b/bin/named/include/named/query.h @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: query.h,v 1.27 2001/01/29 19:49:52 bwelling Exp $ */ +/* $Id: query.h,v 1.28 2001/03/14 19:33:00 halley Exp $ */ #ifndef NAMED_QUERY_H #define NAMED_QUERY_H 1 @@ -69,6 +69,8 @@ struct ns_query { #define NS_QUERYATTR_QUERYOK 0x0080 #define NS_QUERYATTR_WANTRECURSION 0x0100 #define NS_QUERYATTR_WANTDNSSEC 0x0200 +#define NS_QUERYATTR_NOAUTHORITY 0x0400 +#define NS_QUERYATTR_NOADDITIONAL 0x0800 isc_result_t ns_query_init(ns_client_t *client); diff --git a/bin/named/query.c b/bin/named/query.c index 988999b7cf..5f769ef85a 100644 --- a/bin/named/query.c +++ b/bin/named/query.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: query.c,v 1.187 2001/03/13 01:37:11 bwelling Exp $ */ +/* $Id: query.c,v 1.188 2001/03/14 19:32:58 halley Exp $ */ #include @@ -67,6 +67,10 @@ NS_QUERYATTR_WANTRECURSION) != 0) #define WANTDNSSEC(c) (((c)->query.attributes & \ NS_QUERYATTR_WANTDNSSEC) != 0) +#define NOAUTHORITY(c) (((c)->query.attributes & \ + NS_QUERYATTR_NOAUTHORITY) != 0) +#define NOADDITIONAL(c) (((c)->query.attributes & \ + NS_QUERYATTR_NOADDITIONAL) != 0) #if 0 #define CTRACE(m) isc_log_write(ns_g_lctx, \ @@ -237,6 +241,10 @@ query_reset(ns_client_t *client, isc_boolean_t everything) { query_maybeputqname(client); client->query.attributes = (NS_QUERYATTR_RECURSIONOK | +#ifdef MINIMIZE_RESPONSES + NS_QUERYATTR_NOAUTHORITY | + NS_QUERYATTR_NOADDITIONAL | +#endif NS_QUERYATTR_CACHEOK); client->query.restarts = 0; client->query.timerset = ISC_FALSE; @@ -1487,6 +1495,12 @@ query_addrdataset(ns_client_t *client, dns_name_t *fname, CTRACE("query_addrdataset"); ISC_LIST_APPEND(fname->list, rdataset, link); + +#ifdef MINIMIZE_RESPONSES + if (NOADDITIONAL(client)) + return; +#endif + /* * Add additional data. * @@ -2624,6 +2638,16 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype) * database by setting client->query.gluedb. */ client->query.gluedb = db; +#ifdef MINIMIZE_RESPONSES + /* + * We must ensure NOADDITIONAL is off, + * because the generation of + * additional data is required in + * delegations. + */ + client->query.attributes &= + ~NS_QUERYATTR_NOADDITIONAL; +#endif if (sigrdataset != NULL) sigrdatasetp = &sigrdataset; else @@ -2716,6 +2740,16 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype) client->query.gluedb = zdb; client->query.attributes |= NS_QUERYATTR_CACHEGLUEOK; +#ifdef MINIMIZE_RESPONSES + /* + * We must ensure NOADDITIONAL is off, + * because the generation of + * additional data is required in + * delegations. + */ + client->query.attributes &= + ~NS_QUERYATTR_NOADDITIONAL; +#endif if (sigrdataset != NULL) sigrdatasetp = &sigrdataset; else @@ -3128,7 +3162,11 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype) * Add NS records to the authority section (if we haven't already * added them to the answer section). */ - if (!want_restart) { + if (!want_restart +#ifdef MINIMIZE_RESPONSES + && !NOAUTHORITY(client) +#endif + ) { if (is_zone) { if (!((qtype == dns_rdatatype_ns || qtype == dns_rdatatype_any) &&