Skip to content

Commit

Permalink
Some additional basic RR types ... (#239)
Browse files Browse the repository at this point in the history
  • Loading branch information
wtoorop authored Nov 15, 2024
1 parent 9f5f5a0 commit da4ba4a
Show file tree
Hide file tree
Showing 6 changed files with 152 additions and 68 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- tls-supported-groups SvcParam support
- Check iana registries for unimplemented (new) RR types and SvcParamKeys
- RR types NINFO, RKEY, RESINFO, WALLET, CLA and TA

## [0.1.1] - 2024-07-19

Expand Down
14 changes: 13 additions & 1 deletion include/zone.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ extern "C" {
#define ZONE_TYPE_SMIMEA (53u)
/** Host Identity Protocol @rfc{8005} */
#define ZONE_TYPE_HIP (55u)
/** NINFO */
#define ZONE_TYPE_NINFO (56u)
/** RKEY */
#define ZONE_TYPE_RKEY (57u)
/** Child DS @rfc{7344} */
#define ZONE_TYPE_CDS (59u)
/** DNSKEY(s) the Child wants reflected in DS @rfc{7344} */
Expand Down Expand Up @@ -191,7 +195,15 @@ extern "C" {
#define ZONE_TYPE_CAA (257u)
/** DNS Authoritative Source (DNS-AS) */
#define ZONE_TYPE_AVC (258u)
/** DNSSEC Lookaside Validation @rfc{4431} */
/** Resolver Information as Key/Value Pairs @rfc{9606} */
#define ZONE_TYPE_RESINFO (261u)
/** Public wallet address */
#define ZONE_TYPE_WALLET (262u)
/** BP Convergence Layer Adapter */
#define ZONE_TYPE_CLA (263u)
/** DNSSEC Trust Authorities */
#define ZONE_TYPE_TA (32768u)
/** DNSSEC Lookaside Validation @rfc{4431} @obsolete */
#define ZONE_TYPE_DLV (32769u)
/** @} */

Expand Down
23 changes: 20 additions & 3 deletions scripts/hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ static const tuple_t types_and_classes[] = {
{ "TLSA", 52, true },
{ "SMIMEA", 53, true },
{ "HIP", 55, true },
{ "NINFO", 56, true },
{ "RKEY", 57, true },
{ "CDS", 59, true },
{ "CDNSKEY", 60, true },
{ "OPENPGPKEY", 61, true },
Expand All @@ -91,6 +93,10 @@ static const tuple_t types_and_classes[] = {
{ "URI", 256, true },
{ "CAA", 257, true },
{ "AVC", 258, true },
{ "RESINFO", 261, true },
{ "WALLET", 262, true },
{ "CLA", 263, true },
{ "TA", 32768, true },
{ "DLV", 32769, true }
};

Expand All @@ -117,10 +123,21 @@ static void print_table(uint64_t magic)

printf("static const symbol_t *hash_to_symbol[256] = {\n");
for (size_t i=0; i < 256; ) {
printf(" ");
for (size_t j=i+8; i < j; i++) {
uint16_t code = keys[i].code;
char macro = !code || keys[i].type ? 'T' : 'C';
printf("%c(%u), ", macro, code);
uint16_t code;
switch(keys[i].code) {
case 32768: code = 265; // index of TA in types array in generic/types.h
break;
case 32769: code = 266; // index of DLV in types array in generic/types.h
break;
default : code = keys[i].code;
break;
}
char macro = !code ? 'V' : keys[i].type ? 'T' : 'C';
char s[10];
snprintf(s, sizeof(s), " %c(%u)", macro, code);
printf("%7s%s", s, (i < 255 ? "," : ""));
}
printf("\n");
}
Expand Down
62 changes: 31 additions & 31 deletions src/generic/type.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,38 +18,38 @@ static const struct {
const mnemonic_t *mnemonic;
int32_t code;
} types_and_classes[256] = {
V(0), V(0), V(0), V(0), V(0), T(44), V(0), T(3),
V(0), V(0), V(0), V(0), T(11), V(0), T(42), V(0),
V(0), V(0), V(0), V(0), V(0), T(62), V(0), V(0),
V(0), T(99), T(25), V(0), T(53), V(0), V(0), V(0),
V(0), V(0), V(0), V(0), T(50), V(0), V(0), V(0),
V(0), T(39), V(0), T(21), V(0), T(5), V(0), V(0),
V(0), V(0), V(0), V(0), V(0), T(1), V(0), V(0),
C(1), V(0), T(105), T(49), V(0), T(59), V(0), T(29),
V(0), T(20), V(0), T(6), V(0), V(0), V(0), C(3),
V(0), T(63), V(0), V(0), V(0), C(2), T(43), T(37),
V(0), C(4), V(0), V(0), T(45), T(104), T(2), V(0),
T(23), T(55), V(0), T(24), V(0), V(0), V(0), V(0),
V(0), V(0), V(0), T(7), V(0), V(0), V(0), T(12),
V(0), V(0), T(60), V(0), V(0), T(36), T(10), T(15),
V(0), T(26), V(0), V(0), T(19), V(0), V(0), V(0),
V(0), V(0), V(0), T(65), V(0), T(8), V(0), T(108),
V(0), T(38), V(0), T(9), V(0), V(0), V(0), V(0),
V(0), V(0), V(0), V(0), T(46), V(0), V(0), V(0),
V(0), V(0), V(0), V(0), V(0), V(0), T(27), T(48),
V(0), V(0), V(0), V(0), V(0), V(0), V(0), T(20),
T(3), V(0), V(0), V(0), V(0), T(261), V(0), V(0),
T(60), V(0), V(0), T(105), V(0), V(0), V(0), T(258),
V(0), V(0), V(0), V(0), T(30), V(0), T(28), V(0),
V(0), T(16), V(0), V(0), T(56), T(14), T(22), V(0),
V(0), T(13), V(0), T(47), T(21), V(0), T(65), T(27),
V(0), V(0), V(0), V(0), V(0), T(1), T(62), V(0),
V(0), C(1), V(0), T(44), V(0), V(0), T(33), V(0),
V(0), V(0), V(0), V(0), T(63), V(0), T(266), V(0),
C(3), T(99), T(37), V(0), V(0), V(0), C(2), T(43),
V(0), T(50), C(4), T(51), V(0), V(0), V(0), T(2),
T(49), T(42), T(19), T(23), V(0), T(6), V(0), V(0),
V(0), V(0), T(29), V(0), T(7), V(0), V(0), V(0),
V(0), T(57), V(0), V(0), V(0), V(0), V(0), T(36),
T(15), V(0), V(0), T(26), T(11), V(0), V(0), V(0),
V(0), V(0), V(0), V(0), T(104), V(0), T(8), V(0),
V(0), V(0), T(38), V(0), T(9), V(0), T(64), V(0),
V(0), V(0), V(0), V(0), V(0), V(0), T(39), T(52),
T(24), V(0), T(5), T(106), V(0), V(0), V(0), V(0),
T(265), V(0), V(0), V(0), V(0), T(25), V(0), T(18),
T(48), V(0), T(53), V(0), V(0), V(0), T(59), V(0),
V(0), V(0), V(0), V(0), T(4), V(0), T(10), V(0),
V(0), V(0), V(0), V(0), V(0), T(55), V(0), V(0),
V(0), V(0), V(0), V(0), V(0), V(0), V(0), V(0),
V(0), V(0), V(0), V(0), V(0), V(0), V(0), V(0),
V(0), V(0), T(28), T(4), T(51), V(0), V(0), T(30),
V(0), T(106), V(0), V(0), T(16), T(64), V(0), V(0),
V(0), V(0), T(257), V(0), V(0), V(0), V(0), V(0),
T(256), V(0), V(0), V(0), V(0), T(22), V(0), V(0),
V(0), T(33), V(0), T(61), V(0), T(52), V(0), V(0),
T(259), V(0), V(0), V(0), T(14), V(0), V(0), V(0),
T(13), V(0), V(0), V(0), V(0), V(0), T(107), V(0),
V(0), T(18), V(0), T(17), V(0), V(0), T(35), V(0),
V(0), V(0), V(0), V(0), V(0), V(0), V(0), V(0),
V(0), V(0), V(0), V(0), T(258), V(0), V(0), T(109),
V(0), V(0), V(0), V(0), V(0), V(0), T(47), V(0)
V(0), V(0), T(61), T(12), V(0), V(0), V(0), V(0),
V(0), T(108), V(0), V(0), T(257), V(0), V(0), V(0),
T(35), V(0), T(263), V(0), V(0), V(0), V(0), T(107),
V(0), V(0), V(0), V(0), T(17), V(0), T(45), V(0),
V(0), V(0), V(0), V(0), V(0), V(0), T(46), V(0),
V(0), T(109), V(0), V(0), V(0), V(0), V(0), V(0),
V(0), V(0), V(0), V(0), T(262), V(0), T(256), V(0)
};

#undef V
Expand Down Expand Up @@ -110,7 +110,7 @@ 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
return (uint8_t)((value * 3523264710ull) >> 32);
return (uint8_t)((value * 3523548378ull) >> 32);
}

nonnull_all
Expand Down
58 changes: 56 additions & 2 deletions src/generic/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -2805,6 +2805,19 @@ static const rdata_info_t hip_rdata_fields[] = {
FIELD("Rendezvous Servers")
};

// https://www.iana.org/assignments/dns-parameters/NINFO/ninfo-completed-template
static const rdata_info_t ninfo_rdata_fields[] = {
FIELD("text")
};

// https://www.iana.org/assignments/dns-parameters/RKEY/rkey-completed-template
static const rdata_info_t rkey_rdata_fields[] = {
FIELD("flags"),
FIELD("protocol"),
FIELD("algorithm"),
FIELD("publickey")
};

static const rdata_info_t openpgpkey_rdata_fields[] = {
FIELD("key")
};
Expand Down Expand Up @@ -2886,6 +2899,28 @@ static const rdata_info_t avc_rdata_fields[] = {
FIELD("text")
};

// RFC 9606
static const rdata_info_t resinfo_rdata_fields[] = {
FIELD("text")
};

// https://www.iana.org/assignments/dns-parameters/WALLET/wallet-completed-template
static const rdata_info_t wallet_rdata_fields[] = {
FIELD("text")
};

// https://www.iana.org/assignments/dns-parameters/CLA/cla-completed-template
static const rdata_info_t cla_rdata_fields[] = {
FIELD("text")
};

static const rdata_info_t ta_rdata_fields[] = {
FIELD("key"),
FIELD("algorithm"),
FIELD("type"),
FIELD("digest")
};

static const rdata_info_t dlv_rdata_fields[] = {
FIELD("key"),
FIELD("algorithm"),
Expand Down Expand Up @@ -3010,9 +3045,11 @@ static const type_info_t types[] = {

TYPE("HIP", ZONE_TYPE_HIP, ZONE_CLASS_ANY, FIELDS(hip_rdata_fields),
check_hip_rr, parse_hip_rdata),
TYPE("NINFO", ZONE_TYPE_NINFO, ZONE_CLASS_ANY, FIELDS(ninfo_rdata_fields),
check_txt_rr, parse_txt_rdata),
TYPE("RKEY", ZONE_TYPE_RKEY, ZONE_CLASS_ANY, FIELDS(rkey_rdata_fields),
check_dnskey_rr, parse_dnskey_rdata),

UNKNOWN_TYPE(56),
UNKNOWN_TYPE(57),
UNKNOWN_TYPE(58),

TYPE("CDS", ZONE_TYPE_CDS, ZONE_CLASS_ANY, FIELDS(cds_rdata_fields),
Expand Down Expand Up @@ -3238,6 +3275,23 @@ static const type_info_t types[] = {
check_caa_rr, parse_caa_rdata),
TYPE("AVC", ZONE_TYPE_AVC, ZONE_CLASS_ANY, FIELDS(avc_rdata_fields),
check_txt_rr, parse_txt_rdata),

UNKNOWN_TYPE(259),
UNKNOWN_TYPE(260),

TYPE("RESINFO", ZONE_TYPE_RESINFO, ZONE_CLASS_ANY, FIELDS(resinfo_rdata_fields),
check_txt_rr, parse_txt_rdata),
TYPE("WALLET", ZONE_TYPE_WALLET, ZONE_CLASS_ANY, FIELDS(wallet_rdata_fields),
check_txt_rr, parse_txt_rdata),
TYPE("CLA", ZONE_TYPE_CLA, ZONE_CLASS_ANY, FIELDS(cla_rdata_fields),
check_txt_rr, parse_txt_rdata),

UNKNOWN_TYPE(264),

/* Map 32768 in hash.c to 265 */
TYPE("TA", ZONE_TYPE_TA, ZONE_CLASS_ANY, FIELDS(ta_rdata_fields), // obsolete
check_ds_rr, parse_ds_rdata),
/* Map 32769 in hash.c to 266 */
TYPE("DLV", ZONE_TYPE_DLV, ZONE_CLASS_ANY, FIELDS(dlv_rdata_fields), // obsolete
check_ds_rr, parse_ds_rdata)
};
Expand Down
62 changes: 31 additions & 31 deletions src/westmere/type.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,38 +18,38 @@ static const struct {
const mnemonic_t *mnemonic;
int32_t code;
} types_and_classes[256] = {
V(0), V(0), V(0), V(0), V(0), T(44), V(0), T(3),
V(0), V(0), V(0), V(0), T(11), V(0), T(42), V(0),
V(0), V(0), V(0), V(0), V(0), T(62), V(0), V(0),
V(0), T(99), T(25), V(0), T(53), V(0), V(0), V(0),
V(0), V(0), V(0), V(0), T(50), V(0), V(0), V(0),
V(0), T(39), V(0), T(21), V(0), T(5), V(0), V(0),
V(0), V(0), V(0), V(0), V(0), T(1), V(0), V(0),
C(1), V(0), T(105), T(49), V(0), T(59), V(0), T(29),
V(0), T(20), V(0), T(6), V(0), V(0), V(0), C(3),
V(0), T(63), V(0), V(0), V(0), C(2), T(43), T(37),
V(0), C(4), V(0), V(0), T(45), T(104), T(2), V(0),
T(23), T(55), V(0), T(24), V(0), V(0), V(0), V(0),
V(0), V(0), V(0), T(7), V(0), V(0), V(0), T(12),
V(0), V(0), T(60), V(0), V(0), T(36), T(10), T(15),
V(0), T(26), V(0), V(0), T(19), V(0), V(0), V(0),
V(0), V(0), V(0), T(65), V(0), T(8), V(0), T(108),
V(0), T(38), V(0), T(9), V(0), V(0), V(0), V(0),
V(0), V(0), V(0), V(0), T(46), V(0), V(0), V(0),
V(0), V(0), V(0), V(0), V(0), V(0), T(27), T(48),
V(0), V(0), V(0), V(0), V(0), V(0), V(0), T(20),
T(3), V(0), V(0), V(0), V(0), T(261), V(0), V(0),
T(60), V(0), V(0), T(105), V(0), V(0), V(0), T(258),
V(0), V(0), V(0), V(0), T(30), V(0), T(28), V(0),
V(0), T(16), V(0), V(0), T(56), T(14), T(22), V(0),
V(0), T(13), V(0), T(47), T(21), V(0), T(65), T(27),
V(0), V(0), V(0), V(0), V(0), T(1), T(62), V(0),
V(0), C(1), V(0), T(44), V(0), V(0), T(33), V(0),
V(0), V(0), V(0), V(0), T(63), V(0), T(266), V(0),
C(3), T(99), T(37), V(0), V(0), V(0), C(2), T(43),
V(0), T(50), C(4), T(51), V(0), V(0), V(0), T(2),
T(49), T(42), T(19), T(23), V(0), T(6), V(0), V(0),
V(0), V(0), T(29), V(0), T(7), V(0), V(0), V(0),
V(0), T(57), V(0), V(0), V(0), V(0), V(0), T(36),
T(15), V(0), V(0), T(26), T(11), V(0), V(0), V(0),
V(0), V(0), V(0), V(0), T(104), V(0), T(8), V(0),
V(0), V(0), T(38), V(0), T(9), V(0), T(64), V(0),
V(0), V(0), V(0), V(0), V(0), V(0), T(39), T(52),
T(24), V(0), T(5), T(106), V(0), V(0), V(0), V(0),
T(265), V(0), V(0), V(0), V(0), T(25), V(0), T(18),
T(48), V(0), T(53), V(0), V(0), V(0), T(59), V(0),
V(0), V(0), V(0), V(0), T(4), V(0), T(10), V(0),
V(0), V(0), V(0), V(0), V(0), T(55), V(0), V(0),
V(0), V(0), V(0), V(0), V(0), V(0), V(0), V(0),
V(0), V(0), V(0), V(0), V(0), V(0), V(0), V(0),
V(0), V(0), T(28), T(4), T(51), V(0), V(0), T(30),
V(0), T(106), V(0), V(0), T(16), T(64), V(0), V(0),
V(0), V(0), T(257), V(0), V(0), V(0), V(0), V(0),
T(256), V(0), V(0), V(0), V(0), T(22), V(0), V(0),
V(0), T(33), V(0), T(61), V(0), T(52), V(0), V(0),
T(259), V(0), V(0), V(0), T(14), V(0), V(0), V(0),
T(13), V(0), V(0), V(0), V(0), V(0), T(107), V(0),
V(0), T(18), V(0), T(17), V(0), V(0), T(35), V(0),
V(0), V(0), V(0), V(0), V(0), V(0), V(0), V(0),
V(0), V(0), V(0), V(0), T(258), V(0), V(0), T(109),
V(0), V(0), V(0), V(0), V(0), V(0), T(47), V(0)
V(0), V(0), T(61), T(12), V(0), V(0), V(0), V(0),
V(0), T(108), V(0), V(0), T(257), V(0), V(0), V(0),
T(35), V(0), T(263), V(0), V(0), V(0), V(0), T(107),
V(0), V(0), V(0), V(0), T(17), V(0), T(45), V(0),
V(0), V(0), V(0), V(0), V(0), V(0), T(46), V(0),
V(0), T(109), V(0), V(0), V(0), V(0), V(0), V(0),
V(0), V(0), V(0), V(0), T(262), V(0), T(256), V(0)
};

#undef V
Expand Down Expand Up @@ -102,7 +102,7 @@ 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
return (uint8_t)((value * 3523264710ull) >> 32);
return (uint8_t)((value * 3523548378ull) >> 32);
}

nonnull_all
Expand Down

0 comments on commit da4ba4a

Please sign in to comment.