Skip to content

draft-homburg-deleg-incremental-deleg support #248

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open
9 changes: 9 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ case "$enable_haswell" in
yes|*) enable_haswell=yes ;;
esac

AC_ARG_ENABLE(drafts, AS_HELP_STRING([--enable-drafts],[Enables the use of the draft RR types]))
case "$enable_drafts" in
yes)
AC_DEFINE_UNQUOTED([USE_DRAFTS], [], [Define this to enable draft RR types])
;;
no|''|*)
;;
esac

# GCC and Clang
AX_CHECK_COMPILE_FLAG([-MMD],DEPFLAGS="-MMD -MP")
# Oracle Developer Studio (no -MP)
Expand Down
5 changes: 5 additions & 0 deletions include/zone.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <stdbool.h>
#include <stdio.h>
#include <stddef.h>
#include <config.h>

#include "zone/attributes.h"
#include "zone/export.h"
Expand Down Expand Up @@ -223,6 +224,10 @@ extern "C" {
#define ZONE_TYPE_TA (32768u)
/** DNSSEC Lookaside Validation @rfc{4431} @obsolete */
#define ZONE_TYPE_DLV (32769u)
#ifdef USE_DRAFTS
/** DELEG IETF draft */
#define ZONE_TYPE_DELEG (65280u)
#endif
/** @} */

/**
Expand Down
5 changes: 4 additions & 1 deletion scripts/hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ static const tuple_t types_and_classes[] = {
{ "CLA", 263, true },
{ "IPN", 264, true },
{ "TA", 32768, true },
{ "DLV", 32769, true }
{ "DLV", 32769, true },
{ "IDELEG", 65280, true }
};

const uint64_t original_magic = 3523216699ull; // original hash from hash.cpp
Expand Down Expand Up @@ -140,6 +141,8 @@ static void print_table(uint64_t magic)
break;
case 32769: code = 271; // index of DLV in types array in generic/types.h
break;
case 65280: code = 272; // index of IDELEG in types array in generic/types.h
break;
default : code = keys[i].code;
break;
}
Expand Down
44 changes: 43 additions & 1 deletion src/generic/type.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
static const struct {
const mnemonic_t *mnemonic;
int32_t code;
} types_and_classes[256] = {
} types_and_classes[256] =
#ifndef USE_DRAFTS
{
V(0), V(0), V(0), V(0), V(0), V(0), T(34), V(0),
V(0), V(0), T(30), V(0), V(0), T(57), V(0), T(16),
V(0), V(0), T(56), T(14), T(12), V(0), V(0), T(13),
Expand Down Expand Up @@ -51,6 +53,42 @@ static const struct {
V(0), V(0), T(45), V(0), V(0), T(23), V(0), V(0),
V(0), V(0), V(0), V(0), V(0), V(0), V(0), V(0)
};
#else
{
V(0), V(0), T(58), T(66), V(0), V(0), T(65), V(0),
V(0), T(53), V(0), V(0), V(0), T(108), V(0), V(0),
V(0), T(4), V(0), V(0), V(0), T(49), V(0), V(0),
V(0), V(0), V(0), V(0), V(0), T(31), V(0), V(0),
V(0), V(0), V(0), T(28), T(104), V(0), T(257), V(0),
V(0), V(0), T(27), V(0), V(0), V(0), V(0), T(48),
V(0), V(0), V(0), V(0), V(0), T(1), V(0), T(47),
V(0), V(0), T(34), V(0), T(263), V(0), T(106), V(0),
V(0), V(0), V(0), V(0), V(0), T(35), V(0), T(25),
V(0), V(0), V(0), V(0), V(0), V(0), V(0), T(56),
T(14), T(260), T(107), V(0), T(13), V(0), V(0), T(17),
V(0), V(0), V(0), V(0), V(0), V(0), T(50), V(0),
V(0), T(109), T(52), T(258), V(0), V(0), T(45), V(0),
T(264), V(0), T(3), V(0), V(0), T(19), V(0), V(0),
V(0), V(0), V(0), V(0), V(0), V(0), V(0), V(0),
T(61), V(0), V(0), T(42), V(0), V(0), V(0), T(40),
V(0), V(0), T(24), T(60), V(0), V(0), T(55), V(0),
V(0), T(12), V(0), V(0), V(0), V(0), V(0), V(0),
V(0), V(0), T(11), V(0), V(0), T(272), V(0), V(0),
V(0), V(0), T(37), V(0), T(46), T(23), V(0), T(262),
T(64), V(0), T(261), V(0), T(29), T(21), V(0), V(0),
V(0), C(1), V(0), V(0), V(0), T(10), T(57), C(3),
T(271), T(33), V(0), V(0), V(0), V(0), V(0), T(259),
T(18), V(0), T(59), T(30), V(0), V(0), V(0), V(0),
T(16), V(0), V(0), T(7), T(6), C(2), T(43), T(20),
V(0), C(4), V(0), V(0), V(0), V(0), T(2), T(38),
T(22), T(51), V(0), V(0), V(0), V(0), V(0), T(99),
V(0), T(256), V(0), V(0), V(0), T(105), V(0), V(0),
T(44), T(39), V(0), V(0), T(8), V(0), T(5), V(0),
V(0), V(0), V(0), V(0), V(0), T(36), T(32), T(15),
V(0), T(26), V(0), V(0), V(0), T(270), V(0), V(0),
V(0), V(0), T(9), V(0), T(63), V(0), T(62), V(0)
};
#endif

#undef V
#undef T
Expand Down Expand Up @@ -110,7 +148,11 @@ static really_inline uint8_t hash(uint64_t prefix)
prefix = le64toh(prefix);
uint32_t value = (uint32_t)((prefix >> 32) ^ prefix);
// magic value is generated using hash.c, rerun when adding types
#ifndef USE_DRAFTS
return (uint8_t)((value * 3537259401ull) >> 32);
#else
return (uint8_t)((value * 3547541308ull) >> 32);
#endif
}

nonnull_all
Expand Down
48 changes: 48 additions & 0 deletions src/generic/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -2339,6 +2339,41 @@ static int32_t parse_dsync_rdata(
return accept_rr(parser, type, rdata);
}

#ifdef USE_DRAFTS
nonnull_all
static int32_t check_deleg_rr(
parser_t *parser, const type_info_t *type, const rdata_t *rdata)
{
//
// FIXME: incorporate fixes mentioned in check_svcb_rr
//

return accept_rr(parser, type, rdata);
}

nonnull_all
static int32_t parse_deleg_rdata(
parser_t *parser, const type_info_t *type, rdata_t *rdata, token_t *token)
{
int32_t code;
const rdata_info_t *fields = type->rdata.fields;

if ((code = have_contiguous(parser, type, &fields[0], token)) < 0)
return code;
if ((code = parse_int16(parser, type, &fields[0], rdata, token)) < 0)
return code;
if ((code = take_contiguous(parser, type, &fields[1], token)) < 0)
return code;
if ((code = parse_name(parser, type, &fields[1], rdata, token)) < 0)
return code;
take(parser, token);
if ((code = parse_svc_params(parser, type, &fields[2], rdata, token)) < 0)
return code;

return accept_rr(parser, type, rdata);
}
#endif

nonnull_all
static int32_t check_nid_rr(
parser_t *parser, const type_info_t *type, const rdata_t *rdata)
Expand Down Expand Up @@ -3277,6 +3312,12 @@ static const rdata_info_t dsync_rdata_fields[] = {
FIELD("target")
};

static const rdata_info_t deleg_rdata_fields[] = {
FIELD("priority"),
FIELD("target"),
FIELD("params")
};

static const rdata_info_t spf_rdata_fields[] = {
FIELD("text")
};
Expand Down Expand Up @@ -3754,6 +3795,13 @@ static const type_info_t types[] = {
/* Map 32769 in hash.c to 271 */
TYPE("DLV", ZONE_TYPE_DLV, ZONE_CLASS_ANY, FIELDS(dlv_rdata_fields), // obsolete
check_ds_rr, parse_ds_rdata)
#ifdef USE_DRAFTS
,
/* Map 65280 in hash.c to 272 */
TYPE("IDELEG", ZONE_TYPE_DELEG, ZONE_CLASS_IN, FIELDS(deleg_rdata_fields),
check_deleg_rr, parse_deleg_rdata)
#endif

};

#undef UNKNOWN_CLASS
Expand Down
44 changes: 43 additions & 1 deletion src/westmere/type.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
static const struct {
const mnemonic_t *mnemonic;
int32_t code;
} types_and_classes[256] = {
} types_and_classes[256] =
#ifndef USE_DRAFTS
{
V(0), V(0), V(0), V(0), V(0), V(0), T(34), V(0),
V(0), V(0), T(30), V(0), V(0), T(57), V(0), T(16),
V(0), V(0), T(56), T(14), T(12), V(0), V(0), T(13),
Expand Down Expand Up @@ -51,6 +53,42 @@ static const struct {
V(0), V(0), T(45), V(0), V(0), T(23), V(0), V(0),
V(0), V(0), V(0), V(0), V(0), V(0), V(0), V(0)
};
#else
{
V(0), V(0), T(58), T(66), V(0), V(0), T(65), V(0),
V(0), T(53), V(0), V(0), V(0), T(108), V(0), V(0),
V(0), T(4), V(0), V(0), V(0), T(49), V(0), V(0),
V(0), V(0), V(0), V(0), V(0), T(31), V(0), V(0),
V(0), V(0), V(0), T(28), T(104), V(0), T(257), V(0),
V(0), V(0), T(27), V(0), V(0), V(0), V(0), T(48),
V(0), V(0), V(0), V(0), V(0), T(1), V(0), T(47),
V(0), V(0), T(34), V(0), T(263), V(0), T(106), V(0),
V(0), V(0), V(0), V(0), V(0), T(35), V(0), T(25),
V(0), V(0), V(0), V(0), V(0), V(0), V(0), T(56),
T(14), T(260), T(107), V(0), T(13), V(0), V(0), T(17),
V(0), V(0), V(0), V(0), V(0), V(0), T(50), V(0),
V(0), T(109), T(52), T(258), V(0), V(0), T(45), V(0),
T(264), V(0), T(3), V(0), V(0), T(19), V(0), V(0),
V(0), V(0), V(0), V(0), V(0), V(0), V(0), V(0),
T(61), V(0), V(0), T(42), V(0), V(0), V(0), T(40),
V(0), V(0), T(24), T(60), V(0), V(0), T(55), V(0),
V(0), T(12), V(0), V(0), V(0), V(0), V(0), V(0),
V(0), V(0), T(11), V(0), V(0), T(272), V(0), V(0),
V(0), V(0), T(37), V(0), T(46), T(23), V(0), T(262),
T(64), V(0), T(261), V(0), T(29), T(21), V(0), V(0),
V(0), C(1), V(0), V(0), V(0), T(10), T(57), C(3),
T(271), T(33), V(0), V(0), V(0), V(0), V(0), T(259),
T(18), V(0), T(59), T(30), V(0), V(0), V(0), V(0),
T(16), V(0), V(0), T(7), T(6), C(2), T(43), T(20),
V(0), C(4), V(0), V(0), V(0), V(0), T(2), T(38),
T(22), T(51), V(0), V(0), V(0), V(0), V(0), T(99),
V(0), T(256), V(0), V(0), V(0), T(105), V(0), V(0),
T(44), T(39), V(0), V(0), T(8), V(0), T(5), V(0),
V(0), V(0), V(0), V(0), V(0), T(36), T(32), T(15),
V(0), T(26), V(0), V(0), V(0), T(270), V(0), V(0),
V(0), V(0), T(9), V(0), T(63), V(0), T(62), V(0)
};
#endif

#undef V
#undef T
Expand Down Expand Up @@ -102,7 +140,11 @@ static really_inline uint8_t hash(uint64_t prefix)
{
uint32_t value = (uint32_t)((prefix >> 32) ^ prefix);
// magic value is generated using hash.c, rerun when adding types
#ifndef USE_DRAFTS
return (uint8_t)((value * 3537259401ull) >> 32);
#else
return (uint8_t)((value * 3547541308ull) >> 32);
#endif
}

nonnull_all
Expand Down