gen_vectors.c builds DNS queries and responses using the same SPCDNS + base32 + dotify logic as the C implementation.
It reads vectors.txt and writes JSON to stdout.
- The slipstream C repo checked out with submodules: https://github.com/EndPositive/slipstream
- A C compiler (
cc).
The helper script scripts/gen_vectors.sh builds the generator against the C
repo (default ../slipstream, override with SLIPSTREAM_DIR) and writes
fixtures/vectors/dns-vectors.json.
Format of vectors.txt:
name,id,domain,payload_hex[,mode,qname_override,error_rcode,raw_query_hex]
payload_hexmay be-for an empty payload (only valid withmode != normal).modedefaults tonormal.qname_overrideis required forinvalid_base32,suffix_mismatch, andempty_subdomain, and must include a trailing dot.raw_query_hexis required forraw_query_hexmode and is interpreted as a hex-encoded UDP payload.- Use
-as a placeholder to skip optional fields (the CSV parser does not preserve empty fields). error_rcodeis optional; when set,response_erroris emitted. Defaults are used forinvalid_base32andsuffix_mismatch.
Built-in modes:
normalinvalid_base32suffix_mismatchnon_txtempty_subdomainqdcount_zeronot_queryraw_query_hex
Typical use:
./scripts/gen_vectors.sh
This compiles the generator against the slipstream C repo at ../slipstream
(override with SLIPSTREAM_DIR) and requires the C repo submodules to be
initialized.