Decode the Padding option exactly
02Two 16-bit fields precede a variable data region, and zero data bytes is legal.
The chosen builder stops before encoding a second Padding option; no universal RFC receiver error is asserted.
Source for this drawing: RFC 7830 · Read RFC section 3 ↗
New to this? Start hereA quick picture + helpful background
A message needs an address.
Think of a packet as a small addressed envelope. Devices pass it onward; transport protocols decide what delivery promises an application gets.
Helpful first, if these ideas are unfamiliar
These pictures are analogies to help you learn. The linked RFC explains the actual rules.
Terms in this drawing
Related RFCs and changes
“Updates” changes part of an earlier RFC. “Obsoletes” replaces it. This list shows selected related documents.
Count data bytes separately from the four-byte header, and accept any received padding value.
- The option lives inside the RDATA of the OPT record. Its OPTION-CODE is 12, encoded as 00 0c. OPTION-LENGTH is the number of following PADDING octets, excluding the two code octets and two length octets. A chosen length-three zero-filled option is 00 0c 00 03 00 00 00: seven octets in total (§3).
- The minimum data length is zero. Thus 00 0c 00 00 is a present Padding option that still occupies four octets. Presence must not be detected by testing whether its data length is nonzero (§3). This distinction also matters when a zero-length request option triggers the response rule.
- Padding octets SHOULD be 0x00. Other values MAY be used, for example when compression before encryption is a concern. Received PADDING octets of any value MUST be accepted. A nonzero body is not by itself a malformed Padding option; changing SHOULD into a mandatory all-zero receiver check would be wrong (§3).
- The Padding option MUST occur at most once per OPT record and therefore at most once per DNS message (§3). RFC 6891 §6.1.1 permits only one OPT record in a message. The chosen builder rejects a duplicate Padding option before serialization. This is a local input disposition, not a claim that RFC 7830 mandates a particular receiver error packet.
- OPT RDLEN counts all option headers and data in its RDATA. Its 16-bit bound, the overall message budget and any other options all constrain what can fit; a 16-bit Padding length alone does not mean 65535 data octets fit into a whole message. The selected parser never reads past the declared RDATA boundary, and its incomplete/error statuses are local buffer policies (RFC 6891 §6.1.2).
Fictional offline DNS messages, local bounded parsing and chosen padding policies. Length figures describe DNS messages before transport overhead. No DNS traffic, encryption, anonymity measurement or production protocol stack is implemented.
Read the RFC section ↗