Skip to content

Commit c765838

Browse files
committed
Add basic NSEC and NSEC3 no data tests
Fixes NLnetLabs#108.
1 parent 88a6bfd commit c765838

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

tests/types.c

+28
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,32 @@ static const rdata_t ipseckey_name_rdata =
474474
0x81, 0xba, 0x3a, 0x05, 0x21, 0xaf, 0x82, 0xab,
475475
0x78, 0x01);
476476

477+
// https://datatracker.ietf.org/doc/html/rfc4034#section-4.3
478+
static const char nsec_text[] =
479+
PAD("alfa.example.com. 86400 IN NSEC host.example.com. ( \n"
480+
" A MX RRSIG NSEC TYPE1234 )");
481+
482+
static const rdata_t nsec_rdata =
483+
RDATA(0x04, 'h', 'o', 's', 't',
484+
0x07, 'e', 'x', 'a', 'm', 'p', 'l', 'e',
485+
0x03, 'c', 'o', 'm', 0x00,
486+
0x00, 0x06, 0x40, 0x01, 0x00, 0x00, 0x00, 0x03,
487+
0x04, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
488+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
489+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
490+
0x00, 0x00, 0x00, 0x00, 0x20);
491+
492+
// https://datatracker.ietf.org/doc/html/rfc5155#appendix-B.2.1
493+
static const char nsec3_no_data_text[] =
494+
PAD("ji6neoaepv8b5o6k4ev33abha8ht9fgc.example. NSEC3 1 1 12 aabbccdd (\n"
495+
" k8udemvp1j2f7eg6jebps17vp3n8i58h )");
496+
497+
static const rdata_t nsec3_no_data_rdata =
498+
RDATA(0x01, 0x01, 0x00, 0x0c, 0x04, 0xaa, 0xbb, 0xcc, 0xdd,
499+
0x14, 0xa2, 0x3c, 0xd7, 0x5b, 0xf9, 0x0c, 0xc4, 0xf3,
500+
0xba, 0x06, 0x9b, 0x97, 0x9e, 0x04, 0xff, 0xc8, 0xee,
501+
0x89, 0x15, 0x11);
502+
477503
// https://www.rfc-editor.org/rfc/rfc4701.html#section-3.6.1
478504
static const char dhcid_text[] =
479505
PAD(" DHCID ( AAIBY2/AuCccgoJbsaxcQc9TUapptP69l"
@@ -915,6 +941,8 @@ static const test_t tests[] = {
915941
{ ZONE_IPSECKEY, ipseckey_ipv4_text, &ipseckey_ipv4_rdata },
916942
{ ZONE_IPSECKEY, ipseckey_ipv6_text, &ipseckey_ipv6_rdata },
917943
{ ZONE_IPSECKEY, ipseckey_name_text, &ipseckey_name_rdata },
944+
{ ZONE_NSEC, nsec_text, &nsec_rdata },
945+
{ ZONE_NSEC3, nsec3_no_data_text, &nsec3_no_data_rdata },
918946
{ ZONE_DHCID, dhcid_text, &dhcid_rdata },
919947
{ ZONE_DHCID, dhcid_generic_text, &dhcid_rdata },
920948
{ ZONE_TLSA, tlsa_text, &tlsa_rdata },

0 commit comments

Comments
 (0)