[FFmpeg-devel] [PATCH] workaround for IOS9 getaddrinfo in IPv6 only network use hardcode IPv4 address can not resolve port number.

Michael Niedermayer michael at niedermayer.cc
Sun Nov 6 14:34:24 EET 2016


On Sun, Nov 06, 2016 at 12:22:04AM -0700, Dave Yeo wrote:
> On 08/24/16 03:46 AM, liu jc wrote:
> >Signed-off-by: liujingchao <jcliu at outlook.com>
> >---
> >  libavformat/tcp.c | 8 ++++++++
> >  1 file changed, 8 insertions(+)
> >  mode change 100644 => 100755 libavformat/tcp.c
> >
> >diff --git a/libavformat/tcp.c b/libavformat/tcp.c
> >old mode 100644
> >new mode 100755
> >index c105479..fd10a56
> >--- a/libavformat/tcp.c
> >+++ b/libavformat/tcp.c
> >@@ -122,6 +122,14 @@ static int tcp_open(URLContext *h, const char *uri, int flags)
> >      cur_ai = ai;
> >
> >   restart:
> >+    // workaround for IOS9 getaddrinfo in IPv6 only network use hardcode IPv4 address can not resolve port number.
> >+    if (cur_ai->ai_family == AF_INET6){
> >+        struct sockaddr_in6 * sockaddr_v6 = (struct sockaddr_in6 *)cur_ai->ai_addr;
> >+        if (!sockaddr_v6->sin6_port){
> >+            sockaddr_v6->sin6_port = htons(port);
> >+        }
> >+    }
> >+
> >      fd = ff_socket(cur_ai->ai_family,
> >                     cur_ai->ai_socktype,
> >                     cur_ai->ai_protocol);
> >
> 
> src/libavformat/tcp.c: In function 'tcp_open':
> src/libavformat/tcp.c:128:25: error: dereferencing pointer to
> incomplete type
>          if (!sockaddr_v6->sin6_port){
>                          ^
> src/libavformat/tcp.c:129:24: error: dereferencing pointer to
> incomplete type
>              sockaddr_v6->sin6_port = htons(port);
>                         ^
> make: *** [libavformat/tcp.o] Error 1
> make: *** Waiting for unfinished jobs....

does this fix it: ?

diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index fd10a56..25abafc 100644
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -122,6 +122,7 @@ static int tcp_open(URLContext *h, const char *uri, int flags)
     cur_ai = ai;

  restart:
+#if HAVE_STRUCT_SOCKADDR_IN6
     // workaround for IOS9 getaddrinfo in IPv6 only network use hardcode IPv4 address can not resolve port number.
     if (cur_ai->ai_family == AF_INET6){
         struct sockaddr_in6 * sockaddr_v6 = (struct sockaddr_in6 *)cur_ai->ai_addr;
@@ -129,6 +130,7 @@ static int tcp_open(URLContext *h, const char *uri, int flags)
             sockaddr_v6->sin6_port = htons(port);
         }
     }
+#endif

     fd = ff_socket(cur_ai->ai_family,
                    cur_ai->ai_socktype,


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If you drop bombs on a foreign country and kill a hundred thousand
innocent people, expect your government to call the consequence
"unprovoked inhuman terrorist attacks" and use it to justify dropping
more bombs and killing more people. The technology changed, the idea is old.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20161106/82c081a2/attachment.sig>


More information about the ffmpeg-devel mailing list