From: Mark Andrews Date: Thu, 15 Nov 2001 01:30:50 +0000 (+0000) Subject: pullup: X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8c402ee97f52315e1a16b922ed8b7e91ebe4d022;p=thirdparty%2Fbind9.git pullup: Removed all code within #ifdef DNS_OPT_NEWCODES*. It was the last thing being sanitized out of releases; removing it makes it possible to eliminate the sanitation process. --- diff --git a/bin/dig/dig.c b/bin/dig/dig.c index 43329fdddde..c4c95202638 100644 --- a/bin/dig/dig.c +++ b/bin/dig/dig.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dig.c,v 1.131.2.5 2001/09/11 01:39:28 gson Exp $ */ +/* $Id: dig.c,v 1.131.2.6 2001/11/15 01:30:40 marka Exp $ */ #include #include @@ -869,32 +869,9 @@ plus_option(char *option, isc_boolean_t is_batchfile, } break; case 'v': -#ifdef DNS_OPT_NEWCODES_LIVE - switch (cmd[1]) { - default: - case 'c': /* vc, and default */ -#endif /* DNS_OPT_NEWCODES_LIVE */ - if (!is_batchfile) - lookup->tcp_mode = state; - break; -#ifdef DNS_OPT_NEWCODES_LIVE - case 'i': /* view */ - if (value == NULL) - goto need_value; - if (!state) - goto invalid_option; - strncpy(lookup->viewname, value, MXNAME); - break; - } - break; - case 'z': /* zone */ - if (value == NULL) - goto need_value; - if (!state) - goto invalid_option; - strncpy(lookup->zonename, value, MXNAME); + if (!is_batchfile) + lookup->tcp_mode = state; break; -#endif /* DNS_OPT_NEWCODES_LIVE */ default: invalid_option: need_value: diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c index 60577b4c8c8..bda811e6d00 100644 --- a/bin/dig/dighost.c +++ b/bin/dig/dighost.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dighost.c,v 1.174.2.12 2001/10/11 01:38:49 marka Exp $ */ +/* $Id: dighost.c,v 1.174.2.13 2001/11/15 01:30:42 marka Exp $ */ /* * Notice to programmers: Do not use this code as an example of how to @@ -37,9 +37,6 @@ #include #include #include -#ifdef DNS_OPT_NEWCODES -#include -#endif /* DNS_OPT_NEWCODES */ #include #include #include @@ -395,10 +392,6 @@ make_empty_lookup(void) { looknew->section_authority = ISC_TRUE; looknew->section_additional = ISC_TRUE; looknew->new_search = ISC_FALSE; -#ifdef DNS_OPT_NEWCODES_LIVE - looknew->zonename[0] = 0; - looknew->viewname[0] = 0; -#endif /* DNS_OPT_NEWCODES_LIVE */ ISC_LINK_INIT(looknew, link); ISC_LIST_INIT(looknew->q); ISC_LIST_INIT(looknew->my_server_list); @@ -454,10 +447,6 @@ clone_lookup(dig_lookup_t *lookold, isc_boolean_t servers) { looknew->retries = lookold->retries; looknew->origin = lookold->origin; looknew->tsigctx = NULL; -#ifdef DNS_OPT_NEWCODES_LIVE - strncpy(looknew->viewname, lookold-> viewname, MXNAME); - strncpy(looknew->zonename, lookold-> zonename, MXNAME); -#endif /* DNS_OPT_NEWCODES_LIVE */ if (servers) clone_server_list(lookold->my_server_list, @@ -785,20 +774,11 @@ setup_libs(void) { * option is UDP buffer size. */ static void -add_opt(dns_message_t *msg, isc_uint16_t udpsize, isc_boolean_t dnssec -#ifdef DNS_OPT_NEWCODES_LIVE - , dns_optlist_t optlist -#endif /* DNS_OPT_NEWCODES_LIVE */ - ) -{ +add_opt(dns_message_t *msg, isc_uint16_t udpsize, isc_boolean_t dnssec) { dns_rdataset_t *rdataset = NULL; dns_rdatalist_t *rdatalist = NULL; dns_rdata_t *rdata = NULL; isc_result_t result; -#ifdef DNS_OPT_NEWCODES_LIVE - isc_buffer_t *rdatabuf = NULL; - unsigned int i, optsize = 0; -#endif /* DNS_OPT_NEWCODES_LIVE */ debug("add_opt()"); result = dns_message_gettemprdataset(msg, &rdataset); @@ -818,15 +798,6 @@ add_opt(dns_message_t *msg, isc_uint16_t udpsize, isc_boolean_t dnssec rdatalist->ttl = DNS_MESSAGEEXTFLAG_DO; rdata->data = NULL; rdata->length = 0; -#ifdef DNS_OPT_NEWCODES_LIVE - for (i=0; irdata); ISC_LIST_APPEND(rdatalist->rdata, rdata, link); dns_rdatalist_tordataset(rdatalist, rdataset); @@ -1463,67 +1434,10 @@ setup_lookup(dig_lookup_t *lookup) { isc_buffer_init(&lookup->sendbuf, lookup->sendspace, COMMSIZE); result = dns_message_renderbegin(lookup->sendmsg, &lookup->sendbuf); check_result(result, "dns_message_renderbegin"); -#ifndef DNS_OPT_NEWCODES_LIVE if (lookup->udpsize > 0 || lookup->dnssec) { -#else /* DNS_OPT_NEWCODES_LIVE */ - if (lookup->udpsize > 0 || || lookup->dnssec || - lookup->zonename[0] !=0 || lookup->viewname[0] != 0) { - dns_fixedname_t fname; - isc_buffer_t namebuf, *wirebuf = NULL; - dns_compress_t cctx; - dns_optlist_t optlist; - dns_optattr_t optattr[2]; -#endif /* DNS_OPT_NEWCODES_LIVE */ - if (lookup->udpsize == 0) lookup->udpsize = 2048; - -#ifdef DNS_OPT_NEWCODES_LIVE - optlist.size = 2; - optlist.used = 0; - optlist.next = 0; - optlist.attrs = optattr; - - if (lookup->zonename[0] != 0) { - optattr[optlist.used].code = DNS_OPTCODE_ZONE; - dns_fixedname_init(&fname); - isc_buffer_init(&namebuf, lookup->zonename, - strlen(lookup->zonename)); - isc_buffer_add(&namebuf, strlen(lookup->zonename)); - result = dns_name_fromtext(&(fname.name), &namebuf, - dns_rootname, ISC_FALSE, - NULL); - check_result(result, "; illegal zone option"); - result = dns_compress_init(&cctx, 0, mctx); - check_result(result, "dns_compress_init"); - result = isc_buffer_allocate(mctx, &wirebuf, - MXNAME); - check_result(result, "isc_buffer_allocate"); - result = dns_name_towire(&(fname.name), &cctx, - wirebuf); - check_result(result, "dns_name_towire"); - optattr[optlist.used].value.base = - isc_buffer_base(wirebuf); - optattr[optlist.used].value.length = - isc_buffer_usedlength(wirebuf); - optlist.used++; - dns_compress_invalidate(&cctx); - } - if (lookup->viewname[0] != 0) { - optattr[optlist.used].code = DNS_OPTCODE_VIEW; - optattr[optlist.used].value.base = - lookup->viewname; - optattr[optlist.used].value.length = - strlen(lookup->viewname); - optlist.used++; - } - add_opt(lookup->sendmsg, lookup->udpsize, lookup->dnssec, - optlist); - if (wirebuf != NULL) - isc_buffer_free(&wirebuf); -#else /* DNS_OPT_NEWCODES_LIVE */ add_opt(lookup->sendmsg, lookup->udpsize, lookup->dnssec); -#endif /* DNS_OPT_NEWCODES_LIVE */ } result = dns_message_rendersection(lookup->sendmsg, diff --git a/bin/dig/include/dig/dig.h b/bin/dig/include/dig/dig.h index 6526955bce9..b4796973620 100644 --- a/bin/dig/include/dig/dig.h +++ b/bin/dig/include/dig/dig.h @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dig.h,v 1.60.4.1 2001/01/09 22:31:26 bwelling Exp $ */ +/* $Id: dig.h,v 1.60.4.2 2001/11/15 01:30:44 marka Exp $ */ #ifndef DIG_H #define DIG_H @@ -133,10 +133,6 @@ struct dig_lookup { isc_uint32_t ixfr_serial; isc_buffer_t rdatabuf; char rdatastore[MXNAME]; -#ifdef DNS_OPT_NEWCODES_LIVE - char zonename[MXNAME]; - char viewname[MXNAME]; -#endif /* DNS_OPT_NEWCODES_LIVE */ dst_context_t *tsigctx; isc_buffer_t *querysig; isc_uint32_t msgcounter; diff --git a/bin/named/client.c b/bin/named/client.c index d166a021274..cdd976a761c 100644 --- a/bin/named/client.c +++ b/bin/named/client.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: client.c,v 1.136.2.9 2001/10/30 01:14:00 marka Exp $ */ +/* $Id: client.c,v 1.136.2.10 2001/11/15 01:30:45 marka Exp $ */ #include @@ -30,9 +30,6 @@ #include #include #include -#ifdef DNS_OPT_NEWCODES -#include -#endif /* DNS_OPT_NEWCODES */ #include #include #include @@ -246,15 +243,6 @@ client_free(ns_client_t *client) { dns_rdataset_disassociate(client->opt); dns_message_puttemprdataset(client->message, &client->opt); } -#ifdef DNS_OPT_NEWCODES - if (client->opt_zone != NULL) { - isc_mem_put(client->mctx, client->opt_zone, - sizeof(*client->opt_zone)); - client->opt_zone = NULL; - } - if (client->opt_view != NULL) - isc_buffer_free(&client->opt_view); -#endif /* DNS_OPT_NEWCODES */ dns_message_destroy(&client->message); if (client->manager != NULL) { manager = client->manager; @@ -926,75 +914,6 @@ ns_client_error(ns_client_t *client, isc_result_t result) { ns_client_send(client); } -#ifdef DNS_OPT_NEWCODES -static isc_result_t -client_addoptattrs(ns_client_t *client, dns_rdata_t *rdata) { - isc_result_t result; - isc_buffer_t *zonebuf = NULL, *buf = NULL; - dns_optlist_t attrlist; - dns_optattr_t attrs[CLIENT_NUMATTRS]; - dns_compress_t cctx; - int i, sizeneeded = 0; - - result = dns_compress_init(&cctx, 0, client->mctx); - if (result != ISC_R_SUCCESS) - goto fail1; - dns_compress_setmethods(&cctx, DNS_COMPRESS_NONE); - attrlist.size=2; - attrlist.used=0; - attrlist.attrs=attrs; - for (i=0; iopt_zone != NULL) { - result = isc_buffer_allocate(client->mctx, &zonebuf, - DNS_NAME_MAXWIRE); - if (result != ISC_R_SUCCESS) - goto fail2; - result = dns_name_towire(dns_fixedname_name(client->opt_zone), - &cctx, zonebuf); - if (result != ISC_R_SUCCESS) - goto fail2; - attrs[attrlist.used].code = DNS_OPTCODE_ZONE; - attrs[attrlist.used].value.base = isc_buffer_base(zonebuf); - attrs[attrlist.used].value.length = - isc_buffer_usedlength(zonebuf); - attrlist.used++; - sizeneeded += 4 + isc_buffer_usedlength(zonebuf); - } - if (client->opt_view != NULL) { - attrs[attrlist.used].code = DNS_OPTCODE_VIEW; - attrs[attrlist.used].value.base = - isc_buffer_base(client->opt_view); - attrs[attrlist.used].value.length = - isc_buffer_usedlength(client->opt_view); - attrlist.used++; - sizeneeded += 4 + isc_buffer_usedlength(client->opt_view); - } - if (sizeneeded == 0) { - result = ISC_R_SUCCESS; - goto fail2; - } - result = isc_buffer_allocate(client->mctx, &buf, sizeneeded+1); - if (result != ISC_R_SUCCESS) - goto fail2; - result = dns_opt_add(rdata, &attrlist, buf); - if (result != ISC_R_SUCCESS) - goto fail2; - dns_message_takebuffer(client->message, &buf); - fail2: - dns_compress_invalidate(&cctx); - fail1: - if (buf != NULL) - isc_buffer_free(&buf); - if (zonebuf != NULL) - isc_buffer_free(&zonebuf); - return (result); -} -#endif /* DNS_OPT_NEWCODES */ - static inline isc_result_t client_addopt(ns_client_t *client) { dns_rdataset_t *rdataset; @@ -1040,13 +959,6 @@ client_addopt(ns_client_t *client) { rdata->type = rdatalist->type; rdata->flags = 0; -#ifdef DNS_OPT_NEWCODES - /* - * Set the attributes - */ - client_addoptattrs(client, rdata); -#endif /* DNS_OPT_NEWCODES */ - ISC_LIST_INIT(rdatalist->rdata); ISC_LIST_APPEND(rdatalist->rdata, rdata, link); dns_rdatalist_tordataset(rdatalist, rdataset); @@ -1056,81 +968,6 @@ client_addopt(ns_client_t *client) { return (ISC_R_SUCCESS); } -#ifdef DNS_OPT_NEWCODES -static void -client_getoptattrs(ns_client_t *client, dns_rdataset_t *opt) { - dns_optlist_t optlist; - dns_optattr_t optattr; - isc_result_t result, iresult; - isc_buffer_t zonebuf; - dns_decompress_t dctx; - - /* If an old set of opts are still around, free them. */ - if (client->opt_zone != NULL) { - isc_mem_put(client->mctx, client->opt_zone, - sizeof(*client->opt_zone)); - client->opt_zone = NULL; - } - if (client->opt_view != NULL) - isc_buffer_free(&client->opt_view); - - /* - * If there are any options, extract them here - */ - optlist.size = 1; - optlist.used = 0; - optlist.next = 0; - optlist.attrs = &optattr; - do { - result = dns_opt_decodeall(&optlist, opt); - if (result == ISC_R_SUCCESS || - result == DNS_R_MOREDATA) { - switch (optattr.code) { - case DNS_OPTCODE_ZONE: - dns_decompress_init(&dctx, 0, - DNS_DECOMPRESS_NONE); - client->opt_zone = isc_mem_get( - client->mctx, - sizeof(*client->opt_zone)); - if (client->opt_zone == NULL) - goto zonefail1; - dns_fixedname_init(client->opt_zone); - isc_buffer_init(&zonebuf, - optattr.value.base, - optattr.value.length); - isc_buffer_add(&zonebuf,optattr.value.length); - isc_buffer_setactive(&zonebuf, - optattr.value.length); - iresult = dns_name_fromwire( - dns_fixedname_name( - client->opt_zone), - &zonebuf, - &dctx, ISC_FALSE, - NULL); - if (iresult != ISC_R_SUCCESS) { - dns_fixedname_invalidate( - client->opt_zone); - zonefail1: - dns_decompress_invalidate(&dctx); - } - break; - case DNS_OPTCODE_VIEW: - iresult = isc_buffer_allocate(client->mctx, - &client->opt_view, - optattr.value.length); - if (iresult != ISC_R_SUCCESS) - break; - isc_buffer_putmem(client->opt_view, - optattr.value.base, - optattr.value.length); - break; - } - } - } while (result == DNS_R_MOREDATA); -} -#endif /* DNS_OPT_NEWCODES */ - - /* * Handle an incoming request event from the dispatch (UDP case) * or tcpmsg (TCP case). @@ -1269,28 +1106,10 @@ client_request(isc_task_t *task, isc_event_t *event) { if (client->udpsize < 512) client->udpsize = 512; -#ifdef DNS_OPT_NEWCODES - /* - * Get the flags out of the OPT record. - */ - client->extflags = DNS_OPT_FLAGS(opt); - - /* - * Set up the rest of the opt stuff - */ - client_getoptattrs(client, opt); - /* - * If we're using a fixed zone option (opt_zone), set it to - * allow glue here. - */ - if (client->opt_zone != NULL) - client->query.dboptions |= DNS_DBFIND_GLUEOK; -#else /* DNS_OPT_NEWCODES */ /* * Get the flags out of the OPT record. */ client->extflags = opt->ttl & 0xFFFF; -#endif /* DNS_OPT_NEWCODES */ /* * Create an OPT for our reply. @@ -1585,10 +1404,6 @@ client_create(ns_clientmgr_t *manager, ns_client_t **clientp) client->opt = NULL; client->udpsize = 512; client->extflags = 0; -#ifdef DNS_OPT_NEWCODES - client->opt_zone = NULL; - client->opt_view = NULL; -#endif /* DNS_OPT_NEWCODES */ client->next = NULL; client->shutdown = NULL; client->shutdown_arg = NULL; diff --git a/bin/named/include/named/client.h b/bin/named/include/named/client.h index 553c1239321..033d9c0458f 100644 --- a/bin/named/include/named/client.h +++ b/bin/named/include/named/client.h @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: client.h,v 1.48.4.1 2001/01/09 22:32:23 bwelling Exp $ */ +/* $Id: client.h,v 1.48.4.2 2001/11/15 01:30:48 marka Exp $ */ #ifndef NAMED_CLIENT_H #define NAMED_CLIENT_H 1 @@ -71,9 +71,6 @@ #include #include #include -#ifdef DNS_OPT_NEWCODES -#include -#endif /* DNS_OPT_NEWCODES */ #include #include @@ -112,10 +109,6 @@ struct ns_client { dns_rdataset_t * opt; isc_uint16_t udpsize; isc_uint16_t extflags; -#ifdef DNS_OPT_NEWCODES - dns_fixedname_t * opt_zone; - isc_buffer_t * opt_view; -#endif /* DNS_OPT_NEWCODES */ void (*next)(ns_client_t *); void (*shutdown)(void *arg, isc_result_t result); void *shutdown_arg; @@ -139,14 +132,6 @@ struct ns_client { client_list_t *list; }; -#ifdef DNS_OPT_NEWCODES -/* - * Number of attr fields (opt_zone, opt_view) in above structure. Used in - * client_addoptattrs() - */ -#define CLIENT_NUMATTRS 2 -#endif /* DNS_OPT_NEWCODES */ - #define NS_CLIENT_MAGIC 0x4E534363U /* NSCc */ #define NS_CLIENT_VALID(c) ISC_MAGIC_VALID(c, NS_CLIENT_MAGIC) diff --git a/bin/named/query.c b/bin/named/query.c index 73d407741bb..144c2a70578 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.163.2.5 2001/05/01 20:33:12 gson Exp $ */ +/* $Id: query.c,v 1.163.2.6 2001/11/15 01:30:46 marka Exp $ */ #include @@ -27,9 +27,6 @@ #include #include #include -#ifdef DNS_OPT_NEWCODES -#include -#endif /* DNS_OPT_NEWCODES */ #include #include #include @@ -716,25 +713,6 @@ query_getdb(ns_client_t *client, dns_name_t *name, unsigned int options, { isc_result_t result; -#ifdef DNS_OPT_NEWCODES_LIVE - if (client->opt_zone != NULL) { - result = query_getzonedb(client, &(client->opt_zone->name), - options, zonep, dbp, versionp); - if (result == ISC_R_SUCCESS) - *is_zonep = ISC_TRUE; - else - result = DNS_R_REFUSED; - } else { - result = query_getzonedb(client, name, options, zonep, dbp, - versionp); - if (result == ISC_R_SUCCESS) { - *is_zonep = ISC_TRUE; - } else if (result == ISC_R_NOTFOUND) { - result = query_getcachedb(client, dbp, options); - *is_zonep = ISC_FALSE; - } - } -#else /* DNS_OPT_NEWCODES_LIVE */ result = query_getzonedb(client, name, options, zonep, dbp, versionp); if (result == ISC_R_SUCCESS) { *is_zonep = ISC_TRUE; @@ -742,7 +720,6 @@ query_getdb(ns_client_t *client, dns_name_t *name, unsigned int options, result = query_getcachedb(client, dbp, options); *is_zonep = ISC_FALSE; } -#endif /* DNS_OPT_NEWCODES_LIVE */ return (result); } @@ -2566,11 +2543,6 @@ query_find(ns_client_t *client, dns_fetchevent_t *event) { */ break; case DNS_R_GLUE: -#ifdef DNS_OPT_NEWCODES_LIVE - if (client->opt_zone != NULL) - break; - /* Fallthrough if we don't have opt_zone */ -#endif /* DNS_OPT_NEWCODES_LIVE */ case DNS_R_ZONECUT: /* * These cases are handled in the main line below. @@ -2579,13 +2551,6 @@ query_find(ns_client_t *client, dns_fetchevent_t *event) { authoritative = ISC_FALSE; break; case ISC_R_NOTFOUND: -#ifdef DNS_OPT_NEWCODES_LIVE - /* - * If we've passed in opt_zone, don't try anything more. - */ - if (client->opt_zone != NULL) - break; -#endif /* DNS_OPT_NEWCODES_LIVE */ /* * The cache doesn't even have the root NS. Get them from * the hints DB. @@ -2612,14 +2577,6 @@ query_find(ns_client_t *client, dns_fetchevent_t *event) { */ /* FALLTHROUGH */ case DNS_R_DELEGATION: -#ifdef DNS_OPT_NEWCODES_LIVE - /* - * If we've passed in opt_zone, don't try anything more. - */ - if (client->opt_zone != NULL) { - break; - } -#endif /* DNS_OPT_NEWCODES_LIVE */ authoritative = ISC_FALSE; if (is_zone) { /* diff --git a/lib/dns/Makefile.in b/lib/dns/Makefile.in index 22ba7780326..8658b530d6f 100644 --- a/lib/dns/Makefile.in +++ b/lib/dns/Makefile.in @@ -13,7 +13,7 @@ # NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION # WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -# $Id: Makefile.in,v 1.117.4.1 2001/01/09 22:43:19 bwelling Exp $ +# $Id: Makefile.in,v 1.117.4.2 2001/11/15 01:30:36 marka Exp $ srcdir = @srcdir@ VPATH = @srcdir@ @@ -32,11 +32,6 @@ CWARNINGS = LIBS = @LIBS@ -#ifdef DNS_OPT_NEWCODES -OTHEROBJS = opt.@O@ -OTHERSRCS = opt.c -#endif /* DNS_OPT_NEWCODES */ - # Alphabetically CONFOBJS = config/confacl.@O@ config/confcache.@O@ config/confcommon.@O@ \ diff --git a/lib/dns/include/dns/opt.h b/lib/dns/include/dns/opt.h deleted file mode 100644 index 56fdff027da..00000000000 --- a/lib/dns/include/dns/opt.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (C) 2000, 2001 Internet Software Consortium. - * - * Permission to use, copy, modify, and 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 INTERNET SOFTWARE CONSORTIUM - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * INTERNET SOFTWARE CONSORTIUM 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: opt.h,v 1.6.2.1 2001/01/09 22:45:56 bwelling Exp $ */ - -/* DNS_OPT_NEWCODES_KEEP */ - -#ifndef DNS_OPT_H -#define DNS_OPT_H 1 - -#include -#include -#include -#include -#include - -#include -#include - -/* - * XXX WARNING XXX These codes have not yet been assigned by IANA. - * These are here as placekeepers ONLY. - * Hide these definitions and anything that uses them behind a #define - * which happens only in internal debugging code. - * This #ifdef will go away once these are defined by IANA. - */ -#ifdef DNS_OPT_NEWCODES -#define DNS_OPTCODE_ZONE 0xfff0 -#define DNS_OPTCODE_VIEW 0xfff1 -#endif /* DNS_OPT_NEWCODES */ - -#define DNS_OPT_FLAGS(opt) ((opt)->ttl & 0xFFFF) - -/* - * OPT records contain a series of attributes which contain different types. - * These structures are used for holding the individual attribute - * records. - */ -typedef struct dns_optattr { - isc_uint16_t code; - isc_region_t value; -} dns_optattr_t; - -typedef struct dns_optlist { - unsigned int size; - unsigned int used; - unsigned int next; - dns_optattr_t *attrs; -} dns_optlist_t; - -isc_result_t -dns_opt_decode(dns_optlist_t *optlist, dns_rdataset_t *optset, - isc_uint16_t code); - -isc_result_t -dns_opt_decodeall(dns_optlist_t *optlist, dns_rdataset_t *optset); - -isc_result_t -dns_opt_add(dns_rdata_t *rdata, dns_optlist_t *optlist, - isc_buffer_t *target); - -isc_result_t -dns_opt_attrtotext(dns_optattr_t *attr, isc_buffer_t *target, - dns_messagetextflag_t flags); - -isc_result_t -dns_opt_totext(dns_rdataset_t *opt, isc_buffer_t *target, - dns_messagetextflag_t flags); - -ISC_LANG_ENDDECLS - -#endif /* DNS_OPT_H */ diff --git a/lib/dns/message.c b/lib/dns/message.c index 1ca85bd0cd8..0d521c53bad 100644 --- a/lib/dns/message.c +++ b/lib/dns/message.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: message.c,v 1.164.2.7 2001/06/15 17:02:18 gson Exp $ */ +/* $Id: message.c,v 1.164.2.8 2001/11/15 01:30:37 marka Exp $ */ /*** *** Imports @@ -32,9 +32,6 @@ #include #include #include -#ifdef DNS_OPT_NEWCODES -#include -#endif /* DNS_OPT_NEWCODES */ #include #include #include @@ -2820,9 +2817,6 @@ dns_message_pseudosectiontotext(dns_message_t *msg, dns_name_t *name = NULL; isc_result_t result; isc_boolean_t omit_final_dot; -#ifndef DNS_OPT_NEWCODES - char buf[sizeof("1234567890")]; -#endif /* DNS_OPT_NEWCODES */ REQUIRE(DNS_MESSAGE_VALID(msg)); REQUIRE(target != NULL); @@ -2835,9 +2829,6 @@ dns_message_pseudosectiontotext(dns_message_t *msg, ps = dns_message_getopt(msg); if (ps == NULL) return (ISC_R_SUCCESS); -#ifdef DNS_OPT_NEWCODES - result = dns_opt_totext(ps, target, flags); -#else /* DNS_OPT_NEWCODES */ if ((flags & DNS_MESSAGETEXTFLAG_NOCOMMENTS) == 0) ADD_STRING(target, ";; OPT PSEUDOSECTION:\n"); ADD_STRING(target, "; EDNS: version: "); @@ -2849,9 +2840,7 @@ dns_message_pseudosectiontotext(dns_message_t *msg, sprintf(buf, "%7u\n", (unsigned int)ps->rdclass); ADD_STRING(target, buf); - result = ISC_R_SUCCESS; -#endif /* DNS_OPT_NEWCODES */ - return (result); + return (ISC_R_SUCCESS); case DNS_PSEUDOSECTION_TSIG: ps = dns_message_gettsig(msg, &name); if (ps == NULL) diff --git a/lib/dns/opt.c b/lib/dns/opt.c deleted file mode 100644 index b26c95e5a16..00000000000 --- a/lib/dns/opt.c +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Copyright (C) 2000, 2001 Internet Software Consortium. - * - * Permission to use, copy, modify, and 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 INTERNET SOFTWARE CONSORTIUM - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * INTERNET SOFTWARE CONSORTIUM 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: opt.c,v 1.11.2.1 2001/01/09 22:43:54 bwelling Exp $ */ - -/* DNS_OPT_NEWCODES_KEEP */ - -#include - -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define ADD_STRING(b, s, g) {if (strlen(s) >= \ - isc_buffer_availablelength(b)) \ - { result = ISC_R_NOSPACE; \ - goto g; } else \ - isc_buffer_putstr(b, s);} -static isc_result_t -optget(dns_optlist_t *optlist, dns_rdataset_t *optset, - isc_uint16_t code, isc_boolean_t getall) -{ - isc_result_t result; - dns_rdata_t rdata = DNS_RDATA_INIT; - unsigned int location; - isc_region_t rdataregion; - isc_buffer_t rdatabuf; - isc_uint16_t thiscode, thislength; - - REQUIRE(DNS_RDATASET_VALID(optset)); - REQUIRE(optset->type == dns_rdatatype_opt); - - result = dns_rdataset_first(optset); - if (result != ISC_R_SUCCESS) - return(result); - dns_rdataset_current(optset, &rdata); - - dns_rdata_toregion(&rdata, &rdataregion); - isc_buffer_init(&rdatabuf, rdataregion.base, rdataregion.length); - isc_buffer_add(&rdatabuf, rdataregion.length); - - optlist->used = 0; - location = 0; - /* - * We don't do the test in the while loop, since I want to - * actually keep searching the list for more data until I reach - * the first one I *can't* fit in. This way, I can correctly - * decide between MOREDATA and SUCCESS. - */ - while (1) { - if (isc_buffer_remaininglength(&rdatabuf) == 0) { - optlist->next = 0; - return (ISC_R_SUCCESS); - } - if (isc_buffer_remaininglength(&rdatabuf) < 4) - return (ISC_R_UNEXPECTEDEND); - thiscode = isc_buffer_getuint16(&rdatabuf); - thislength = isc_buffer_getuint16(&rdatabuf); - if (isc_buffer_remaininglength(&rdatabuf) < thislength) - return (ISC_R_UNEXPECTEDEND); - if ((thiscode == code || getall) && - (location >= optlist->next)) { - if (optlist->used >= optlist->size) { - optlist->next = location; - return (DNS_R_MOREDATA); - } - optlist->attrs[optlist->used].code = thiscode; - optlist->attrs[optlist->used].value.base = - isc_buffer_current(&rdatabuf); - optlist->attrs[optlist->used].value.length = - thislength; - optlist->used++; - } - isc_buffer_forward(&rdatabuf, thislength); - location++; - } - /*NOTREACHED*/ -} - -isc_result_t -dns_opt_decode(dns_optlist_t *optlist, dns_rdataset_t *optset, - isc_uint16_t code) -{ - return (optget(optlist, optset, code, ISC_FALSE)); -} - -isc_result_t -dns_opt_decodeall(dns_optlist_t *optlist, dns_rdataset_t *optset) { - return (optget(optlist, optset, 0, ISC_TRUE)); -} - -isc_result_t -dns_opt_add(dns_rdata_t *rdata, dns_optlist_t *optlist, - isc_buffer_t *target) -{ - unsigned char *base; - unsigned int i; - - REQUIRE(rdata->length == 0); - - base = isc_buffer_current(target); - if (optlist != NULL) { - for (i = 0; i < optlist->used; i++) { - rdata->length += optlist->attrs[i].value.length; - rdata->length += 4; - } - if (isc_buffer_availablelength(target) < rdata->length) { - rdata->length = 0; - return (ISC_R_NOSPACE); - } - for (i = 0; i < optlist->used; i++) { - isc_buffer_putuint16(target, optlist->attrs[i].code); - isc_buffer_putuint16(target, - optlist->attrs[i].value.length); - isc_buffer_putmem(target, - optlist->attrs[i].value.base, - optlist->attrs[i].value.length); - } - rdata->data = base; - } - return (ISC_R_SUCCESS); -} - -isc_result_t -dns_opt_attrtotext(dns_optattr_t *attr, isc_buffer_t *target, - dns_messagetextflag_t flags) { - isc_result_t result = ISC_R_SUCCESS; - char store[sizeof("012345678")]; -#ifdef DNS_OPT_NEWCODES - isc_boolean_t omit_final_dot; - dns_decompress_t dctx; - dns_fixedname_t fname; - isc_buffer_t source; - - omit_final_dot = ISC_TF((flags & DNS_MESSAGETEXTFLAG_OMITDOT) != 0); - -#else /* DNS_OPT_NEWCODES */ - UNUSED (flags); -#endif /* DNS_OPT_NEWCODES */ - - switch (attr->code) { -#ifdef DNS_OPT_NEWCODES - case DNS_OPTCODE_ZONE: - ADD_STRING(target, "; ZONE attribute: ", zonefail0); - dns_fixedname_init(&fname); - dns_decompress_init(&dctx, 0, DNS_DECOMPRESS_NONE); - isc_buffer_init(&source, attr->value.base, attr->value.length); - isc_buffer_add(&source, attr->value.length); - isc_buffer_setactive(&source, attr->value.length); - result = dns_name_fromwire(&fname.name, &source, &dctx, - ISC_FALSE, NULL); - if (result != ISC_R_SUCCESS) - goto zonefail1; - result = dns_name_totext(&fname.name, omit_final_dot, - target); - ADD_STRING(target, "\n", zonefail1); - zonefail1: - dns_decompress_invalidate(&dctx); - dns_fixedname_invalidate(&fname); - zonefail0: - return (result); - case DNS_OPTCODE_VIEW: - ADD_STRING(target, "; VIEW attribute: ", viewfail0); - if (attr->value.length >= isc_buffer_availablelength(target)) - return(ISC_R_NOSPACE); - else - isc_buffer_putmem(target, attr->value.base, - attr->value.length); - ADD_STRING(target, "\n", viewfail0); - viewfail0: - return (result); -#endif /* DNS_OPT_NEWCODES */ - /* - * This routine is a placekeeper, awaiting assignment of - * OPT attribute values from IANA. - */ - default: - ADD_STRING(target, "; Unknown EDNS attribute ", deffail); - sprintf(store,"%d",attr->code); - ADD_STRING(target, store, deffail); - ADD_STRING(target, "\n", deffail); - result = DNS_R_UNKNOWNOPT; - deffail: - return (result); - } -} - -isc_result_t -dns_opt_totext(dns_rdataset_t *opt, isc_buffer_t *target, - dns_messagetextflag_t flags) { - isc_result_t result, iresult; - char buf[sizeof("1234567890")]; - dns_optattr_t attr; - dns_optlist_t list; - - REQUIRE(DNS_RDATASET_VALID(opt)); - REQUIRE(target != NULL); - - if ((flags & DNS_MESSAGETEXTFLAG_NOCOMMENTS) == 0) - ADD_STRING(target, ";; OPT PSEUDOSECTION:\n", fail); - ADD_STRING(target, "; EDNS: version: ", fail); - sprintf(buf, "%4u", - (unsigned int)((opt->ttl & - 0x00ff0000 >> 16))); - ADD_STRING(target, buf, fail); - ADD_STRING(target, ", udp=", fail); - sprintf(buf, "%7u", - (unsigned int)opt->rdclass); - ADD_STRING(target, buf, fail); - ADD_STRING(target, ", flags:", fail); - if ((DNS_OPT_FLAGS(opt) & DNS_MESSAGEEXTFLAG_DO) != 0) - ADD_STRING(target, " do", fail); - ADD_STRING(target, "\n", fail); - - list.attrs = &attr; - list.size = 1; - list.used = 0; - list.next = 0; - do { - result = dns_opt_decodeall(&list, opt); - if ((result == ISC_R_SUCCESS || result == DNS_R_MOREDATA) - && list.used != 0) { - iresult = dns_opt_attrtotext(list.attrs, target, - flags); - if (iresult != ISC_R_SUCCESS && - iresult != DNS_R_UNKNOWNOPT) - result = iresult; - } - } while (result == DNS_R_MOREDATA); - fail: - return (result); -} diff --git a/util/copyrights b/util/copyrights index 99e62e017b2..6dec971acaa 100644 --- a/util/copyrights +++ b/util/copyrights @@ -1095,7 +1095,6 @@ ./lib/dns/include/dns/namedconf.h C 1999,2000,2001 ./lib/dns/include/dns/ncache.h C 1999,2000,2001 ./lib/dns/include/dns/nxt.h C 1999,2000,2001 -./lib/dns/include/dns/opt.h C 2000,2001 ./lib/dns/include/dns/peer.h C 2000,2001 ./lib/dns/include/dns/rbt.h C 1999,2000,2001 ./lib/dns/include/dns/rcode.h C 1999,2000,2001 @@ -1138,7 +1137,6 @@ ./lib/dns/name.c C 1998,1999,2000,2001 ./lib/dns/ncache.c C 1999,2000,2001 ./lib/dns/nxt.c C 1999,2000,2001 -./lib/dns/opt.c C 2000,2001 ./lib/dns/peer.c C 2000,2001 ./lib/dns/rbt.c C 1999,2000,2001 ./lib/dns/rbtdb.c C 1999,2000,2001