Skip to content

Commit 8c896fe

Browse files
committed
Treat TYPE0 like any other unknown type
1 parent 2a109de commit 8c896fe

File tree

3 files changed

+11
-22
lines changed

3 files changed

+11
-22
lines changed

FORMAT.md

+3
Original file line numberDiff line numberDiff line change
@@ -225,3 +225,6 @@ anything other than domain names and text strings, MUST not be quoted.
225225
226226
* BIND10 had a nice writeup on zone files, kindly provided by Shane Kerr.
227227
[Zone File Loading Requirements on Wayback Machine](https://web.archive.org/web/20140928215002/http://bind10.isc.org:80/wiki/ZoneLoadingRequirements)
228+
229+
* `TYPE0` is sometimes used for debugging and therefore may occur in type
230+
bitmaps or as unknown RR type.

src/generic/types.h

+2-22
Original file line numberDiff line numberDiff line change
@@ -123,27 +123,6 @@ static really_inline ssize_t check_ttl(
123123
return 4;
124124
}
125125

126-
zone_nonnull((1,2,3,4))
127-
static really_inline ssize_t check_type(
128-
parser_t *parser,
129-
const type_info_t *type,
130-
const rdata_info_t *field,
131-
const uint8_t *data,
132-
const size_t length)
133-
{
134-
uint16_t number;
135-
136-
if (length < sizeof(number))
137-
SYNTAX_ERROR(parser, "Missing %s in %s", NAME(field), NAME(type));
138-
139-
memcpy(&number, data, sizeof(number));
140-
141-
if (!number)
142-
SEMANTIC_ERROR(parser, "Invalid %s in %s", NAME(field), NAME(type));
143-
144-
return 2;
145-
}
146-
147126
zone_nonnull((1,2,3,4))
148127
static really_inline ssize_t check_name(
149128
parser_t *parser,
@@ -1584,7 +1563,7 @@ static int32_t check_rrsig_rr(
15841563
const uint8_t *o = parser->rdata->octets;
15851564
const rdata_info_t *f = type->rdata.fields;
15861565

1587-
if ((r = check(&c, check_type(parser, type, &f[0], o, n))) ||
1566+
if ((r = check(&c, check_int16(parser, type, &f[0], o, n))) ||
15881567
(r = check(&c, check_int8(parser, type, &f[1], o+c, n-c))) ||
15891568
(r = check(&c, check_int8(parser, type, &f[2], o+c, n-c))) ||
15901569
(r = check(&c, check_ttl(parser, type, &f[3], o+c, n-c))) ||
@@ -2845,6 +2824,7 @@ static const rdata_info_t dlv_rdata_fields[] = {
28452824
FIELD("digest")
28462825
};
28472826

2827+
// https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml
28482828
static const type_info_t types[] = {
28492829
UNKNOWN_TYPE(0),
28502830

tests/types.c

+6
Original file line numberDiff line numberDiff line change
@@ -867,6 +867,11 @@ static const char dlv_text[] =
867867
static const char dlv_generic_text[] =
868868
PAD("foo. DLV \\# 24 e466 05 01 3079f1593ebad6dc121e202a8b766a6a4837206c");
869869

870+
static const char type0_generic_text[] =
871+
PAD("foo. TYPE0 \\# 6 666f6f626172");
872+
static const rdata_t type0_rdata =
873+
RDATA('f', 'o', 'o', 'b', 'a', 'r');
874+
870875
typedef struct test test_t;
871876
struct test {
872877
const uint16_t type;
@@ -876,6 +881,7 @@ struct test {
876881

877882

878883
static const test_t tests[] = {
884+
{ 0, type0_generic_text, &type0_rdata },
879885
{ ZONE_A, a_text, &a_rdata },
880886
{ ZONE_A, a_generic_text, &a_rdata },
881887
{ ZONE_NS, ns_text, &ns_rdata },

0 commit comments

Comments
 (0)