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

Martin Storsjö martin
Mon Jan 4 10:14:49 CET 2010


Hi Ronald,

On Sun, 3 Jan 2010, Ronald S. Bultje wrote:

> On Sun, Jan 3, 2010 at 6:11 PM, Martin Storsj? <martin at martin.st> wrote:
> [..]
> 
> Now, as for patches.
> 0001 (check for getaddrinfo) - can be applied if Diego / Mans are OK with it
> 0002 (getaddrinfo instead of gethostbyname) - ok with me
> 0003 (configure) - not for me (Diego / Mans)
> 0004 (struct sockaddr_storage etc.) - ok with me, same as 0001

I split this one, and moved adding of the sockaddr_storage stuff to patch 
9, since it wasn't directly used by any of the later commits here (but is 
used by e.g. the ipv6 codepath in udp.c and may be useful for ffserver). 
So this patch only checks for struct addrinfo at the moment.

> 0005 (addrinfo) - as said before, use ff_ prefix and add define to
> header, then OK with me

Ok, added ff_ prefix.

> 0006 (mark as deprecated) - can be applied
> 0007 (tcp) -
> 
> +    if (fd < 0) {
> +        freeaddrinfo(ai);
>          return AVERROR(EIO);
> +    }
> 
> shouldn't that be goto fail; and retry next address? OK otherwise.

Ah, good catch. Fixed.

> 0008 (udp) - looks ok but somebody else with more knowledge of udp
> might want to look at it (e.g. Luca), I'm not familiar with it.

As for the new patch 9, it adds sockaddr_storage. It doesn't have any 
sensibly usable members though. (According to rfc 2553, the initial fields 
of this struct should be identical to the initial fields of struct 
sockaddr, but the code that uses sockaddr_storage doesn't use its members 
directly currently.)

// Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Check-for-the-getaddrinfo-function.patch
Type: text/x-diff
Size: 823 bytes
Desc: 
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100104/5d98f806/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: 1657 bytes
Desc: 
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100104/5d98f806/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: 818 bytes
Desc: 
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100104/5d98f806/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: 1234 bytes
Desc: 
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100104/5d98f806/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: 3479 bytes
Desc: 
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100104/5d98f806/attachment-0004.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0006-Mark-resolve_host-as-deprecated.patch
Type: text/x-diff
Size: 931 bytes
Desc: 
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100104/5d98f806/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: 2957 bytes
Desc: 
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100104/5d98f806/attachment-0006.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0008-Use-getaddrinfo-instead-of-resolve_host-in-the-non-i.patch
Type: text/x-diff
Size: 1600 bytes
Desc: 
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100104/5d98f806/attachment-0007.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0009-Make-sure-the-sockaddr_storage-struct-is-available.patch
Type: text/x-diff
Size: 1855 bytes
Desc: 
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100104/5d98f806/attachment-0008.patch>



More information about the ffmpeg-devel mailing list