From de48496c66ec4e3d70f70d2373433fe112ac1448 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Wed, 27 Aug 2025 13:22:29 -0400 Subject: [PATCH] MT#55283 switch callback argument We already use the `dtls_connection` object as "app data" so let's use it for the BIO callback arg as well. Change-Id: I715b6756ea36c7a3cb2bed68fce17108eb480e23 (cherry picked from commit 8297449aa10727624e8243fb0af83f4bc6f9ee07) (cherry picked from commit bb72d7da926bda6432bf32a20ed8023849500625) --- daemon/dtls.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/daemon/dtls.c b/daemon/dtls.c index f4fec6483..cdcfa2801 100644 --- a/daemon/dtls.c +++ b/daemon/dtls.c @@ -617,15 +617,15 @@ static long dtls_bio_callback(BIO *bio, int oper, const char *argp, size_t len, if (!argp || len <= 0) return ret; - struct packet_stream *ps = (struct packet_stream *) BIO_get_callback_arg(bio); + struct dtls_connection *d = (struct dtls_connection *) BIO_get_callback_arg(bio); + if (!d) + return ret; + struct packet_stream *ps = d->ps; if (!ps) return ret; struct stream_fd *sfd = ps->selected_sfd; if (!sfd) return ret; - struct dtls_connection *d = dtls_ptr(sfd); - if (!d) - return ret; __DBG("dtls packet output: len %zu %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", len, @@ -699,7 +699,7 @@ int dtls_connection_init(struct dtls_connection *d, struct packet_stream *ps, in goto error; BIO_set_callback_ex(d->w_bio, dtls_bio_callback); - BIO_set_callback_arg(d->w_bio, (char *) ps); + BIO_set_callback_arg(d->w_bio, (char *) d); #if defined(BIO_CTRL_DGRAM_SET_MTU) BIO_ctrl(d->w_bio, BIO_CTRL_DGRAM_SET_MTU, rtpe_config.dtls_mtu, NULL);