[FFmpeg-devel] [PATCH] Use getaddrinfo in resolve_host (ipv6 support)

Ronald S. Bultje rsbultje
Mon Sep 10 20:24:06 CEST 2007

Hi all,

I've been poking at ipv6-support again, here's a (untested - this is mainly
for API comments while I do all testing of what I broke and what not) patch
to add full ipv6-support to ffmpeg.

- tcp.c and ffserver are now ipv6-compatible (upd.c already was).
- url_split() is now ipv6-compatible (similar to apache [*])

- udp.c is a mess

Future work:
- test (this is untested, it just happens to compile - let's ship it)
- add useful return codes to inetaddr_resolve() so that apps can signal nice
errors to users ("Host not found") rather than "error code -1: please check
something to fix something and try again, or not"

The error codes will come in a separate patch (with other error codes),
otherwise it'll get too big. I'll split this up in multiple parts if wanted
(e.g. one to add all API/functions, then separate patches to port each of
ffserver, udp.c (or not) and tcp.c to the new API and a separate patch to
remove resolve_host(), plus a separate one to fix url_split()).


[*] url_split() is problematic because of ambiguity in host:port in
ipv6-addresses. Valid ipv6 address representations are ::<num>,
::<num>:<num>, a:b:c:d:e:f:g:h and a:b:c:d:e:f:w.x.y.z and a variety of
combinations between those, as long as there's only one :: in it (which
means pad this with zeroes to make 8 shorts in total). Obviously, this leads
to problems if we try to parse an address such as ::1:80, is this ::1 port
80 or 0:0:0:0:0:0:1:80? url_split() parses this as a host, which is what
Apache does too. We support :::80 (tripple colons), full address notition
with port (0:0:0:0:0:0:0:0:80, i.e. 8 colons), dotted notation for the last
4 bytes (::a.b.c.d:80) or space-separated notition (host port instead of
host:port). Comments on this welcome.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ffmpeg-ipv6.patch
Type: application/octet-stream
Size: 39256 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070910/db990393/attachment.obj>

More information about the ffmpeg-devel mailing list