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

Ronald S. Bultje rsbultje
Tue Jan 12 17:26:00 CET 2010


Hi,

On Tue, Jan 12, 2010 at 5:26 AM, Martin Storsj? <martin at martin.st> wrote:
> On Tue, 12 Jan 2010, Luca Abeni wrote:
>
>> Sorry, I missed this thread... Anyway, I am ok with it (but: what was the
>> problem with the patch I originally approved?)
>
> That patch left some use of sockaddr_in6 in the ipv6 codepath that I had
> missed, and the ipv6 codepath used the ss_family field of sockaddr_storage
> (that our replacement didn't provide). The new series in the "[PATCH]
> Clean up ipv6 vs the udp protocol" thread should handle this better.

So, I think the attached would be easier. RFC-2553 defines the storage
size to be 128, and although it may be more because of alignment, the
result of the attached version would always be >=128, as defined in
RFC-2553.

Ronald
-------------- next part --------------
Index: libavformat/network.h
===================================================================
--- libavformat/network.h	(revision 21150)
+++ libavformat/network.h	(working copy)
@@ -69,8 +69,10 @@
 #endif
 
 #if !HAVE_STRUCT_SOCKADDR_STORAGE
+/** RFC-2553 defines this to be 128 bytes */
 struct sockaddr_storage {
-    struct sockaddr_in x;
+    uint16_t ss_family;
+    char   __ss_pad[126];
 };
 #endif
 



More information about the ffmpeg-devel mailing list