SSL_INJECT_NET_DGRAM(3ossl)

πŸ“¦ version 3.5.0, in opensuse-leap 16.0

πŸ’… SSL_INJECT_NET_DGRAM πŸ’…

okay so bestie, this is a page from the 3ossl manual and it's literally about a function called SSL_inject_net_dgram() β€” yes that's a mouthful, we're gonna get through it together, i promise 🫢


✨ NAME ✨

SSL_inject_net_dgram β€” inject a datagram as though it was received from the network 🌐


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <openssl/ssl.h>

int SSL_inject_net_dgram(SSL *s, const unsigned char *buf,
                         size_t buf_len,
                         const BIO_ADDR *peer,
                         const BIO_ADDR *local);

like, look at that signature. it's giving "i know exactly what i'm doing" energy πŸ’…


🌸 DESCRIPTION 🌸

So this function is your little backstage pass 🎟️ β€” it lets you inject a datagram payload into a QUIC connection SSL object, and the payload gets processed exactly as though it had arrived from the network. The docs say it's useful for debugging, or for feeding datagrams to QUIC from alternative sources. No cap, that's the whole vibe.

  • buf is required (non-negotiable, bestie) and it must point at the datagram payload you want to inject.
  • buf_len is the length of that buffer, in bytes. The buffer gets copied, so it doesn't have to stay valid after the function returns β€” you're free to let it go πŸ¦‹.

Now for the addresses: peer and local are optional values, and they point to BIO_ADDR structures describing the remote and local UDP endpoint addresses for the packet. ikyk: even though OpenSSL didn't literally receive the injected packet from the network, the packet still gets processed as though the received datagram came with those addresses. so you're basically doing a little costume change for the packet πŸ‘‘


πŸŽ€ RETURN VALUES πŸŽ€

Returns 1 on success or 0 on failure. And lowkey important: this function always fails if you call it on an SSL object that is not a QUIC connection SSL object. wrong vibe, wrong object, it's not doing it πŸ’€


🌈 SEE ALSO 🌈

go read those too, bestie, they're all part of the same friend group 🫢


⭐ HISTORY ⭐

The function SSL_inject_net_dgram() was added in OpenSSL 3.2. iconic behavior, honestly πŸ‘‘


Copyright 2023 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.


and that's the whole page, bestie πŸŽ€ mwah πŸ’‹ β€” this was version 3.5.0, dated 2026-09-25, from the SSL_INJECT_NET_DGRAM(3ossl) manual. periodt. 🌸

πŸ“¦ where this page comes from