[FFmpeg-devel] [PATCH/RFC] Prefer getaddrinfo over gethostbyname

Martin Storsjö martin
Wed Jan 6 23:02:33 CET 2010


On Wed, 6 Jan 2010, Ronald S. Bultje wrote:

> On Tue, Jan 5, 2010 at 6:19 AM, Martin Storsj? <martin at martin.st> wrote:
> > As a follow-up to this, as discussed in the other thread - we may want to
> > rely on the getnameinfo interface, too, for ip -> host resolving or for ip
> > -> string formatting. This patch can be applied after the getaddrinfo
> > wrapper patch, making sure the getnameinfo function is always available.
> 
> I like this very much. Michael (or anyone caring about libossupport),
> can I apply these wrappers to libossupport?

Great!

Here's a rerolled version of the series.

The getaddrinfo replacement is a bit restructured and improved (I read the 
manpage a bit and found more corner cases I had to take care of, and now 
check the return values from av_malloc).

The old patch for the udp protocol is dropped.

When checking for enable/disable ipv6, it doesn't check for 
getaddrinfo/getnameinfo any more, since we make sure these are always 
available. This check also looks in mingw/windows specific headers now.

The non-ipv6 codepath in the udp protocol is removed, since everything the 
ipv6 codepath needed should now be provided through wrappers.

And finally, two different patches for enabling full IPv6 support on 
Windows are proposed. The first one loads the function pointers 
dynamically from the DLL and thus is backwards compatible with any old 
windows version. This one required some ugly reference counting for the 
function pointers, though, which is thread unsafe currently. The second 
one simply links directly to getaddrinfo on windows, making it binary 
incompatible with anything prior to XP.

// Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Check-for-the-getaddrinfo-function.patch
Type: text/x-diff
Size: 825 bytes
Desc: 
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100107/492cbd8c/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Use-getaddrinfo-instead-of-gethostbyname-if-availabl.patch
Type: text/x-diff
Size: 1866 bytes
Desc: 
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100107/492cbd8c/attachment-0001.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Make-check_type-handle-type-names-containing-spaces.patch
Type: text/x-diff
Size: 820 bytes
Desc: 
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100107/492cbd8c/attachment-0002.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-Check-for-the-addrinfo-struct-needed-for-using-getad.patch
Type: text/x-diff
Size: 1236 bytes
Desc: 
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100107/492cbd8c/attachment-0003.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0005-Make-sure-getaddrinfo-and-freeaddrinfo-are-always-av.patch
Type: text/x-diff
Size: 4075 bytes
Desc: 
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100107/492cbd8c/attachment-0004.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0006-Mark-resolve_host-as-deprecated.patch
Type: text/x-diff
Size: 933 bytes
Desc: 
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100107/492cbd8c/attachment-0005.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0007-Use-getaddrinfo-instead-of-resolve_host-in-the-tcp-p.patch
Type: text/x-diff
Size: 2959 bytes
Desc: 
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100107/492cbd8c/attachment-0006.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0008-Make-sure-the-sockaddr_storage-struct-is-available.patch
Type: text/x-diff
Size: 1857 bytes
Desc: 
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100107/492cbd8c/attachment-0007.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0009-If-getaddrinfo-isn-t-available-provide-a-replacement.patch
Type: text/x-diff
Size: 3636 bytes
Desc: 
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100107/492cbd8c/attachment-0008.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0010-Don-t-check-for-getaddrinfo-getnameinfo-in-the-ipv6-.patch
Type: text/x-diff
Size: 797 bytes
Desc: 
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100107/492cbd8c/attachment-0009.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0011-When-doing-the-IPv6-check-check-in-mingw-specific-he.patch
Type: text/x-diff
Size: 896 bytes
Desc: 
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100107/492cbd8c/attachment-0010.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0012-Remove-the-non-ipv6-codepath-in-the-udp-protocol.patch
Type: text/x-diff
Size: 2768 bytes
Desc: 
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100107/492cbd8c/attachment-0011.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: win-ipv6-function-pointers.patch
Type: text/x-diff
Size: 5000 bytes
Desc: 
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100107/492cbd8c/attachment-0012.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: win-ipv6-link-direct-require-xp.patch
Type: text/x-diff
Size: 996 bytes
Desc: 
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100107/492cbd8c/attachment-0013.patch>



More information about the ffmpeg-devel mailing list