From 5bc16aeea5e65abc6d4ab3776180cbc4d2d83748 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) --- daemon/dtls.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/daemon/dtls.c b/daemon/dtls.c index 8e767ddf2..f7e9c2d67 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, @@ -711,7 +711,7 @@ int dtls_connection_init(struct dtls_connection *d, struct packet_stream *ps, in #else BIO_set_callback(d->w_bio, dtls_bio_callback_wrap); #endif - 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);