Changelog

View Source

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

v6.0.0

6.0.0 renames dnssec to dns_sec, holds DNSSEC keys as bytes, keeps $INCLUDE to the zone file's directory, and refuses zone files, JSON and RRSIGs that 5.x took: see the migration guide under Changed.

Added

  • DNSSEC algorithms 1 (RSAMD5), 12 (ECC-GOST), 17 (SM2SM3) and 23 (ECC-GOST12) have names and constants in dns_terms.hrl.
  • DNSSEC: dns_sec:dnskey_public_key/2 makes a DNSKEY's public key field from an RSA or DSA key's numbers as bytes, or from an ECDSA, EdDSA or ML-DSA-44 public key as crypto gives it.

Changed

  • dnssec is now dns_sec, as every other module of this library starts with dns.
  • DNSKEY and CDNSKEY: public_key is always the RDATA's key field, a binary(); RSA and DSA keys no longer decode to [E, M] and [P, Q, G, Y], nor encode from them.
  • DNSKEY and CDNSKEY: dns_sec:verify_rrsig/4, dns_json:to_map/1 and dns_zone's writer raise {badarg, public_key_not_binary} for a key that is not a binary, [E, M] and [P, Q, G, Y] included.
  • JSON: an RSA or DSA DNSKEY's or CDNSKEY's public_key is base64 of its key field, where it was base64 of each number behind a 32-bit length; convert stored ones, which start AAAA.
  • DNSSEC: RSA and DSA private keys are big-endian bytes, where RSA keys could be integers and DSA keys had to be; integers raise {badarg, number_not_bytes}.
  • Zone files: $INCLUDE reads only files at or under the zone file's directory, not through an absolute path, .. or a symbolic link that leads out, and parse_string/1,2 and include => false refuse it, where it read any file the process could.
  • JSON and zone files: a DNSKEY or CDNSKEY whose RSA or DSA key RFC 3110, RFC 5702 or RFC 2536 rules out is refused when loaded, stored 5.x JSON among them.
  • DNSSEC: verify_rrsig/4 verifies with no RSA or DSA key that RFC 3110, RFC 5702 or RFC 2536 rules out, where it verified with RSA moduli under 512 or over 4096 bits, or under 1024 for RSA/SHA-512, and with DSA keys off the wire whose T is wider than their P needs.
  • DNSSEC: verify_rrsig/4 verifies only with zone keys of the RRSIG's class and key tag (RFC 4035 §5.3.1), where it tried every DNSKEY of its algorithm and signer.
  • DNSSEC: verify_rrsig/4 verifies only RRsets whose every record has the RRSIG's owner, class and covered type, and whose owner has at least the labels the RRSIG's labels field counts (RFC 4035 §5.3.1), where it never read the RRSIG's owner, type covered or labels field, and took only the RDATA of the records after the first.
  • DNSSEC: verify_rrsig/4 verifies only RRsets whose zone the signer can be (RFC 4035 §5.3.1), NS, SOA and DNSKEY at the signer, NSEC3 one label under it, DS under it and any other at or under it, with a labels field counting at least the signer's labels, where any signer's key verified any RRset.
  • Zone files: an SVCB or HTTPS key written as keyNNNNN takes its value as its wire format (RFC 9460 §2.1), as BIND reads it: key3=\001\187 is port 443, and key3=443 and key1=h2, which read as port 443 and alpn h2, are refused.
  • Zone files: a line that does not start with a blank takes a first field that reads as a TTL for its owner (RFC 1035 §5.1), as BIND does: 1 IN PTR host. was a PTR at the owner before it with a TTL of 1, and 1 3600 IN PTR host., as dns_zone writes reverse zones, was refused.
  • DNSSEC: a DSA key whose G is not 1 < G < P, or whose Y is not 2 ≤ Y ≤ P − 2, is refused when loaded or laid out and verifies nothing, where a G and Y of 1 verified the signature R = S = 1 over any data.
  • Zone files and JSON: an SVCB or HTTPS record with no-default-alpn and no alpn is refused (RFC 9460 §7.1.1), as BIND refuses it; decoding still takes one.
  • DNSSEC: signing with an RSA key whose modulus or exponent RFC 3110 or RFC 5702 rules out raises {badarg, {rsa_modulus_bits, Bits}} or {badarg, {rsa_exponent_bits, Bits}}, and with one of other than 3 or 8 numbers {badarg, key_shape}, where it signed, or raised crypto's errors.
  • Zone files: RDATA of a known type in RFC 3597's generic form, as A \# 4 C0000201, is read as that type's record, where it was kept as its octets; octets that are no RDATA of the type, or hold a compression pointer, are refused, as BIND refuses them.
  • DNSSEC: sign_rrset raises {badarg, outside_signer_zone} for an RRset its signer's zone cannot hold, such as a delegation's NS RRset or one above the signer, and sign_rr leaves it out, where both signed what verify_rrsig/4 refuses.
  • DNSSEC: sign_rr and sign_rrset raise {badarg, expiration_before_inception} for a validity period that no RRSIG verifies with (RFC 4034 §3.1.5), 2^31 seconds or more included, where they signed it.

Migration guide

Every function of dnssec is in dns_sec under the same name and arity, so replace dnssec: with dns_sec:.

An RSA or DSA DNSKEY's or CDNSKEY's public_key is its RDATA's key field. Make it with dns_sec:dnskey_public_key/2 from the key's numbers as bytes, where 5.x took the list itself:

% 5.x
#dns_rrdata_dnskey{alg = ?DNS_ALG_RSASHA256, public_key = [E, M], ...}
% 6.0, with E and M as binary:encode_unsigned/1 gives them
#dns_rrdata_dnskey{alg = ?DNS_ALG_RSASHA256, public_key = dns_sec:dnskey_public_key(?DNS_ALG_RSASHA256, [E, M]), ...}

Code that read [E, M] from a decoded RSA key splits the field as RFC 3110 §2 lays it out:

rsa_numbers(<<0, Len:16, E:Len/binary, M/binary>>) -> [E, M];
rsa_numbers(<<Len, E:Len/binary, M/binary>>) -> [E, M].

Stored JSON whose RSA or DSA DNSKEY or CDNSKEY public_key starts AAAA is in 5.x's form, which dns_json:from_map/1 refuses. Convert it with the record's alg; ECDSA, EdDSA and ML-DSA-44 keys are stored as before:

Numbers = [N || <<Len:32, N:Len/binary>> <= base64:decode(PublicKey)],
base64:encode(dns_sec:dnskey_public_key(Alg, Numbers))

RSA and DSA private keys are lists of big-endian bytes, as crypto:generate_key/2 gives an RSA key's. Convert a key of integers:

[binary:encode_unsigned(N) || N <- Key]

$INCLUDE names a file relative to the directory of the file it is in, and reads it only at or under the zone file's directory. Drop the base_dir option, keep included files under the zone file's directory, and parse a zone that includes files with dns_zone:parse_file/1,2.

The rest of this release needs no change to code, but signing, verify_rrsig/4, zone files and JSON refuse some input 5.x took, as listed above.

Removed

  • Zone files: the base_dir option, as $INCLUDE reads only from the zone file's directory and under it.

Updated

  • Optimized encode_message/2: a reply that fits whole is no longer copied behind its header, 1.1–1.3x faster on replies of up to three records.
  • Optimized RSA DNSKEYs and CDNSKEYs, now kept as bytes: a DNSKEY answer encodes 1.6x faster with 1.2x less memory and decodes 1.2x faster, and dns_zone:encode_rdata/2 writes one 1.5x faster.
  • Zone files: dns_zone parses binaries directly, without leex and yecc, 2.37–8.93x faster with 4.51–10.16x less memory on large zones, and every error in a zone's text gives its line.
  • Zone files: dns_zone:encode_string/1,2 writes large zones 1.72–2.31x faster with 2.38–2.50x less memory.
  • Optimized dns_domain:to_lower/1 and to_upper/1: a name of up to 64 octets no longer takes a 256-octet buffer off the heap, and converts 2.1–3.6x faster.

Fixed

  • Zone files: hex and base64 that read as a number or a TTL, such as the salt 1234 or the CDS 0 0 0 00, are read as hex and base64, where they were lost or refused.
  • Zone files: SVCB and HTTPS values may be quoted and escaped, as RFC 9460 has them and dns_zone writes alpn, mandatory, ipv4hint and ipv6hint, and a key may not repeat, in the record or in mandatory.
  • Zone files: SVCB tls-supported-groups is key 9, as IANA has it, with its groups 2 octets each, where it was read as key 13 holding the text.
  • Zone files: a field that does not read as its type is refused, where an unknown type name or TYPE65536 was read as A, a bad salt or hash as empty, and unquoted strings were dropped.
  • Zone files: a KEY may have no key, CERT data is only base64, LOC takes RFC 1876's optional fields, names take escapes, and a relative $ORIGIN follows the one before.
  • Zone files: dns_zone writes the names in SVCB, HTTPS, NSEC, HIP, IPSECKEY, AMTRELAY, LP and DSYNC RDATA in the case DNSSEC signs them in, where it lowercased them.
  • Zone files: IPSECKEY is written and read in RFC 4025's form, with the gateway type and the key in base64, where the writer left out the type and wrote the key in hex.
  • Zone files and JSON: IPv6 addresses that start with fe80 or ff02 and a non-zero word are written whole, where fe80:1:: came out as fe80::%01, fe80:: with a zone index.
  • Zone files: a line that starts with a blank has the owner of the record before it, with its TTL, class and type in any case, as BIND reads it, where a first in, 1D or class1 was taken for the owner.
  • Zone files: everything dns_zone writes reads back: it escapes names and ALPN values, splits strings over 255 octets, ends names with a dot when relative_names is false, and writes in RFC 3597's generic form what its presentation format cannot, such as an empty DS digest or a LOC latitude past 90 degrees.
  • Zone files: dns_zone writes URI targets quoted, NSEC3 hashes without padding, SIG times as dates, LOC, EUI-48 and EUI-64 as their RFCs do, and CAA tags unquoted, which BIND did not read.
  • Zone files: an error within a file that $INCLUDE reads gives its line and the kind of error, but none of the file's text.
  • Zone files: $INCLUDE stops at files included 16 deep, where a file that included itself ran the process out of memory.
  • Zone files: a CERT type may be one of RFC 4398's mnemonics, such as PKIX or PGP, as BIND writes it, where only numbers were read.
  • Zone files: without a $TTL or default_ttl, a record without a TTL has that of the record before it, as RFC 1035 and BIND have it, where it had 0.
  • #dns_rrdata_loc{} types lat, lon and alt as integer(), the signed offsets they hold, where it said dns:uint32().
  • Wire: a name is held to 255 octets counted on the wire (RFC 1035): decoding took 256 and refused 255 with escapes or a pointer, and compressing took 256 and over.
  • Wire: encoding RDATA over 65535 octets raises {rdata_too_long, Size}, where it wrapped RDLENGTH.
  • Wire: NSEC, NSEC3 and CSYNC RDATA with a type bitmap window over 32 octets is malformed, where it decoded as types of the next windows.
  • Wire: encode_message/2 sets TC and keeps the OPT RR when the answers fit only without it, where it dropped the OPT RR and left TC unset.
  • Wire: an SVCB or HTTPS port that is not 2 octets is malformed, where it decoded as its octets.
  • Names: dns_domain:split/1 and to_wire/1,3 raise {invalid_dname, empty_label} for a leading dot, as in .a, where they gave an empty first label that ended the name on the wire, and JSON and a zone's origin option refuse one.
  • Wire: encoding a CAA tag, NSEC3 salt or hash, or HINFO, NAPTR or HIP string over 255 octets raises {string_too_long, Size}, where it wrapped the length, split the string or raised function_clause.
  • DNSSEC: an algorithm 1 (RSA/MD5) key tag, decoded or read from a zone file, is the third- and second-to-last octets of the modulus (RFC 4034 Appendix B.1), where it was the checksum of the other algorithms.
  • DNSSEC: sign_rr leaves RRSIG records out and sign_rrset raises {badarg, rrsig_rrset} for an RRSIG RRset, where both signed it (RFC 4035 §2.2).
  • DNSSEC: sign_rrset raises {badarg, mixed_rrset} for records of more than one RRset, where it signed them as one.
  • DNSSEC: sign_rr signs records whose owner names differ only in a final dot as one RRset, where it signed two halves that never verified.
  • DNSSEC: verify_rrsig/4 verifies with RSA and DSA DNSKEYs read from zone files or JSON, and returns false for RSA keys with leading zeros or a long exponent length they don't need, where it raised.
  • DNSSEC: verify_rrsig/4 takes a DNSKEY owned by example. for the signer example, and the other way round, where a final dot on one name and not the other kept it from verifying.
  • DNSSEC: verify_rrsig/4 returns false for an empty RRset, and for an owner or signer with an empty label, a label over 63 octets or over 255 octets in all, where it raised for most of them, and verified some.
  • DNSSEC: verify_rrsig/4 verifies RRsets a wildcard was expanded into, as the wildcard was signed (RFC 4035 §5.3.2), where it verified none, and verified RRSIGs whose labels field was lowered after signing.
  • DNSSEC: verify_rrsig/4 returns false for keys crypto cannot use, ECDSA and DSA signatures of another size, RRSIGs whose RDATA did not decode, records that are no RRSIG and RDATA holding names that are none, where it raised.
  • DNSSEC: verify_rrsig/4 verifies no RSA signature shorter than its key's modulus (RFC 8017 §8.2.2), where it verified one whose leading zero octets were left out.
  • JSON: from_map/1 reads every DNSKEY's and CDNSKEY's key as its bytes, where it read some ECDSA and EdDSA keys as lists of numbers.
  • JSON: from_map/1 takes nil, which Elixir's JSON.decode/1 gives for a JSON null, wherever it takes null: an SVCB or HTTPS record's svc_params, its no-default-alpn and a keyNNNN with no value, where the record was refused.

v5.2.0

Added

  • DNSSEC: algorithm 18, ML-DSA-44 (draft-westerbaan-dnssec-mldsa-04), where crypto has it (OTP 28.1+ built against OpenSSL 3.5+).

v5.1.3

Fixed

  • DNSSEC: verify_rrsig/4 returns false for an RRSIG in an algorithm it does not implement, where it raised function_clause, and signing in one raises {unsupported_algorithm, Alg}.
  • DNSSEC: verify_rrsig/4 verifies an RRset whose first record's TTL is not the RRSIG's original TTL, as from a cache, where it raised function_clause (RFC 4035 §5.3.2).
  • DNSSEC: a record twice in an RRset is signed and verified once, as validators take it (RFC 4034 §6.3); signing it twice made an RRSIG validators rejected.
  • DNSSEC: DSA RRSIGs (algorithms 3 and 6) now validate elsewhere; every release signed and verified the signed data with its length in front of it (RFC 2536).
  • Wire: DHCID, OPENPGPKEY and WALLET records of class NONE, as an UPDATE deletes them with, encode as they decode.

v5.1.2

Fixed

  • DNSSEC: ECDSA RRSIGs (algorithms 13 and 14) now validate elsewhere; since 4.4.0 signing and verifying hashed the signed data twice (RFC 6605).
  • Zone files: read hex split by whitespace in DS, CDS, DLV, TLSA and SMIMEA, and base64 in DHCID, CERT and KEY.
  • Zone files: read TLSA, SMIMEA, DHCID and CERT data unquoted, as their RFCs' examples write it.
  • Zone files: read base64 whose final = is alone on a line.

v5.1.1

Updated

  • Optimized dns_domain:from_wire/1,2 on labels holding . or \, which come out escaped: 1.15–1.6x faster when many bytes need escaping, as in a label crafted of dots or backslashes, and unchanged on names that need no escaping.
  • Optimized dns_domain:split/1, used by dns_domain:to_wire/1,3 on escaped names: 2–3.5x faster with 3.5–8x less memory on names without \, up to 10% slower on names with one.
  • Optimized dns_domain:join/1,2: 1.5–2x faster, up to 5.5x with long labels, and 5–10x less memory for up to 8 labels, on labels without . or \; names with one take at most 1.3x as long.

v5.1.0

Added

  • Add support for the ILNP records NID (Type 104), L32 (Type 105), L64 (Type 106) and LP (Type 107) — RFC 6742. They encode and decode on the wire in any class, parse from and encode to zone files, and transcode to JSON. LP's FQDN is never compressed on the wire and keeps its case in DNSSEC canonical form.
  • Add support for the AMTRELAY record (Type 260) — RFC 8777. It encodes and decodes on the wire in any class, parses from and encodes to zone files, and transcodes to JSON. Relay types 0 (no relay), 1 (IPv4), 2 (IPv6) and 3 (domain name) get a record; an undefined relay type stays opaque RDATA. The relay's domain name is never compressed on the wire and keeps its case in DNSSEC canonical form.
  • Add support for the DRIP records HHIT (Type 67) and BRID (Type 68) — RFC 9886. Their CBOR data is carried as it is: it encodes and decodes on the wire in any class, parses from and encodes to zone files as base64, which may be split into several pieces, and transcodes to JSON as base64.
  • Add support for the HIP record (Type 55) — RFC 8005. It encodes and decodes on the wire in any class, parses from and encodes to zone files, and transcodes to JSON, the HIT as hex and the public key as base64. The rendezvous servers' names are never compressed on the wire and keep their case in DNSSEC canonical form. A HIP RDATA with an empty HIT or public key, both of which the RFC requires, stays opaque.
  • Add support for the SIG record (Type 24) — RFC 2535, and so for SIG(0) message signatures — RFC 2931, as a record: creating and verifying SIG(0) signatures is not part of this. It encodes and decodes on the wire, parses from and encodes to zone files and transcodes to JSON as RRSIG does. The signer's name is never compressed on the wire and is lowercased in DNSSEC canonical form, as RFC 4034 §6.2 has it for SIG.
  • Add support for the PX record (Type 26) — RFC 2163. It encodes and decodes on the wire in class IN, as A does, parses from and encodes to zone files, and transcodes to JSON. Its names are never compressed on the wire and are lowercased in DNSSEC canonical form, as RFC 4034 §6.2 has it for PX.

Changed

  • RRs of types SIG (24), PX (26) and HIP (55), which this library used to leave as opaque binary RDATA, now decode into their records, so code matching a binary data for them no longer matches. Like every type decoded into a record, an empty RDATA for them now decodes to formerr.
  • Zone files: as for the other types, a line that starts with one of the new mnemonics (NID, L32, L64, LP, AMTRELAY, HHIT, BRID, HIP, SIG or PX) and has no class reads as a record of that type with a blank owner. An owner spelled as one of them, such as a host named PX, needs a class after it, directly or after a TTL, as in PX IN A 192.0.2.1.

v5.0.21

Fixed

  • Zone files: a type without a mnemonic, written TYPE### (RFC 3597 §5), is now read in RDATA, such as an RRSIG's type covered or an NSEC or CSYNC type bitmap. The encoder writes such types that way, so a zone it wrote with them did not parse back, nor did a zone holding the TYPE65534 records BIND keeps its signing state in, which its NSEC lists and an RRSIG covers.
  • Zone files: an owner spelled as a type mnemonic, such as a host named LOC, MX or KX, is now read as the owner when a class follows it, directly or after a TTL. The parser read it as a type, so the record failed to parse. Without a class, as in LOC 3600 A 192.0.2.1, the line still reads as a record of that type with a blank owner, since the parser does not keep the whitespace that marks one.

v5.0.20

Fixed

  • DNSSEC canonical form no longer lowercases the names in the RDATA of NSEC, IPSECKEY, DSYNC, SVCB and HTTPS records. RFC 3597 §7 closes the list of RFC 4034 §6.2 to the types published before it, and RFC 6840 §5.1 takes NSEC off it, so these names keep their case, as in BIND. With an uppercase letter in such a name, a signature made here did not verify elsewhere, and one made elsewhere did not verify here.
  • Zone files: the names in RDATA, and the origin they are resolved against, now keep the case they are written in (RFC 1035 §2.3.3); owner names are still lowercased. The parser lowercased every name, so a signature over a record whose RDATA names keep their case in DNSSEC canonical form, such as an HTTPS record pointing at Svc.Example.Test., did not verify against the record read from the zone, and a signature made over the record read did not verify elsewhere.
  • dnssec:sign_rr/6 and dnssec:verify_rrsig/4 now put the signer's name into the signed data lowercased, as RFC 4034 §3.1.8.1 and RFC 6840 §5.1 require, and sign_rr/6 writes it lowercased in the RRSIG. It went in as given, so signing with a mixed-case zone name gave signatures other validators rejected, and an RRSIG received with a mixed-case signer did not verify.
  • The names in the RDATA of DNAME, KX, NXT and RT records are no longer compressed on the wire. RFC 3597 §4 forbids compressing names in the RDATA of types not defined in RFC 1035, and RFC 6672 §2.5 says so of the DNAME target. A receiver that does not know such a type cannot follow the pointer and corrupts the name when it passes the record on.
  • Zone files: RRSIG expiration and inception times written as YYYYMMDDHHmmSS (RFC 4034 §3.2), as signed zones usually spell them, are now read as UTC dates. They were kept as the 14-digit number, and encoding wrote its low 32 bits, so the signature times on the wire were wrong. Invalid dates and values that fit neither form are rejected.
  • dns_domain:split/1 and dns_domain:to_wire/1 now raise {label_too_long, Label} for a last label over 63 bytes, as they did for the others. to_wire/1 wrote its length as it was, a byte the wire reads as another label type, so the uncompressed names in RDATA (SRV targets, RRSIG signers, and others) could go out malformed. Compressed names already refused it.
  • dns_json:from_map/1 and the zone file parser now refuse, when they load it, a record the wire cannot carry as written, raising {invalid_record, Record} and returning a semantic error respectively. The encoder trusts its input and writes each field with bit syntax, which silently cuts an integer too wide for its field (MX preference 70000 went out as 4464, -1 as 65535) and writes a binary of the wrong size as it is. The checks cover every fixed-width RDATA field, addresses, LOC coordinates, 8-bit lengths (CAA tags, NSEC3 salts and hashes, HINFO strings), NSEC type numbers, SVCB params (a hint that is not an address was silently dropped), names, RDATA over 65535 bytes, the RR header (type and class are 16 bits, and the TTL 31 bits as RFC 2181 §8 has it), and, in JSON, message headers, queries, the OPT pseudo-RR and its options. The RDATA is checked in the record's class, so a record in a class the encoder does not write its type in, such as an A record in class CH, is refused. Such records, and EUI48 and EUI64 addresses of the wrong length in JSON, used to load and then fail every response carrying them.

v5.0.19

Fixed

  • The SVCB/HTTPS ech parameter is base64 in JSON, both ways. from_json/1 took the string as the raw ECHConfigList, so a base64 value was served as its own characters, and to_json/1 crashed on any real ECHConfigList because it is not valid UTF-8.

v5.0.18

Updated

  • Name compression is 1.1x-8.9x faster across the benchmark corpus depending on how much a message repeats its names. Both the relative and fully-qualified spelling of a repeated name take the same fast path.
  • dns_domain:compmap/0 is now explicitly opaque. Build one with dns_domain:new_compmap/0.

v5.0.17

Fixed

  • gen_nsec/1,3,4 no longer crashes when a zone carries one name spelled both as an FQDN and relatively (example.com and example.com.).

v5.0.16

Fixed

  • decode_query/1 no longer rejects rfc1995 IXFR queries as formerr but as notimp.

v5.0.15

Fixed

  • decode_message/1 now decodes rfc2136 UPDATE messages, while decode_query/1 does not anymore as it shouldn't have, returning notimp.

v5.0.14

Updated

  • Optimized dns_domain:to_wire/3 (compressed name encoding): 1.4–2.8x faster on typical names, up to 17–22x on many-label names such as IPv6 reverse PTRs, with 1.1–3x less allocation.
  • Optimized dns_domain:from_wire/1,2 (wire-format name decoding): ~1.1–1.2x faster on typical compressed names, up to 1.4–1.5x on pointer chains, with up to 18% less allocation on pointer-heavy names.
  • Optimized message encoding: ~1.1–1.3x faster on typical bounded responses with 5–35% less allocation across message shapes.

Fixed

  • Correct name compression in the additional section of encode_message/2 for non-EDNS responses
  • NSEC/NSEC3/CSYNC/NXT type bitmap encoding shifted every type after the first by one bit position in any window whose first present type is a multiple of 256
  • MINFO records failed to decode inside full messages (formerr) due to swapped dns_domain:from_wire/2 arguments in the MINFO rdata decoder
  • encode_message/2 subtracted the question section twice when sizing the OPT RR and additional records, wrongly dropping them (including the EDNS OPT RR, contra RFC 6891) from responses within question-size bytes of max_size
  • LOC latitude and longitude used 2^31 - 1 instead of 2^31 as the equator/prime-meridian reference point (RFC 1876 §2)
  • LOC size/horiz/vert outside the representable 0–9e9 cm range now raise badarg, and in-range values round to nearest instead of truncating (RFC 1876 §2)
  • encode_message/2 with tc_mode => llq_event raised badmatch when the authority/additional tail or the question section exceeded max_size; it now truncates and sets TC
  • Zero-length <character-string>s were dropped when encoding TXT, SPF, RESINFO and WALLET records (RFC 1035 §3.3)
  • A NAPTR record whose REGEXP is not valid UTF-8 decoded into a record holding an error tuple instead of being rejected (RFC 3403 §4.1)
  • An EDNS OPT RR advertising a UDP payload size below 512 is clamped to 512 instead of raising badarg (RFC 6891 §6.2.3)
  • encode_message/2 with an unsupported tsig algorithm raised case_clause instead of badarg
  • An SVCB/HTTPS alpn id longer than 255 bytes silently truncated its length octet, producing undecodable wire data; it now raises {svcb_invalid_alpn_id, _}
  • SVCB/HTTPS mandatory, ipv4hint and ipv6hint values that are not a whole number of elements are rejected instead of silently dropping the remainder (RFC 9460 §7.4, §8)
  • An EDNS OPT RR with a non-root owner name, and a message carrying more than one OPT RR, now decode to formerr (RFC 6891 §6.1.1)
  • RDLENGTH = 0 for a type this library decodes now decodes to formerr instead of an opaque <<>> (RFC 1035 §3.2.1)
  • An OPT RR anywhere but first in the additional section was ignored when sizing the response and dropped from truncated ones (RFC 6891 §6.1.1)
  • URI targets were replaced by their normalized form when decoding, losing data and changing the canonical RDATA that RRSIGs cover (RFC 7553 §4.5)
  • A DNSKEY or CDNSKEY with a DSA algorithm but rdata too short to parse as one crashed on re-encode (RFC 2536 §2)
  • Re-encoding a DSA DNSKEY whose P began with a zero byte truncated G and Y, producing an undecodable record (RFC 2536 §2)
  • encode_rrdata/2 crashed with badmap on every KX record, and with it the DNSSEC canonical form (RFC 2230)
  • A repeated or out-of-order NSEC/NSEC3/CSYNC type-bitmap window decoded to a types list containing duplicates (RFC 4034 §4.1.2)
  • LOC precision octets with a base nibble above nine were accepted instead of being left opaque (RFC 1876 §2)
  • encode_message/1,2 would emit a message carrying two OPT RRs, which the decoder rejects (RFC 6891 §6.1.1)
  • A non-canonically encoded RSA DNSKEY/CDNSKEY public key changed shape when re-encoded, altering the canonical RDATA an RRSIG covers (RFC 3110 §2)

v5.0.13

Fixed

  • Correctly return formerr on invalid NOTIFY DNS messages (rfc1996 §3.7: a NOTIFY carries exactly one question (QDCOUNT=1) and at most one), (#130)

v5.0.12

Fixed

  • A malformed EDNS COOKIE option (RFC 7873) in a received message now decodes to a formerr result instead of raising bad_cookie.

v5.0.11

Fixed

  • WALLET (type 262) RDATA uses TXT-style character-strings on the wire and in zone files (data as a list of binaries), per IANA WALLET.
  • Zone file parsing and RDATA decoding: improved handling of BIND-style presentations and record types;
  • Empty TXT/RESINFO RDATA are rejected during semantic validation;
  • Empty A/AAAA RDATA is rejected (no longer skipped);

v5.0.10

Updated

v5.0.9

Updated

v5.0.8

Fixed

  • Handle truncated RR headers in additional and body sections (#121)

v5.0.7

Changed

  • Minor internal cleanups in the dnssec module (better function naming)

v5.0.6

Added

  • dnssec exports record types it works over as types.

Fixed

  • Fixed encoding and decoding of ECDSA signatures
  • Refactored dnssec to use the newer dns_domain API internally in a more efficient way
  • Incremented test coverage for DNSSEC

Removed

  • Internal ASN1 parser, as it is supported by OTP's public_key module.

v5.0.5

Fixed

  • SVCB/HTTPS params: treat numeric keys key0–key6 as reserved and equivalent to named params (mandatory, alpn, no-default-alpn, port, ipv4hint, ech, ipv6hint). Validate them the same at ingestion in zone parsing, JSON parsing, and wire decoding; key0–key6 are no longer accepted as generic unknown keys (#110, #111)
  • SVCB params JSON docs: document key0–key6 equivalence to named params, no-default-alpn as null, and keyNNNN format (value binary or null) in generated JSON documentation
  • SVCB params wire: decode unknown keys with zero-length value as none (not <<>>) so round-trip and to_json stay consistent (null vs empty binary)
  • SVCB params JSON: reject invalid param keys in to_json/1 (e.g. key > 65535) with {svcb_param_invalid_key, K} instead of emitting a map with undefined as key
  • Ensure strict parsing of IPv4 and IPv6 in zonefiles respectively (#108)

v5.0.4

Fixed

  • Fix parsing SVCB json records when svc_params are missing

v5.0.3

Fixed

  • Fix FQDNs an (C)DNSKEY payloads in zonefile encoding

v5.0.2

Changed

  • Use nulls instead of none in SVCB params JSON payloads #107

v5.0.1

Fixed

  • Fix an issue with the hex package not including all needed files

v5.0.0

Added

Changed

  • Require OTP 27 or later (minimum_otp_vsn set to "27")
  • dns:encode_message/2 changed how truncation is returned to a clearer type
  • Migrate domain name operations to new dns_domain module

All domain name processing functions have been moved to a new optimized dns_domain module. The old implementations in dns and related helper modules have been removed and replaced with calls to the new module.

Migration guide

All domain name functions have been moved to dns_domain. Update your code as follows:

% Old → New
dns:dname_to_lower(Name)             -> dns_domain:to_lower(Name)
dns:dname_to_upper(Name)             -> dns_domain:to_upper(Name)
dns:dname_to_labels(Name)            -> dns_domain:split(Name)
dns:labels_to_dname(Labels)          -> dns_domain:join(Labels)
dns:dname_to_lower_labels(Name)      -> dns_domain:split(dns_domain:to_lower(Name))
dns:compare_dname(NameA, NameB)      -> dns_domain:are_equal(NameA, NameB)
dns:compare_labels(LabelsA, LabelsB) -> dns_domain:are_equal_labels(LabelsA, LabelsB)
dns:escape_label(Label)              -> dns_domain:escape_label(Label)
dns_encode:encode_dname(Name)        -> dns_domain:to_wire(Name)
dns_encode:encode_dname(CM, Pos, N)  -> dns_domain:to_wire(CM, Pos, N)

Note: The wrapper functions in dns module (dname_to_labels/1, labels_to_dname/1, dname_to_lower_labels/1, dname_to_upper/1, dname_to_lower/1, compare_dname/2, compare_labels/2, escape_label/1) have been removed. Use dns_domain functions directly now.

Error Handling Changes:

  • decoding invalid wire packets previously used throw/1 for errors (decode_loop, bad_pointer), it uses error/1 now
  • Update error handling: try dns:decode_message(...) catch error:Reason -> ... end

Removed

  • Removed old dns_record and dns_record_info modules

4.9.1

Fixed

  • Fix a bug that would incorrectly calculate pointers, introduced in 4.9.0

4.9.0

Added

  • Add extended support for SVCB and HTTPS Resource Records — RFC9460
  • Add support for OPENPGPKEY (Type 61) — RFC 7929
  • Add support for SMIMEA (Type 53) — RFC 8162
  • Add support for URI (Type 256) — RFC 7553
  • Add support for WALLET (Type 262) — IANA Registration
  • Add support for EUI48 (Type 108) and EUI64 (Type 109) — RFC 7043
  • Add support for CSYNC (Type 62) — RFC 7477
  • Add support for DSYNC (Type 66) — RFC 9859
  • Add dns:decode_query/1 function for strict query validation to prevent DoS attacks

Changed

  • Performance improvements in message encoding (~5-15% faster for encode/1, ~0-20% faster for encode/2)

4.8.1

Fixed

  • Fix bad size for reserved OptRR record during encoding

4.8.0

Added

  • Add support for RFC8976: Message Digest for DNS Zones

Fixed

  • Fix Base64 lexing of zone files

4.7.0

Added

  • Extend support for RFC8914: Extended DNS Errors.

4.6.0

Added

  • Add support for DNS zone file parsing

4.5.0

Added

  • Add support for RFC8080: Ed22519/Ed448 for DNSSEC.
  • Add support for RFC8914: Extended DNS Errors.

4.4.0

Added

  • Add support for RFC6605: ECDSA for DNSSEC.
  • Add support for RFC9077: NSEC/NSEC3 TTLs.

4.3.0

Added

  • Add support for TLSA records.

4.2.0

Added

  • Add shortcuts for normalizing and converting domains into labels.
  • Add a helper for comparing label lists.
  • Add helpers to convert from and to codes into their string representation.

4.1.0

Added

  • Add support for RFC7873 EDNS cookies encoding and decoding

4.0.1

Fixed

  • Fix additional count when truncating a message

4.0.0

Changed

  • Use erlang:system_time/1 for timestamps.
  • Use maps instead of proplists for options to be passed to encoding, decoding, TSIG, and DNSSEC functions.
  • Encoding logic builds responses that contain the full question section, and optionally drop the answers if the response is to be truncated.
  • Use consistent record names.
  • Split names functions into a standalone dns_names module.
  • Extends and reorganise documentation.

3.1.3

Fixed

  • Fix: now using the reserved space for the OPT RR records during the encoding of the message (#74)

3.1.2

Added

  • Add NXNAME type to terms types.

3.1.1

Fixed

  • Fix EDNS0 compliance for truncated records and unsupported versions

3.1.0

Fixed

  • Fix EDNS0 compliance for truncated records and unsupported versions

3.0.5

Fixed

  • Fix max_size in encode_message opts

3.0.4

Changed

  • Upgrade dependencies
  • Apply linter specs

3.0.3

Changed

  • Performance improvements in string manipulations

3.0.2

Fixed

  • Fix type definitions

3.0.1

Fixed

  • Ensure ASN1 compilation before building package

3.0.0

Added

  • Add xref, dialyzer, and ex_doc
  • Add strict typing and RFC references to all records
  • Add support for TXT splitting of strings over the maximum permitted size

2.0.0

Changed

  • Bump to OTP/27
  • Replace "jsx" with "json"

Added

  • Erlfmt
  • CONTRIBUTING.md
  • CHANGELOG.md
  • Release process to hex.pm

1.1.0

N/A