libnbd-release-notes-1.16 - Man Page

release notes for libnbd 1.16


These are the release notes for libnbd stable release 1.16. This describes the major changes since 1.14.

libnbd 1.16.0 was released on 18 April 2023.


No security issues were found in this release.

If you find a security issue, please read SECURITY in the source (online here:  To find out about previous security issues in libnbd, see libnbd-security(3).

New APIs

New API nbd_supports_vsock(3) can be used to test if the client has vsock support (Eric Blake).

New API nbd_poll2(3) which allows an extra file descriptor to be passed in (Ming Lei).

New nbd_stats_bytes_sent(3), nbd_stats_bytes_received(3), nbd_stats_chunks_sent(3) and nbd_stats_chunks_received(3) APIs which expose the number of bytes and messages sent and received on the current connection (Eric Blake).

New nbd_opt_list_meta_context_queries(3) and nbd_aio_opt_list_meta_context_queries(3) APIs allow you to query the available meta contexts interactively with the server during the negotiation phase of the protocol (Eric Blake).

New nbd_set_request_meta_context(3) lets you control whether the meta context is set during negotiation.  This can make certain operations faster, especially nbdinfo --list.  (Eric Blake)

New nbd_opt_set_meta_context(3), nbd_opt_set_meta_context_queries(3), nbd_aio_opt_set_meta_context(3) and nbd_aio_opt_set_meta_context_queries(3) APIs let you request meta contexts when using nbd_set_opt_mode(3) (Eric Blake).

New nbd_opt_structured_reply(3) and nbd_aio_opt_structured_reply(3) APIs let you fine-tune when structured replies are requested during the negotiation phase (Eric Blake).

New nbd_opt_starttls(3) and nbd_aio_opt_starttls(3) APIs let you fine-tune when STARTTLS is negotiated (Eric Blake).

New nbd_set_socket_activation_name(3) and nbd_get_socket_activation_name(3) APIs which allow you to name the socket used for socket activation.  Certain servers such as qemu-storage-daemon will use this name on the command line and in scripts.  (Thanks Laszlo Ersek).

Enhancements to existing APIs

nbd_connect_command(3) called with NULL argv parameter previously crashed, but now returns an error (Eric Blake).

nbd_opt_list_meta_context(3) can now be called without having negotiated structured replies (Eric Blake).

nbd_set_strict_mode(3) has a new LIBNBD_STRICT_PAYLOAD flag which can be used to control whether send oversize messages, in order to test servers (Eric Blake).

C API pointer parameters that cannot be NULL are now annotated with attribute((nonnull)) (if the compiler supports it) so that you will get a compile time warning if they are used improperly (thanks Eric Blake).

C APIs which allocate are now marked with attribute((malloc)) and similar attributions to improve static analysis of programs using libnbd (Eric Blake).

C APIs expressing flag values now use unsigned types, removing some undefined corner-cases with bitwise math on signed ints.  This change is API and ABI backwards compatible.  (Eric Blake)


New nbdublk(1) program which is used to create a Linux /dev/ublkb<N> block device from an NBD server (thanks Ming Lei).

nbdinfo(1) now has colorized output (use --no-color to disable).

nbdinfo has new --is tls and --can structured-reply options to let you test for these features on the server (Eric Blake).

nbdcopy(1) now writes progress messages to stderr (previously they were written to /dev/tty).  This makes it consistent with other tools like dd.  (Eric Blake).

nbdsh(1) options -c and -u can now be interleaved, making it easier to toggle optional URI features (Eric Blake).

Language bindings

Documentation for the OCaml bindings now includes parameter names.

The OCaml bindings now return OCaml error values in exceptions instead of raw C errno numbers.

OCaml bindings now support nbd_aio_connect(3) which uses the sockaddr type directly.

The Python bindings now have an explicit h.close() method.  Letting the handle go out of scope still works for closing the handle, but now you have the choice to explicitly close the handle before it goes out of scope.  If you try to use the handle after closing it, a new nbd.ClosedHandle exception will be thrown.

The Python bindings now provide a contextlib decorated function, so you can write the more natural with nbd.nbd() as h: ...


Wider CI coverage (Eric Blake).

Other improvements and bug fixes

The state machine can now cope with and recover from some bad structured reply messages and unknown cookies sent by the server (Eric Blake).

The library is now annotated with -z nodelete, preventing it from being "really" unloaded when you call dlclose(3).  This is the only way to prevent a crash in multi-threaded code.  See commit 368e3d0d5a887 for details.

Improve debugging when the handle enters the %DEAD state.

The library is now much more POSIX-compliant and resilient when running subcommands, no longer relying on quirks of the glibc implementation of execvp and other non-async-signal-safe functions (Laszlo Ersek).

Source files reformatted to use ≤ 80 columns (Laszlo Ersek).


Fix build on Alpine Linux + musl which declares AF_VSOCK but does not define the associated structures (Eric Blake).

Python distutils, deprecated in Python ≥ 3.10, has been replaced by sysconfig (thanks Miro Hrončok).

See Also



Daniel P. Berrangé

Eric Blake

Laszlo Ersek

Ming Lei

Richard W.M. Jones


This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

Referenced By


2023-05-10 libnbd-1.16.1