PR #23202 opened by VannHarl
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23202
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23202.patch

ff_udp_get_last_recv_addr and ff_udp_set_remote_addr are defined in
udp.c which only compiles under CONFIG_UDP_PROTOCOL. Building with
--disable-everything plus a protocol whitelist that excludes UDP
left these references unresolved at link time, even though TLS
itself uses TCP. Wrap the DTLS UDP-remote-addr blocks accordingly


>From 84ec23fbdf2721b18f84e1a41cabbe6555537ac5 Mon Sep 17 00:00:00 2001
From: Vann Harl <[email protected]>
Date: Fri, 22 May 2026 15:09:10 +0200
Subject: [PATCH] avformat/tls_{openssl,gnutls,mbedtls}: gate DTLS udp helpers
 on CONFIG_UDP_PROTOCOL

ff_udp_get_last_recv_addr and ff_udp_set_remote_addr are defined in
udp.c which only compiles under CONFIG_UDP_PROTOCOL. Building with
--disable-everything plus a protocol whitelist that excludes UDP
left these references unresolved at link time, even though TLS
itself uses TCP. Wrap the DTLS UDP-remote-addr blocks accordingly
---
 libavformat/tls_gnutls.c  | 2 ++
 libavformat/tls_mbedtls.c | 2 ++
 libavformat/tls_openssl.c | 2 ++
 3 files changed, 6 insertions(+)

diff --git a/libavformat/tls_gnutls.c b/libavformat/tls_gnutls.c
index 75ec83d22d..789ce59db7 100644
--- a/libavformat/tls_gnutls.c
+++ b/libavformat/tls_gnutls.c
@@ -437,6 +437,7 @@ static ssize_t gnutls_url_pull(gnutls_transport_ptr_t 
transport,
     URLContext *uc = s->is_dtls ? s->udp : s->tcp;
     int ret = ffurl_read(uc, buf, len);
     if (ret >= 0) {
+#if CONFIG_UDP_PROTOCOL
         if (s->is_dtls && s->listen && !c->dest_addr_len) {
             int err_ret;
 
@@ -448,6 +449,7 @@ static ssize_t gnutls_url_pull(gnutls_transport_ptr_t 
transport,
             }
             av_log(c, AV_LOG_TRACE, "Set UDP remote addr on UDP socket, now 
'connected'\n");
         }
+#endif
         return ret;
     }
     if (ret == AVERROR_EXIT)
diff --git a/libavformat/tls_mbedtls.c b/libavformat/tls_mbedtls.c
index 4f85c51777..ec5350a9a9 100644
--- a/libavformat/tls_mbedtls.c
+++ b/libavformat/tls_mbedtls.c
@@ -383,6 +383,7 @@ static int mbedtls_recv(void *ctx, unsigned char *buf, 
size_t len)
     URLContext *h = shr->is_dtls ? shr->udp : shr->tcp;
     int ret = ffurl_read(h, buf, len);
     if (ret >= 0) {
+#if CONFIG_UDP_PROTOCOL
         if (shr->is_dtls && shr->listen && !tls_ctx->dest_addr_len) {
             int err_ret;
 
@@ -394,6 +395,7 @@ static int mbedtls_recv(void *ctx, unsigned char *buf, 
size_t len)
             }
             av_log(tls_ctx, AV_LOG_TRACE, "Set UDP remote addr on UDP socket, 
now 'connected'\n");
         }
+#endif
         /* Skip non-DTLS packets such as STUN to avoid failures. */
         if (shr->is_dtls && !ff_is_dtls_packet(buf, ret))
             return MBEDTLS_ERR_SSL_WANT_READ;
diff --git a/libavformat/tls_openssl.c b/libavformat/tls_openssl.c
index eade59b5d5..f030b6a59c 100644
--- a/libavformat/tls_openssl.c
+++ b/libavformat/tls_openssl.c
@@ -536,6 +536,7 @@ static int url_bio_bread(BIO *b, char *buf, int len)
     TLSShared *s = &c->tls_shared;
     int ret = ffurl_read(c->tls_shared.is_dtls ? c->tls_shared.udp : 
c->tls_shared.tcp, buf, len);
     if (ret >= 0) {
+#if CONFIG_UDP_PROTOCOL
         if (s->is_dtls && s->listen && !c->dest_addr_len) {
             int err_ret;
 
@@ -547,6 +548,7 @@ static int url_bio_bread(BIO *b, char *buf, int len)
             }
             av_log(c, AV_LOG_TRACE, "Set UDP remote addr on UDP socket, now 
'connected'\n");
         }
+#endif
 
         return ret;
     }
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to