diff mbox

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

Message ID SG2PR0201MB0933EB22DB97A32EE685AB96A5EA0@SG2PR0201MB0933.apcprd02.prod.outlook.com
State Accepted
Commit c0f6eff6a7edaa38a9ea4865ffc2ad36539d9d48
Headers show

Commit Message

liu jc Aug. 24, 2016, 10:46 a.m. UTC
Signed-off-by: liujingchao <jcliu@outlook.com>
---
 libavformat/tcp.c | 8 ++++++++
 1 file changed, 8 insertions(+)
 mode change 100644 => 100755 libavformat/tcp.c

Comments

Michael Niedermayer Nov. 5, 2016, 5:28 p.m. UTC | #1
On Wed, Aug 24, 2016 at 10:46:41AM +0000, liu jc wrote:
> Signed-off-by: liujingchao <jcliu@outlook.com>
> ---
>  libavformat/tcp.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>  mode change 100644 => 100755 libavformat/tcp.c

applied

thx

[...]
Dave Yeo Nov. 6, 2016, 7:22 a.m. UTC | #2
On 08/24/16 03:46 AM, liu jc wrote:
> Signed-off-by: liujingchao <jcliu@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....

Dave
Dave Yeo Nov. 6, 2016, 5:31 p.m. UTC | #3
On 11/06/16 04:34 AM, Michael Niedermayer wrote:
>> 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,

Yes, that seems to fix it.
Thanks,
Dave
Michael Niedermayer Nov. 6, 2016, 8:30 p.m. UTC | #4
On Sun, Nov 06, 2016 at 09:31:09AM -0800, Dave Yeo wrote:
> On 11/06/16 04:34 AM, Michael Niedermayer wrote:
> >>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,
> 
> Yes, that seems to fix it.

applied

thanks

[...]
diff mbox

Patch

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);