Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Rost via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: Rost <code@ffmpeg.org>
Subject: [FFmpeg-devel] [PR] WIP: Don't bind sockets to 0.0.0.0 by default for unicast UDP inputs (PR #21470)
Date: Thu, 15 Jan 2026 00:40:56 -0000
Message-ID: <176843765692.25.16788318577617920512@4457048688e7> (raw)

PR #21470 opened by Rost (rost.kurylo)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21470
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21470.patch


>From 6bc89b9956a2bf5606a6d3bd89c7abcba1c61110 Mon Sep 17 00:00:00 2001
From: Rost Kurylo <rost.kurylo@netint.ca>
Date: Tue, 13 Jan 2026 11:17:57 -0800
Subject: [PATCH 1/2] Don't bind sockets to 0.0.0.0 by default for unicast UDP
 inputs

---
 libavformat/udp.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libavformat/udp.c b/libavformat/udp.c
index 61e80c86c5..4718457f42 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -700,6 +700,7 @@ static int udp_open(URLContext *h, const char *uri, int flags)
     struct sockaddr_storage my_addr;
     socklen_t len;
     int ret;
+    const char *bind_addr = NULL;
 
     h->is_streamed = 1;
 
@@ -759,7 +760,12 @@ static int udp_open(URLContext *h, const char *uri, int flags)
     if ((s->is_multicast || s->local_port < 0) && (h->flags & AVIO_FLAG_READ))
         s->local_port = port;
 
-    udp_fd = udp_socket_create(h, &my_addr, &len, s->localaddr);
+    if (!s->is_multicast && (s->localaddr == NULL || s->localaddr[0] == '\0') && h->flags & AVIO_FLAG_READ)
+        bind_addr = hostname;
+    else
+        bind_addr = s->localaddr;
+
+    udp_fd = udp_socket_create(h, &my_addr, &len, bind_addr);
     if (udp_fd < 0) {
         ret = AVERROR(EIO);
         goto fail;
-- 
2.49.1


>From 0ed684751806933020deba95345b608284feb489 Mon Sep 17 00:00:00 2001
From: Rost Kurylo <rost.kurylo@netint.ca>
Date: Tue, 13 Jan 2026 11:28:04 -0800
Subject: [PATCH 2/2] Explicitly bind RTP sockets to 0.0.0.0 in rtsp

A better alternative is to bind to a local IP that is used to
communicate with RTSP server via signalling socket. Should be
considered as a further improvement.
---
 libavformat/rtsp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index e8f44e571a..048f8de5bb 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1566,7 +1566,7 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,
             while (j + 1 <= rt->rtp_port_max) {
                 AVDictionary *opts = map_to_opts(rt);
 
-                ff_url_join(buf, sizeof(buf), "rtp", NULL, host, -1,
+                ff_url_join(buf, sizeof(buf), "rtp", NULL, "0.0.0.0", -1,
                             "?localport=%d", j);
                 /* we will use two ports per rtp stream (rtp and rtcp) */
                 j += 2;
-- 
2.49.1

_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org

                 reply	other threads:[~2026-01-15  0:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=176843765692.25.16788318577617920512@4457048688e7 \
    --to=ffmpeg-devel@ffmpeg.org \
    --cc=code@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git