Network File System (NFS) Version 4 Minor Version 2 External Data Representation Standard (XDR) Description
Extracted elements (24)
Error code value 19 is deliberately left unassigned in nfsstat4 to avoid collision with an NFSv3 error value that carried a different meaning, preventing cross-version semantic confusion.
The NFSv4.2 XDR reconverges the previously divergent NFSv4.0 (RFC 7531) and NFSv4.1 (RFC 5662) XDR strands by aliasing clientaddr4 to netaddr4, renaming its fields (r_netid to na_r_netid, r_addr to na_r_addr) while keeping the same semantics.
The XDR is embedded in the RFC using a '///' sentinel prefix so that a simple two-stage shell script (grep + sed) can extract a machine-compilable nfs4_prot.x directly from the RFC text without any manual editing.
The XDR specification intentionally includes operations and features from NFSv4.0 and NFSv4.1 in addition to NFSv4.2 in order to facilitate implementations that support all three minor versions from a single .x file.
The NFSv4.2 XDR is fully compatible with NFSv4.0 (RFC 7531) except for the clientaddr4-to-netaddr4 aliasing, which also reconverges with the NFSv4.1 (RFC 5662) XDR strand; a single .x file can be used to implement all three NFSv4 minor versions.
Key protocol size constants: NFS4_FHSIZE=128 bytes (maximum filehandle size), NFS4_VERIFIER_SIZE=8 bytes, NFS4_OTHER_SIZE=12 bytes (stateid opaque field), NFS4_OPAQUE_LIMIT=1024 bytes, NFS4_SESSIONID_SIZE=16 bytes.
NFSv4.2 adds seven new error codes to nfsstat4: NFS4ERR_PARTNER_NOTSUPP=10088, NFS4ERR_PARTNER_NO_AUTH=10089, NFS4ERR_UNION_NOTSUPP=10090, NFS4ERR_OFFLOAD_DENIED=10091, NFS4ERR_WRONG_LFS=10092, NFS4ERR_BADLABEL=10093, NFS4ERR_OFFLOAD_NO_REQS=10094.
NFSv4.2 defines four new recommended file attributes: FATTR4_CLONE_BLKSIZE=77 (uint32_t), FATTR4_SPACE_FREED=78 (uint64_t), FATTR4_CHANGE_ATTR_TYPE=79 (change_attr_type4), and FATTR4_SEC_LABEL=80 (sec_label4).
NFSv4.2 introduces 13 new operation codes in nfs_opnum4: OP_ALLOCATE=59, OP_COPY=60, OP_COPY_NOTIFY=61, OP_DEALLOCATE=62, OP_IO_ADVISE=63, OP_LAYOUTERROR=64, OP_LAYOUTSTATS=65, OP_OFFLOAD_CANCEL=66, OP_OFFLOAD_STATUS=67, OP_READ_PLUS=68, OP_SEEK=69, OP_WRITE_SAME=70, OP_CLONE=71.
RFC 7863 introduces no new security considerations beyond the XDR encoding itself; all security considerations for NFSv4.2 are addressed in the companion protocol specification RFC 7862.
app_data_block4 (new to NFSv4.2, used by WRITE_SAME) describes an application data block with adb_offset (offset4), adb_block_size (length4), adb_block_count (length4), adb_reloff_blocknum (length4), adb_block_num (count4), adb_reloff_pattern (length4), and variable-length adb_pattern (opaque).
change_attr_type4 (new to NFSv4.2) is an enum describing change attribute semantics: NFS4_CHANGE_TYPE_IS_MONOTONIC_INCR=0, IS_VERSION_COUNTER=1, IS_VERSION_COUNTER_NOPNFS=2, IS_TIME_METADATA=3, IS_UNDEFINED=4.
CLONE4args encodes a server-side clone operation with cl_src_stateid and cl_dst_stateid (stateid4 for SAVED_FH and CURRENT_FH respectively), cl_src_offset and cl_dst_offset (offset4), and cl_count (length4).
copy_confirm_auth_priv carries the GSS_GetMIC() of the shared secret as ccap_shared_secret_mic (variable-length opaque) plus ccap_username (utf8str_mixed), used to confirm inter-server copy authorization at the destination server.
copy_from_auth_priv encodes source-side inter-server copy authorization with cfap_shared_secret (secret4), cfap_destination (netloc4), and cfap_username (utf8str_mixed). copy_to_auth_priv mirrors this for the destination with ctap_source as a list (netloc4<>).
data_content4 enum (new to NFSv4.2) identifies the content type of a READ_PLUS result segment: NFS4_CONTENT_DATA=0 (data) or NFS4_CONTENT_HOLE=1 (sparse hole).
data4 encodes a READ_PLUS data segment as d_offset (offset4) plus d_data (variable-length opaque). data_info4 encodes a hole descriptor as di_offset (offset4) and di_length (length4).
netloc4 (new to NFSv4.2) is a discriminated union keyed on netloc_type4 with three arms: NL4_NAME=1 (utf8str_cis DNS name), NL4_URL=2 (utf8str_cis URL), NL4_NETADDR=3 (netaddr4 structure).
nfl_util4 (uint32_t) includes the new NFSv4.2 flag NFL42_UFLG_IO_ADVISE_THRU_MDS=0x00000004, indicating that IO_ADVISE hints in a pNFS file layout should be forwarded through the MDS rather than sent directly to the data server.
nfsace4 encodes an ACE as type (acetype4, uint32_t), flag (aceflag4, uint32_t), access_mask (acemask4, uint32_t), and who (utf8str_mixed, variable-length UTF-8). ACE4_GENERIC_READ=0x00120081, ACE4_GENERIC_WRITE=0x00160106, ACE4_GENERIC_EXECUTE=0x001200A0 are predefined composite masks.
nfstime4 encodes time as a signed 64-bit seconds field (int64_t) and an unsigned 32-bit nanoseconds field (uint32_t), for a fixed 12-byte on-wire encoding.
sec_label4 (new to NFSv4.2) encodes a MAC security label as a labelformat_spec4 (slai_lfs, containing policy4 fields lfs_lfs and lfs_pi) followed by variable-length opaque label data (slai_data<>).
stateid4 is encoded as a 32-bit sequence number (seqid, uint32_t) followed by a fixed 12-byte opaque identifier (other[NFS4_OTHER_SIZE]), for a total on-wire footprint of 16 bytes.
write_response4 (new to NFSv4.2) carries the result of a COPY or asynchronous write: wr_callback_id (optional stateid4<1>), wr_count (length4), wr_committed (stable_how4), wr_writeverf (verifier4).