SSL_INJECT_NET_DGRAM(3ossl)
π SSL_inject_net_dgram β the manual page, but make it make sense β¨
okay so bestie, this is a page from the OpenSSL manual, section 3ossl, and it's all about one lil function called SSL_inject_net_dgram. yes it's a mouthful. no we're not scared of it. let's go π«Ά
β¨ NAME β¨
SSL_inject_net_dgram β inject a datagram as though it got received from the network ππ
like... you're faking the mail delivery but the letter is real. iykyk.
πΈ 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);
copy that exactly, don't get cute with it π
π¦ DESCRIPTION π¦
So here's the vibe: this function lets you inject a datagram payload into a QUIC connection SSL object. The payload gets processed as though it was received from the network. no cap, it's literally treated like it came off the wire.
Why would you ever want that? Two main character reasons:
- debugging purposes β you wanna poke at stuff without an actual network in the way π
- letting datagrams be fed to QUIC from alternative sources β your data, your rules, your supply chain π
Now the args, one by one, no skipping:
bufβ required, bestie. it must point to a datagram payload to inject. no buf, no injection, no slay.buf_lenβ the length of the buffer, in bytes. numbers. we love a number. βpeerandlocalβ these are optional values pointing toBIO_ADDRstructures describing the remote and local UDP endpoint addresses for the packet.
And the key detail, the one you cannot miss: even though the injected packet was not actually received from the network directly by OpenSSL, the packet will still be processed as though the received datagram had the given addresses. so like, the addresses are honored as if they were real. it's giving method acting π
Oh and also: the buffer is copied, so it does not need to remain valid after this function returns. free it, reuse it, do whatever, we already took our copy π
π RETURN VALUES π
- Returns
1on success β¨ - Returns
0on failure π
And important: this function always fails if you call it on an SSL object which is not a QUIC connection SSL object. like. always. it will not be nice about it. it will simply return 0 and you will have to sit with that. π
π SEE ALSO π
go read these too, they're all part of the same friend group:
β HISTORY β
SSL_inject_net_dgram() was added in OpenSSL 3.2. so if you're on something older, bestie, that's a you problem, time to upgrade π§
π COPYRIGHT π
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>.
lowkey the whole "may not use this file except in compliance with the License" thing is not a vibe check you wanna fail. read the license. fr fr. π«Ά
and that's the page, bestie!! π this was OpenSSL version 3.5.9, dated 2026-09-29, and you read the SSL_INJECT_NET_DGRAM(3ossl) manual page. go inject some datagrams responsibly. periodt. πβ¨π¦
π¦ where this page comes from
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms