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.
* 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 <config.h>
#include <stdlib.h>
}
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:
* 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
#include <dns/fixedname.h>
#include <dns/message.h>
#include <dns/name.h>
-#ifdef DNS_OPT_NEWCODES
-#include <dns/opt.h>
-#endif /* DNS_OPT_NEWCODES */
#include <dns/rdata.h>
#include <dns/rdataclass.h>
#include <dns/rdatalist.h>
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);
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,
* 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);
rdatalist->ttl = DNS_MESSAGEEXTFLAG_DO;
rdata->data = NULL;
rdata->length = 0;
-#ifdef DNS_OPT_NEWCODES_LIVE
- for (i=0; i<optlist.used; i++)
- optsize += optlist.attrs[i].value.length + 4;
- result = isc_buffer_allocate(mctx, &rdatabuf, optsize);
- check_result(result, "isc_buffer_allocate");
- result = dns_opt_add(rdata, &optlist, rdatabuf);
- check_result(result, "dns_opt_add");
- dns_message_takebuffer(msg, &rdatabuf);
-#endif /* DNS_OPT_NEWCODES_LIVE */
ISC_LIST_INIT(rdatalist->rdata);
ISC_LIST_APPEND(rdatalist->rdata, rdata, link);
dns_rdatalist_tordataset(rdatalist, rdataset);
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,
* 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
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;
* 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 <config.h>
#include <dns/dispatch.h>
#include <dns/events.h>
#include <dns/message.h>
-#ifdef DNS_OPT_NEWCODES
-#include <dns/opt.h>
-#endif /* DNS_OPT_NEWCODES */
#include <dns/rdata.h>
#include <dns/rdataclass.h>
#include <dns/rdatalist.h>
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;
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; i<CLIENT_NUMATTRS; i++) {
- attrs[i].code = 0;
- attrs[i].value.base = NULL;
- attrs[i].value.length = 0;
- }
- if (client->opt_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;
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);
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).
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.
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;
* 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
#include <dns/types.h>
#include <dns/tcpmsg.h>
#include <dns/fixedname.h>
-#ifdef DNS_OPT_NEWCODES
-#include <dns/opt.h>
-#endif /* DNS_OPT_NEWCODES */
#include <named/types.h>
#include <named/query.h>
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;
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)
* 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 <config.h>
#include <dns/db.h>
#include <dns/events.h>
#include <dns/message.h>
-#ifdef DNS_OPT_NEWCODES
-#include <dns/opt.h>
-#endif /* DNS_OPT_NEWCODES */
#include <dns/rdata.h>
#include <dns/rdataclass.h>
#include <dns/rdatalist.h>
{
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;
result = query_getcachedb(client, dbp, options);
*is_zonep = ISC_FALSE;
}
-#endif /* DNS_OPT_NEWCODES_LIVE */
return (result);
}
*/
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.
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.
*/
/* 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) {
/*
# 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@
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@ \
+++ /dev/null
-/*
- * 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 <isc/lang.h>
-#include <isc/result.h>
-#include <isc/mem.h>
-#include <isc/region.h>
-#include <isc/types.h>
-
-#include <dns/rdataset.h>
-#include <dns/message.h>
-
-/*
- * 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 */
* 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
#include <dns/keyvalues.h>
#include <dns/log.h>
#include <dns/message.h>
-#ifdef DNS_OPT_NEWCODES
-#include <dns/opt.h>
-#endif /* DNS_OPT_NEWCODES */
#include <dns/rdata.h>
#include <dns/rdatalist.h>
#include <dns/rdataset.h>
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);
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: ");
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)
+++ /dev/null
-/*
- * 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 <config.h>
-
-#include <stdlib.h>
-#include <string.h>
-
-#include <isc/buffer.h>
-#include <isc/util.h>
-
-#include <dns/compress.h>
-#include <dns/fixedname.h>
-#include <dns/message.h>
-#include <dns/name.h>
-#include <dns/ncache.h>
-#include <dns/opt.h>
-#include <dns/rdata.h>
-#include <dns/rdatalist.h>
-#include <dns/rdataset.h>
-#include <dns/result.h>
-
-#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);
-}
./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
./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