From: Alessio Podda Date: Wed, 10 Dec 2025 10:11:39 +0000 (+0100) Subject: Document the memory layout of rdatavec X-Git-Tag: v9.21.17~42^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f465976536f25ae1816243e4b38c902800d6f254;p=thirdparty%2Fbind9.git Document the memory layout of rdatavec --- diff --git a/lib/dns/rdatavec.c b/lib/dns/rdatavec.c index 3dd9eeb2cb8..7f7c38045db 100644 --- a/lib/dns/rdatavec.c +++ b/lib/dns/rdatavec.c @@ -38,16 +38,26 @@ * The memory structure of an rdatavec is as follows: * * header (dns_vecheader_t) - * record count (2 bytes) + * record count (2 bytes, big endian) * data records - * data length (2 bytes) - * order (2 bytes) - * meta data (1 byte for RRSIG, 0 for all other types) + * data length (2 bytes, big endian) + * meta data (1 byte for RRSIG, 0 bytes for all other types) * data (data length bytes) * - * A "bare" rdatavec is everything after "header". + * A "bare" rdatavec is everything after the header. The first two bytes + * contain the count of rdata records in the rdatavec. For records with + * the DNS_VECHEADERATTR_NONEXISTENT attribute, the record count is omitted + * entirely. * - * When a vec is created, data records are sorted into DNSSEC order. + * After the count, the rdata records are stored sequentially in memory. + * Each record consists of a length field, optional metadata, and the actual + * rdata bytes. + * + * The rdata format depends on the RR type and is defined by the type-specific + * *_fromwire and *_towire functions (e.g., lib/dns/rdata/in_1/a_1.c for A + * records). The data is typically stored in wire format. + * + * When a vec is created, data records are sorted into DNSSEC canonical order. */ static void