Nine characters, three zero bytes, and one rule that has quietly held two generations of networked software together. XDR — the External Data Representation behind Sun RPC and NFS — writes a nine-byte filename as a four-byte count, the nine bytes themselves, and then three octets of padding that belong to nobody at all.
They are not characters. They are not counted. They carry no meaning. And an encoder that fills them with anything but zeros has broken the contract — because the moment padding becomes a place to stash memory residue, two machines holding the identical filename start emitting two different byte strings, and every checksum, comparison and cache key downstream inherits the disagreement.
That is XDR in miniature: interoperability achieved not by pretending all computers arrange memory alike, but by naming precisely which differences must die at the boundary.
The short version
- XDR moved agreement out of native memory and into one external, most-significant-byte-first representation built on four-byte units.
- A variable value carried its own count; zero fill restored alignment without joining the value, and had to stay zero so that equal values produced equal bytes.
- The schema fixed field order and union branches, while framing, authentication, authorization and application meaning stayed with other layers.
Three zero octets held the boundary
The worked file example in RFC 4506 begins with a nine-byte filename. XDR writes a four-byte count, the nine filename bytes, and then three zero octets. The next field starts on the following four-byte boundary.
Those last three octets are physically present, but they are not characters in the filename. They do not increase its count. They carry no application content. Yet an encoder may not treat them as convenient spare space: XDR demands zero fill. The reason is stronger than neat alignment. If one machine filled the gap with memory residue and another used different residue, the same value would acquire different byte representations, and comparison and checksumming would stop being deterministic.
The blank bytes are the tell. Interoperability was not achieved by pretending every computer arranged memory alike. It came from deciding, once, exactly which differences had to disappear at the external boundary.
RFC 1014: native layouts stopped at the encoder
RFC 1014, published in 1987, introduced XDR as a language for describing and encoding data exchanged among architectures as different as workstations, PCs, VAX systems and Cray machines. Sun RPC and NFS were already named users. The description language resembled C, but it was not a programming language and it did not transmit a machine’s in-memory structure.
An XDR signed integer occupies 32 bits in two’s-complement form, most significant byte first. Arrays follow natural order. Structure components follow declaration order. The endpoint may keep any convenient native representation internally, but the encoder must surrender that private choice before emitting a byte, and the decoder must rebuild a local object from the shared form.
There is no endian flag at the front. XDR picked one order and lived with the bill. Its own discussion concedes that a single canonical order imposes more conversion on some machines; the return is that no higher protocol must first negotiate which representation follows. An XDR object stored on media keeps its interpretation long after the negotiation context has vanished.
The four-byte unit was a choice too, not a law of nature. Smaller units would cut padding but fit fewer alignment requirements; larger units would ease alignment on more architectures while inflating every encoding. Four was the compromise somebody had to pick.
Counts, strings and the padding rule
Fixed opaque data has a size supplied by the schema. Variable opaque data carries a 32-bit unsigned count, then exactly that many arbitrary bytes, then enough zero fill to reach the grid. Strings use the same counted shape. A variable array carries an element count, then the elements in order.
This hands a decoder evidence it can test locally. It can compare a count with the maximum the protocol declares, confirm enough bytes remain, and calculate the next aligned position. A bounded opaque declaration makes an over-limit encoding invalid. Omitting a schema maximum does not oblige a receiver to reserve the language’s theoretical limit; the receiver still owns its memory and its work limits.
Count, allocation and meaning must stay separate. A counted XDR string can contain a NUL octet even where a local language treats NUL as the end of a string. Trust one convention while allocating under the other and parsing, comparison and deallocation will eventually disagree about where the string ended. Canonical bytes remove architectural ambiguity only where the schema actually defines it.
Discriminated unions: one arm gets permission to exist
XDR uses implicit typing: ordinary values carry no field name and no universal type tag beside each component. Both sides must already share the declaration. That makes declaration order constitutional. Reordering two fields in a durable schema is not cosmetic; it changes the type assigned to every later byte.
A discriminated union makes the branch choice explicit. It encodes a discriminant first, then the selected arm. If the declaration has no default arm, an unlisted discriminant has no valid encoding at all. Optional data is the compact case: a Boolean says whether an element follows, and false selects a zero-byte void. Absence is proved by the branch selector, not guessed from an empty payload.
The discriminant’s authority is narrow. It chooses a type branch inside the agreed schema. It does not authorize a remote procedure, authenticate the sender, or prove the chosen contents are sensible.
RFC 1832, RFC 4506 and the record-layer boundary
RFC 1832 moved the deployed format onto the Standards Track in 1995. Eleven years later, RFC 4506 became STD 67 and explicitly made no technical change to that wire contract. It added IANA treatment, reference discipline and the security guidance the earlier text lacked. The longevity belongs to the representation, not to a claim that every decoder was safe.
RFC 5531 draws the boundary cleanly. ONC RPC messages are described in XDR, but RPC over TCP needs a separate record-marking layer to delimit messages inside a byte stream. Its fragment header is explicitly not XDR standard form. Decoding one XDR value therefore proves nothing about where an arbitrary TCP message ends, which call owns it, or whether an operation committed.
XDR also supplies no authentication, confidentiality, authorization or replay protection. Its 2006 security section instead loads concrete duties onto protocols and decoders: bound variable values, reconcile counted strings with native conventions, limit recursive structures. A canonical grammar can make malformed input recognizable. It cannot force software to reject it safely.
Sources and limits
The closed record is RFC 1014, RFC 1832, RFC 4506 and RFC 5531. Together they establish the encoding, the revision history, the rationale, the documented RPC/NFS relationship and the record-layer boundary. They do not measure current use, certify a product, describe a captured packet, or turn agreement about representation into agreement about policy or truth.
XDR never promised that the machines would agree about anything else. It promised only that when they disagreed, they would disagree about the same bytes — and that the three quiet zeros in the middle of a filename would never be mistaken for part of the name.
Member Briefing
Read the full trend briefing
Members read the full briefing with the source notes behind every finding.
Strategic Circle
A daily briefing in your language, built from changes we have verified.
Join for USD 20/monthCancel anytime.
Members also get the full research library, a daily briefing on the networks they follow and the private forum.






