[FFmpeg-devel] [PATCH] avformat: enable UDP IPv6 multicast interface selection

Michael Niedermayer michael at niedermayer.cc
Thu Mar 14 23:13:52 EET 2024


On Thu, Mar 14, 2024 at 12:04:47PM +0000, Ignjatović, Lazar (RS) wrote:
> localaddr option now properly works with IPv6 addresses. Properly
> resolved interface index in places where default 0 interface index is
> used (marked with TODO: within udp.c). Added SO_BINDTODEVICE for mcast
> sockets that are used for reading from the network. Need for this
> arises from the fact that [ffx1::*] and [ffx2::*] mcast addresses need
> to have a defined interface for binding to avoid ambiguity between
> multiple link-local networks on the same host. Failing to set this
> option causes errors on Linux systems for interface and link-local
> scopes.
> 
> For mcast addresses, bind to mcast address is attempted as before.
> In case that this fails, which will happen on Windows, socket is bound
> to INADDR_ANY/IN6ADDR_ANY_INIT depending on address family. Actual
> interface selection is performed using udp_set_multicast_interface to
> point to the desired interface for sending/listening.
> 
> Utilization of sin6_scope_id field enables usage and adequate resolving
> of IPv6 addresses that utilize zone index
> (e.g. fe80::1ff:fe23:4567:890a%eth2)
> This is not fully supported on Windows, thus relying on this field
> is not done on Windows systems.
> 
> Closes: #368
> 
> Signed-off-by: Lazar Ignjatovic <Lazar.Ignjatovic at cubic.com>
> ---
>  configure             |  3 ++
>  libavformat/ip.c      | 45 ++++++++++++++++++++++++
>  libavformat/ip.h      |  6 ++++
>  libavformat/network.h |  6 ++++
>  libavformat/udp.c     | 80 ++++++++++++++++++++++++++++++++++++++-----
>  5 files changed, 132 insertions(+), 8 deletions(-)

breaks mingw64 build

CC	libavformat/ip.o
src/libavformat/ip.c: In function ‘ff_ip_resolve_interface_index’:
src/libavformat/ip.c:206:1: error: control reaches end of non-void function [-Werror=return-type]
 }
 ^
cc1: some warnings being treated as errors
src/ffbuild/common.mak:81: recipe for target 'libavformat/ip.o' failed
make: *** [libavformat/ip.o] Error 1

also configure produces
../configure: 6415: ../configure: network_extralibs+= -liphlpapi: not found


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I have never wished to cater to the crowd; for what I know they do not
approve, and what they approve I do not know. -- Epicurus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20240314/9748c487/attachment.sig>


More information about the ffmpeg-devel mailing list