nbd_set_uri_allow_tls_priority(3)

πŸ’… nbd_set_uri_allow_tls_priority(3) β€” the libnbd girlies' guide πŸ’…

okay so bestie, this is a page from LIBNBD, and it's about nbd_set_uri_allow_tls_priority β€” yes that's a mouthful, we're gonna get through it together 🫢


✨ NAME ✨

nbd_set_uri_allow_tls_priority β€” literally just sets whether tls-priority is allowed in NBD URIs. that's it. that's the whole vibe πŸ’–


🌸 SYNOPSIS 🌸

#include <libnbd.h>

int nbd_set_uri_allow_tls_priority (
      struct nbd_handle *h, bool allow
    );

look at her. iconic signature. two params, no notes πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea β˜• β€” this one lets NBD URIs override the TLS priority by sticking ?tls-priority=PRIORITY into the query string. like, the URI itself gets to be a little main character and pick the priority. iykyk.

it's disabled by default though, and honestly? for good reason πŸ™ˆ because it's probably not safe. like, not "oops I broke it" unsafe β€” the TLS priority string is quite powerful, lowkey scary powerful. the way that it can let you read some local configuration files 😭 and possibly even downgrade TLS security πŸ’€

so yeah β€” if you turn this on, you're the one making that choice. no cap. be careful bestie πŸŽ€

⭐ RETURN VALUE ⭐

if the call goes through and everything's cute? it returns 0. slay ✨


πŸ’€ ERRORS πŸ’€

if something goes wrong, you get -1 back. not the vibe.

refer to ERROR HANDLING in libnbd(3) for how to get further details of the error β€” that's where the actual lore lives fr fr.

also, these parameters must not be NULL: h. for more info see Non-NULL parameters in libnbd(3). tiny detail, huge consequences πŸ’…


πŸŽ€ HANDLE STATE πŸŽ€

nbd_set_uri_allow_tls_priority can be called when the handle is in these states β€” vibe check time:

  • Handle created, before connecting β€” βœ… allowed (this is her moment πŸ‘‘)
  • Connecting β€” ❌ error
  • Connecting & handshaking (opt_mode) β€” ❌ error
  • Connected to the server β€” ❌ error
  • Connection shut down β€” ❌ error
  • Handle dead β€” ❌ error

so basically: catch her before you connect. periodt πŸ’œ


🌈 VERSION 🌈

this function first appeared in libnbd 1.24. new girl on the block πŸ¦‹

if you need to test at compile time whether this function is available, check if the following macro is defined:

#define LIBNBD_HAVE_NBD_SET_URI_ALLOW_TLS_PRIORITY 1

πŸ”₯ SEE ALSO πŸ”₯


πŸ‘‘ AUTHORS πŸ‘‘

  • Eric Blake
  • Richard W.M. Jones

the masterminds. we stan 🫢


Copyright Red Hat


🧚 LICENSE 🧚

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


okay that's the whole page bestie, go forth and set your URI allow-tls-priority flag responsibly πŸ’–βœ¨

and like, credit where it's due β€” this masterpiece came from libnbd-1.24.4, dated 2026-10-13, page nbd_set_uri_allow_tls_priority(3). byeeee πŸŽ€πŸ’…

πŸ“¦ where this page comes from