bind9/doc/design/decompression
Ondřej Surý 58bd26b6cf Update the copyright information in all files in the repository
This commit converts the license handling to adhere to the REUSE
specification.  It specifically:

1. Adds used licnses to LICENSES/ directory

2. Add "isc" template for adding the copyright boilerplate

3. Changes all source files to include copyright and SPDX license
   header, this includes all the C sources, documentation, zone files,
   configuration files.  There are notes in the doc/dev/copyrights file
   on how to add correct headers to the new files.

4. Handle the rest that can't be modified via .reuse/dep5 file.  The
   binary (or otherwise unmodifiable) files could have license places
   next to them in <foo>.license file, but this would lead to cluttered
   repository and most of the files handled in the .reuse/dep5 file are
   system test files.
2022-01-11 09:05:02 +01:00

107 lines
2.8 KiB
Text

<!--
Copyright (C) Internet Systems Consortium, Inc. ("ISC")
SPDX-License-Identifier: MPL-2.0
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, you can obtain one at https://mozilla.org/MPL/2.0/.
See the COPYRIGHT file distributed with this work for additional
information regarding copyright ownership.
-->
Name Decompression
Overview.
There are 4 type of compression: global 14 bit, global 16 bit,
local 14 bit and local 16 bit.
In general the resolver / nameserver should accept any compression
method at any time regardless of whether it was legal to
send it. This fits with the principle of being liberal with
what you accept and strict with what you send.
There are a few cases where it does not make sense to accept
compression pointers of a given type. i.e. the first domain name
in a message, local compression pointers in the ownername of a RR
or in a question.
When performing regression testing however we should be as strict
as possible. Hence we need to be able modify the behaviour of the
decompression routines.
To be able to decompress a domain name we need some or all of the
following pieces of information.
1. where the message starts.
2. where the current rdata starts in the message (local compression).
3. what the current owner name is (local compression).
4. where the domainname we are decompressing starts.
5. what are allowable decompression method. These vary across type
and edn version.
Implementation:
dns_rdata_fromwire will set the allowed decompression methods allowed
by looking at edns, strict and the type values.
Types:
struct dns_decompress {
unsigned int magic;
unsigned int allowed;
int edns;
dns_name_t owner_name;
unsigned int rdata;
bool strict;
}
Functions:
void
dns_decompress_init(dns_decompress_t *dctx, int edns,
bool strict);
initialise dctx
dctx->ownername is invalidated
void
dns_decompress_localinit(dns_decompress_t *dctx, dns_name_t *name,
isc_buffer_t *source);
initialise dctx->ownername
record source->current to dctx->rdata
void
dns_decompress_invalidate(dns_decompress_t *dctx);
invalidate dctx
void
dns_decompress_localinvalidate(dns_decompress_t *dctx);
invalidate dctx->ownername
void
dns_decompress_setmethods(dns_decompress_t *dctx, unsigned int allowed);
sets dctx->allowed
unsigned int
dns_decompress_getmethods(dns_decompress_t *dctx);
returns dctx->allowed
int
dns_decompress_edns(dns_decompress_t *dctx);
returns dctx->edns
bool
dns_decompress_strict(dns_decompress_t *dctx);
returns dctx->strict
dns_result_t
dns_name_fromwire(dns_name_t *name, isc_buffer_t *source,
dns_decompress_t *dctx, bool downcase,
isc_buffer_t *target)