Files
freebsd/cmd
Garth Snyder eaaea55b69 Consistently encode DRR_BEGIN packed nvlist payloads with NV_ENCODE_XDR
Currently, zfs send generates a mix of nvlist encodings in DRR_BEGIN
records, some XDR and some in native byte order. The result is that
most streams currently can't be zfs received on opposite-endian systems.

zfs send generates the outer wrappers for compound streams in userspace,
and it explicitly requests NV_ENCODE_XDR format for those records. But
the BEGIN records for individual datasets are generated on the kernel
side, in dmu_send.c, where fnvlist_pack() is used for encoding. That
routine hard-wires NV_ENCODE_NATIVE format.

This PR replaces the fnvlist_pack() call with a direct call to
nvlist_pack() that specifies NV_ENCODE_XDR.

Tests are included to verify that native-encoded nvlists are not
generated by any kernel path that attaches nvlists to BEGIN records.
There's also a check for XDR encoding in the outer wrapper of
replication streams in case there is ever a regression there.

There are also two tests that have a chance of triggering (and
detecting) bug #18491. Non-triggering versions of those tests are
already included here, so when that bug is more fully characterized,
the tests can be moved to a more directly relevant category. (They
are the two tests with _with_write suffixes.)

This PR adds to zstream dump an output line that shows the exact
encoding of any nvlists in BEGIN records. This feature is used by
the tests to validate streams.

Reviewed-by: Alexander Motin <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Garth Snyder <[email protected]>
Closes #18360
Closes #18372
2026-05-12 07:49:55 -07:00
..
2026-04-08 10:09:47 -07:00
2025-03-13 17:56:27 -07:00
2025-03-13 17:56:27 -07:00
2025-03-13 17:56:27 -07:00
2025-03-13 17:56:27 -07:00