From c6f02f54bde0d9da7ebc68b3c286a9ccba3e89e4 Mon Sep 17 00:00:00 2001 From: Willem Toorop Date: Fri, 3 Jan 2025 11:08:03 +0100 Subject: [PATCH 01/13] Parse DSYNC --- simdzone | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simdzone b/simdzone index 83a2327a5..90ec6fa88 160000 --- a/simdzone +++ b/simdzone @@ -1 +1 @@ -Subproject commit 83a2327a524ffaf35c81d03e8f48073c7991944e +Subproject commit 90ec6fa88e0bea7e1ad30cd0895ed25113969a65 From 2ab2ab671e901e0289a5d54ba5a847e3adeb403e Mon Sep 17 00:00:00 2001 From: Willem Toorop Date: Fri, 3 Jan 2025 11:26:56 +0100 Subject: [PATCH 02/13] RR types implementation administration --- tpkg/parsing-not-printing.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 tpkg/parsing-not-printing.py diff --git a/tpkg/parsing-not-printing.py b/tpkg/parsing-not-printing.py new file mode 100755 index 000000000..f6560c371 --- /dev/null +++ b/tpkg/parsing-not-printing.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python + +printing = { (name[5:], int(num)) + for name, num in [ ln.split(maxsplit=3)[1:3] + for ln in open('dns.h') + if ln.startswith('#define TYPE_') ] + if int(num) != 41 and (int(num) < 128 or int(num) >= 256) } +parsing = { (name[10:], int(num[1:-2])) + for name, num in [ ln.split(maxsplit=3)[1:3] + for ln in open('simdzone/include/zone.h') + if ln.startswith('#define ZONE_TYPE_') ] } + +if printing - parsing: + print('implement parsing for:', printing - parsing) +if parsing - printing: + print('implement printing for:', parsing - printing) + From efb8b94644b6337258f04cebe0d726a6a48d4887 Mon Sep 17 00:00:00 2001 From: Willem Toorop Date: Fri, 3 Jan 2025 11:56:32 +0100 Subject: [PATCH 03/13] Printing of DSYNC RR type --- dns.c | 6 +++++- dns.h | 1 + simdzone | 2 +- tpkg/rr-test.tdir/rr-test.cmp_zone | 3 +++ tpkg/rr-test.tdir/rr-test.zone | 3 +++ 5 files changed, 13 insertions(+), 2 deletions(-) diff --git a/dns.c b/dns.c index b60880d1c..5e30a830a 100644 --- a/dns.c +++ b/dns.c @@ -485,7 +485,11 @@ static rrtype_descriptor_type rrtype_descriptors[(RRTYPE_DESCRIPTORS_LENGTH+2)] , RDATA_ZF_SVCPARAM, RDATA_ZF_SVCPARAM, RDATA_ZF_SVCPARAM } }, /* 66 */ - { 66, NULL, 1, 1, { RDATA_WF_BINARY }, { RDATA_ZF_UNKNOWN } }, + { TYPE_DSYNC, "DSYNC", 4, 4, + { RDATA_WF_SHORT , RDATA_WF_BYTE, RDATA_WF_SHORT + , RDATA_WF_LITERAL_DNAME }, + { RDATA_ZF_RRTYPE, RDATA_ZF_BYTE, RDATA_ZF_SHORT + , RDATA_ZF_LITERAL_DNAME } }, /* 67 */ { 67, NULL, 1, 1, { RDATA_WF_BINARY }, { RDATA_ZF_UNKNOWN } }, /* 68 */ diff --git a/dns.h b/dns.h index dcd25bbcc..da1987a7c 100644 --- a/dns.h +++ b/dns.h @@ -145,6 +145,7 @@ typedef enum nsd_rc nsd_rc_type; #define TYPE_ZONEMD 63 /* RFC 8976 */ #define TYPE_SVCB 64 /* RFC 9460 */ #define TYPE_HTTPS 65 /* RFC 9460 */ +#define TYPE_DSYNC 66 /* draft-ietf-dnsop-generalized-notify */ #define TYPE_SPF 99 /* RFC 4408 */ diff --git a/simdzone b/simdzone index 90ec6fa88..580e8efb0 160000 --- a/simdzone +++ b/simdzone @@ -1 +1 @@ -Subproject commit 90ec6fa88e0bea7e1ad30cd0895ed25113969a65 +Subproject commit 580e8efb08e348ac380360b8a5d0243adedf149e diff --git a/tpkg/rr-test.tdir/rr-test.cmp_zone b/tpkg/rr-test.tdir/rr-test.cmp_zone index 4d694c5af..3a0b94f62 100644 --- a/tpkg/rr-test.tdir/rr-test.cmp_zone +++ b/tpkg/rr-test.tdir/rr-test.cmp_zone @@ -37,6 +37,9 @@ blaat 3600 IN SOA elektron.atoom.net. miekg.atoom.net. ( 3600 IN LOC \# 16 001216138b3556c88008165000989a89 3600 IN LOC \# 16 00121613791b7d2898e64c4f00989a68 3600 IN LOC \# 16 002516138916cb3c70c310df009884ed +$ORIGIN _dsync.blaat.nl. +* 3600 IN DSYNC CDS 1 5359 cds-scanner.example.net. + 3600 IN DSYNC CSYNC 1 5360 csync-scanner.example.net. $ORIGIN blaat.nl. caa 3600 IN CAA 0 issue "ca.example.net" 3600 IN CAA 0 iodef "mailto:security@example.com" diff --git a/tpkg/rr-test.tdir/rr-test.zone b/tpkg/rr-test.tdir/rr-test.zone index e5fd38455..27310490f 100644 --- a/tpkg/rr-test.tdir/rr-test.zone +++ b/tpkg/rr-test.tdir/rr-test.zone @@ -65,6 +65,9 @@ $ORIGIN blaat.nl. @ IN LOC 32 7 19 S 116 2 25.999 E 10m @ IN LOC 42 21 28.764 N 71 00 51.617 W -44.99m 2000m +*._dsync IN DSYNC CDS 1 5359 cds-scanner.example.net. +*._dsync IN DSYNC CSYNC 1 5360 csync-scanner.example.net. + $ORIGIN blaat.nl. dotted\.label IN MX 10 foo\ bar\.nl From af007bb3e35de843f6382adbd35f70288e364711 Mon Sep 17 00:00:00 2001 From: Willem Toorop Date: Sun, 5 Jan 2025 13:48:44 +0100 Subject: [PATCH 04/13] Support for EID and NIMLOC RR types --- dns.c | 4 ++-- dns.h | 3 ++- simdzone | 2 +- tpkg/rr-test.tdir/rr-test.cmp_zone | 5 +++++ tpkg/rr-test.tdir/rr-test.zone | 9 +++++++++ 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/dns.c b/dns.c index 5e30a830a..00f92812f 100644 --- a/dns.c +++ b/dns.c @@ -152,9 +152,9 @@ static rrtype_descriptor_type rrtype_descriptors[(RRTYPE_DESCRIPTORS_LENGTH+2)] { RDATA_WF_UNCOMPRESSED_DNAME, RDATA_WF_BINARY }, { RDATA_ZF_DNAME, RDATA_ZF_NXT } }, /* 31 */ - { 31, NULL, 1, 1, { RDATA_WF_BINARY }, { RDATA_ZF_UNKNOWN } }, + { TYPE_EID, "EID", 1, 1, { RDATA_WF_BINARY }, { RDATA_ZF_HEX } }, /* 32 */ - { 32, NULL, 1, 1, { RDATA_WF_BINARY }, { RDATA_ZF_UNKNOWN } }, + { TYPE_NIMLOC, "NIMLOC", 1, 1, { RDATA_WF_BINARY }, { RDATA_ZF_HEX } }, /* 33 */ { TYPE_SRV, "SRV", 4, 4, { RDATA_WF_SHORT, RDATA_WF_SHORT, RDATA_WF_SHORT, diff --git a/dns.h b/dns.h index da1987a7c..02b62f7ef 100644 --- a/dns.h +++ b/dns.h @@ -112,7 +112,8 @@ typedef enum nsd_rc nsd_rc_type; #define TYPE_AAAA 28 /* ipv6 address */ #define TYPE_LOC 29 /* LOC record RFC1876 */ #define TYPE_NXT 30 /* 2535typecode */ - +#define TYPE_EID 31 /* draft-ietf-nimrod-dns-01 */ +#define TYPE_NIMLOC 32 /* draft-ietf-nimrod-dns-01 */ #define TYPE_SRV 33 /* SRV record RFC2782 */ #define TYPE_NAPTR 35 /* RFC2915 */ diff --git a/simdzone b/simdzone index 580e8efb0..a0ed8b8fd 160000 --- a/simdzone +++ b/simdzone @@ -1 +1 @@ -Subproject commit 580e8efb08e348ac380360b8a5d0243adedf149e +Subproject commit a0ed8b8fd198fa0407bbf459ec9557b36b3cfac0 diff --git a/tpkg/rr-test.tdir/rr-test.cmp_zone b/tpkg/rr-test.tdir/rr-test.cmp_zone index 3a0b94f62..cf2e51a85 100644 --- a/tpkg/rr-test.tdir/rr-test.cmp_zone +++ b/tpkg/rr-test.tdir/rr-test.cmp_zone @@ -89,6 +89,11 @@ rt-host 3600 IN A 127.0.0.1 3600 IN X25 "x25 address in text format" 3600 IN ISDN "isdn address" ta 3600 IN TA 56039 13 2 4104805b43928fc573f0704a2c1b5a10baa2878de26b8535dde77517c154ce9f +vaxa 3600 IN EID 3141592653589793 + 3600 IN NIMLOC 75234159eac457800921 +venera 3600 IN EID 813f4b7cdab34217 + 3600 IN NIMLOC 3227450a010034 + 3600 IN NIMLOC 75234159eac457800920 wallet 3600 IN WALLET "BTC" "1H6WkSHdqVahBKczJrs9bBfFYhUHrP5R2F" 3600 IN WALLET "BCH" "1PdRYCYMv7RA8PwxQZ1Q3aCYC4gxKVwFPu" 3600 IN WALLET "NMC" "MwKMAXMaXPFQTSCiVD5zHucmA6r3gaAnra" diff --git a/tpkg/rr-test.tdir/rr-test.zone b/tpkg/rr-test.tdir/rr-test.zone index 27310490f..ccf9724d0 100644 --- a/tpkg/rr-test.tdir/rr-test.zone +++ b/tpkg/rr-test.tdir/rr-test.zone @@ -164,3 +164,12 @@ hip3 IN HIP ( 2 200100107B1A74DF365639CC39F1D578 rvs1.example.com. rvs2.example.com. ) +; EID and NIMLOC examples from draft-ietf-nimrod-dns-01 +VENERA EID 813F 4B7C DAB3 4217 + NIMLOC ( 3227 45 + 0A 01 00 34 ) + NIMLOC 752341 59EAC4 5780 0920 + +VAXA EID 3141 5926 5358 9793 + NIMLOC 752341 59EAC4 5780 0921 + From df63facf06e8fd9357859f21f9358476d6aeb95d Mon Sep 17 00:00:00 2001 From: Willem Toorop Date: Mon, 6 Jan 2025 13:49:17 +0100 Subject: [PATCH 05/13] Support for the SINK, TALINK and DOA RR types --- dns.c | 14 +++++++++++--- dns.h | 6 +++--- rdata.c | 4 ++-- simdzone | 2 +- tpkg/rr-test.tdir/rr-test.cmp_zone | 7 +++++++ tpkg/rr-test.tdir/rr-test.zone | 13 +++++++++++++ 6 files changed, 37 insertions(+), 9 deletions(-) diff --git a/dns.c b/dns.c index 00f92812f..5f09471f8 100644 --- a/dns.c +++ b/dns.c @@ -183,7 +183,9 @@ static rrtype_descriptor_type rrtype_descriptors[(RRTYPE_DESCRIPTORS_LENGTH+2)] { TYPE_DNAME, "DNAME", 1, 1, { RDATA_WF_UNCOMPRESSED_DNAME }, { RDATA_ZF_DNAME } }, /* 40 */ - { 40, NULL, 1, 1, { RDATA_WF_BINARY }, { RDATA_ZF_UNKNOWN } }, + { TYPE_SINK, "SINK", 3, 3, + { RDATA_WF_BYTE, RDATA_WF_BYTE, RDATA_WF_BINARY }, + { RDATA_ZF_BYTE, RDATA_ZF_BYTE, RDATA_ZF_BASE64 } }, /* 41 */ { TYPE_OPT, "OPT", 1, 1, { RDATA_WF_BINARY }, { RDATA_ZF_UNKNOWN } }, @@ -363,7 +365,9 @@ static rrtype_descriptor_type rrtype_descriptors[(RRTYPE_DESCRIPTORS_LENGTH+2)] { RDATA_ZF_SHORT, RDATA_ZF_BYTE, RDATA_ZF_ALGORITHM, RDATA_ZF_BASE64 } }, /* 58 - TALINK */ - { 58, NULL, 1, 1, { RDATA_WF_BINARY }, { RDATA_ZF_UNKNOWN } }, + { TYPE_TALINK, "TALINK", 2, 2, + { RDATA_WF_LITERAL_DNAME, RDATA_WF_LITERAL_DNAME }, + { RDATA_ZF_LITERAL_DNAME, RDATA_ZF_LITERAL_DNAME } }, /* 59 - CDS */ { TYPE_CDS, "CDS", 4, 4, { RDATA_WF_SHORT, RDATA_WF_BYTE, RDATA_WF_BYTE, RDATA_WF_BINARY }, @@ -892,7 +896,11 @@ static rrtype_descriptor_type rrtype_descriptors[(RRTYPE_DESCRIPTORS_LENGTH+2)] { RDATA_WF_TEXTS }, { RDATA_ZF_TEXTS } }, /* 259 - DOA */ - { 259, NULL, 1, 1, { RDATA_WF_BINARY }, { RDATA_ZF_UNKNOWN } }, + { TYPE_DOA, "DOA", 5, 5, + { RDATA_WF_LONG, RDATA_WF_LONG, RDATA_WF_BYTE, + RDATA_WF_TEXT, RDATA_WF_BINARY }, + { RDATA_ZF_LONG, RDATA_ZF_LONG, RDATA_ZF_BYTE, + RDATA_ZF_TEXT, RDATA_ZF_BASE64 } }, /* 260 - AMTRELAY */ { 260, NULL, 1, 1, { RDATA_WF_BINARY }, { RDATA_ZF_UNKNOWN } }, /* 261 - RESINFO */ diff --git a/dns.h b/dns.h index 02b62f7ef..8f17826c7 100644 --- a/dns.h +++ b/dns.h @@ -121,7 +121,7 @@ typedef enum nsd_rc nsd_rc_type; #define TYPE_CERT 37 /* RFC2538 */ #define TYPE_A6 38 /* RFC2874 */ #define TYPE_DNAME 39 /* RFC2672 */ - +#define TYPE_SINK 40 /* draft-eastlake-kitchen-sink */ #define TYPE_OPT 41 /* Pseudo OPT record... */ #define TYPE_APL 42 /* RFC3123 */ #define TYPE_DS 43 /* RFC 4033, 4034, and 4035 */ @@ -138,7 +138,7 @@ typedef enum nsd_rc nsd_rc_type; #define TYPE_HIP 55 /* RFC 8005 */ #define TYPE_NINFO 56 /* NINFO/ninfo-completed-template */ #define TYPE_RKEY 57 /* RKEY/rkey-completed-template */ - +#define TYPE_TALINK 58 /* draft-iet5f-dnsop-dnssec-trust-history */ #define TYPE_CDS 59 /* RFC 7344 */ #define TYPE_CDNSKEY 60 /* RFC 7344 */ #define TYPE_OPENPGPKEY 61 /* RFC 7929 */ @@ -166,7 +166,7 @@ typedef enum nsd_rc nsd_rc_type; #define TYPE_URI 256 /* RFC 7553 */ #define TYPE_CAA 257 /* RFC 6844 */ #define TYPE_AVC 258 /* AVC/avc-completed-template */ - +#define TYPE_DOA 259 /* draft-durand-doa-over-dns */ #define TYPE_RESINFO 261 /* RFC 9606 */ #define TYPE_WALLET 262 /* WALLET/wallet-completed-template */ #define TYPE_CLA 263 /* CLA/cla-completed-template */ diff --git a/rdata.c b/rdata.c index 232f752fe..a5f79b6a0 100644 --- a/rdata.c +++ b/rdata.c @@ -450,13 +450,13 @@ rdata_base32_to_string(buffer_type *output, rdata_atom_type rdata, static int rdata_base64_to_string(buffer_type *output, rdata_atom_type rdata, - rr_type* ATTR_UNUSED(rr)) + rr_type* rr) { int length; size_t size = rdata_atom_size(rdata); if(size == 0) { /* single zero represents empty buffer */ - buffer_write(output, "0", 1); + buffer_write(output, (rr->type == TYPE_DOA ? "-" : "0"), 1); return 1; } buffer_reserve(output, size * 2 + 1); diff --git a/simdzone b/simdzone index a0ed8b8fd..3e037aa52 160000 --- a/simdzone +++ b/simdzone @@ -1 +1 @@ -Subproject commit a0ed8b8fd198fa0407bbf459ec9557b36b3cfac0 +Subproject commit 3e037aa528208f498776af5854a406df5c115615 diff --git a/tpkg/rr-test.tdir/rr-test.cmp_zone b/tpkg/rr-test.tdir/rr-test.cmp_zone index cf2e51a85..cac450ced 100644 --- a/tpkg/rr-test.tdir/rr-test.cmp_zone +++ b/tpkg/rr-test.tdir/rr-test.cmp_zone @@ -37,6 +37,10 @@ blaat 3600 IN SOA elektron.atoom.net. miekg.atoom.net. ( 3600 IN LOC \# 16 001216138b3556c88008165000989a89 3600 IN LOC \# 16 00121613791b7d2898e64c4f00989a68 3600 IN LOC \# 16 002516138916cb3c70c310df009884ed + 3600 IN SINK 64 1 TkxuZXRMYWJzLm5s + 3600 IN TALINK h0.blaat.nl. h2.blaat.nl. + 3600 IN DOA 0 1 2 "" bWFpbHRvOmxhYnNAbmxuZXRsYWJzLm5s + 3600 IN DOA 0 100000 200 "example/nothing" - $ORIGIN _dsync.blaat.nl. * 3600 IN DSYNC CDS 1 5359 cds-scanner.example.net. 3600 IN DSYNC CSYNC 1 5360 csync-scanner.example.net. @@ -60,6 +64,9 @@ hinault 3600 IN GPOS -22.6882 116.8652 250.0 lillee 3600 IN GPOS -32.6882 116.8652 10.0 marsh 3600 IN GPOS -32.6882 116.8652 10.0 $ORIGIN blaat.nl. +h0 3600 IN TALINK . h1.blaat.nl. +h1 3600 IN TALINK h0.blaat.nl. h2.blaat.nl. +h2 3600 IN TALINK h1.blaat.nl. . highbit-\200\210\201a 3600 IN A 127.0.0.1 hip1 3600 IN HIP 2 200100107b1a74df365639cc39f1d578 AwEAAbdxyhNuSutc5EMzxTs9LBPCIkOFH8cIvM4p9+LrV4e19WzK00+CI6zBCQTdtWsuxKbWIy87UOoJTwkUs7lBu+Upr1gsNrut79ryra+bSRGQb1slImA8YVJyuIDsj7kwzG7jnERNqnWxZ48AWkskmdHaVDP4BcelrTI3rMXdXF5D hip2 3600 IN HIP 2 200100107b1a74df365639cc39f1d578 AwEAAbdxyhNuSutc5EMzxTs9LBPCIkOFH8cIvM4p9+LrV4e19WzK00+CI6zBCQTdtWsuxKbWIy87UOoJTwkUs7lBu+Upr1gsNrut79ryra+bSRGQb1slImA8YVJyuIDsj7kwzG7jnERNqnWxZ48AWkskmdHaVDP4BcelrTI3rMXdXF5D rvs.example.com. diff --git a/tpkg/rr-test.tdir/rr-test.zone b/tpkg/rr-test.tdir/rr-test.zone index ccf9724d0..9f0ff56dc 100644 --- a/tpkg/rr-test.tdir/rr-test.zone +++ b/tpkg/rr-test.tdir/rr-test.zone @@ -65,6 +65,19 @@ $ORIGIN blaat.nl. @ IN LOC 32 7 19 S 116 2 25.999 E 10m @ IN LOC 42 21 28.764 N 71 00 51.617 W -44.99m 2000m +; draft-eastlake-kitchen-sink +@ IN SINK 64 1 TkxuZXRMYWJzLm5s + +; draft-ietf-dnsop-dnssec-trust-history +@ IN TALINK h0 h2 +h0 IN TALINK . h1 +h1 IN TALINK h0 h2 +h2 IN TALINK h1 . + +; draft-durand-doa-over-dns +@ IN DOA 0 1 2 "" bWFpbHRvOmxhYnNAbmxuZXRsYWJzLm5s + IN DOA 0 100000 200 example/nothing - + *._dsync IN DSYNC CDS 1 5359 cds-scanner.example.net. *._dsync IN DSYNC CSYNC 1 5360 csync-scanner.example.net. From 6ba9428aece7ec7fb1da349545d8b0f18fd62d0e Mon Sep 17 00:00:00 2001 From: Willem Toorop Date: Tue, 21 Jan 2025 11:44:49 +0100 Subject: [PATCH 06/13] Support for ATMA --- dns.c | 2 +- dns.h | 3 ++- rdata.c | 24 +++++++++++++++++++++++- simdzone | 2 +- tpkg/rr-test.tdir/rr-test.cmp_zone | 2 ++ tpkg/rr-test.tdir/rr-test.zone | 4 ++++ 6 files changed, 33 insertions(+), 4 deletions(-) diff --git a/dns.c b/dns.c index 5f09471f8..74547a81f 100644 --- a/dns.c +++ b/dns.c @@ -161,7 +161,7 @@ static rrtype_descriptor_type rrtype_descriptors[(RRTYPE_DESCRIPTORS_LENGTH+2)] RDATA_WF_UNCOMPRESSED_DNAME }, { RDATA_ZF_SHORT, RDATA_ZF_SHORT, RDATA_ZF_SHORT, RDATA_ZF_DNAME } }, /* 34 */ - { 34, NULL, 1, 1, { RDATA_WF_BINARY }, { RDATA_ZF_UNKNOWN } }, + { TYPE_ATMA, "ATMA", 1, 1, { RDATA_WF_BINARY }, { RDATA_ZF_ATMA } }, /* 35 */ { TYPE_NAPTR, "NAPTR", 6, 6, { RDATA_WF_SHORT, RDATA_WF_SHORT, RDATA_WF_TEXT, RDATA_WF_TEXT, diff --git a/dns.h b/dns.h index 8f17826c7..308a1c294 100644 --- a/dns.h +++ b/dns.h @@ -115,7 +115,7 @@ typedef enum nsd_rc nsd_rc_type; #define TYPE_EID 31 /* draft-ietf-nimrod-dns-01 */ #define TYPE_NIMLOC 32 /* draft-ietf-nimrod-dns-01 */ #define TYPE_SRV 33 /* SRV record RFC2782 */ - +#define TYPE_ATMA 34 /* ATM Address */ #define TYPE_NAPTR 35 /* RFC2915 */ #define TYPE_KX 36 /* RFC2230 Key Exchange Delegation Record */ #define TYPE_CERT 37 /* RFC2538 */ @@ -272,6 +272,7 @@ enum rdata_zoneformat RDATA_ZF_TAG, /* A sequence of letters and numbers. */ RDATA_ZF_SVCPARAM, /* SvcParam [=] */ RDATA_ZF_HIP, /* HIP rdata up to the Rendezvous Servers */ + RDATA_ZF_ATMA, /* ATM Address */ RDATA_ZF_UNKNOWN /* Unknown data. */ }; typedef enum rdata_zoneformat rdata_zoneformat_type; diff --git a/rdata.c b/rdata.c index a5f79b6a0..38df7ddc8 100644 --- a/rdata.c +++ b/rdata.c @@ -950,7 +950,7 @@ static int rdata_hip_to_string(buffer_type *output, rdata_atom_type rdata, rr_type* ATTR_UNUSED(rr)) { - uint16_t size = rdata_atom_size(rdata); + uint16_t size = rdata_atom_size(rdata); uint8_t hit_length; uint16_t pk_length; int length = 0; @@ -974,6 +974,27 @@ rdata_hip_to_string(buffer_type *output, rdata_atom_type rdata, return length != -1; } +static int +rdata_atma_to_string(buffer_type *output, rdata_atom_type rdata, + rr_type* ATTR_UNUSED(rr)) +{ + uint16_t size = rdata_atom_size(rdata), i; + + if(size < 2 || rdata_atom_data(rdata)[0] > 1) + return 0; + if(!rdata_atom_data(rdata)[0]) { + hex_to_string(output, rdata_atom_data(rdata) + 1, size - 1); + return 1; + } + for(i = 1; i < size; i++) { + if(!isdigit(rdata_atom_data(rdata)[i])) + return 0; + } + buffer_write_u8(output, '+'); + buffer_write(output, rdata_atom_data(rdata) + 1, size - 1); + return 1; +} + static int rdata_unknown_to_string(buffer_type *output, rdata_atom_type rdata, rr_type* ATTR_UNUSED(rr)) @@ -1019,6 +1040,7 @@ static rdata_to_string_type rdata_to_string_table[RDATA_ZF_UNKNOWN + 1] = { rdata_tag_to_string, rdata_svcparam_to_string, rdata_hip_to_string, + rdata_atma_to_string, rdata_unknown_to_string }; diff --git a/simdzone b/simdzone index 3e037aa52..b913eda2b 160000 --- a/simdzone +++ b/simdzone @@ -1 +1 @@ -Subproject commit 3e037aa528208f498776af5854a406df5c115615 +Subproject commit b913eda2b0d03d10e9350d995fae91d6003cbb88 diff --git a/tpkg/rr-test.tdir/rr-test.cmp_zone b/tpkg/rr-test.tdir/rr-test.cmp_zone index cac450ced..09389b9e2 100644 --- a/tpkg/rr-test.tdir/rr-test.cmp_zone +++ b/tpkg/rr-test.tdir/rr-test.cmp_zone @@ -41,6 +41,8 @@ blaat 3600 IN SOA elektron.atoom.net. miekg.atoom.net. ( 3600 IN TALINK h0.blaat.nl. h2.blaat.nl. 3600 IN DOA 0 1 2 "" bWFpbHRvOmxhYnNAbmxuZXRsYWJzLm5s 3600 IN DOA 0 100000 200 "example/nothing" - + 3600 IN ATMA 39246f000e7c9c03120001000100001234567800 + 3600 IN ATMA +3584001234567 $ORIGIN _dsync.blaat.nl. * 3600 IN DSYNC CDS 1 5359 cds-scanner.example.net. 3600 IN DSYNC CSYNC 1 5360 csync-scanner.example.net. diff --git a/tpkg/rr-test.tdir/rr-test.zone b/tpkg/rr-test.tdir/rr-test.zone index 9f0ff56dc..f9010df83 100644 --- a/tpkg/rr-test.tdir/rr-test.zone +++ b/tpkg/rr-test.tdir/rr-test.zone @@ -78,6 +78,10 @@ h2 IN TALINK h1 . @ IN DOA 0 1 2 "" bWFpbHRvOmxhYnNAbmxuZXRsYWJzLm5s IN DOA 0 100000 200 example/nothing - +; https://web.archive.org/web/20190112072924/http://www.broadband-forum.org/ftp/pub/approved-specs/af-dans-0152.000.pdf +@ IN ATMA 39.246f.00.0e7c9c.0312.0001.0001.000012345678.00 + IN ATMA +358.400.1234567 + *._dsync IN DSYNC CDS 1 5359 cds-scanner.example.net. *._dsync IN DSYNC CSYNC 1 5360 csync-scanner.example.net. From 30800f642f04fc2f2f95cd4ea75791b6d7359f73 Mon Sep 17 00:00:00 2001 From: Willem Toorop Date: Wed, 22 Jan 2025 12:06:17 +0100 Subject: [PATCH 07/13] Support for AMTRELAY --- dns.c | 4 ++- dns.h | 3 ++ rdata.c | 56 +++++++++++++++++++----------- simdzone | 2 +- tpkg/rr-test.tdir/rr-test.cmp_zone | 4 +++ tpkg/rr-test.tdir/rr-test.zone | 6 ++++ 6 files changed, 53 insertions(+), 22 deletions(-) diff --git a/dns.c b/dns.c index 74547a81f..dcce0bf9e 100644 --- a/dns.c +++ b/dns.c @@ -902,7 +902,9 @@ static rrtype_descriptor_type rrtype_descriptors[(RRTYPE_DESCRIPTORS_LENGTH+2)] { RDATA_ZF_LONG, RDATA_ZF_LONG, RDATA_ZF_BYTE, RDATA_ZF_TEXT, RDATA_ZF_BASE64 } }, /* 260 - AMTRELAY */ - { 260, NULL, 1, 1, { RDATA_WF_BINARY }, { RDATA_ZF_UNKNOWN } }, + { TYPE_AMTRELAY, "AMTRELAY", 3, 3, + { RDATA_WF_BYTE, RDATA_WF_BYTE , RDATA_WF_IPSECGATEWAY }, + { RDATA_ZF_BYTE, RDATA_ZF_AMTRELAY_D_TYPE, RDATA_ZF_AMTRELAY_RELAY } }, /* 261 - RESINFO */ { TYPE_RESINFO, "RESINFO", 1, 1, { RDATA_WF_TEXTS }, { RDATA_ZF_UNQUOTEDS } }, /* 262 - WALLET */ diff --git a/dns.h b/dns.h index efab59c24..ae8faf731 100644 --- a/dns.h +++ b/dns.h @@ -167,6 +167,7 @@ typedef enum nsd_rc nsd_rc_type; #define TYPE_CAA 257 /* RFC 6844 */ #define TYPE_AVC 258 /* AVC/avc-completed-template */ #define TYPE_DOA 259 /* draft-durand-doa-over-dns */ +#define TYPE_AMTRELAY 260 /* RFC 8777 */ #define TYPE_RESINFO 261 /* RFC 9606 */ #define TYPE_WALLET 262 /* WALLET/wallet-completed-template */ #define TYPE_CLA 263 /* CLA/cla-completed-template */ @@ -273,6 +274,8 @@ enum rdata_zoneformat RDATA_ZF_SVCPARAM, /* SvcParam [=] */ RDATA_ZF_HIP, /* HIP rdata up to the Rendezvous Servers */ RDATA_ZF_ATMA, /* ATM Address */ + RDATA_ZF_AMTRELAY_D_TYPE,/* Discovery Optional and Type */ + RDATA_ZF_AMTRELAY_RELAY,/* ip4, ip6, dname or nothing */ RDATA_ZF_UNKNOWN /* Unknown data. */ }; typedef enum rdata_zoneformat rdata_zoneformat_type; diff --git a/rdata.c b/rdata.c index 38df7ddc8..0ea123163 100644 --- a/rdata.c +++ b/rdata.c @@ -605,38 +605,32 @@ rdata_services_to_string(buffer_type *output, rdata_atom_type rdata, } static int -rdata_ipsecgateway_to_string(buffer_type *output, rdata_atom_type rdata, rr_type* rr) +rdata_gateway_relay_to_string(buffer_type *output, rdata_atom_type rdata, + int gateway_relay_type) { - int gateway_type = rdata_atom_data(rr->rdatas[1])[0]; - switch(gateway_type) { + switch(gateway_relay_type) { case IPSECKEY_NOGATEWAY: buffer_printf(output, "."); break; case IPSECKEY_IP4: - rdata_a_to_string(output, rdata, rr); - break; + return rdata_a_to_string(output, rdata, NULL); case IPSECKEY_IP6: - rdata_aaaa_to_string(output, rdata, rr); - break; + return rdata_aaaa_to_string(output, rdata, NULL); case IPSECKEY_DNAME: - { - region_type* temp = region_create(xalloc, free); - const dname_type* d = dname_make(temp, - rdata_atom_data(rdata), 0); - if(!d) { - region_destroy(temp); - return 0; - } - buffer_printf(output, "%s", dname_to_string(d, NULL)); - region_destroy(temp); - } - break; + return rdata_dns_name_to_string(output, rdata, NULL); default: return 0; } return 1; } +static int +rdata_ipsecgateway_to_string(buffer_type *output, rdata_atom_type rdata, rr_type* rr) +{ + return rdata_gateway_relay_to_string(output, rdata, + rdata_atom_data(rr->rdatas[1])[0]); +} + static int rdata_nxt_to_string(buffer_type *output, rdata_atom_type rdata, rr_type* ATTR_UNUSED(rr)) @@ -995,6 +989,26 @@ rdata_atma_to_string(buffer_type *output, rdata_atom_type rdata, return 1; } +static int +rdata_amtrelay_d_type_to_string(buffer_type *output, rdata_atom_type rdata, + rr_type* ATTR_UNUSED(rr)) +{ + uint8_t data = *rdata_atom_data(rdata); + buffer_printf(output , "%c %lu", (data & 0x80 ? '1' : '0'), + ((unsigned long)data & 0x7f)); + return 1; +} + +static int +rdata_amtrelay_relay_to_string(buffer_type *output, rdata_atom_type rdata, + rr_type* ATTR_UNUSED(rr)) +{ + int relay_type = rdata_atom_data(rr->rdatas[1])[0] & 0x7f; + if(!relay_type) + return 1; + return rdata_gateway_relay_to_string(output, rdata, relay_type); +} + static int rdata_unknown_to_string(buffer_type *output, rdata_atom_type rdata, rr_type* ATTR_UNUSED(rr)) @@ -1041,6 +1055,8 @@ static rdata_to_string_type rdata_to_string_table[RDATA_ZF_UNKNOWN + 1] = { rdata_svcparam_to_string, rdata_hip_to_string, rdata_atma_to_string, + rdata_amtrelay_d_type_to_string, + rdata_amtrelay_relay_to_string, rdata_unknown_to_string }; @@ -1142,7 +1158,7 @@ rdata_wireformat_to_rdata_atoms(region_type *region, break; case RDATA_WF_IPSECGATEWAY: assert(i>1); /* we are past the gateway type */ - switch(rdata_atom_data(temp_rdatas[1])[0]) /* gateway type */ { + switch(rdata_atom_data(temp_rdatas[1])[0] & 0x7f) /* gateway type */ { default: case IPSECKEY_NOGATEWAY: length = 0; diff --git a/simdzone b/simdzone index b913eda2b..4265c1751 160000 --- a/simdzone +++ b/simdzone @@ -1 +1 @@ -Subproject commit b913eda2b0d03d10e9350d995fae91d6003cbb88 +Subproject commit 4265c175107750f6aed24fcfb2176e0f1e6fff48 diff --git a/tpkg/rr-test.tdir/rr-test.cmp_zone b/tpkg/rr-test.tdir/rr-test.cmp_zone index 09389b9e2..82e2b82e7 100644 --- a/tpkg/rr-test.tdir/rr-test.cmp_zone +++ b/tpkg/rr-test.tdir/rr-test.cmp_zone @@ -43,6 +43,10 @@ blaat 3600 IN SOA elektron.atoom.net. miekg.atoom.net. ( 3600 IN DOA 0 100000 200 "example/nothing" - 3600 IN ATMA 39246f000e7c9c03120001000100001234567800 3600 IN ATMA +3584001234567 + 3600 IN AMTRELAY 200 0 0 + 3600 IN AMTRELAY 10 0 1 203.0.113.15 + 3600 IN AMTRELAY 10 0 2 2001:db8::15 + 3600 IN AMTRELAY 128 1 3 amtrelays.example.com. $ORIGIN _dsync.blaat.nl. * 3600 IN DSYNC CDS 1 5359 cds-scanner.example.net. 3600 IN DSYNC CSYNC 1 5360 csync-scanner.example.net. diff --git a/tpkg/rr-test.tdir/rr-test.zone b/tpkg/rr-test.tdir/rr-test.zone index f9010df83..681de464f 100644 --- a/tpkg/rr-test.tdir/rr-test.zone +++ b/tpkg/rr-test.tdir/rr-test.zone @@ -82,6 +82,12 @@ h2 IN TALINK h1 . @ IN ATMA 39.246f.00.0e7c9c.0312.0001.0001.000012345678.00 IN ATMA +358.400.1234567 +; RFC 8777 +@ IN AMTRELAY 200 0 0 + IN AMTRELAY 10 0 1 203.0.113.15 + IN AMTRELAY 10 0 2 2001:db8::15 + IN AMTRELAY 128 1 3 amtrelays.example.com. + *._dsync IN DSYNC CDS 1 5359 cds-scanner.example.net. *._dsync IN DSYNC CSYNC 1 5360 csync-scanner.example.net. From 459e6026680789670fe1fe145fc7066e9a7eff2c Mon Sep 17 00:00:00 2001 From: Willem Toorop Date: Wed, 22 Jan 2025 12:54:10 +0100 Subject: [PATCH 08/13] Support for IPN RR type --- dns.c | 2 ++ dns.h | 5 ++++- ixfr.c | 3 +++ rdata.c | 13 +++++++++++++ simdzone | 2 +- tpkg/rr-test.tdir/rr-test.cmp_zone | 3 +++ tpkg/rr-test.tdir/rr-test.zone | 5 +++++ 7 files changed, 31 insertions(+), 2 deletions(-) diff --git a/dns.c b/dns.c index dcce0bf9e..1248aea14 100644 --- a/dns.c +++ b/dns.c @@ -911,6 +911,8 @@ static rrtype_descriptor_type rrtype_descriptors[(RRTYPE_DESCRIPTORS_LENGTH+2)] { TYPE_WALLET, "WALLET", 1, 1, { RDATA_WF_TEXTS }, { RDATA_ZF_TEXTS } }, /* 263 - CLA */ { TYPE_CLA, "CLA", 1, 1, { RDATA_WF_TEXTS }, { RDATA_ZF_TEXTS } }, + /* 264 - IPN */ + { TYPE_IPN, "IPN", 1, 1, { RDATA_WF_LONGLONG }, { RDATA_ZF_LONGLONG } }, /* 32768 - TA */ { TYPE_TA, "TA", 4, 4, diff --git a/dns.h b/dns.h index ae8faf731..f2fefc785 100644 --- a/dns.h +++ b/dns.h @@ -171,6 +171,7 @@ typedef enum nsd_rc nsd_rc_type; #define TYPE_RESINFO 261 /* RFC 9606 */ #define TYPE_WALLET 262 /* WALLET/wallet-completed-template */ #define TYPE_CLA 263 /* CLA/cla-completed-template */ +#define TYPE_IPN 264 /* IPN/ipn-completed-template */ #define TYPE_TA 32768 /* http://www.watson.org/~weiler/INI1999-19.pdf */ #define TYPE_DLV 32769 /* RFC 4431 */ @@ -217,6 +218,7 @@ enum rdata_wireformat RDATA_WF_BYTE, /* 8-bit integer. */ RDATA_WF_SHORT, /* 16-bit integer. */ RDATA_WF_LONG, /* 32-bit integer. */ + RDATA_WF_LONGLONG, /* 64-bit integer. */ RDATA_WF_TEXT, /* Text string. */ RDATA_WF_TEXTS, /* Text string sequence. */ RDATA_WF_A, /* 32-bit IPv4 address. */ @@ -246,6 +248,7 @@ enum rdata_zoneformat RDATA_ZF_BYTE, /* 8-bit integer. */ RDATA_ZF_SHORT, /* 16-bit integer. */ RDATA_ZF_LONG, /* 32-bit integer. */ + RDATA_ZF_LONGLONG, /* 64-bit integer. */ RDATA_ZF_A, /* 32-bit IPv4 address. */ RDATA_ZF_AAAA, /* 128-bit IPv6 address. */ RDATA_ZF_RRTYPE, /* RR type. */ @@ -297,7 +300,7 @@ typedef struct rrtype_descriptor rrtype_descriptor_type; * * CLA + 1 */ -#define RRTYPE_DESCRIPTORS_LENGTH (TYPE_CLA + 1) +#define RRTYPE_DESCRIPTORS_LENGTH (TYPE_IPN + 1) rrtype_descriptor_type *rrtype_descriptor_by_name(const char *name); rrtype_descriptor_type *rrtype_descriptor_by_type(uint16_t type); diff --git a/ixfr.c b/ixfr.c index 6a56ac753..bd84852f3 100644 --- a/ixfr.c +++ b/ixfr.c @@ -353,6 +353,9 @@ static int ixfr_write_rr_pkt(struct query* query, struct buffer* packet, case RDATA_WF_LONG: copy_len = 4; break; + case RDATA_WF_LONGLONG: + copy_len = 8; + break; case RDATA_WF_TEXTS: case RDATA_WF_LONG_TEXT: copy_len = rdlen; diff --git a/rdata.c b/rdata.c index 0ea123163..4bc5c206a 100644 --- a/rdata.c +++ b/rdata.c @@ -295,6 +295,15 @@ rdata_long_to_string(buffer_type *output, rdata_atom_type rdata, return 1; } +static int +rdata_longlong_to_string(buffer_type *output, rdata_atom_type rdata, + rr_type* ATTR_UNUSED(rr)) +{ + uint64_t data = read_uint64(rdata_atom_data(rdata)); + buffer_printf(output, "%llu", (unsigned long long) data); + return 1; +} + static int rdata_a_to_string(buffer_type *output, rdata_atom_type rdata, rr_type* ATTR_UNUSED(rr)) @@ -1027,6 +1036,7 @@ static rdata_to_string_type rdata_to_string_table[RDATA_ZF_UNKNOWN + 1] = { rdata_byte_to_string, rdata_short_to_string, rdata_long_to_string, + rdata_longlong_to_string, rdata_a_to_string, rdata_aaaa_to_string, rdata_rrtype_to_string, @@ -1115,6 +1125,9 @@ rdata_wireformat_to_rdata_atoms(region_type *region, case RDATA_WF_LONG: length = sizeof(uint32_t); break; + case RDATA_WF_LONGLONG: + length = sizeof(uint64_t); + break; case RDATA_WF_TEXTS: case RDATA_WF_LONG_TEXT: length = end - buffer_position(packet); diff --git a/simdzone b/simdzone index 4265c1751..a2dd0e3fd 160000 --- a/simdzone +++ b/simdzone @@ -1 +1 @@ -Subproject commit 4265c175107750f6aed24fcfb2176e0f1e6fff48 +Subproject commit a2dd0e3fd2e4e25636f39d07382e603042b588a0 diff --git a/tpkg/rr-test.tdir/rr-test.cmp_zone b/tpkg/rr-test.tdir/rr-test.cmp_zone index 82e2b82e7..c6ad55304 100644 --- a/tpkg/rr-test.tdir/rr-test.cmp_zone +++ b/tpkg/rr-test.tdir/rr-test.cmp_zone @@ -47,6 +47,9 @@ blaat 3600 IN SOA elektron.atoom.net. miekg.atoom.net. ( 3600 IN AMTRELAY 10 0 1 203.0.113.15 3600 IN AMTRELAY 10 0 2 2001:db8::15 3600 IN AMTRELAY 128 1 3 amtrelays.example.com. + 3600 IN IPN 100 + 3600 IN IPN 429496729700 + 3600 IN IPN 10000000000000000000 $ORIGIN _dsync.blaat.nl. * 3600 IN DSYNC CDS 1 5359 cds-scanner.example.net. 3600 IN DSYNC CSYNC 1 5360 csync-scanner.example.net. diff --git a/tpkg/rr-test.tdir/rr-test.zone b/tpkg/rr-test.tdir/rr-test.zone index 681de464f..9a75b4917 100644 --- a/tpkg/rr-test.tdir/rr-test.zone +++ b/tpkg/rr-test.tdir/rr-test.zone @@ -88,6 +88,11 @@ h2 IN TALINK h1 . IN AMTRELAY 10 0 2 2001:db8::15 IN AMTRELAY 128 1 3 amtrelays.example.com. +; draft-johnson-dns-ipn-cla-07 Section 3.1. +@ IN IPN 100 + IN IPN 100.100 + IN IPN 10000000000000000000 + *._dsync IN DSYNC CDS 1 5359 cds-scanner.example.net. *._dsync IN DSYNC CSYNC 1 5360 csync-scanner.example.net. From 3cd0cd364c5f078e25afd3c91a058eb5b25a16a8 Mon Sep 17 00:00:00 2001 From: Willem Toorop Date: Wed, 22 Jan 2025 13:18:40 +0100 Subject: [PATCH 09/13] Latest simdzone with additional RR types --- simdzone | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simdzone b/simdzone index a2dd0e3fd..87affeead 160000 --- a/simdzone +++ b/simdzone @@ -1 +1 @@ -Subproject commit a2dd0e3fd2e4e25636f39d07382e603042b588a0 +Subproject commit 87affeead83804d5dfdf908c43581360c097662c From 4c456af7615a338c91ebc4fd4b9003e0ea76cb91 Mon Sep 17 00:00:00 2001 From: Willem Toorop Date: Thu, 23 Jan 2025 12:20:36 +0100 Subject: [PATCH 10/13] Correct ipseckey gateway type testing --- dns.c | 2 +- dns.h | 3 ++- rdata.c | 61 ++++++++++++++++++++++++++++++++++++++------------------- zonec.h | 5 +++++ 4 files changed, 49 insertions(+), 22 deletions(-) diff --git a/dns.c b/dns.c index 1248aea14..dc516f514 100644 --- a/dns.c +++ b/dns.c @@ -903,7 +903,7 @@ static rrtype_descriptor_type rrtype_descriptors[(RRTYPE_DESCRIPTORS_LENGTH+2)] RDATA_ZF_TEXT, RDATA_ZF_BASE64 } }, /* 260 - AMTRELAY */ { TYPE_AMTRELAY, "AMTRELAY", 3, 3, - { RDATA_WF_BYTE, RDATA_WF_BYTE , RDATA_WF_IPSECGATEWAY }, + { RDATA_WF_BYTE, RDATA_WF_BYTE , RDATA_WF_AMTRELAY_RELAY }, { RDATA_ZF_BYTE, RDATA_ZF_AMTRELAY_D_TYPE, RDATA_ZF_AMTRELAY_RELAY } }, /* 261 - RESINFO */ { TYPE_RESINFO, "RESINFO", 1, 1, { RDATA_WF_TEXTS }, { RDATA_ZF_UNQUOTEDS } }, diff --git a/dns.h b/dns.h index f2fefc785..6f8d279ca 100644 --- a/dns.h +++ b/dns.h @@ -232,7 +232,8 @@ enum rdata_wireformat RDATA_WF_EUI64, /* 64-bit address. */ RDATA_WF_LONG_TEXT, /* Long (>255) text string. */ RDATA_WF_SVCPARAM, /* SvcParam [=] */ - RDATA_WF_HIP /* HIP rdata up to the Rendezvous Servers */ + RDATA_WF_HIP, /* HIP rdata up to the Rendezvous Servers */ + RDATA_WF_AMTRELAY_RELAY /* ip4, ip6, dname or nothing */ }; typedef enum rdata_wireformat rdata_wireformat_type; diff --git a/rdata.c b/rdata.c index 4bc5c206a..a1966896b 100644 --- a/rdata.c +++ b/rdata.c @@ -614,32 +614,24 @@ rdata_services_to_string(buffer_type *output, rdata_atom_type rdata, } static int -rdata_gateway_relay_to_string(buffer_type *output, rdata_atom_type rdata, - int gateway_relay_type) +rdata_ipsecgateway_to_string(buffer_type *output, rdata_atom_type rdata, rr_type* rr) { - switch(gateway_relay_type) { + switch(rdata_atom_data(rr->rdatas[1])[0]) { case IPSECKEY_NOGATEWAY: buffer_printf(output, "."); break; case IPSECKEY_IP4: - return rdata_a_to_string(output, rdata, NULL); + return rdata_a_to_string(output, rdata, rr); case IPSECKEY_IP6: - return rdata_aaaa_to_string(output, rdata, NULL); + return rdata_aaaa_to_string(output, rdata, rr); case IPSECKEY_DNAME: - return rdata_dns_name_to_string(output, rdata, NULL); + return rdata_dns_name_to_string(output, rdata, rr); default: return 0; } return 1; } -static int -rdata_ipsecgateway_to_string(buffer_type *output, rdata_atom_type rdata, rr_type* rr) -{ - return rdata_gateway_relay_to_string(output, rdata, - rdata_atom_data(rr->rdatas[1])[0]); -} - static int rdata_nxt_to_string(buffer_type *output, rdata_atom_type rdata, rr_type* ATTR_UNUSED(rr)) @@ -953,7 +945,7 @@ static int rdata_hip_to_string(buffer_type *output, rdata_atom_type rdata, rr_type* ATTR_UNUSED(rr)) { - uint16_t size = rdata_atom_size(rdata); + uint16_t size = rdata_atom_size(rdata); uint8_t hit_length; uint16_t pk_length; int length = 0; @@ -1010,12 +1002,21 @@ rdata_amtrelay_d_type_to_string(buffer_type *output, rdata_atom_type rdata, static int rdata_amtrelay_relay_to_string(buffer_type *output, rdata_atom_type rdata, - rr_type* ATTR_UNUSED(rr)) + rr_type* rr) { - int relay_type = rdata_atom_data(rr->rdatas[1])[0] & 0x7f; - if(!relay_type) - return 1; - return rdata_gateway_relay_to_string(output, rdata, relay_type); + switch(rdata_atom_data(rr->rdatas[1])[0] & 0x7f) { + case AMTRELAY_NOGATEWAY: + break; + case AMTRELAY_IP4: + return rdata_a_to_string(output, rdata, rr); + case AMTRELAY_IP6: + return rdata_aaaa_to_string(output, rdata, rr); + case AMTRELAY_DNAME: + return rdata_dns_name_to_string(output, rdata, rr); + default: + return 0; + } + return 1; } static int @@ -1171,7 +1172,7 @@ rdata_wireformat_to_rdata_atoms(region_type *region, break; case RDATA_WF_IPSECGATEWAY: assert(i>1); /* we are past the gateway type */ - switch(rdata_atom_data(temp_rdatas[1])[0] & 0x7f) /* gateway type */ { + switch(rdata_atom_data(temp_rdatas[1])[0]) /* gateway type */ { default: case IPSECKEY_NOGATEWAY: length = 0; @@ -1205,6 +1206,26 @@ rdata_wireformat_to_rdata_atoms(region_type *region, length += read_uint16(buffer_current(packet) + 2); } break; + case RDATA_WF_AMTRELAY_RELAY: + assert(i>1); + switch(rdata_atom_data(temp_rdatas[1])[0] & 0x7f) /* relay type */ { + default: + case AMTRELAY_NOGATEWAY: + length = 0; + break; + case AMTRELAY_IP4: + length = IP4ADDRLEN; + break; + case AMTRELAY_IP6: + length = IP6ADDRLEN; + break; + case AMTRELAY_DNAME: + is_domain = 1; + is_normalized = 1; + is_wirestore = 1; + break; + } + break; } if (is_domain) { const dname_type *dname; diff --git a/zonec.h b/zonec.h index 2f51be436..448dc3c9c 100644 --- a/zonec.h +++ b/zonec.h @@ -21,6 +21,11 @@ #define IPSECKEY_IP6 2 #define IPSECKEY_DNAME 3 +#define AMTRELAY_NOGATEWAY 0 /* RFC 8777 */ +#define AMTRELAY_IP4 1 +#define AMTRELAY_IP6 2 +#define AMTRELAY_DNAME 3 + #define LINEBUFSZ 1024 #define DEFAULT_TTL 3600 From 21287cd2d0040842a4c16819318853b69cf44bbb Mon Sep 17 00:00:00 2001 From: Willem Toorop Date: Thu, 23 Jan 2025 14:59:41 +0100 Subject: [PATCH 11/13] Update ChangeLog for new RR types As well as have the updated main branch from simdzone as submodule --- doc/ChangeLog | 8 ++++++-- doc/RELNOTES | 4 ++++ simdzone | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index f657595ab..a577a9f75 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,7 +1,11 @@ +23 January 2025: Willem + - Support for DSYNC, EID, NIMLOC, SINK, TALINK, DOA, AMTRELAY and + IPN resource record types. + 20 January 2025: Willem - code repository continues with 4.11.2 under development. - - Fix re-enable to configure dns-cookies from config file, which was - accidentally removed with the 4.11.1 release. + - Fix re-enable to configure dns-cookies from config file, which + was accidentally removed with the 4.11.1 release. 19 January 2025: Willem - NSD 4.11.1 emergency quick-fix release diff --git a/doc/RELNOTES b/doc/RELNOTES index b96df44dd..5e7b5c294 100644 --- a/doc/RELNOTES +++ b/doc/RELNOTES @@ -2,6 +2,10 @@ NSD RELEASE NOTES 4.11.2 ================ +FEATURES: + - Support for DSYNC, EID, NIMLOC, SINK, TALINK, DOA, AMTRELAY and + IPN resource record types. + BUG FIXES: - Fix re-enable to configure dns-cookies from config file, which was accidentally removed with the 4.11.1 release. diff --git a/simdzone b/simdzone index 87affeead..80f5f44df 160000 --- a/simdzone +++ b/simdzone @@ -1 +1 @@ -Subproject commit 87affeead83804d5dfdf908c43581360c097662c +Subproject commit 80f5f44dfeb9878b5559b0bfbdd75a077ce92f3e From dbe90d69bffed6beab585dc3cd47814d29bcf87f Mon Sep 17 00:00:00 2001 From: Willem Toorop Date: Thu, 23 Jan 2025 15:03:07 +0100 Subject: [PATCH 12/13] Mention PR #418 in ChangeLog and RELNOTES --- doc/ChangeLog | 4 ++-- doc/RELNOTES | 4 ++-- simdzone | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 1e7d68867..9381e36f9 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,6 +1,6 @@ 23 January 2025: Willem - - Support for DSYNC, EID, NIMLOC, SINK, TALINK, DOA, AMTRELAY and - IPN resource record types. + - Merge #418: Support for DSYNC, EID, NIMLOC, SINK, TALINK, DOA, + AMTRELAY and IPN resource record types. 22 January 2025: Wouter - Fix #426: nsd crashes with patterns in config_apply_pattern. diff --git a/doc/RELNOTES b/doc/RELNOTES index 24604008d..e8b85044e 100644 --- a/doc/RELNOTES +++ b/doc/RELNOTES @@ -3,8 +3,8 @@ NSD RELEASE NOTES 4.11.2 ================ FEATURES: - - Support for DSYNC, EID, NIMLOC, SINK, TALINK, DOA, AMTRELAY and - IPN resource record types. + - Merge #418: Support for DSYNC, EID, NIMLOC, SINK, TALINK, DOA, + AMTRELAY and IPN resource record types. BUG FIXES: - Fix re-enable to configure dns-cookies from config file, which was diff --git a/simdzone b/simdzone index 80f5f44df..aeb7e5909 160000 --- a/simdzone +++ b/simdzone @@ -1 +1 @@ -Subproject commit 80f5f44dfeb9878b5559b0bfbdd75a077ce92f3e +Subproject commit aeb7e590947bb58a122ce7538dd0cbf8d49eb8ef From 638c54289dfe612ba187602fbdf9244ff0ca4e59 Mon Sep 17 00:00:00 2001 From: Willem Toorop Date: Thu, 23 Jan 2025 15:11:33 +0100 Subject: [PATCH 13/13] Update simdzone --- simdzone | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simdzone b/simdzone index aeb7e5909..80f5f44df 160000 --- a/simdzone +++ b/simdzone @@ -1 +1 @@ -Subproject commit aeb7e590947bb58a122ce7538dd0cbf8d49eb8ef +Subproject commit 80f5f44dfeb9878b5559b0bfbdd75a077ce92f3e