Commit a6dec641 authored by Marek Vavruša's avatar Marek Vavruša

Merge branch 'master' into resolver_compat

parents f3a9a433 ce68c1b8
Features not supported
======================
Here is a list of the most notable features that are not supported in the
current version of Knot.
* Other DNS classes than IN, partially CH (CS, HS)
This diff is collapsed.
......@@ -20,9 +20,9 @@ Installation
============
Knot DNS may already be included in your operating system distribution and
therefore can be installed from packages (Linux) or ports (BSD). This is
always preferred unless you want to test the latest features, contribute to
Knot development, or you just know what you are doing.
therefore can be installed from packages (Linux), ports (BSD) or via
Homebrew (Mac). This is always preferred unless you want to test the latest
features, contribute to Knot development, or you just know what you are doing.
Following sections describe how to build Knot DNS from the source code.
......@@ -57,18 +57,6 @@ $ yum install libtool autoconf flex bison openssl-devel userspace-rcu-devel
Install optional packages:
($ yum install libcap-ng-devel)
OS X
----
Not all prerequisites are preinstalled for OS X.
- liburcu must be compiled from sources
- liburcu requires gcc-4.6 from MacPorts, as it depends on __thread keyword
$ CC=gcc-mp-4.6 ARCH=x86_64 ./configure
$ make && sudo make install
- liburcu >= 0.7.0 works with supplied compiler, however ARCH must still be set
- alternative is to set it with configure parameter --target
Compiling Knot DNS with gcc-mp-4.6 is recommended, but not necessary.
2) Install Knot DNS
Knot DNS requires compiler to support atomic intrinsics.
......@@ -115,7 +103,7 @@ $ mv example.com.zone /var/lib/knot/
Alternatively, your distribution should have an init script available, if you've
installed Knot using a binary package.
Start Knot in foreground to see if it runs:
Start Knot in the foreground to see if it runs:
$ knotd -c myserver.conf
For more information, refer to the user manual or:
......
......@@ -219,11 +219,14 @@ default. You can enable it with the :ref:`rate-limit` option in the
:ref:`system` section. Setting to a value greater than ``0`` means
that every flow is allowed N responses per second, (i.e. ``rate-limit
50;`` means ``50`` responses per second). It is also possible to
configure SLIP interval, which causes every Nth blocked response to be
slipped as a truncated response. Not that some error responses cannot
be truncated and are slipped as-is. For more information, refer to
:ref:`rate-limit-slip`. It is advisable to not set slip interval to a
value larger than 1.
configure SLIP interval, which causes every Nth ``blocked`` response to be
slipped as a truncated response. Note that some error responses cannot
be truncated. For more information, refer to the :ref:`rate-limit-slip`.
It is advisable to not set slip interval to a value larger than 2,
as too large slip value means more denial of service for legitimate
requestors, and introduces excessive timeouts during resolution.
On the other hand, slipping truncated answer gives the legitimate
requestors a chance to reconnect over TCP.
Example configuration::
......@@ -360,13 +363,17 @@ or a UNIX socket prefixed with *unix:*.
For example::
zones {
query_module "/tmp/capture.tap";
query_module {
dnstap "/tmp/capture.tap";
}
}
You can also log to a UNIX socket with the prefix::
zones {
query_module "unix:/tmp/capture.tap";
query_module {
dnstap "unix:/tmp/capture.tap";
}
}
.. _dnstap: http://dnstap.info/
......
......@@ -21,15 +21,19 @@ Knot DNS features
Knot DNS supports the following DNS features:
* IN class and partially CH class
* TCP/UDP protocols
* AXFR, IXFR - master, slave
* TSIG
* EDNS0
* DNSSEC, including NSEC3
* NSID
* Unknown RR types
* Dynamic updates
* Response Rate Limiting
* RR types A, NS, CNAME, SOA, PTR, HINFO, MINFO, MX, TXT, RP, AFSDB, RT, KEY,
AAAA, LOC, SRV, NAPTR, KX, CERT, DNAME, APL, DS, SSHFP, IPSECKEY, RRSIG, NSEC,
DNSKEY, DHCID, NSEC3, NSEC3PARAM, TLSA, SPF, NID, L32, L64, LP, EUI48, EUI64
and Unknown
Server features:
......
......@@ -322,7 +322,7 @@ keys Syntax
::
keys {
key_id algorithm "string"; ]
key_id algorithm "string";
[ key_id algorithm "string"; ... ]
}
......@@ -532,7 +532,7 @@ with this ``remote``. This section is optional.
address 127.0.0.1;
port 53531;
key key0.server0;
via ipv4; # reference to 'remotes'
via ipv4; # reference to interface named ipv4
# via 82.35.64.59; # direct IPv4
# via [::cafe]; # direct IPv6
}
......@@ -704,7 +704,6 @@ The ``zones`` statement contains definition of zones served by Knot DNS.
[ notify-in remote_id [, remote_id, ... ]; ]
[ notify-out remote_id [, remote_id, ... ]; ]
[ update-in remote_id [, remote_id, ... ]; ]
[ query_module { module_name "string"; [ module_name "string"; ... ] } ]
[ zone_options ]
}
}
......@@ -723,6 +722,7 @@ The ``zones`` statement contains definition of zones served by Knot DNS.
[ dnssec-enable ( on | off ); ]
[ signature-lifetime ( integer | integer(s | m | h | d); ) ]
[ serial-policy ( increment | unixtime ); ]
[ query_module { module_name "string"; [ module_name "string"; ... ] } ]
.. _zones Statement Definition and Grammar:
......
......@@ -293,6 +293,13 @@ zones {
# Default value: increment
# serial-policy increment;
# Query modules are dynamically loaded modules that can alter query plan processing
# Configuration is always module-specific, but passed as a simple string here
# Query modules listed here are effective for all queries (even those without assigned zone)
query_module {
module_name "configuration string";
}
# Zone entry
#
# Format: <zone-name> { file "<path-to-zone-file>"; }
......@@ -390,6 +397,7 @@ zones {
module_one "configuration string";
module_two "specific configuration string";
}
}
}
......
......@@ -79,8 +79,8 @@ Sets \fIname\fR as a default class for all updates. If not used, the default
class is \fIIN\fR.
.TP
.BI ttl \ value
Sets \fIvalue\fR as a default TTL (time to live) in seconds. If not used, the
default value is \fI0\fR.
Sets \fIvalue\fR as a default TTL (in seconds). If not used, the default
value is \fI0\fR.
.TP
.BI key \ name \ \fIkey\fR
Specifies TSIG key to authenticate the request. This command has the same
......@@ -132,9 +132,6 @@ Zone name/server guessing, if the zone name/server is not specified.
Empty line doesn't send an update.
.TP
Bind-like key format (\fBddns\-confgen\fR output) is not supported.
.TP
Command \fBadd\fR doesn't require \fIttl\fR item to be set. In such case,
the default ttl value is used.
.SH EXAMPLES
.B Example 1. Add two records to the zone example.com.:
.TP 0
......
......@@ -345,17 +345,19 @@ static int check_rrsig_rdata(err_handler_t *handler,
}
/* signer's name is same as in the zone apex */
const knot_dname_t *signer_name =
knot_rrsig_signer_name(rrsig, rr_pos);
knot_dname_t *signer = knot_dname_copy(knot_rrsig_signer_name(rrsig, rr_pos), NULL);
knot_dname_to_lower(signer);
/* dnskey is in the apex node */
if (!knot_rrset_empty(dnskey_rrset) &&
!knot_dname_is_equal(signer_name, dnskey_rrset->owner)) {
!knot_dname_is_equal(signer, dnskey_rrset->owner)) {
err_handler_handle_error(handler, zone, node,
ZC_ERR_RRSIG_RDATA_DNSKEY_OWNER,
info_str);
}
knot_dname_free(&signer, NULL);
/* Compare algorithm, key tag and signer's name with DNSKEY rrset
* one of the records has to match. Signer name has been checked
* before */
......
......@@ -43,8 +43,6 @@ static void discard_zone(zone_t *zone)
if (zone->zonefile_mtime == 0) {
zone_flush_journal(zone);
}
/* Wait for current operations. */
synchronize_rcu();
zone_free(&zone);
}
......
......@@ -37,48 +37,48 @@ static const rdata_descriptor_t rdata_descriptors[] = {
[0] = { { KNOT_RDATA_WF_REMAINDER,
KNOT_RDATA_WF_END }, NULL },
[KNOT_RRTYPE_A] = { { 4, KNOT_RDATA_WF_END }, "A" },
[KNOT_RRTYPE_NS] = { { KNOT_RDATA_WF_COMPRESSED_DNAME,
[KNOT_RRTYPE_NS] = { { KNOT_RDATA_WF_COMPRESSIBLE_DNAME,
KNOT_RDATA_WF_END }, "NS" },
[KNOT_RRTYPE_CNAME] = { { KNOT_RDATA_WF_COMPRESSED_DNAME,
[KNOT_RRTYPE_CNAME] = { { KNOT_RDATA_WF_COMPRESSIBLE_DNAME,
KNOT_RDATA_WF_END }, "CNAME" },
[KNOT_RRTYPE_SOA] = { { KNOT_RDATA_WF_COMPRESSED_DNAME,
KNOT_RDATA_WF_COMPRESSED_DNAME,
[KNOT_RRTYPE_SOA] = { { KNOT_RDATA_WF_COMPRESSIBLE_DNAME,
KNOT_RDATA_WF_COMPRESSIBLE_DNAME,
20, KNOT_RDATA_WF_END }, "SOA" },
[KNOT_RRTYPE_PTR] = { { KNOT_RDATA_WF_COMPRESSED_DNAME,
[KNOT_RRTYPE_PTR] = { { KNOT_RDATA_WF_COMPRESSIBLE_DNAME,
KNOT_RDATA_WF_END }, "PTR" },
[KNOT_RRTYPE_HINFO] = { { KNOT_RDATA_WF_REMAINDER,
KNOT_RDATA_WF_END }, "HINFO" },
[KNOT_RRTYPE_MINFO] = { { KNOT_RDATA_WF_COMPRESSED_DNAME,
KNOT_RDATA_WF_COMPRESSED_DNAME,
[KNOT_RRTYPE_MINFO] = { { KNOT_RDATA_WF_COMPRESSIBLE_DNAME,
KNOT_RDATA_WF_COMPRESSIBLE_DNAME,
KNOT_RDATA_WF_END }, "MINFO" },
[KNOT_RRTYPE_MX] = { { 2, KNOT_RDATA_WF_COMPRESSED_DNAME,
[KNOT_RRTYPE_MX] = { { 2, KNOT_RDATA_WF_COMPRESSIBLE_DNAME,
KNOT_RDATA_WF_END }, "MX" },
[KNOT_RRTYPE_TXT] = { { KNOT_RDATA_WF_REMAINDER,
KNOT_RDATA_WF_END }, "TXT" },
[KNOT_RRTYPE_RP] = { { KNOT_RDATA_WF_COMPRESSED_DNAME,
KNOT_RDATA_WF_COMPRESSED_DNAME,
[KNOT_RRTYPE_RP] = { { KNOT_RDATA_WF_DECOMPRESSIBLE_DNAME,
KNOT_RDATA_WF_DECOMPRESSIBLE_DNAME,
KNOT_RDATA_WF_END }, "RP" },
[KNOT_RRTYPE_AFSDB] = { { 2, KNOT_RDATA_WF_COMPRESSED_DNAME,
[KNOT_RRTYPE_AFSDB] = { { 2, KNOT_RDATA_WF_DECOMPRESSIBLE_DNAME,
KNOT_RDATA_WF_END }, "AFSDB" },
[KNOT_RRTYPE_RT] = { { 2, KNOT_RDATA_WF_COMPRESSED_DNAME,
[KNOT_RRTYPE_RT] = { { 2, KNOT_RDATA_WF_DECOMPRESSIBLE_DNAME,
KNOT_RDATA_WF_END }, "RT" },
[KNOT_RRTYPE_SIG] = { { 18, KNOT_RDATA_WF_COMPRESSED_DNAME,
[KNOT_RRTYPE_SIG] = { { 18, KNOT_RDATA_WF_DECOMPRESSIBLE_DNAME,
KNOT_RDATA_WF_REMAINDER,
KNOT_RDATA_WF_END }, "SIG" },
[KNOT_RRTYPE_KEY] = { { KNOT_RDATA_WF_REMAINDER,
KNOT_RDATA_WF_END }, "KEY" },
[KNOT_RRTYPE_AAAA] = { { 16, KNOT_RDATA_WF_END }, "AAAA" },
[KNOT_RRTYPE_LOC] = { { 16, KNOT_RDATA_WF_END }, "LOC" },
[KNOT_RRTYPE_SRV] = { { 6, KNOT_RDATA_WF_COMPRESSED_DNAME,
[KNOT_RRTYPE_SRV] = { { 6, KNOT_RDATA_WF_DECOMPRESSIBLE_DNAME,
KNOT_RDATA_WF_END }, "SRV" },
[KNOT_RRTYPE_NAPTR] = { { KNOT_RDATA_WF_NAPTR_HEADER,
KNOT_RDATA_WF_COMPRESSED_DNAME,
KNOT_RDATA_WF_DECOMPRESSIBLE_DNAME,
KNOT_RDATA_WF_END }, "NAPTR" },
[KNOT_RRTYPE_KX] = { { 2, KNOT_RDATA_WF_UNCOMPRESSED_DNAME,
[KNOT_RRTYPE_KX] = { { 2, KNOT_RDATA_WF_FIXED_DNAME,
KNOT_RDATA_WF_END }, "KX" },
[KNOT_RRTYPE_CERT] = { { KNOT_RDATA_WF_REMAINDER,
KNOT_RDATA_WF_END }, "CERT" },
[KNOT_RRTYPE_DNAME] = { { KNOT_RDATA_WF_UNCOMPRESSED_DNAME,
[KNOT_RRTYPE_DNAME] = { { KNOT_RDATA_WF_FIXED_DNAME,
KNOT_RDATA_WF_END }, "DNAME" },
[KNOT_RRTYPE_OPT] = { { KNOT_RDATA_WF_REMAINDER,
KNOT_RDATA_WF_END }, "OPT" },
......@@ -90,10 +90,10 @@ static const rdata_descriptor_t rdata_descriptors[] = {
KNOT_RDATA_WF_END }, "SSHFP" },
[KNOT_RRTYPE_IPSECKEY] = { { KNOT_RDATA_WF_REMAINDER,
KNOT_RDATA_WF_END }, "IPSECKEY" },
[KNOT_RRTYPE_RRSIG] = { { 18, KNOT_RDATA_WF_UNCOMPRESSED_DNAME,
[KNOT_RRTYPE_RRSIG] = { { 18, KNOT_RDATA_WF_FIXED_DNAME,
KNOT_RDATA_WF_REMAINDER,
KNOT_RDATA_WF_END }, "RRSIG" },
[KNOT_RRTYPE_NSEC] = { { KNOT_RDATA_WF_UNCOMPRESSED_DNAME,
[KNOT_RRTYPE_NSEC] = { { KNOT_RDATA_WF_FIXED_DNAME,
KNOT_RDATA_WF_REMAINDER,
KNOT_RDATA_WF_END }, "NSEC" },
[KNOT_RRTYPE_DNSKEY] = { { KNOT_RDATA_WF_REMAINDER,
......@@ -111,14 +111,14 @@ static const rdata_descriptor_t rdata_descriptors[] = {
[KNOT_RRTYPE_NID] = { { 10, KNOT_RDATA_WF_END }, "NID" },
[KNOT_RRTYPE_L32] = { { 6, KNOT_RDATA_WF_END }, "L32" },
[KNOT_RRTYPE_L64] = { { 10, KNOT_RDATA_WF_END }, "L64" },
[KNOT_RRTYPE_LP] = { { 2, KNOT_RDATA_WF_UNCOMPRESSED_DNAME,
[KNOT_RRTYPE_LP] = { { 2, KNOT_RDATA_WF_FIXED_DNAME,
KNOT_RDATA_WF_END }, "LP" },
[KNOT_RRTYPE_EUI48] = { { 6, KNOT_RDATA_WF_END }, "EUI48" },
[KNOT_RRTYPE_EUI64] = { { 8, KNOT_RDATA_WF_END }, "EUI64" },
[KNOT_RRTYPE_TKEY] = { { KNOT_RDATA_WF_UNCOMPRESSED_DNAME,
[KNOT_RRTYPE_TKEY] = { { KNOT_RDATA_WF_FIXED_DNAME,
KNOT_RDATA_WF_REMAINDER,
KNOT_RDATA_WF_END }, "TKEY" },
[KNOT_RRTYPE_TSIG] = { { KNOT_RDATA_WF_UNCOMPRESSED_DNAME,
[KNOT_RRTYPE_TSIG] = { { KNOT_RDATA_WF_FIXED_DNAME,
KNOT_RDATA_WF_REMAINDER,
KNOT_RDATA_WF_END }, "TSIG" },
[KNOT_RRTYPE_IXFR] = { { KNOT_RDATA_WF_REMAINDER,
......@@ -135,20 +135,20 @@ static const rdata_descriptor_t rdata_descriptors[] = {
static const rdata_descriptor_t obsolete_rdata_descriptors[] = {
[0] = { { KNOT_RDATA_WF_REMAINDER,
KNOT_RDATA_WF_END }, NULL },
[KNOT_RRTYPE_MD] = { { KNOT_RDATA_WF_COMPRESSED_DNAME,
[KNOT_RRTYPE_MD] = { { KNOT_RDATA_WF_DECOMPRESSIBLE_DNAME,
KNOT_RDATA_WF_END }, "MD" },
[KNOT_RRTYPE_MF] = { { KNOT_RDATA_WF_COMPRESSED_DNAME,
[KNOT_RRTYPE_MF] = { { KNOT_RDATA_WF_DECOMPRESSIBLE_DNAME,
KNOT_RDATA_WF_END }, "MF" },
[KNOT_RRTYPE_MB] = { { KNOT_RDATA_WF_COMPRESSED_DNAME,
[KNOT_RRTYPE_MB] = { { KNOT_RDATA_WF_DECOMPRESSIBLE_DNAME,
KNOT_RDATA_WF_END }, "MB" },
[KNOT_RRTYPE_MG] = { { KNOT_RDATA_WF_COMPRESSED_DNAME,
[KNOT_RRTYPE_MG] = { { KNOT_RDATA_WF_DECOMPRESSIBLE_DNAME,
KNOT_RDATA_WF_END }, "MG" },
[KNOT_RRTYPE_MR] = { { KNOT_RDATA_WF_COMPRESSED_DNAME,
[KNOT_RRTYPE_MR] = { { KNOT_RDATA_WF_DECOMPRESSIBLE_DNAME,
KNOT_RDATA_WF_END }, "MR" },
[KNOT_RRTYPE_PX] = { { 2, KNOT_RDATA_WF_COMPRESSED_DNAME,
KNOT_RDATA_WF_COMPRESSED_DNAME,
[KNOT_RRTYPE_PX] = { { 2, KNOT_RDATA_WF_DECOMPRESSIBLE_DNAME,
KNOT_RDATA_WF_DECOMPRESSIBLE_DNAME,
KNOT_RDATA_WF_END }, "PX" },
[KNOT_RRTYPE_NXT] = { { KNOT_RDATA_WF_COMPRESSED_DNAME,
[KNOT_RRTYPE_NXT] = { { KNOT_RDATA_WF_DECOMPRESSIBLE_DNAME,
KNOT_RDATA_WF_REMAINDER,
KNOT_RDATA_WF_END }, "NXT" },
};
......@@ -295,13 +295,9 @@ int knot_rrclass_from_string(const char *name, uint16_t *num)
int knot_descriptor_item_is_dname(const int item)
{
return item == KNOT_RDATA_WF_COMPRESSED_DNAME ||
item == KNOT_RDATA_WF_UNCOMPRESSED_DNAME;
}
int knot_descriptor_item_is_compr_dname(const int item)
{
return item == KNOT_RDATA_WF_COMPRESSED_DNAME;
return item == KNOT_RDATA_WF_FIXED_DNAME ||
item == KNOT_RDATA_WF_COMPRESSIBLE_DNAME ||
item == KNOT_RDATA_WF_DECOMPRESSIBLE_DNAME;
}
int knot_descriptor_item_is_fixed(const int item)
......
......@@ -45,7 +45,9 @@ enum knot_rr_class {
/*!
* \brief Resource record type constants.
*
* References:
* http://www.iana.org/assignments/dns-parameters/dns-parameters.xml
* RFC 3597#4
*
* METATYPE: Contains DNS data that can't be in a zone file.
* QTYPE: Specifies DNS query type; can't be in a zone file.
......@@ -114,11 +116,12 @@ enum knot_rr_type {
/*!
* \brief Some (OBSOLETE) resource record type constants.
*
* References:
* http://www.iana.org/assignments/dns-parameters/dns-parameters.xml
* RFC 3597#4
*
* \note These records can contain compressed domain name in rdata so
* it is important to know the position of it during transfers.
* See RFC 3597#4.
* it is important to know the position of them during transfers.
*/
enum knot_obsolete_rr_type {
KNOT_RRTYPE_MD = 3,
......@@ -134,16 +137,18 @@ enum knot_obsolete_rr_type {
* \brief Constants characterising the wire format of RDATA items.
*/
enum knot_rdata_wireformat {
/*!< Possibly compressed dname. */
KNOT_RDATA_WF_COMPRESSED_DNAME = -10,
/*!< Uncompressed dname. */
KNOT_RDATA_WF_UNCOMPRESSED_DNAME,
/*!< Dname must not be compressed. */
KNOT_RDATA_WF_FIXED_DNAME = -10,
/*!< Dname can be both compressed and decompressed. */
KNOT_RDATA_WF_COMPRESSIBLE_DNAME,
/*!< Dname can be decompressed. */
KNOT_RDATA_WF_DECOMPRESSIBLE_DNAME,
/*!< Initial part of NAPTR record before dname. */
KNOT_RDATA_WF_NAPTR_HEADER,
/*!< Final part of a record. */
KNOT_RDATA_WF_REMAINDER,
/*!< The last descriptor in array. */
KNOT_RDATA_WF_END = 0
KNOT_RDATA_WF_END = 0
};
/*!
......@@ -236,16 +241,6 @@ int knot_rrclass_from_string(const char *name, uint16_t *num);
*/
int knot_descriptor_item_is_dname(const int item);
/*!
* \brief Checks if given item is compressible dname.
*
* \param item Item value.
*
* \retval > 0 if YES.
* \retval 0 if NO.
*/
int knot_descriptor_item_is_compr_dname(const int item);
/*!
* \brief Checks if given item has fixed size.
*
......
......@@ -119,10 +119,22 @@ static int sign_ctx_add_self(knot_dnssec_sign_context_t *ctx,
assert(ctx);
assert(rdata);
const uint8_t *signer = rdata + RRSIG_RDATA_SIGNER_OFFSET;
size_t data_size = RRSIG_RDATA_SIGNER_OFFSET + knot_dname_size(signer);
int result;
return knot_dnssec_sign_add(ctx, rdata, data_size);
// add static header
result = knot_dnssec_sign_add(ctx, rdata, RRSIG_RDATA_SIGNER_OFFSET);
if (result != KNOT_EOK) {
return result;
}
// add signer name
const uint8_t *signer_ptr = rdata + RRSIG_RDATA_SIGNER_OFFSET;
knot_dname_t *signer = knot_dname_copy(signer_ptr, NULL);
knot_dname_to_lower(signer);
result = knot_dnssec_sign_add(ctx, signer, knot_dname_size(signer));
knot_dname_free(&signer, NULL);
return result;
}
/*!
......@@ -254,7 +266,7 @@ int knot_sign_rrset(knot_rrset_t *rrsigs, const knot_rrset_t *covered,
{
if (knot_rrset_empty(covered) || !key || !sign_ctx || !policy ||
rrsigs->type != KNOT_RRTYPE_RRSIG ||
(knot_dname_cmp(rrsigs->owner, covered->owner) != 0)
!knot_dname_is_equal(rrsigs->owner, covered->owner)
) {
return KNOT_EINVAL;
}
......
......@@ -293,10 +293,11 @@ static int write_rdata_block(uint8_t **src, size_t *src_avail,
knot_rrset_wire_flags_t flags)
{
switch (type) {
case KNOT_RDATA_WF_COMPRESSED_DNAME:
case KNOT_RDATA_WF_COMPRESSIBLE_DNAME:
return write_rdata_dname(src, src_avail, wire, capacity,
compr, compr_hint_id, true, flags);
case KNOT_RDATA_WF_UNCOMPRESSED_DNAME:
case KNOT_RDATA_WF_DECOMPRESSIBLE_DNAME:
case KNOT_RDATA_WF_FIXED_DNAME:
return write_rdata_dname(src, src_avail, wire, capacity,
compr, compr_hint_id, false, flags);
case KNOT_RDATA_WF_NAPTR_HEADER:
......@@ -541,7 +542,7 @@ int knot_rrset_rdata_from_wire_one(knot_rrset_t *rrset,
if (total_size - *pos < rdlength) {
return KNOT_EMALF;
}
const rdata_descriptor_t *desc = knot_get_rdata_descriptor(rrset->type);
/* Check for obsolete record. */
......
......@@ -29,13 +29,15 @@ typedef struct {
const err_table_t err_msgs[] = {
ERR_ITEM( ZS_OK, "ok" ),
ERR_ITEM( ZS_SYSTEM,
"system error" ),
ERR_ITEM( ZS_FILE_OPEN,
"file open error" ),
ERR_ITEM( ZS_FILE_PATH,
"file path error" ),
ERR_ITEM( ZS_FILE_FSTAT,
"fstat error" ),
ERR_ITEM( ZS_FILE_DIRECTORY,
ERR_ITEM( ZS_FILE_DIR,
"not zone file but directory" ),
ERR_ITEM( ZS_FILE_MMAP,
"file mmap error" ),
......
......@@ -27,10 +27,11 @@
enum err_codes {
ZS_OK = 0,
ZS_FILE_OPEN = -1000,
ZS_SYSTEM = -1000,
ZS_FILE_OPEN,
ZS_FILE_PATH,
ZS_FILE_FSTAT,
ZS_FILE_DIRECTORY,
ZS_FILE_DIR,
ZS_FILE_MMAP,
ZS_DOS_NEWLINE,
ZS_UNCOVERED_STATE,
......
......@@ -73109,6 +73109,13 @@ int zs_scanner_parse_file(zs_scanner_t *s,
return -1;
}
// Getting OS page size.
page_size = sysconf(_SC_PAGESIZE);
if (page_size <= 0) {
ERR(ZS_SYSTEM);
return -1;
}
// Copying file name.
s->file.name = strdup(file_name);
......@@ -73133,9 +73140,6 @@ int zs_scanner_parse_file(zs_scanner_t *s,
return -1;
}
// Getting OS page size.
page_size = sysconf(_SC_PAGESIZE);
// Getting file information.
if (fstat(s->file.descriptor, &file_stat) == -1) {
ERR(ZS_FILE_FSTAT);
......@@ -73146,7 +73150,7 @@ int zs_scanner_parse_file(zs_scanner_t *s,
// Check for directory.
if (S_ISDIR(file_stat.st_mode)) {
ERR(ZS_FILE_DIRECTORY);
ERR(ZS_FILE_DIR);
close(s->file.descriptor);
free(s->file.name);
return -1;
......@@ -7430,6 +7430,13 @@ int zs_scanner_parse_file(zs_scanner_t *s,
return -1;
}
// Getting OS page size.
page_size = sysconf(_SC_PAGESIZE);
if (page_size <= 0) {
ERR(ZS_SYSTEM);
return -1;
}
// Copying file name.
s->file.name = strdup(file_name);
......@@ -7454,9 +7461,6 @@ int zs_scanner_parse_file(zs_scanner_t *s,
return -1;
}
// Getting OS page size.
page_size = sysconf(_SC_PAGESIZE);
// Getting file information.
if (fstat(s->file.descriptor, &file_stat) == -1) {
ERR(ZS_FILE_FSTAT);
......@@ -7467,7 +7471,7 @@ int zs_scanner_parse_file(zs_scanner_t *s,
// Check for directory.
if (S_ISDIR(file_stat.st_mode)) {
ERR(ZS_FILE_DIRECTORY);
ERR(ZS_FILE_DIR);
close(s->file.descriptor);
free(s->file.name);
return -1;
......
......@@ -277,6 +277,13 @@ int zs_scanner_parse_file(zs_scanner_t *s,
return -1;
}
// Getting OS page size.
page_size = sysconf(_SC_PAGESIZE);
if (page_size <= 0) {
ERR(ZS_SYSTEM);
return -1;
}
// Copying file name.
s->file.name = strdup(file_name);
......@@ -301,9 +308,6 @@ int zs_scanner_parse_file(zs_scanner_t *s,
return -1;
}
// Getting OS page size.
page_size = sysconf(_SC_PAGESIZE);
// Getting file information.
if (fstat(s->file.descriptor, &file_stat) == -1) {
ERR(ZS_FILE_FSTAT);
......@@ -314,7 +318,7 @@ int zs_scanner_parse_file(zs_scanner_t *s,
// Check for directory.
if (S_ISDIR(file_stat.st_mode)) {
ERR(ZS_FILE_DIRECTORY);
ERR(ZS_FILE_DIR);
close(s->file.descriptor);
free(s->file.name);
return -1;
......
00-0_general
00-1_general
00-2_general
01_owner
02_class
03_rrttl
......
ERROR=ZS_FILE_DIRECTORY
ERROR=ZS_FILE_DIR
------
......@@ -11,7 +11,7 @@ TMPDIR=$(test_tmpdir)
TESTS_DIR="$SOURCE"/data
ZSCANNER_TOOL="$BUILD"/zscanner-tool
plan 68
plan 69
mkdir -p "$TMPDIR"/includes/
for a in 1 2 3 4 5 6; do
......
......@@ -26,6 +26,20 @@ def create_log(logger, filename="", level=logging.NOTSET):
logger.addHandler(handler)
return handler
def log_environment(filename):
def want_log(key):
return key in [ "CC", "CPP", "CFLAGS", "CPPFLAGS",
"LDFLAGS", "LIBS",
"PKG_CONFIG", "PKG_CONFIG_PATH", "PKG_CONFIG_LIBDIR",
"YAAC", "YFLAGS",
"MALLOC_PERTURB_", "MALLOC_CHECK_" ] or \
re.match(r'.+_(CFLAGS|LIBS)$', key) or \
re.match(r'^KNOT_TEST_', key)
with open(filename, "w") as log:
lines = ["%s=%s\n" % (k, v) for (k, v) in os.environ.items() if want_log(k)]
log.writelines(lines)
def parse_args(cmd_args):
parser = argparse.ArgumentParser()
parser.add_argument("-d", dest="debug", action="store_true", \
......@@ -95,6 +109,9 @@ def main(args):
except:
pass
# Write down environment
log_environment(os.path.join(outs_dir, "environment.log"))
# Set up logging.
log = logging.getLogger()
log.setLevel(logging.NOTSET)
......
......@@ -25,7 +25,7 @@
int main(int argc, char *argv[])
{
plan(108);
plan(107);
const rdata_descriptor_t *descr;
char name[BUF_LEN];
......@@ -60,7 +60,7 @@ int main(int argc, char *argv[])
// 3. CNAME
descr = knot_get_rdata_descriptor(5);
ok(strcmp(descr->type_name, "CNAME") == 0, "get CNAME descriptor name");
ok(descr->block_types[0] == KNOT_RDATA_WF_COMPRESSED_DNAME,
ok(descr->block_types[0] == KNOT_RDATA_WF_COMPRESSIBLE_DNAME,
"get CNAME descriptor 1. item type");
ok(descr->block_types[1] == KNOT_RDATA_WF_END,
"get CNAME descriptor 2. item type");
......@@ -228,7 +228,7 @@ int main(int argc, char *argv[])
// 31. MD
descr = knot_get_obsolete_rdata_descriptor(3);
ok(strcmp(descr->type_name, "MD") == 0, "get MD descriptor name");
ok(descr->block_types[0] == KNOT_RDATA_WF_COMPRESSED_DNAME,
ok(descr->block_types[0] == KNOT_RDATA_WF_DECOMPRESSIBLE_DNAME,
"get A descriptor 1. item type");
ok(descr->block_types[1] == KNOT_RDATA_WF_END,
"get A descriptor 2. item type");
......@@ -236,7 +236,7 @@ int main(int argc, char *argv[])
// 32. NXT
descr = knot_get_obsolete_rdata_descriptor(30);
ok(strcmp(descr->type_name, "NXT") == 0, "get NXT descriptor name");
ok(descr->block_types[0] == KNOT_RDATA_WF_COMPRESSED_DNAME,
ok(descr->block_types[0] == KNOT_RDATA_WF_DECOMPRESSIBLE_DNAME,
"get CNAME descriptor 1. item type");
ok(descr->block_types[1] == KNOT_RDATA_WF_REMAINDER,
"get CNAME descriptor 2. item type");
......@@ -262,16 +262,12 @@ int main(int argc, char *argv[])
// descriptor_item_is_dname
ok(knot_descriptor_item_is_dname(KNOT_RDATA_WF_END) == 0,
"descriptor is not dname");
ok(knot_descriptor_item_is_dname(KNOT_RDATA_WF_COMPRESSED_DNAME) != 0,
"descriptor is compressed dname");
ok(knot_descriptor_item_is_dname(KNOT_RDATA_WF_UNCOMPRESSED_DNAME) != 0,
"descriptor is uncompressed dname");
// descriptor_item_is_compr_dname
ok(knot_descriptor_item_is_compr_dname(KNOT_RDATA_WF_END) == 0,
"descriptor is not compressed dname");
ok(knot_descriptor_item_is_compr_dname(KNOT_RDATA_WF_COMPRESSED_DNAME) != 0,
"descriptor is compressed dname");
ok(knot_descriptor_item_is_dname(KNOT_RDATA_WF_FIXED_DNAME) != 0,
"descriptor is fixed dname");
ok(knot_descriptor_item_is_dname(KNOT_RDATA_WF_COMPRESSIBLE_DNAME) != 0,
"descriptor is compressible dname");
ok(knot_descriptor_item_is_dname(KNOT_RDATA_WF_DECOMPRESSIBLE_DNAME) != 0,
"descriptor is decompressible dname");
// descriptor_item_is_fixed
ok(knot_descriptor_item_is_fixed(0) == 0,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment