DNS message encoding and decoding for Zig, with no I/O and no allocation.
zig-dns GLOSSARY.md
2.7 kB · 73 lines
Markdown
at main

zig-dns #

The vocabulary for deciding what a DNS message decoder accepts, what it refuses, and what it carries through without understanding.

Accepting and refusing #

Framing: Whether a message's bytes divide up as they claim: counts, lengths, names that end, pointers that land somewhere. A message with bad framing cannot be read at all. Avoid: structure, syntax

Shape rule: A constraint on a known type's record data that holds whatever its fields mean, so no future registry entry can make a violation legitimate — a bitmap window ending in a zero byte, an SVCB port that is not two bytes. Avoid: syntax rule, format check

Meaning rule: A constraint that depends on what a registry value currently means, such as the digest length a TLSA matching type implies. A new code point could make a violation correct tomorrow. Avoid: semantic check

Refuse: To report a message or record as malformed rather than hand it back. Avoid: reject, fail

Carry through: To hand back data unchanged that the decoder does not understand or does not judge, so that it can be forwarded, printed or re-encoded byte for byte. Avoid: pass through, ignore

Recordless type: A type number that never has record data: one that only names a kind of question — ANY, AXFR, IXFR, MAILA, MAILB — and NXNAME, which only ever appears in a type bitmap. Avoid: question-only type, QTYPE, meta-type (RFC 6895 also counts OPT, TSIG and TKEY, which do have data)

Names #

Pointer chain: Two or more compression pointers followed in a row with no label between them. Nothing that compresses a name produces one. Avoid: pointer loop (a loop is one kind of chain), indirection

Overlapping target: A compression pointer whose target name does not end before the part of the name holding the pointer began, so that following it reads the pointer's own bytes as labels. Avoid: forward pointer (that is a pointer at or above itself, which is another thing)

Compression-forbidden field: A name inside record data that its type's specification says must be written out in full. RFC 3597 allows compression only in RFC 1035's types and a short list after them; every name in a type defined since is one of these. Avoid: uncompressed name (that describes a name, not a rule about a field)

Checking against dnspython #

Deliberate difference: A disagreement with dnspython over whether a message is acceptable that has been looked at and written down with its reason, as opposed to one that is a bug on one side. Avoid: known failure, expected mismatch